herdr-remote-relay 0.2.16 → 0.2.17

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,44 @@
1
+ var ly=Object.defineProperty;var ay=(o,a,r)=>a in o?ly(o,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[a]=r;var Se=(o,a,r)=>ay(o,typeof a!="symbol"?a+"":a,r);import{r as cp,g as up,a as dp}from"./vendor-react-CYSfZuHu.js";import{r as iy,a as ry,b as sy,c as oy}from"./vendor-xterm-Bldps5fz.js";(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const p of f.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&c(p)}).observe(document,{childList:!0,subtree:!0});function r(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function c(d){if(d.ep)return;d.ep=!0;const f=r(d);fetch(d.href,f)}})();var su={exports:{}},br={};/**
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 xm;function cy(){if(xm)return br;xm=1;var o=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function r(c,d,f){var p=null;if(f!==void 0&&(p=""+f),d.key!==void 0&&(p=""+d.key),"key"in d){f={};for(var m in d)m!=="key"&&(f[m]=d[m])}else f=d;return d=f.ref,{$$typeof:o,type:c,key:p,ref:d!==void 0?d:null,props:f}}return br.Fragment=a,br.jsx=r,br.jsxs=r,br}var Sm;function uy(){return Sm||(Sm=1,su.exports=cy()),su.exports}var u=uy(),y=cp();const fl=up(y);var ou={exports:{}},yr={},cu={exports:{}},uu={};/**
10
+ * @license React
11
+ * scheduler.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var wm;function dy(){return wm||(wm=1,(function(o){function a(j,q){var W=j.length;j.push(q);e:for(;0<W;){var Ce=W-1>>>1,H=j[Ce];if(0<d(H,q))j[Ce]=q,j[W]=H,W=Ce;else break e}}function r(j){return j.length===0?null:j[0]}function c(j){if(j.length===0)return null;var q=j[0],W=j.pop();if(W!==q){j[0]=W;e:for(var Ce=0,H=j.length,qe=H>>>1;Ce<qe;){var F=2*(Ce+1)-1,pe=j[F],ze=F+1,ve=j[ze];if(0>d(pe,W))ze<H&&0>d(ve,pe)?(j[Ce]=ve,j[ze]=W,Ce=ze):(j[Ce]=pe,j[F]=W,Ce=F);else if(ze<H&&0>d(ve,W))j[Ce]=ve,j[ze]=W,Ce=ze;else break e}}return q}function d(j,q){var W=j.sortIndex-q.sortIndex;return W!==0?W:j.id-q.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;o.unstable_now=function(){return f.now()}}else{var p=Date,m=p.now();o.unstable_now=function(){return p.now()-m}}var b=[],S=[],v=1,C=null,D=3,_=!1,z=!1,X=!1,M=!1,Z=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,J=typeof setImmediate<"u"?setImmediate:null;function ae(j){for(var q=r(S);q!==null;){if(q.callback===null)c(S);else if(q.startTime<=j)c(S),q.sortIndex=q.expirationTime,a(b,q);else break;q=r(S)}}function ye(j){if(X=!1,ae(j),!z)if(r(b)!==null)z=!0,O||(O=!0,Ee());else{var q=r(S);q!==null&&Le(ye,q.startTime-j)}}var O=!1,U=-1,R=5,te=-1;function je(){return M?!0:!(o.unstable_now()-te<R)}function Me(){if(M=!1,O){var j=o.unstable_now();te=j;var q=!0;try{e:{z=!1,X&&(X=!1,$(U),U=-1),_=!0;var W=D;try{t:{for(ae(j),C=r(b);C!==null&&!(C.expirationTime>j&&je());){var Ce=C.callback;if(typeof Ce=="function"){C.callback=null,D=C.priorityLevel;var H=Ce(C.expirationTime<=j);if(j=o.unstable_now(),typeof H=="function"){C.callback=H,ae(j),q=!0;break t}C===r(b)&&c(b),ae(j)}else c(b);C=r(b)}if(C!==null)q=!0;else{var qe=r(S);qe!==null&&Le(ye,qe.startTime-j),q=!1}}break e}finally{C=null,D=W,_=!1}q=void 0}}finally{q?Ee():O=!1}}}var Ee;if(typeof J=="function")Ee=function(){J(Me)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,_e=de.port2;de.port1.onmessage=Me,Ee=function(){_e.postMessage(null)}}else Ee=function(){Z(Me,0)};function Le(j,q){U=Z(function(){j(o.unstable_now())},q)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(j){j.callback=null},o.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<j?Math.floor(1e3/j):5},o.unstable_getCurrentPriorityLevel=function(){return D},o.unstable_next=function(j){switch(D){case 1:case 2:case 3:var q=3;break;default:q=D}var W=D;D=q;try{return j()}finally{D=W}},o.unstable_requestPaint=function(){M=!0},o.unstable_runWithPriority=function(j,q){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var W=D;D=j;try{return q()}finally{D=W}},o.unstable_scheduleCallback=function(j,q,W){var Ce=o.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?Ce+W:Ce):W=Ce,j){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=W+H,j={id:v++,callback:q,priorityLevel:j,startTime:W,expirationTime:H,sortIndex:-1},W>Ce?(j.sortIndex=W,a(S,j),r(b)===null&&j===r(S)&&(X?($(U),U=-1):X=!0,Le(ye,W-Ce))):(j.sortIndex=H,a(b,j),z||_||(z=!0,O||(O=!0,Ee()))),j},o.unstable_shouldYield=je,o.unstable_wrapCallback=function(j){var q=D;return function(){var W=D;D=q;try{return j.apply(this,arguments)}finally{D=W}}}})(uu)),uu}var Cm;function fy(){return Cm||(Cm=1,cu.exports=dy()),cu.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 Tm;function hy(){if(Tm)return yr;Tm=1;var o=fy(),a=cp(),r=dp();function c(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 d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(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 p(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function b(e){if(f(e)!==e)throw Error(c(188))}function S(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(c(188));return t!==e?null:e}for(var n=e,l=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(l=i.return,l!==null){n=l;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return b(i),e;if(s===l)return b(i),t;s=s.sibling}throw Error(c(188))}if(n.return!==l.return)n=i,l=s;else{for(var h=!1,g=i.child;g;){if(g===n){h=!0,n=i,l=s;break}if(g===l){h=!0,l=i,n=s;break}g=g.sibling}if(!h){for(g=s.child;g;){if(g===n){h=!0,n=s,l=i;break}if(g===l){h=!0,l=s,n=i;break}g=g.sibling}if(!h)throw Error(c(189))}}if(n.alternate!==l)throw Error(c(190))}if(n.tag!==3)throw Error(c(188));return n.stateNode.current===n?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}var C=Object.assign,D=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),z=Symbol.for("react.portal"),X=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),Z=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),J=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),ye=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),te=Symbol.for("react.activity"),je=Symbol.for("react.memo_cache_sentinel"),Me=Symbol.iterator;function Ee(e){return e===null||typeof e!="object"?null:(e=Me&&e[Me]||e["@@iterator"],typeof e=="function"?e:null)}var de=Symbol.for("react.client.reference");function _e(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case X:return"Fragment";case Z:return"Profiler";case M:return"StrictMode";case ye:return"Suspense";case O:return"SuspenseList";case te:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case z:return"Portal";case J:return e.displayName||"Context";case $:return(e._context.displayName||"Context")+".Consumer";case ae:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case U:return t=e.displayName||null,t!==null?t:_e(e.type)||"Memo";case R:t=e._payload,e=e._init;try{return _e(e(t))}catch{}}return null}var Le=Array.isArray,j=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},Ce=[],H=-1;function qe(e){return{current:e}}function F(e){0>H||(e.current=Ce[H],Ce[H]=null,H--)}function pe(e,t){H++,Ce[H]=e.current,e.current=t}var ze=qe(null),ve=qe(null),he=qe(null),St=qe(null);function Ue(e,t){switch(pe(he,t),pe(ve,e),pe(ze,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qh(t),e=Vh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}F(ze),pe(ze,e)}function we(){F(ze),F(ve),F(he)}function ft(e){e.memoizedState!==null&&pe(St,e);var t=ze.current,n=Vh(t,e.type);t!==n&&(pe(ve,e),pe(ze,n))}function lt(e){ve.current===e&&(F(ze),F(ve)),St.current===e&&(F(St),hr._currentValue=W)}var mt,Bt;function gt(e){if(mt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);mt=t&&t[1]||"",Bt=-1<n.stack.indexOf(`
26
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
27
+ `+mt+e+Bt}var zn=!1;function Dn(e,t){if(!e||zn)return"";zn=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var G=function(){throw Error()};if(Object.defineProperty(G.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(G,[])}catch(k){var A=k}Reflect.construct(e,[],G)}else{try{G.call()}catch(k){A=k}e.call(G.prototype)}}else{try{throw Error()}catch(k){A=k}(G=e())&&typeof G.catch=="function"&&G.catch(function(){})}}catch(k){if(k&&A&&typeof k.stack=="string")return[k.stack,A.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var i=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");i&&i.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var s=l.DetermineComponentFrameRoot(),h=s[0],g=s[1];if(h&&g){var x=h.split(`
28
+ `),E=g.split(`
29
+ `);for(i=l=0;l<x.length&&!x[l].includes("DetermineComponentFrameRoot");)l++;for(;i<E.length&&!E[i].includes("DetermineComponentFrameRoot");)i++;if(l===x.length||i===E.length)for(l=x.length-1,i=E.length-1;1<=l&&0<=i&&x[l]!==E[i];)i--;for(;1<=l&&0<=i;l--,i--)if(x[l]!==E[i]){if(l!==1||i!==1)do if(l--,i--,0>i||x[l]!==E[i]){var B=`
30
+ `+x[l].replace(" at new "," at ");return e.displayName&&B.includes("<anonymous>")&&(B=B.replace("<anonymous>",e.displayName)),B}while(1<=l&&0<=i);break}}}finally{zn=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?gt(n):""}function kt(e,t){switch(e.tag){case 26:case 27:case 5:return gt(e.type);case 16:return gt("Lazy");case 13:return e.child!==t&&t!==null?gt("Suspense Fallback"):gt("Suspense");case 19:return gt("SuspenseList");case 0:case 15:return Dn(e.type,!1);case 11:return Dn(e.type.render,!1);case 1:return Dn(e.type,!0);case 31:return gt("Activity");default:return""}}function cn(e){try{var t="",n=null;do t+=kt(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
31
+ Error generating stack: `+l.message+`
32
+ `+l.stack}}var On=Object.prototype.hasOwnProperty,Ht=o.unstable_scheduleCallback,Qe=o.unstable_cancelCallback,Ft=o.unstable_shouldYield,Yt=o.unstable_requestPaint,ee=o.unstable_now,Re=o.unstable_getCurrentPriorityLevel,Ke=o.unstable_ImmediatePriority,We=o.unstable_UserBlockingPriority,et=o.unstable_NormalPriority,hn=o.unstable_LowPriority,pt=o.unstable_IdlePriority,Rt=o.log,It=o.unstable_setDisableYieldValue,ln=null,at=null;function _t(e){if(typeof Rt=="function"&&It(e),at&&typeof at.setStrictMode=="function")try{at.setStrictMode(ln,e)}catch{}}var wt=Math.clz32?Math.clz32:Ha,Ba=Math.log,mn=Math.LN2;function Ha(e){return e>>>=0,e===0?32:31-(Ba(e)/mn|0)|0}var Ln=256,hl=262144,ml=4194304;function Jt(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 un(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var i=0,s=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var g=l&134217727;return g!==0?(l=g&~s,l!==0?i=Jt(l):(h&=g,h!==0?i=Jt(h):n||(n=g&~e,n!==0&&(i=Jt(n))))):(g=l&~s,g!==0?i=Jt(g):h!==0?i=Jt(h):n||(n=l&~e,n!==0&&(i=Jt(n)))),i===0?0:t!==0&&t!==i&&(t&s)===0&&(s=i&-i,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:i}function pn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function pl(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 Ya(){var e=ml;return ml<<=1,(ml&62914560)===0&&(ml=4194304),e}function Ul(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function al(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Bl(e,t,n,l,i,s){var h=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 g=e.entanglements,x=e.expirationTimes,E=e.hiddenUpdates;for(n=h&~n;0<n;){var B=31-wt(n),G=1<<B;g[B]=0,x[B]=-1;var A=E[B];if(A!==null)for(E[B]=null,B=0;B<A.length;B++){var k=A[B];k!==null&&(k.lane&=-536870913)}n&=~G}l!==0&&gl(e,l,0),s!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=s&~(h&~t))}function gl(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-wt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function bl(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-wt(n),i=1<<l;i&t|e[l]&t&&(e[l]|=t),n&=~i}}function Ka(e,t){var n=t&-t;return n=(n&42)!==0?1:L(n),(n&(e.suspendedLanes|t))!==0?0:n}function L(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 Y(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ie(){var e=q.p;return e!==0?e:(e=window.event,e===void 0?32:hm(e.type))}function Ae(e,t){var n=q.p;try{return q.p=e,t()}finally{q.p=n}}var xe=Math.random().toString(36).slice(2),fe="__reactFiber$"+xe,ke="__reactProps$"+xe,Tt="__reactContainer$"+xe,bt="__reactEvents$"+xe,Un="__reactListeners$"+xe,il="__reactHandles$"+xe,gn="__reactResources$"+xe,rl="__reactMarker$"+xe;function Ga(e){delete e[fe],delete e[ke],delete e[bt],delete e[Un],delete e[il]}function yl(e){var t=e[fe];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Tt]||n[fe]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Wh(e);e!==null;){if(n=e[fe])return n;e=Wh(e)}return t}e=n,n=e.parentNode}return null}function vl(e){if(e=e[fe]||e[Tt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Hl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(c(33))}function V(e){var t=e[gn];return t||(t=e[gn]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Q(e){e[rl]=!0}var ue=new Set,ge={};function Ie(e,t){ne(e,t),ne(e+"Capture",t)}function ne(e,t){for(ge[e]=t,e=0;e<t.length;e++)ue.add(t[e])}var an=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]*$"),Wt={},zt={};function it(e){return On.call(zt,e)?!0:On.call(Wt,e)?!1:an.test(e)?zt[e]=!0:(Wt[e]=!0,!1)}function rn(e,t,n){if(it(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 Wn(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 dn(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 Kt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Yl(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ro(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 i=l.get,s=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(h){n=""+h,s.call(this,h)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(h){n=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ai(e){if(!e._valueTracker){var t=Yl(e)?"checked":"value";e._valueTracker=ro(e,t,""+e[t])}}function Or(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=Yl(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function qa(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 so=/[\n"\\]/g;function bn(e){return e.replace(so,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ji(e,t,n,l,i,s,h,g){e.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.type=h:e.removeAttribute("type"),t!=null?h==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Kt(t)):e.value!==""+Kt(t)&&(e.value=""+Kt(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?Va(e,h,Kt(t)):n!=null?Va(e,h,Kt(n)):l!=null&&e.removeAttribute("value"),i==null&&s!=null&&(e.defaultChecked=!!s),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.name=""+Kt(g):e.removeAttribute("name")}function Lr(e,t,n,l,i,s,h,g){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){Ai(e);return}n=n!=null?""+Kt(n):"",t=t!=null?""+Kt(t):n,g||t===e.value||(e.value=t),e.defaultValue=t}l=l??i,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=g?e.checked:!!l,e.defaultChecked=!!l,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.name=h),Ai(e)}function Va(e,t,n){t==="number"&&qa(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Gt(e,t,n,l){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&l&&(e[n].defaultSelected=!0)}else{for(n=""+Kt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,l&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ur(e,t,n){if(t!=null&&(t=""+Kt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Kt(n):""}function Br(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(c(92));if(Le(l)){if(1<l.length)throw Error(c(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=Kt(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),Ai(e)}function Bn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Pn=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 Mi(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||Pn.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function ki(e,t,n){if(t!=null&&typeof t!="object")throw Error(c(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 i in t)l=t[i],t.hasOwnProperty(i)&&n[i]!==l&&Mi(e,i,l)}else for(var s in t)t.hasOwnProperty(s)&&Mi(e,s,t[s])}function Kl(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 Xa=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"]]),Fa=/^[\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 pa(e){return Fa.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Hn(){}var I=null;function le(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var De=null,At=null;function Zt(e){var t=vl(e);if(t&&(e=t.stateNode)){var n=e[ke]||null;e:switch(e=t.stateNode,t.type){case"input":if(ji(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="'+bn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var i=l[ke]||null;if(!i)throw Error(c(90));ji(l,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&Or(l)}break e;case"textarea":Ur(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Gt(e,!!n.multiple,t,!1)}}}var yn=!1;function me(e,t,n){if(yn)return e(t,n);yn=!0;try{var l=e(t);return l}finally{if(yn=!1,(De!==null||At!==null)&&(Ts(),De&&(t=De,e=At,At=De=null,Zt(t),e)))for(t=0;t<e.length;t++)Zt(e[t])}}function ot(e,t){var n=e.stateNode;if(n===null)return null;var l=n[ke]||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(c(231,t,typeof n));return n}var tt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Pt=!1;if(tt)try{var sn={};Object.defineProperty(sn,"passive",{get:function(){Pt=!0}}),window.addEventListener("test",sn,sn),window.removeEventListener("test",sn,sn)}catch{Pt=!1}var qt=null,Gl=null,ga=null;function qu(){if(ga)return ga;var e,t=Gl,n=t.length,l,i="value"in qt?qt.value:qt.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var h=n-e;for(l=1;l<=h&&t[n-l]===i[s-l];l++);return ga=i.slice(e,1<l?1-l:void 0)}function Hr(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 Yr(){return!0}function Vu(){return!1}function vn(e){function t(n,l,i,s,h){this._reactName=n,this._targetInst=i,this.type=l,this.nativeEvent=s,this.target=h,this.currentTarget=null;for(var g in e)e.hasOwnProperty(g)&&(n=e[g],this[g]=n?n(s):s[g]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Yr:Vu,this.isPropagationStopped=Vu,this}return C(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=Yr)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Yr)},persist:function(){},isPersistent:Yr}),t}var ba={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Kr=vn(ba),_i=C({},ba,{view:0,detail:0}),tg=vn(_i),oo,co,zi,Gr=C({},_i,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fo,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!==zi&&(zi&&e.type==="mousemove"?(oo=e.screenX-zi.screenX,co=e.screenY-zi.screenY):co=oo=0,zi=e),oo)},movementY:function(e){return"movementY"in e?e.movementY:co}}),Xu=vn(Gr),ng=C({},Gr,{dataTransfer:0}),lg=vn(ng),ag=C({},_i,{relatedTarget:0}),uo=vn(ag),ig=C({},ba,{animationName:0,elapsedTime:0,pseudoElement:0}),rg=vn(ig),sg=C({},ba,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),og=vn(sg),cg=C({},ba,{data:0}),Fu=vn(cg),ug={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dg={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"},fg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hg(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=fg[e])?!!t[e]:!1}function fo(){return hg}var mg=C({},_i,{key:function(e){if(e.key){var t=ug[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Hr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?dg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fo,charCode:function(e){return e.type==="keypress"?Hr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Hr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),pg=vn(mg),gg=C({},Gr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Zu=vn(gg),bg=C({},_i,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fo}),yg=vn(bg),vg=C({},ba,{propertyName:0,elapsedTime:0,pseudoElement:0}),xg=vn(vg),Sg=C({},Gr,{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}),wg=vn(Sg),Cg=C({},ba,{newState:0,oldState:0}),Tg=vn(Cg),Ng=[9,13,27,32],ho=tt&&"CompositionEvent"in window,Di=null;tt&&"documentMode"in document&&(Di=document.documentMode);var Eg=tt&&"TextEvent"in window&&!Di,Qu=tt&&(!ho||Di&&8<Di&&11>=Di),Iu=" ",Ju=!1;function Wu(e,t){switch(e){case"keyup":return Ng.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Za=!1;function Rg(e,t){switch(e){case"compositionend":return Pu(t);case"keypress":return t.which!==32?null:(Ju=!0,Iu);case"textInput":return e=t.data,e===Iu&&Ju?null:e;default:return null}}function Ag(e,t){if(Za)return e==="compositionend"||!ho&&Wu(e,t)?(e=qu(),ga=Gl=qt=null,Za=!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 Qu&&t.locale!=="ko"?null:t.data;default:return null}}var jg={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 $u(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!jg[e.type]:t==="textarea"}function ed(e,t,n,l){De?At?At.push(l):At=[l]:De=l,t=ks(t,"onChange"),0<t.length&&(n=new Kr("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var Oi=null,Li=null;function Mg(e){Uh(e,0)}function qr(e){var t=Hl(e);if(Or(t))return e}function td(e,t){if(e==="change")return t}var nd=!1;if(tt){var mo;if(tt){var po="oninput"in document;if(!po){var ld=document.createElement("div");ld.setAttribute("oninput","return;"),po=typeof ld.oninput=="function"}mo=po}else mo=!1;nd=mo&&(!document.documentMode||9<document.documentMode)}function ad(){Oi&&(Oi.detachEvent("onpropertychange",id),Li=Oi=null)}function id(e){if(e.propertyName==="value"&&qr(Li)){var t=[];ed(t,Li,e,le(e)),me(Mg,t)}}function kg(e,t,n){e==="focusin"?(ad(),Oi=t,Li=n,Oi.attachEvent("onpropertychange",id)):e==="focusout"&&ad()}function _g(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return qr(Li)}function zg(e,t){if(e==="click")return qr(t)}function Dg(e,t){if(e==="input"||e==="change")return qr(t)}function Og(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Nn=typeof Object.is=="function"?Object.is:Og;function Ui(e,t){if(Nn(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 i=n[l];if(!On.call(t,i)||!Nn(e[i],t[i]))return!1}return!0}function rd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function sd(e,t){var n=rd(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=rd(n)}}function od(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?od(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function cd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=qa(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=qa(e.document)}return t}function go(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 Lg=tt&&"documentMode"in document&&11>=document.documentMode,Qa=null,bo=null,Bi=null,yo=!1;function ud(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;yo||Qa==null||Qa!==qa(l)||(l=Qa,"selectionStart"in l&&go(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}),Bi&&Ui(Bi,l)||(Bi=l,l=ks(bo,"onSelect"),0<l.length&&(t=new Kr("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=Qa)))}function ya(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ia={animationend:ya("Animation","AnimationEnd"),animationiteration:ya("Animation","AnimationIteration"),animationstart:ya("Animation","AnimationStart"),transitionrun:ya("Transition","TransitionRun"),transitionstart:ya("Transition","TransitionStart"),transitioncancel:ya("Transition","TransitionCancel"),transitionend:ya("Transition","TransitionEnd")},vo={},dd={};tt&&(dd=document.createElement("div").style,"AnimationEvent"in window||(delete Ia.animationend.animation,delete Ia.animationiteration.animation,delete Ia.animationstart.animation),"TransitionEvent"in window||delete Ia.transitionend.transition);function va(e){if(vo[e])return vo[e];if(!Ia[e])return e;var t=Ia[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in dd)return vo[e]=t[n];return e}var fd=va("animationend"),hd=va("animationiteration"),md=va("animationstart"),Ug=va("transitionrun"),Bg=va("transitionstart"),Hg=va("transitioncancel"),pd=va("transitionend"),gd=new Map,xo="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");xo.push("scrollEnd");function $n(e,t){gd.set(e,t),Ie(t,[e])}var Vr=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)},Yn=[],Ja=0,So=0;function Xr(){for(var e=Ja,t=So=Ja=0;t<e;){var n=Yn[t];Yn[t++]=null;var l=Yn[t];Yn[t++]=null;var i=Yn[t];Yn[t++]=null;var s=Yn[t];if(Yn[t++]=null,l!==null&&i!==null){var h=l.pending;h===null?i.next=i:(i.next=h.next,h.next=i),l.pending=i}s!==0&&bd(n,i,s)}}function Fr(e,t,n,l){Yn[Ja++]=e,Yn[Ja++]=t,Yn[Ja++]=n,Yn[Ja++]=l,So|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function wo(e,t,n,l){return Fr(e,t,n,l),Zr(e)}function xa(e,t){return Fr(e,null,null,t),Zr(e)}function bd(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var i=!1,s=e.return;s!==null;)s.childLanes|=n,l=s.alternate,l!==null&&(l.childLanes|=n),s.tag===22&&(e=s.stateNode,e===null||e._visibility&1||(i=!0)),e=s,s=s.return;return e.tag===3?(s=e.stateNode,i&&t!==null&&(i=31-wt(n),e=s.hiddenUpdates,l=e[i],l===null?e[i]=[t]:l.push(t),t.lane=n|536870912),s):null}function Zr(e){if(50<rr)throw rr=0,kc=null,Error(c(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Wa={};function Yg(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 En(e,t,n,l){return new Yg(e,t,n,l)}function Co(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xl(e,t){var n=e.alternate;return n===null?(n=En(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 yd(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 Qr(e,t,n,l,i,s){var h=0;if(l=e,typeof e=="function")Co(e)&&(h=1);else if(typeof e=="string")h=Xb(e,n,ze.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case te:return e=En(31,n,t,i),e.elementType=te,e.lanes=s,e;case X:return Sa(n.children,i,s,t);case M:h=8,i|=24;break;case Z:return e=En(12,n,t,i|2),e.elementType=Z,e.lanes=s,e;case ye:return e=En(13,n,t,i),e.elementType=ye,e.lanes=s,e;case O:return e=En(19,n,t,i),e.elementType=O,e.lanes=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case J:h=10;break e;case $:h=9;break e;case ae:h=11;break e;case U:h=14;break e;case R:h=16,l=null;break e}h=29,n=Error(c(130,e===null?"null":typeof e,"")),l=null}return t=En(h,n,t,i),t.elementType=e,t.type=l,t.lanes=s,t}function Sa(e,t,n,l){return e=En(7,e,l,t),e.lanes=n,e}function To(e,t,n){return e=En(6,e,null,t),e.lanes=n,e}function vd(e){var t=En(18,null,null,0);return t.stateNode=e,t}function No(e,t,n){return t=En(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var xd=new WeakMap;function Kn(e,t){if(typeof e=="object"&&e!==null){var n=xd.get(e);return n!==void 0?n:(t={value:e,source:t,stack:cn(t)},xd.set(e,t),t)}return{value:e,source:t,stack:cn(t)}}var Pa=[],$a=0,Ir=null,Hi=0,Gn=[],qn=0,ql=null,sl=1,ol="";function Sl(e,t){Pa[$a++]=Hi,Pa[$a++]=Ir,Ir=e,Hi=t}function Sd(e,t,n){Gn[qn++]=sl,Gn[qn++]=ol,Gn[qn++]=ql,ql=e;var l=sl;e=ol;var i=32-wt(l)-1;l&=~(1<<i),n+=1;var s=32-wt(t)+i;if(30<s){var h=i-i%5;s=(l&(1<<h)-1).toString(32),l>>=h,i-=h,sl=1<<32-wt(t)+i|n<<i|l,ol=s+e}else sl=1<<s|n<<i|l,ol=e}function Eo(e){e.return!==null&&(Sl(e,1),Sd(e,1,0))}function Ro(e){for(;e===Ir;)Ir=Pa[--$a],Pa[$a]=null,Hi=Pa[--$a],Pa[$a]=null;for(;e===ql;)ql=Gn[--qn],Gn[qn]=null,ol=Gn[--qn],Gn[qn]=null,sl=Gn[--qn],Gn[qn]=null}function wd(e,t){Gn[qn++]=sl,Gn[qn++]=ol,Gn[qn++]=ql,sl=t.id,ol=t.overflow,ql=e}var $t=null,yt=null,Je=!1,Vl=null,Vn=!1,Ao=Error(c(519));function Xl(e){var t=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Yi(Kn(t,e)),Ao}function Cd(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[fe]=e,t[ke]=l,n){case"dialog":Xe("cancel",t),Xe("close",t);break;case"iframe":case"object":case"embed":Xe("load",t);break;case"video":case"audio":for(n=0;n<or.length;n++)Xe(or[n],t);break;case"source":Xe("error",t);break;case"img":case"image":case"link":Xe("error",t),Xe("load",t);break;case"details":Xe("toggle",t);break;case"input":Xe("invalid",t),Lr(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Xe("invalid",t);break;case"textarea":Xe("invalid",t),Br(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||Kh(t.textContent,n)?(l.popover!=null&&(Xe("beforetoggle",t),Xe("toggle",t)),l.onScroll!=null&&Xe("scroll",t),l.onScrollEnd!=null&&Xe("scrollend",t),l.onClick!=null&&(t.onclick=Hn),t=!0):t=!1,t||Xl(e,!0)}function Td(e){for($t=e.return;$t;)switch($t.tag){case 5:case 31:case 13:Vn=!1;return;case 27:case 3:Vn=!0;return;default:$t=$t.return}}function ei(e){if(e!==$t)return!1;if(!Je)return Td(e),Je=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Fc(e.type,e.memoizedProps)),n=!n),n&&yt&&Xl(e),Td(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));yt=Jh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));yt=Jh(e)}else t===27?(t=yt,ia(e.type)?(e=Wc,Wc=null,yt=e):yt=t):yt=$t?Fn(e.stateNode.nextSibling):null;return!0}function wa(){yt=$t=null,Je=!1}function jo(){var e=Vl;return e!==null&&(Cn===null?Cn=e:Cn.push.apply(Cn,e),Vl=null),e}function Yi(e){Vl===null?Vl=[e]:Vl.push(e)}var Mo=qe(null),Ca=null,wl=null;function Fl(e,t,n){pe(Mo,t._currentValue),t._currentValue=n}function Cl(e){e._currentValue=Mo.current,F(Mo)}function ko(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 _o(e,t,n,l){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var s=i.dependencies;if(s!==null){var h=i.child;s=s.firstContext;e:for(;s!==null;){var g=s;s=i;for(var x=0;x<t.length;x++)if(g.context===t[x]){s.lanes|=n,g=s.alternate,g!==null&&(g.lanes|=n),ko(s.return,n,e),l||(h=null);break e}s=g.next}}else if(i.tag===18){if(h=i.return,h===null)throw Error(c(341));h.lanes|=n,s=h.alternate,s!==null&&(s.lanes|=n),ko(h,n,e),h=null}else h=i.child;if(h!==null)h.return=i;else for(h=i;h!==null;){if(h===e){h=null;break}if(i=h.sibling,i!==null){i.return=h.return,h=i;break}h=h.return}i=h}}function ti(e,t,n,l){e=null;for(var i=t,s=!1;i!==null;){if(!s){if((i.flags&524288)!==0)s=!0;else if((i.flags&262144)!==0)break}if(i.tag===10){var h=i.alternate;if(h===null)throw Error(c(387));if(h=h.memoizedProps,h!==null){var g=i.type;Nn(i.pendingProps.value,h.value)||(e!==null?e.push(g):e=[g])}}else if(i===St.current){if(h=i.alternate,h===null)throw Error(c(387));h.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e!==null?e.push(hr):e=[hr])}i=i.return}e!==null&&_o(t,e,n,l),t.flags|=262144}function Jr(e){for(e=e.firstContext;e!==null;){if(!Nn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ta(e){Ca=e,wl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function en(e){return Nd(Ca,e)}function Wr(e,t){return Ca===null&&Ta(e),Nd(e,t)}function Nd(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},wl===null){if(e===null)throw Error(c(308));wl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else wl=wl.next=t;return n}var Kg=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()})}},Gg=o.unstable_scheduleCallback,qg=o.unstable_NormalPriority,Dt={$$typeof:J,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function zo(){return{controller:new Kg,data:new Map,refCount:0}}function Ki(e){e.refCount--,e.refCount===0&&Gg(qg,function(){e.controller.abort()})}var Gi=null,Do=0,ni=0,li=null;function Vg(e,t){if(Gi===null){var n=Gi=[];Do=0,ni=Uc(),li={status:"pending",value:void 0,then:function(l){n.push(l)}}}return Do++,t.then(Ed,Ed),t}function Ed(){if(--Do===0&&Gi!==null){li!==null&&(li.status="fulfilled");var e=Gi;Gi=null,ni=0,li=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Xg(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(i){n.push(i)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var i=0;i<n.length;i++)(0,n[i])(t)},function(i){for(l.status="rejected",l.reason=i,i=0;i<n.length;i++)(0,n[i])(void 0)}),l}var Rd=j.S;j.S=function(e,t){dh=ee(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Vg(e,t),Rd!==null&&Rd(e,t)};var Na=qe(null);function Oo(){var e=Na.current;return e!==null?e:ht.pooledCache}function Pr(e,t){t===null?pe(Na,Na.current):pe(Na,t.pool)}function Ad(){var e=Oo();return e===null?null:{parent:Dt._currentValue,pool:e}}var ai=Error(c(460)),Lo=Error(c(474)),$r=Error(c(542)),es={then:function(){}};function jd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Md(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Hn,Hn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,_d(e),e;default:if(typeof t.status=="string")t.then(Hn,Hn);else{if(e=ht,e!==null&&100<e.shellSuspendCounter)throw Error(c(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var i=t;i.status="fulfilled",i.value=l}},function(l){if(t.status==="pending"){var i=t;i.status="rejected",i.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,_d(e),e}throw Ra=t,ai}}function Ea(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Ra=n,ai):n}}var Ra=null;function kd(){if(Ra===null)throw Error(c(459));var e=Ra;return Ra=null,e}function _d(e){if(e===ai||e===$r)throw Error(c(483))}var ii=null,qi=0;function ts(e){var t=qi;return qi+=1,ii===null&&(ii=[]),Md(ii,e,t)}function Vi(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ns(e,t){throw t.$$typeof===D?Error(c(525)):(e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function zd(e){function t(T,w){if(e){var N=T.deletions;N===null?(T.deletions=[w],T.flags|=16):N.push(w)}}function n(T,w){if(!e)return null;for(;w!==null;)t(T,w),w=w.sibling;return null}function l(T){for(var w=new Map;T!==null;)T.key!==null?w.set(T.key,T):w.set(T.index,T),T=T.sibling;return w}function i(T,w){return T=xl(T,w),T.index=0,T.sibling=null,T}function s(T,w,N){return T.index=N,e?(N=T.alternate,N!==null?(N=N.index,N<w?(T.flags|=67108866,w):N):(T.flags|=67108866,w)):(T.flags|=1048576,w)}function h(T){return e&&T.alternate===null&&(T.flags|=67108866),T}function g(T,w,N,K){return w===null||w.tag!==6?(w=To(N,T.mode,K),w.return=T,w):(w=i(w,N),w.return=T,w)}function x(T,w,N,K){var be=N.type;return be===X?B(T,w,N.props.children,K,N.key):w!==null&&(w.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===R&&Ea(be)===w.type)?(w=i(w,N.props),Vi(w,N),w.return=T,w):(w=Qr(N.type,N.key,N.props,null,T.mode,K),Vi(w,N),w.return=T,w)}function E(T,w,N,K){return w===null||w.tag!==4||w.stateNode.containerInfo!==N.containerInfo||w.stateNode.implementation!==N.implementation?(w=No(N,T.mode,K),w.return=T,w):(w=i(w,N.children||[]),w.return=T,w)}function B(T,w,N,K,be){return w===null||w.tag!==7?(w=Sa(N,T.mode,K,be),w.return=T,w):(w=i(w,N),w.return=T,w)}function G(T,w,N){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return w=To(""+w,T.mode,N),w.return=T,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case _:return N=Qr(w.type,w.key,w.props,null,T.mode,N),Vi(N,w),N.return=T,N;case z:return w=No(w,T.mode,N),w.return=T,w;case R:return w=Ea(w),G(T,w,N)}if(Le(w)||Ee(w))return w=Sa(w,T.mode,N,null),w.return=T,w;if(typeof w.then=="function")return G(T,ts(w),N);if(w.$$typeof===J)return G(T,Wr(T,w),N);ns(T,w)}return null}function A(T,w,N,K){var be=w!==null?w.key:null;if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return be!==null?null:g(T,w,""+N,K);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case _:return N.key===be?x(T,w,N,K):null;case z:return N.key===be?E(T,w,N,K):null;case R:return N=Ea(N),A(T,w,N,K)}if(Le(N)||Ee(N))return be!==null?null:B(T,w,N,K,null);if(typeof N.then=="function")return A(T,w,ts(N),K);if(N.$$typeof===J)return A(T,w,Wr(T,N),K);ns(T,N)}return null}function k(T,w,N,K,be){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return T=T.get(N)||null,g(w,T,""+K,be);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case _:return T=T.get(K.key===null?N:K.key)||null,x(w,T,K,be);case z:return T=T.get(K.key===null?N:K.key)||null,E(w,T,K,be);case R:return K=Ea(K),k(T,w,N,K,be)}if(Le(K)||Ee(K))return T=T.get(N)||null,B(w,T,K,be,null);if(typeof K.then=="function")return k(T,w,N,ts(K),be);if(K.$$typeof===J)return k(T,w,N,Wr(w,K),be);ns(w,K)}return null}function oe(T,w,N,K){for(var be=null,Pe=null,ce=w,Be=w=0,Ze=null;ce!==null&&Be<N.length;Be++){ce.index>Be?(Ze=ce,ce=null):Ze=ce.sibling;var $e=A(T,ce,N[Be],K);if($e===null){ce===null&&(ce=Ze);break}e&&ce&&$e.alternate===null&&t(T,ce),w=s($e,w,Be),Pe===null?be=$e:Pe.sibling=$e,Pe=$e,ce=Ze}if(Be===N.length)return n(T,ce),Je&&Sl(T,Be),be;if(ce===null){for(;Be<N.length;Be++)ce=G(T,N[Be],K),ce!==null&&(w=s(ce,w,Be),Pe===null?be=ce:Pe.sibling=ce,Pe=ce);return Je&&Sl(T,Be),be}for(ce=l(ce);Be<N.length;Be++)Ze=k(ce,T,Be,N[Be],K),Ze!==null&&(e&&Ze.alternate!==null&&ce.delete(Ze.key===null?Be:Ze.key),w=s(Ze,w,Be),Pe===null?be=Ze:Pe.sibling=Ze,Pe=Ze);return e&&ce.forEach(function(ua){return t(T,ua)}),Je&&Sl(T,Be),be}function Te(T,w,N,K){if(N==null)throw Error(c(151));for(var be=null,Pe=null,ce=w,Be=w=0,Ze=null,$e=N.next();ce!==null&&!$e.done;Be++,$e=N.next()){ce.index>Be?(Ze=ce,ce=null):Ze=ce.sibling;var ua=A(T,ce,$e.value,K);if(ua===null){ce===null&&(ce=Ze);break}e&&ce&&ua.alternate===null&&t(T,ce),w=s(ua,w,Be),Pe===null?be=ua:Pe.sibling=ua,Pe=ua,ce=Ze}if($e.done)return n(T,ce),Je&&Sl(T,Be),be;if(ce===null){for(;!$e.done;Be++,$e=N.next())$e=G(T,$e.value,K),$e!==null&&(w=s($e,w,Be),Pe===null?be=$e:Pe.sibling=$e,Pe=$e);return Je&&Sl(T,Be),be}for(ce=l(ce);!$e.done;Be++,$e=N.next())$e=k(ce,T,Be,$e.value,K),$e!==null&&(e&&$e.alternate!==null&&ce.delete($e.key===null?Be:$e.key),w=s($e,w,Be),Pe===null?be=$e:Pe.sibling=$e,Pe=$e);return e&&ce.forEach(function(ny){return t(T,ny)}),Je&&Sl(T,Be),be}function dt(T,w,N,K){if(typeof N=="object"&&N!==null&&N.type===X&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case _:e:{for(var be=N.key;w!==null;){if(w.key===be){if(be=N.type,be===X){if(w.tag===7){n(T,w.sibling),K=i(w,N.props.children),K.return=T,T=K;break e}}else if(w.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===R&&Ea(be)===w.type){n(T,w.sibling),K=i(w,N.props),Vi(K,N),K.return=T,T=K;break e}n(T,w);break}else t(T,w);w=w.sibling}N.type===X?(K=Sa(N.props.children,T.mode,K,N.key),K.return=T,T=K):(K=Qr(N.type,N.key,N.props,null,T.mode,K),Vi(K,N),K.return=T,T=K)}return h(T);case z:e:{for(be=N.key;w!==null;){if(w.key===be)if(w.tag===4&&w.stateNode.containerInfo===N.containerInfo&&w.stateNode.implementation===N.implementation){n(T,w.sibling),K=i(w,N.children||[]),K.return=T,T=K;break e}else{n(T,w);break}else t(T,w);w=w.sibling}K=No(N,T.mode,K),K.return=T,T=K}return h(T);case R:return N=Ea(N),dt(T,w,N,K)}if(Le(N))return oe(T,w,N,K);if(Ee(N)){if(be=Ee(N),typeof be!="function")throw Error(c(150));return N=be.call(N),Te(T,w,N,K)}if(typeof N.then=="function")return dt(T,w,ts(N),K);if(N.$$typeof===J)return dt(T,w,Wr(T,N),K);ns(T,N)}return typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint"?(N=""+N,w!==null&&w.tag===6?(n(T,w.sibling),K=i(w,N),K.return=T,T=K):(n(T,w),K=To(N,T.mode,K),K.return=T,T=K),h(T)):n(T,w)}return function(T,w,N,K){try{qi=0;var be=dt(T,w,N,K);return ii=null,be}catch(ce){if(ce===ai||ce===$r)throw ce;var Pe=En(29,ce,null,T.mode);return Pe.lanes=K,Pe.return=T,Pe}finally{}}}var Aa=zd(!0),Dd=zd(!1),Zl=!1;function Uo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Bo(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 Ql(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Il(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(nt&2)!==0){var i=l.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),l.pending=t,t=Zr(e),bd(e,null,n),t}return Fr(e,l,t,n),Zr(e)}function Xi(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,bl(e,n)}}function Ho(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var h={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?i=s=h:s=s.next=h,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:l.baseState,firstBaseUpdate:i,lastBaseUpdate:s,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 Yo=!1;function Fi(){if(Yo){var e=li;if(e!==null)throw e}}function Zi(e,t,n,l){Yo=!1;var i=e.updateQueue;Zl=!1;var s=i.firstBaseUpdate,h=i.lastBaseUpdate,g=i.shared.pending;if(g!==null){i.shared.pending=null;var x=g,E=x.next;x.next=null,h===null?s=E:h.next=E,h=x;var B=e.alternate;B!==null&&(B=B.updateQueue,g=B.lastBaseUpdate,g!==h&&(g===null?B.firstBaseUpdate=E:g.next=E,B.lastBaseUpdate=x))}if(s!==null){var G=i.baseState;h=0,B=E=x=null,g=s;do{var A=g.lane&-536870913,k=A!==g.lane;if(k?(Fe&A)===A:(l&A)===A){A!==0&&A===ni&&(Yo=!0),B!==null&&(B=B.next={lane:0,tag:g.tag,payload:g.payload,callback:null,next:null});e:{var oe=e,Te=g;A=t;var dt=n;switch(Te.tag){case 1:if(oe=Te.payload,typeof oe=="function"){G=oe.call(dt,G,A);break e}G=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=Te.payload,A=typeof oe=="function"?oe.call(dt,G,A):oe,A==null)break e;G=C({},G,A);break e;case 2:Zl=!0}}A=g.callback,A!==null&&(e.flags|=64,k&&(e.flags|=8192),k=i.callbacks,k===null?i.callbacks=[A]:k.push(A))}else k={lane:A,tag:g.tag,payload:g.payload,callback:g.callback,next:null},B===null?(E=B=k,x=G):B=B.next=k,h|=A;if(g=g.next,g===null){if(g=i.shared.pending,g===null)break;k=g,g=k.next,k.next=null,i.lastBaseUpdate=k,i.shared.pending=null}}while(!0);B===null&&(x=G),i.baseState=x,i.firstBaseUpdate=E,i.lastBaseUpdate=B,s===null&&(i.shared.lanes=0),ea|=h,e.lanes=h,e.memoizedState=G}}function Od(e,t){if(typeof e!="function")throw Error(c(191,e));e.call(t)}function Ld(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Od(n[e],t)}var ri=qe(null),ls=qe(0);function Ud(e,t){e=_l,pe(ls,e),pe(ri,t),_l=e|t.baseLanes}function Ko(){pe(ls,_l),pe(ri,ri.current)}function Go(){_l=ls.current,F(ri),F(ls)}var Rn=qe(null),Xn=null;function Jl(e){var t=e.alternate;pe(jt,jt.current&1),pe(Rn,e),Xn===null&&(t===null||ri.current!==null||t.memoizedState!==null)&&(Xn=e)}function qo(e){pe(jt,jt.current),pe(Rn,e),Xn===null&&(Xn=e)}function Bd(e){e.tag===22?(pe(jt,jt.current),pe(Rn,e),Xn===null&&(Xn=e)):Wl()}function Wl(){pe(jt,jt.current),pe(Rn,Rn.current)}function An(e){F(Rn),Xn===e&&(Xn=null),F(jt)}var jt=qe(0);function as(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Ic(n)||Jc(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 Tl=0,Oe=null,ct=null,Ot=null,is=!1,si=!1,ja=!1,rs=0,Qi=0,oi=null,Fg=0;function Nt(){throw Error(c(321))}function Vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Nn(e[n],t[n]))return!1;return!0}function Xo(e,t,n,l,i,s){return Tl=s,Oe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,j.H=e===null||e.memoizedState===null?wf:rc,ja=!1,s=n(l,i),ja=!1,si&&(s=Yd(t,n,l,i)),Hd(e),s}function Hd(e){j.H=Wi;var t=ct!==null&&ct.next!==null;if(Tl=0,Ot=ct=Oe=null,is=!1,Qi=0,oi=null,t)throw Error(c(300));e===null||Lt||(e=e.dependencies,e!==null&&Jr(e)&&(Lt=!0))}function Yd(e,t,n,l){Oe=e;var i=0;do{if(si&&(oi=null),Qi=0,si=!1,25<=i)throw Error(c(301));if(i+=1,Ot=ct=null,e.updateQueue!=null){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}j.H=Cf,s=t(n,l)}while(si);return s}function Zg(){var e=j.H,t=e.useState()[0];return t=typeof t.then=="function"?Ii(t):t,e=e.useState()[0],(ct!==null?ct.memoizedState:null)!==e&&(Oe.flags|=1024),t}function Fo(){var e=rs!==0;return rs=0,e}function Zo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Qo(e){if(is){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}is=!1}Tl=0,Ot=ct=Oe=null,si=!1,Qi=rs=0,oi=null}function fn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ot===null?Oe.memoizedState=Ot=e:Ot=Ot.next=e,Ot}function Mt(){if(ct===null){var e=Oe.alternate;e=e!==null?e.memoizedState:null}else e=ct.next;var t=Ot===null?Oe.memoizedState:Ot.next;if(t!==null)Ot=t,ct=e;else{if(e===null)throw Oe.alternate===null?Error(c(467)):Error(c(310));ct=e,e={memoizedState:ct.memoizedState,baseState:ct.baseState,baseQueue:ct.baseQueue,queue:ct.queue,next:null},Ot===null?Oe.memoizedState=Ot=e:Ot=Ot.next=e}return Ot}function ss(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ii(e){var t=Qi;return Qi+=1,oi===null&&(oi=[]),e=Md(oi,e,t),t=Oe,(Ot===null?t.memoizedState:Ot.next)===null&&(t=t.alternate,j.H=t===null||t.memoizedState===null?wf:rc),e}function os(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ii(e);if(e.$$typeof===J)return en(e)}throw Error(c(438,String(e)))}function Io(e){var t=null,n=Oe.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=Oe.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(i){return i.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=ss(),Oe.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]=je;return t.index++,n}function Nl(e,t){return typeof t=="function"?t(e):t}function cs(e){var t=Mt();return Jo(t,ct,e)}function Jo(e,t,n){var l=e.queue;if(l===null)throw Error(c(311));l.lastRenderedReducer=n;var i=e.baseQueue,s=l.pending;if(s!==null){if(i!==null){var h=i.next;i.next=s.next,s.next=h}t.baseQueue=i=s,l.pending=null}if(s=e.baseState,i===null)e.memoizedState=s;else{t=i.next;var g=h=null,x=null,E=t,B=!1;do{var G=E.lane&-536870913;if(G!==E.lane?(Fe&G)===G:(Tl&G)===G){var A=E.revertLane;if(A===0)x!==null&&(x=x.next={lane:0,revertLane:0,gesture:null,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null}),G===ni&&(B=!0);else if((Tl&A)===A){E=E.next,A===ni&&(B=!0);continue}else G={lane:0,revertLane:E.revertLane,gesture:null,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null},x===null?(g=x=G,h=s):x=x.next=G,Oe.lanes|=A,ea|=A;G=E.action,ja&&n(s,G),s=E.hasEagerState?E.eagerState:n(s,G)}else A={lane:G,revertLane:E.revertLane,gesture:E.gesture,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null},x===null?(g=x=A,h=s):x=x.next=A,Oe.lanes|=G,ea|=G;E=E.next}while(E!==null&&E!==t);if(x===null?h=s:x.next=g,!Nn(s,e.memoizedState)&&(Lt=!0,B&&(n=li,n!==null)))throw n;e.memoizedState=s,e.baseState=h,e.baseQueue=x,l.lastRenderedState=s}return i===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Wo(e){var t=Mt(),n=t.queue;if(n===null)throw Error(c(311));n.lastRenderedReducer=e;var l=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var h=i=i.next;do s=e(s,h.action),h=h.next;while(h!==i);Nn(s,t.memoizedState)||(Lt=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,l]}function Kd(e,t,n){var l=Oe,i=Mt(),s=Je;if(s){if(n===void 0)throw Error(c(407));n=n()}else n=t();var h=!Nn((ct||i).memoizedState,n);if(h&&(i.memoizedState=n,Lt=!0),i=i.queue,ec(Vd.bind(null,l,i,e),[e]),i.getSnapshot!==t||h||Ot!==null&&Ot.memoizedState.tag&1){if(l.flags|=2048,ci(9,{destroy:void 0},qd.bind(null,l,i,n,t),null),ht===null)throw Error(c(349));s||(Tl&127)!==0||Gd(l,t,n)}return n}function Gd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Oe.updateQueue,t===null?(t=ss(),Oe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function qd(e,t,n,l){t.value=n,t.getSnapshot=l,Xd(t)&&Fd(e)}function Vd(e,t,n){return n(function(){Xd(t)&&Fd(e)})}function Xd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Nn(e,n)}catch{return!0}}function Fd(e){var t=xa(e,2);t!==null&&Tn(t,e,2)}function Po(e){var t=fn();if(typeof e=="function"){var n=e;if(e=n(),ja){_t(!0);try{n()}finally{_t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nl,lastRenderedState:e},t}function Zd(e,t,n,l){return e.baseState=n,Jo(e,ct,typeof l=="function"?l:Nl)}function Qg(e,t,n,l,i){if(fs(e))throw Error(c(485));if(e=t.action,e!==null){var s={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(h){s.listeners.push(h)}};j.T!==null?n(!0):s.isTransition=!1,l(s),n=t.pending,n===null?(s.next=t.pending=s,Qd(t,s)):(s.next=n.next,t.pending=n.next=s)}}function Qd(e,t){var n=t.action,l=t.payload,i=e.state;if(t.isTransition){var s=j.T,h={};j.T=h;try{var g=n(i,l),x=j.S;x!==null&&x(h,g),Id(e,t,g)}catch(E){$o(e,t,E)}finally{s!==null&&h.types!==null&&(s.types=h.types),j.T=s}}else try{s=n(i,l),Id(e,t,s)}catch(E){$o(e,t,E)}}function Id(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){Jd(e,t,l)},function(l){return $o(e,t,l)}):Jd(e,t,n)}function Jd(e,t,n){t.status="fulfilled",t.value=n,Wd(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Qd(e,n)))}function $o(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,Wd(t),t=t.next;while(t!==l)}e.action=null}function Wd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Pd(e,t){return t}function $d(e,t){if(Je){var n=ht.formState;if(n!==null){e:{var l=Oe;if(Je){if(yt){t:{for(var i=yt,s=Vn;i.nodeType!==8;){if(!s){i=null;break t}if(i=Fn(i.nextSibling),i===null){i=null;break t}}s=i.data,i=s==="F!"||s==="F"?i:null}if(i){yt=Fn(i.nextSibling),l=i.data==="F!";break e}}Xl(l)}l=!1}l&&(t=n[0])}}return n=fn(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pd,lastRenderedState:t},n.queue=l,n=vf.bind(null,Oe,l),l.dispatch=n,l=Po(!1),s=ic.bind(null,Oe,!1,l.queue),l=fn(),i={state:t,dispatch:null,action:e,pending:null},l.queue=i,n=Qg.bind(null,Oe,i,s,n),i.dispatch=n,l.memoizedState=e,[t,n,!1]}function ef(e){var t=Mt();return tf(t,ct,e)}function tf(e,t,n){if(t=Jo(e,t,Pd)[0],e=cs(Nl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Ii(t)}catch(h){throw h===ai?$r:h}else l=t;t=Mt();var i=t.queue,s=i.dispatch;return n!==t.memoizedState&&(Oe.flags|=2048,ci(9,{destroy:void 0},Ig.bind(null,i,n),null)),[l,s,e]}function Ig(e,t){e.action=t}function nf(e){var t=Mt(),n=ct;if(n!==null)return tf(t,n,e);Mt(),t=t.memoizedState,n=Mt();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function ci(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=Oe.updateQueue,t===null&&(t=ss(),Oe.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 lf(){return Mt().memoizedState}function us(e,t,n,l){var i=fn();Oe.flags|=e,i.memoizedState=ci(1|t,{destroy:void 0},n,l===void 0?null:l)}function ds(e,t,n,l){var i=Mt();l=l===void 0?null:l;var s=i.memoizedState.inst;ct!==null&&l!==null&&Vo(l,ct.memoizedState.deps)?i.memoizedState=ci(t,s,n,l):(Oe.flags|=e,i.memoizedState=ci(1|t,s,n,l))}function af(e,t){us(8390656,8,e,t)}function ec(e,t){ds(2048,8,e,t)}function Jg(e){Oe.flags|=4;var t=Oe.updateQueue;if(t===null)t=ss(),Oe.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function rf(e){var t=Mt().memoizedState;return Jg({ref:t,nextImpl:e}),function(){if((nt&2)!==0)throw Error(c(440));return t.impl.apply(void 0,arguments)}}function sf(e,t){return ds(4,2,e,t)}function of(e,t){return ds(4,4,e,t)}function cf(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 uf(e,t,n){n=n!=null?n.concat([e]):null,ds(4,4,cf.bind(null,t,e),n)}function tc(){}function df(e,t){var n=Mt();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&Vo(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function ff(e,t){var n=Mt();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&Vo(t,l[1]))return l[0];if(l=e(),ja){_t(!0);try{e()}finally{_t(!1)}}return n.memoizedState=[l,t],l}function nc(e,t,n){return n===void 0||(Tl&1073741824)!==0&&(Fe&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=hh(),Oe.lanes|=e,ea|=e,n)}function hf(e,t,n,l){return Nn(n,t)?n:ri.current!==null?(e=nc(e,n,l),Nn(e,t)||(Lt=!0),e):(Tl&42)===0||(Tl&1073741824)!==0&&(Fe&261930)===0?(Lt=!0,e.memoizedState=n):(e=hh(),Oe.lanes|=e,ea|=e,t)}function mf(e,t,n,l,i){var s=q.p;q.p=s!==0&&8>s?s:8;var h=j.T,g={};j.T=g,ic(e,!1,t,n);try{var x=i(),E=j.S;if(E!==null&&E(g,x),x!==null&&typeof x=="object"&&typeof x.then=="function"){var B=Xg(x,l);Ji(e,t,B,kn(e))}else Ji(e,t,l,kn(e))}catch(G){Ji(e,t,{then:function(){},status:"rejected",reason:G},kn())}finally{q.p=s,h!==null&&g.types!==null&&(h.types=g.types),j.T=h}}function Wg(){}function lc(e,t,n,l){if(e.tag!==5)throw Error(c(476));var i=pf(e).queue;mf(e,i,t,W,n===null?Wg:function(){return gf(e),n(l)})}function pf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nl,lastRenderedState:W},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nl,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function gf(e){var t=pf(e);t.next===null&&(t=e.alternate.memoizedState),Ji(e,t.next.queue,{},kn())}function ac(){return en(hr)}function bf(){return Mt().memoizedState}function yf(){return Mt().memoizedState}function Pg(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=kn();e=Ql(n);var l=Il(t,e,n);l!==null&&(Tn(l,t,n),Xi(l,t,n)),t={cache:zo()},e.payload=t;return}t=t.return}}function $g(e,t,n){var l=kn();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},fs(e)?xf(t,n):(n=wo(e,t,n,l),n!==null&&(Tn(n,e,l),Sf(n,t,l)))}function vf(e,t,n){var l=kn();Ji(e,t,n,l)}function Ji(e,t,n,l){var i={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(fs(e))xf(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var h=t.lastRenderedState,g=s(h,n);if(i.hasEagerState=!0,i.eagerState=g,Nn(g,h))return Fr(e,t,i,0),ht===null&&Xr(),!1}catch{}finally{}if(n=wo(e,t,i,l),n!==null)return Tn(n,e,l),Sf(n,t,l),!0}return!1}function ic(e,t,n,l){if(l={lane:2,revertLane:Uc(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},fs(e)){if(t)throw Error(c(479))}else t=wo(e,n,l,2),t!==null&&Tn(t,e,2)}function fs(e){var t=e.alternate;return e===Oe||t!==null&&t===Oe}function xf(e,t){si=is=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Sf(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,bl(e,n)}}var Wi={readContext:en,use:os,useCallback:Nt,useContext:Nt,useEffect:Nt,useImperativeHandle:Nt,useLayoutEffect:Nt,useInsertionEffect:Nt,useMemo:Nt,useReducer:Nt,useRef:Nt,useState:Nt,useDebugValue:Nt,useDeferredValue:Nt,useTransition:Nt,useSyncExternalStore:Nt,useId:Nt,useHostTransitionStatus:Nt,useFormState:Nt,useActionState:Nt,useOptimistic:Nt,useMemoCache:Nt,useCacheRefresh:Nt};Wi.useEffectEvent=Nt;var wf={readContext:en,use:os,useCallback:function(e,t){return fn().memoizedState=[e,t===void 0?null:t],e},useContext:en,useEffect:af,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,us(4194308,4,cf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return us(4194308,4,e,t)},useInsertionEffect:function(e,t){us(4,2,e,t)},useMemo:function(e,t){var n=fn();t=t===void 0?null:t;var l=e();if(ja){_t(!0);try{e()}finally{_t(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=fn();if(n!==void 0){var i=n(t);if(ja){_t(!0);try{n(t)}finally{_t(!1)}}}else i=t;return l.memoizedState=l.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},l.queue=e,e=e.dispatch=$g.bind(null,Oe,e),[l.memoizedState,e]},useRef:function(e){var t=fn();return e={current:e},t.memoizedState=e},useState:function(e){e=Po(e);var t=e.queue,n=vf.bind(null,Oe,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:tc,useDeferredValue:function(e,t){var n=fn();return nc(n,e,t)},useTransition:function(){var e=Po(!1);return e=mf.bind(null,Oe,e.queue,!0,!1),fn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=Oe,i=fn();if(Je){if(n===void 0)throw Error(c(407));n=n()}else{if(n=t(),ht===null)throw Error(c(349));(Fe&127)!==0||Gd(l,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,af(Vd.bind(null,l,s,e),[e]),l.flags|=2048,ci(9,{destroy:void 0},qd.bind(null,l,s,n,t),null),n},useId:function(){var e=fn(),t=ht.identifierPrefix;if(Je){var n=ol,l=sl;n=(l&~(1<<32-wt(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=rs++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Fg++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ac,useFormState:$d,useActionState:$d,useOptimistic:function(e){var t=fn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ic.bind(null,Oe,!0,n),n.dispatch=t,[e,t]},useMemoCache:Io,useCacheRefresh:function(){return fn().memoizedState=Pg.bind(null,Oe)},useEffectEvent:function(e){var t=fn(),n={impl:e};return t.memoizedState=n,function(){if((nt&2)!==0)throw Error(c(440));return n.impl.apply(void 0,arguments)}}},rc={readContext:en,use:os,useCallback:df,useContext:en,useEffect:ec,useImperativeHandle:uf,useInsertionEffect:sf,useLayoutEffect:of,useMemo:ff,useReducer:cs,useRef:lf,useState:function(){return cs(Nl)},useDebugValue:tc,useDeferredValue:function(e,t){var n=Mt();return hf(n,ct.memoizedState,e,t)},useTransition:function(){var e=cs(Nl)[0],t=Mt().memoizedState;return[typeof e=="boolean"?e:Ii(e),t]},useSyncExternalStore:Kd,useId:bf,useHostTransitionStatus:ac,useFormState:ef,useActionState:ef,useOptimistic:function(e,t){var n=Mt();return Zd(n,ct,e,t)},useMemoCache:Io,useCacheRefresh:yf};rc.useEffectEvent=rf;var Cf={readContext:en,use:os,useCallback:df,useContext:en,useEffect:ec,useImperativeHandle:uf,useInsertionEffect:sf,useLayoutEffect:of,useMemo:ff,useReducer:Wo,useRef:lf,useState:function(){return Wo(Nl)},useDebugValue:tc,useDeferredValue:function(e,t){var n=Mt();return ct===null?nc(n,e,t):hf(n,ct.memoizedState,e,t)},useTransition:function(){var e=Wo(Nl)[0],t=Mt().memoizedState;return[typeof e=="boolean"?e:Ii(e),t]},useSyncExternalStore:Kd,useId:bf,useHostTransitionStatus:ac,useFormState:nf,useActionState:nf,useOptimistic:function(e,t){var n=Mt();return ct!==null?Zd(n,ct,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Io,useCacheRefresh:yf};Cf.useEffectEvent=rf;function sc(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:C({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var oc={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=kn(),i=Ql(l);i.payload=t,n!=null&&(i.callback=n),t=Il(e,i,l),t!==null&&(Tn(t,e,l),Xi(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=kn(),i=Ql(l);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Il(e,i,l),t!==null&&(Tn(t,e,l),Xi(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=kn(),l=Ql(n);l.tag=2,t!=null&&(l.callback=t),t=Il(e,l,n),t!==null&&(Tn(t,e,n),Xi(t,e,n))}};function Tf(e,t,n,l,i,s,h){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,s,h):t.prototype&&t.prototype.isPureReactComponent?!Ui(n,l)||!Ui(i,s):!0}function Nf(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&&oc.enqueueReplaceState(t,t.state,null)}function Ma(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=C({},n));for(var i in e)n[i]===void 0&&(n[i]=e[i])}return n}function Ef(e){Vr(e)}function Rf(e){console.error(e)}function Af(e){Vr(e)}function hs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function jf(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(i){setTimeout(function(){throw i})}}function cc(e,t,n){return n=Ql(n),n.tag=3,n.payload={element:null},n.callback=function(){hs(e,t)},n}function Mf(e){return e=Ql(e),e.tag=3,e}function kf(e,t,n,l){var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var s=l.value;e.payload=function(){return i(s)},e.callback=function(){jf(t,n,l)}}var h=n.stateNode;h!==null&&typeof h.componentDidCatch=="function"&&(e.callback=function(){jf(t,n,l),typeof i!="function"&&(ta===null?ta=new Set([this]):ta.add(this));var g=l.stack;this.componentDidCatch(l.value,{componentStack:g!==null?g:""})})}function eb(e,t,n,l,i){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&ti(t,n,i,!0),n=Rn.current,n!==null){switch(n.tag){case 31:case 13:return Xn===null?Ns():n.alternate===null&&Et===0&&(Et=3),n.flags&=-257,n.flags|=65536,n.lanes=i,l===es?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),Dc(e,l,i)),!1;case 22:return n.flags|=65536,l===es?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)),Dc(e,l,i)),!1}throw Error(c(435,n.tag))}return Dc(e,l,i),Ns(),!1}if(Je)return t=Rn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=i,l!==Ao&&(e=Error(c(422),{cause:l}),Yi(Kn(e,n)))):(l!==Ao&&(t=Error(c(423),{cause:l}),Yi(Kn(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,l=Kn(l,n),i=cc(e.stateNode,l,i),Ho(e,i),Et!==4&&(Et=2)),!1;var s=Error(c(520),{cause:l});if(s=Kn(s,n),ir===null?ir=[s]:ir.push(s),Et!==4&&(Et=2),t===null)return!0;l=Kn(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=cc(n.stateNode,l,e),Ho(n,e),!1;case 1:if(t=n.type,s=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||s!==null&&typeof s.componentDidCatch=="function"&&(ta===null||!ta.has(s))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Mf(i),kf(i,e,n,l),Ho(n,i),!1}n=n.return}while(n!==null);return!1}var uc=Error(c(461)),Lt=!1;function tn(e,t,n,l){t.child=e===null?Dd(t,null,n,l):Aa(t,e.child,n,l)}function _f(e,t,n,l,i){n=n.render;var s=t.ref;if("ref"in l){var h={};for(var g in l)g!=="ref"&&(h[g]=l[g])}else h=l;return Ta(t),l=Xo(e,t,n,h,s,i),g=Fo(),e!==null&&!Lt?(Zo(e,t,i),El(e,t,i)):(Je&&g&&Eo(t),t.flags|=1,tn(e,t,l,i),t.child)}function zf(e,t,n,l,i){if(e===null){var s=n.type;return typeof s=="function"&&!Co(s)&&s.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=s,Df(e,t,s,l,i)):(e=Qr(n.type,null,l,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!yc(e,i)){var h=s.memoizedProps;if(n=n.compare,n=n!==null?n:Ui,n(h,l)&&e.ref===t.ref)return El(e,t,i)}return t.flags|=1,e=xl(s,l),e.ref=t.ref,e.return=t,t.child=e}function Df(e,t,n,l,i){if(e!==null){var s=e.memoizedProps;if(Ui(s,l)&&e.ref===t.ref)if(Lt=!1,t.pendingProps=l=s,yc(e,i))(e.flags&131072)!==0&&(Lt=!0);else return t.lanes=e.lanes,El(e,t,i)}return dc(e,t,n,l,i)}function Of(e,t,n,l){var i=l.children,s=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(s=s!==null?s.baseLanes|n:n,e!==null){for(l=t.child=e.child,i=0;l!==null;)i=i|l.lanes|l.childLanes,l=l.sibling;l=i&~s}else l=0,t.child=null;return Lf(e,t,s,n,l)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Pr(t,s!==null?s.cachePool:null),s!==null?Ud(t,s):Ko(),Bd(t);else return l=t.lanes=536870912,Lf(e,t,s!==null?s.baseLanes|n:n,n,l)}else s!==null?(Pr(t,s.cachePool),Ud(t,s),Wl(),t.memoizedState=null):(e!==null&&Pr(t,null),Ko(),Wl());return tn(e,t,i,n),t.child}function Pi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Lf(e,t,n,l,i){var s=Oo();return s=s===null?null:{parent:Dt._currentValue,pool:s},t.memoizedState={baseLanes:n,cachePool:s},e!==null&&Pr(t,null),Ko(),Bd(t),e!==null&&ti(e,t,l,!0),t.childLanes=i,null}function ms(e,t){return t=gs({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Uf(e,t,n){return Aa(t,e.child,null,n),e=ms(t,t.pendingProps),e.flags|=2,An(t),t.memoizedState=null,e}function tb(e,t,n){var l=t.pendingProps,i=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Je){if(l.mode==="hidden")return e=ms(t,l),t.lanes=536870912,Pi(null,e);if(qo(t),(e=yt)?(e=Ih(e,Vn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ql!==null?{id:sl,overflow:ol}:null,retryLane:536870912,hydrationErrors:null},n=vd(e),n.return=t,t.child=n,$t=t,yt=null)):e=null,e===null)throw Xl(t);return t.lanes=536870912,null}return ms(t,l)}var s=e.memoizedState;if(s!==null){var h=s.dehydrated;if(qo(t),i)if(t.flags&256)t.flags&=-257,t=Uf(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(c(558));else if(Lt||ti(e,t,n,!1),i=(n&e.childLanes)!==0,Lt||i){if(l=ht,l!==null&&(h=Ka(l,n),h!==0&&h!==s.retryLane))throw s.retryLane=h,xa(e,h),Tn(l,e,h),uc;Ns(),t=Uf(e,t,n)}else e=s.treeContext,yt=Fn(h.nextSibling),$t=t,Je=!0,Vl=null,Vn=!1,e!==null&&wd(t,e),t=ms(t,l),t.flags|=4096;return t}return e=xl(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ps(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(c(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function dc(e,t,n,l,i){return Ta(t),n=Xo(e,t,n,l,void 0,i),l=Fo(),e!==null&&!Lt?(Zo(e,t,i),El(e,t,i)):(Je&&l&&Eo(t),t.flags|=1,tn(e,t,n,i),t.child)}function Bf(e,t,n,l,i,s){return Ta(t),t.updateQueue=null,n=Yd(t,l,n,i),Hd(e),l=Fo(),e!==null&&!Lt?(Zo(e,t,s),El(e,t,s)):(Je&&l&&Eo(t),t.flags|=1,tn(e,t,n,s),t.child)}function Hf(e,t,n,l,i){if(Ta(t),t.stateNode===null){var s=Wa,h=n.contextType;typeof h=="object"&&h!==null&&(s=en(h)),s=new n(l,s),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=oc,t.stateNode=s,s._reactInternals=t,s=t.stateNode,s.props=l,s.state=t.memoizedState,s.refs={},Uo(t),h=n.contextType,s.context=typeof h=="object"&&h!==null?en(h):Wa,s.state=t.memoizedState,h=n.getDerivedStateFromProps,typeof h=="function"&&(sc(t,n,h,l),s.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(h=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),h!==s.state&&oc.enqueueReplaceState(s,s.state,null),Zi(t,l,s,i),Fi(),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){s=t.stateNode;var g=t.memoizedProps,x=Ma(n,g);s.props=x;var E=s.context,B=n.contextType;h=Wa,typeof B=="object"&&B!==null&&(h=en(B));var G=n.getDerivedStateFromProps;B=typeof G=="function"||typeof s.getSnapshotBeforeUpdate=="function",g=t.pendingProps!==g,B||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(g||E!==h)&&Nf(t,s,l,h),Zl=!1;var A=t.memoizedState;s.state=A,Zi(t,l,s,i),Fi(),E=t.memoizedState,g||A!==E||Zl?(typeof G=="function"&&(sc(t,n,G,l),E=t.memoizedState),(x=Zl||Tf(t,n,x,l,A,E,h))?(B||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=E),s.props=l,s.state=E,s.context=h,l=x):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{s=t.stateNode,Bo(e,t),h=t.memoizedProps,B=Ma(n,h),s.props=B,G=t.pendingProps,A=s.context,E=n.contextType,x=Wa,typeof E=="object"&&E!==null&&(x=en(E)),g=n.getDerivedStateFromProps,(E=typeof g=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(h!==G||A!==x)&&Nf(t,s,l,x),Zl=!1,A=t.memoizedState,s.state=A,Zi(t,l,s,i),Fi();var k=t.memoizedState;h!==G||A!==k||Zl||e!==null&&e.dependencies!==null&&Jr(e.dependencies)?(typeof g=="function"&&(sc(t,n,g,l),k=t.memoizedState),(B=Zl||Tf(t,n,B,l,A,k,x)||e!==null&&e.dependencies!==null&&Jr(e.dependencies))?(E||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(l,k,x),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(l,k,x)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||h===e.memoizedProps&&A===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&A===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=k),s.props=l,s.state=k,s.context=x,l=B):(typeof s.componentDidUpdate!="function"||h===e.memoizedProps&&A===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&A===e.memoizedState||(t.flags|=1024),l=!1)}return s=l,ps(e,t),l=(t.flags&128)!==0,s||l?(s=t.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:s.render(),t.flags|=1,e!==null&&l?(t.child=Aa(t,e.child,null,i),t.child=Aa(t,null,n,i)):tn(e,t,n,i),t.memoizedState=s.state,e=t.child):e=El(e,t,i),e}function Yf(e,t,n,l){return wa(),t.flags|=256,tn(e,t,n,l),t.child}var fc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hc(e){return{baseLanes:e,cachePool:Ad()}}function mc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Mn),e}function Kf(e,t,n){var l=t.pendingProps,i=!1,s=(t.flags&128)!==0,h;if((h=s)||(h=e!==null&&e.memoizedState===null?!1:(jt.current&2)!==0),h&&(i=!0,t.flags&=-129),h=(t.flags&32)!==0,t.flags&=-33,e===null){if(Je){if(i?Jl(t):Wl(),(e=yt)?(e=Ih(e,Vn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ql!==null?{id:sl,overflow:ol}:null,retryLane:536870912,hydrationErrors:null},n=vd(e),n.return=t,t.child=n,$t=t,yt=null)):e=null,e===null)throw Xl(t);return Jc(e)?t.lanes=32:t.lanes=536870912,null}var g=l.children;return l=l.fallback,i?(Wl(),i=t.mode,g=gs({mode:"hidden",children:g},i),l=Sa(l,i,n,null),g.return=t,l.return=t,g.sibling=l,t.child=g,l=t.child,l.memoizedState=hc(n),l.childLanes=mc(e,h,n),t.memoizedState=fc,Pi(null,l)):(Jl(t),pc(t,g))}var x=e.memoizedState;if(x!==null&&(g=x.dehydrated,g!==null)){if(s)t.flags&256?(Jl(t),t.flags&=-257,t=gc(e,t,n)):t.memoizedState!==null?(Wl(),t.child=e.child,t.flags|=128,t=null):(Wl(),g=l.fallback,i=t.mode,l=gs({mode:"visible",children:l.children},i),g=Sa(g,i,n,null),g.flags|=2,l.return=t,g.return=t,l.sibling=g,t.child=l,Aa(t,e.child,null,n),l=t.child,l.memoizedState=hc(n),l.childLanes=mc(e,h,n),t.memoizedState=fc,t=Pi(null,l));else if(Jl(t),Jc(g)){if(h=g.nextSibling&&g.nextSibling.dataset,h)var E=h.dgst;h=E,l=Error(c(419)),l.stack="",l.digest=h,Yi({value:l,source:null,stack:null}),t=gc(e,t,n)}else if(Lt||ti(e,t,n,!1),h=(n&e.childLanes)!==0,Lt||h){if(h=ht,h!==null&&(l=Ka(h,n),l!==0&&l!==x.retryLane))throw x.retryLane=l,xa(e,l),Tn(h,e,l),uc;Ic(g)||Ns(),t=gc(e,t,n)}else Ic(g)?(t.flags|=192,t.child=e.child,t=null):(e=x.treeContext,yt=Fn(g.nextSibling),$t=t,Je=!0,Vl=null,Vn=!1,e!==null&&wd(t,e),t=pc(t,l.children),t.flags|=4096);return t}return i?(Wl(),g=l.fallback,i=t.mode,x=e.child,E=x.sibling,l=xl(x,{mode:"hidden",children:l.children}),l.subtreeFlags=x.subtreeFlags&65011712,E!==null?g=xl(E,g):(g=Sa(g,i,n,null),g.flags|=2),g.return=t,l.return=t,l.sibling=g,t.child=l,Pi(null,l),l=t.child,g=e.child.memoizedState,g===null?g=hc(n):(i=g.cachePool,i!==null?(x=Dt._currentValue,i=i.parent!==x?{parent:x,pool:x}:i):i=Ad(),g={baseLanes:g.baseLanes|n,cachePool:i}),l.memoizedState=g,l.childLanes=mc(e,h,n),t.memoizedState=fc,Pi(e.child,l)):(Jl(t),n=e.child,e=n.sibling,n=xl(n,{mode:"visible",children:l.children}),n.return=t,n.sibling=null,e!==null&&(h=t.deletions,h===null?(t.deletions=[e],t.flags|=16):h.push(e)),t.child=n,t.memoizedState=null,n)}function pc(e,t){return t=gs({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function gs(e,t){return e=En(22,e,null,t),e.lanes=0,e}function gc(e,t,n){return Aa(t,e.child,null,n),e=pc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gf(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),ko(e.return,t,n)}function bc(e,t,n,l,i,s){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:i,treeForkCount:s}:(h.isBackwards=t,h.rendering=null,h.renderingStartTime=0,h.last=l,h.tail=n,h.tailMode=i,h.treeForkCount=s)}function qf(e,t,n){var l=t.pendingProps,i=l.revealOrder,s=l.tail;l=l.children;var h=jt.current,g=(h&2)!==0;if(g?(h=h&1|2,t.flags|=128):h&=1,pe(jt,h),tn(e,t,l,n),l=Je?Hi:0,!g&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Gf(e,n,t);else if(e.tag===19)Gf(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(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&as(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),bc(t,!1,i,n,s,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&as(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}bc(t,!0,n,null,s,l);break;case"together":bc(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function El(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ea|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ti(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(c(153));if(t.child!==null){for(e=t.child,n=xl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=xl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function yc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Jr(e)))}function nb(e,t,n){switch(t.tag){case 3:Ue(t,t.stateNode.containerInfo),Fl(t,Dt,e.memoizedState.cache),wa();break;case 27:case 5:ft(t);break;case 4:Ue(t,t.stateNode.containerInfo);break;case 10:Fl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,qo(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Jl(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Kf(e,t,n):(Jl(t),e=El(e,t,n),e!==null?e.sibling:null);Jl(t);break;case 19:var i=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(ti(e,t,n,!1),l=(n&t.childLanes)!==0),i){if(l)return qf(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),pe(jt,jt.current),l)break;return null;case 22:return t.lanes=0,Of(e,t,n,t.pendingProps);case 24:Fl(t,Dt,e.memoizedState.cache)}return El(e,t,n)}function Vf(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Lt=!0;else{if(!yc(e,n)&&(t.flags&128)===0)return Lt=!1,nb(e,t,n);Lt=(e.flags&131072)!==0}else Lt=!1,Je&&(t.flags&1048576)!==0&&Sd(t,Hi,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Ea(t.elementType),t.type=e,typeof e=="function")Co(e)?(l=Ma(e,l),t.tag=1,t=Hf(null,t,e,l,n)):(t.tag=0,t=dc(null,t,e,l,n));else{if(e!=null){var i=e.$$typeof;if(i===ae){t.tag=11,t=_f(null,t,e,l,n);break e}else if(i===U){t.tag=14,t=zf(null,t,e,l,n);break e}}throw t=_e(e)||e,Error(c(306,t,""))}}return t;case 0:return dc(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,i=Ma(l,t.pendingProps),Hf(e,t,l,i,n);case 3:e:{if(Ue(t,t.stateNode.containerInfo),e===null)throw Error(c(387));l=t.pendingProps;var s=t.memoizedState;i=s.element,Bo(e,t),Zi(t,l,null,n);var h=t.memoizedState;if(l=h.cache,Fl(t,Dt,l),l!==s.cache&&_o(t,[Dt],n,!0),Fi(),l=h.element,s.isDehydrated)if(s={element:l,isDehydrated:!1,cache:h.cache},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){t=Yf(e,t,l,n);break e}else if(l!==i){i=Kn(Error(c(424)),t),Yi(i),t=Yf(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(yt=Fn(e.firstChild),$t=t,Je=!0,Vl=null,Vn=!0,n=Dd(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(wa(),l===i){t=El(e,t,n);break e}tn(e,t,l,n)}t=t.child}return t;case 26:return ps(e,t),e===null?(n=tm(t.type,null,t.pendingProps,null))?t.memoizedState=n:Je||(n=t.type,e=t.pendingProps,l=_s(he.current).createElement(n),l[fe]=t,l[ke]=e,nn(l,n,e),Q(l),t.stateNode=l):t.memoizedState=tm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ft(t),e===null&&Je&&(l=t.stateNode=Ph(t.type,t.pendingProps,he.current),$t=t,Vn=!0,i=yt,ia(t.type)?(Wc=i,yt=Fn(l.firstChild)):yt=i),tn(e,t,t.pendingProps.children,n),ps(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Je&&((i=l=yt)&&(l=_b(l,t.type,t.pendingProps,Vn),l!==null?(t.stateNode=l,$t=t,yt=Fn(l.firstChild),Vn=!1,i=!0):i=!1),i||Xl(t)),ft(t),i=t.type,s=t.pendingProps,h=e!==null?e.memoizedProps:null,l=s.children,Fc(i,s)?l=null:h!==null&&Fc(i,h)&&(t.flags|=32),t.memoizedState!==null&&(i=Xo(e,t,Zg,null,null,n),hr._currentValue=i),ps(e,t),tn(e,t,l,n),t.child;case 6:return e===null&&Je&&((e=n=yt)&&(n=zb(n,t.pendingProps,Vn),n!==null?(t.stateNode=n,$t=t,yt=null,e=!0):e=!1),e||Xl(t)),null;case 13:return Kf(e,t,n);case 4:return Ue(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Aa(t,null,l,n):tn(e,t,l,n),t.child;case 11:return _f(e,t,t.type,t.pendingProps,n);case 7:return tn(e,t,t.pendingProps,n),t.child;case 8:return tn(e,t,t.pendingProps.children,n),t.child;case 12:return tn(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,Fl(t,t.type,l.value),tn(e,t,l.children,n),t.child;case 9:return i=t.type._context,l=t.pendingProps.children,Ta(t),i=en(i),l=l(i),t.flags|=1,tn(e,t,l,n),t.child;case 14:return zf(e,t,t.type,t.pendingProps,n);case 15:return Df(e,t,t.type,t.pendingProps,n);case 19:return qf(e,t,n);case 31:return tb(e,t,n);case 22:return Of(e,t,n,t.pendingProps);case 24:return Ta(t),l=en(Dt),e===null?(i=Oo(),i===null&&(i=ht,s=zo(),i.pooledCache=s,s.refCount++,s!==null&&(i.pooledCacheLanes|=n),i=s),t.memoizedState={parent:l,cache:i},Uo(t),Fl(t,Dt,i)):((e.lanes&n)!==0&&(Bo(e,t),Zi(t,null,null,n),Fi()),i=e.memoizedState,s=t.memoizedState,i.parent!==l?(i={parent:l,cache:l},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Fl(t,Dt,l)):(l=s.cache,Fl(t,Dt,l),l!==i.cache&&_o(t,[Dt],n,!0))),tn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(c(156,t.tag))}function Rl(e){e.flags|=4}function vc(e,t,n,l,i){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(bh())e.flags|=8192;else throw Ra=es,Lo}else e.flags&=-16777217}function Xf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!rm(t))if(bh())e.flags|=8192;else throw Ra=es,Lo}function bs(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ya():536870912,e.lanes|=t,hi|=t)}function $i(e,t){if(!Je)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 vt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,l|=i.subtreeFlags&65011712,l|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,l|=i.subtreeFlags,l|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function lb(e,t,n){var l=t.pendingProps;switch(Ro(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vt(t),null;case 1:return vt(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Cl(Dt),we(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ei(t)?Rl(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,jo())),vt(t),null;case 26:var i=t.type,s=t.memoizedState;return e===null?(Rl(t),s!==null?(vt(t),Xf(t,s)):(vt(t),vc(t,i,null,l,n))):s?s!==e.memoizedState?(Rl(t),vt(t),Xf(t,s)):(vt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Rl(t),vt(t),vc(t,i,e,l,n)),null;case 27:if(lt(t),n=he.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Rl(t);else{if(!l){if(t.stateNode===null)throw Error(c(166));return vt(t),null}e=ze.current,ei(t)?Cd(t):(e=Ph(i,l,n),t.stateNode=e,Rl(t))}return vt(t),null;case 5:if(lt(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Rl(t);else{if(!l){if(t.stateNode===null)throw Error(c(166));return vt(t),null}if(s=ze.current,ei(t))Cd(t);else{var h=_s(he.current);switch(s){case 1:s=h.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:s=h.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":s=h.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":s=h.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":s=h.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof l.is=="string"?h.createElement("select",{is:l.is}):h.createElement("select"),l.multiple?s.multiple=!0:l.size&&(s.size=l.size);break;default:s=typeof l.is=="string"?h.createElement(i,{is:l.is}):h.createElement(i)}}s[fe]=t,s[ke]=l;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)s.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=s;e:switch(nn(s,i,l),i){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Rl(t)}}return vt(t),vc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Rl(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(c(166));if(e=he.current,ei(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,i=$t,i!==null)switch(i.tag){case 27:case 5:l=i.memoizedProps}e[fe]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||Kh(e.nodeValue,n)),e||Xl(t,!0)}else e=_s(e).createTextNode(l),e[fe]=t,t.stateNode=e}return vt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=ei(t),n!==null){if(e===null){if(!l)throw Error(c(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(557));e[fe]=t}else wa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;vt(t),e=!1}else n=jo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(An(t),t):(An(t),null);if((t.flags&128)!==0)throw Error(c(558))}return vt(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=ei(t),l!==null&&l.dehydrated!==null){if(e===null){if(!i)throw Error(c(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(c(317));i[fe]=t}else wa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;vt(t),i=!1}else i=jo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(An(t),t):(An(t),null)}return An(t),(t.flags&128)!==0?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,i=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(i=l.alternate.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==i&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),bs(t,t.updateQueue),vt(t),null);case 4:return we(),e===null&&Kc(t.stateNode.containerInfo),vt(t),null;case 10:return Cl(t.type),vt(t),null;case 19:if(F(jt),l=t.memoizedState,l===null)return vt(t),null;if(i=(t.flags&128)!==0,s=l.rendering,s===null)if(i)$i(l,!1);else{if(Et!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=as(e),s!==null){for(t.flags|=128,$i(l,!1),e=s.updateQueue,t.updateQueue=e,bs(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)yd(n,e),n=n.sibling;return pe(jt,jt.current&1|2),Je&&Sl(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&ee()>ws&&(t.flags|=128,i=!0,$i(l,!1),t.lanes=4194304)}else{if(!i)if(e=as(s),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,bs(t,e),$i(l,!0),l.tail===null&&l.tailMode==="hidden"&&!s.alternate&&!Je)return vt(t),null}else 2*ee()-l.renderingStartTime>ws&&n!==536870912&&(t.flags|=128,i=!0,$i(l,!1),t.lanes=4194304);l.isBackwards?(s.sibling=t.child,t.child=s):(e=l.last,e!==null?e.sibling=s:t.child=s,l.last=s)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=ee(),e.sibling=null,n=jt.current,pe(jt,i?n&1|2:n&1),Je&&Sl(t,l.treeForkCount),e):(vt(t),null);case 22:case 23:return An(t),Go(),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&&(vt(t),t.subtreeFlags&6&&(t.flags|=8192)):vt(t),n=t.updateQueue,n!==null&&bs(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&&F(Na),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Cl(Dt),vt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function ab(e,t){switch(Ro(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Cl(Dt),we(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return lt(t),null;case 31:if(t.memoizedState!==null){if(An(t),t.alternate===null)throw Error(c(340));wa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(An(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));wa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return F(jt),null;case 4:return we(),null;case 10:return Cl(t.type),null;case 22:case 23:return An(t),Go(),e!==null&&F(Na),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Cl(Dt),null;case 25:return null;default:return null}}function Ff(e,t){switch(Ro(t),t.tag){case 3:Cl(Dt),we();break;case 26:case 27:case 5:lt(t);break;case 4:we();break;case 31:t.memoizedState!==null&&An(t);break;case 13:An(t);break;case 19:F(jt);break;case 10:Cl(t.type);break;case 22:case 23:An(t),Go(),e!==null&&F(Na);break;case 24:Cl(Dt)}}function er(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var i=l.next;n=i;do{if((n.tag&e)===e){l=void 0;var s=n.create,h=n.inst;l=s(),h.destroy=l}n=n.next}while(n!==i)}}catch(g){st(t,t.return,g)}}function Pl(e,t,n){try{var l=t.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var s=i.next;l=s;do{if((l.tag&e)===e){var h=l.inst,g=h.destroy;if(g!==void 0){h.destroy=void 0,i=t;var x=n,E=g;try{E()}catch(B){st(i,x,B)}}}l=l.next}while(l!==s)}}catch(B){st(t,t.return,B)}}function Zf(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ld(t,n)}catch(l){st(e,e.return,l)}}}function Qf(e,t,n){n.props=Ma(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){st(e,t,l)}}function tr(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(i){st(e,t,i)}}function cl(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(i){st(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){st(e,t,i)}else n.current=null}function If(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(i){st(e,e.return,i)}}function xc(e,t,n){try{var l=e.stateNode;Eb(l,e.type,n,t),l[ke]=t}catch(i){st(e,e.return,i)}}function Jf(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ia(e.type)||e.tag===4}function Sc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Jf(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&&ia(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 wc(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=Hn));else if(l!==4&&(l===27&&ia(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(wc(e,t,n),e=e.sibling;e!==null;)wc(e,t,n),e=e.sibling}function ys(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&&ia(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(ys(e,t,n),e=e.sibling;e!==null;)ys(e,t,n),e=e.sibling}function Wf(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);nn(t,l,n),t[fe]=e,t[ke]=n}catch(s){st(e,e.return,s)}}var Al=!1,Ut=!1,Cc=!1,Pf=typeof WeakSet=="function"?WeakSet:Set,Qt=null;function ib(e,t){if(e=e.containerInfo,Vc=Hs,e=cd(e),go(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 i=l.anchorOffset,s=l.focusNode;l=l.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var h=0,g=-1,x=-1,E=0,B=0,G=e,A=null;t:for(;;){for(var k;G!==n||i!==0&&G.nodeType!==3||(g=h+i),G!==s||l!==0&&G.nodeType!==3||(x=h+l),G.nodeType===3&&(h+=G.nodeValue.length),(k=G.firstChild)!==null;)A=G,G=k;for(;;){if(G===e)break t;if(A===n&&++E===i&&(g=h),A===s&&++B===l&&(x=h),(k=G.nextSibling)!==null)break;G=A,A=G.parentNode}G=k}n=g===-1||x===-1?null:{start:g,end:x}}else n=null}n=n||{start:0,end:0}}else n=null;for(Xc={focusedElem:e,selectionRange:n},Hs=!1,Qt=t;Qt!==null;)if(t=Qt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Qt=e;else for(;Qt!==null;){switch(t=Qt,s=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++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&s!==null){e=void 0,n=t,i=s.memoizedProps,s=s.memoizedState,l=n.stateNode;try{var oe=Ma(n.type,i);e=l.getSnapshotBeforeUpdate(oe,s),l.__reactInternalSnapshotBeforeUpdate=e}catch(Te){st(n,n.return,Te)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Qc(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Qc(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(c(163))}if(e=t.sibling,e!==null){e.return=t.return,Qt=e;break}Qt=t.return}}function $f(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:Ml(e,n),l&4&&er(5,n);break;case 1:if(Ml(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(h){st(n,n.return,h)}else{var i=Ma(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(h){st(n,n.return,h)}}l&64&&Zf(n),l&512&&tr(n,n.return);break;case 3:if(Ml(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{Ld(e,t)}catch(h){st(n,n.return,h)}}break;case 27:t===null&&l&4&&Wf(n);case 26:case 5:Ml(e,n),t===null&&l&4&&If(n),l&512&&tr(n,n.return);break;case 12:Ml(e,n);break;case 31:Ml(e,n),l&4&&nh(e,n);break;case 13:Ml(e,n),l&4&&lh(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=mb.bind(null,n),Db(e,n))));break;case 22:if(l=n.memoizedState!==null||Al,!l){t=t!==null&&t.memoizedState!==null||Ut,i=Al;var s=Ut;Al=l,(Ut=t)&&!s?kl(e,n,(n.subtreeFlags&8772)!==0):Ml(e,n),Al=i,Ut=s}break;case 30:break;default:Ml(e,n)}}function eh(e){var t=e.alternate;t!==null&&(e.alternate=null,eh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ga(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 xt=null,xn=!1;function jl(e,t,n){for(n=n.child;n!==null;)th(e,t,n),n=n.sibling}function th(e,t,n){if(at&&typeof at.onCommitFiberUnmount=="function")try{at.onCommitFiberUnmount(ln,n)}catch{}switch(n.tag){case 26:Ut||cl(n,t),jl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Ut||cl(n,t);var l=xt,i=xn;ia(n.type)&&(xt=n.stateNode,xn=!1),jl(e,t,n),ur(n.stateNode),xt=l,xn=i;break;case 5:Ut||cl(n,t);case 6:if(l=xt,i=xn,xt=null,jl(e,t,n),xt=l,xn=i,xt!==null)if(xn)try{(xt.nodeType===9?xt.body:xt.nodeName==="HTML"?xt.ownerDocument.body:xt).removeChild(n.stateNode)}catch(s){st(n,t,s)}else try{xt.removeChild(n.stateNode)}catch(s){st(n,t,s)}break;case 18:xt!==null&&(xn?(e=xt,Zh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Si(e)):Zh(xt,n.stateNode));break;case 4:l=xt,i=xn,xt=n.stateNode.containerInfo,xn=!0,jl(e,t,n),xt=l,xn=i;break;case 0:case 11:case 14:case 15:Pl(2,n,t),Ut||Pl(4,n,t),jl(e,t,n);break;case 1:Ut||(cl(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&Qf(n,t,l)),jl(e,t,n);break;case 21:jl(e,t,n);break;case 22:Ut=(l=Ut)||n.memoizedState!==null,jl(e,t,n),Ut=l;break;default:jl(e,t,n)}}function nh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Si(e)}catch(n){st(t,t.return,n)}}}function lh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Si(e)}catch(n){st(t,t.return,n)}}function rb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Pf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Pf),t;default:throw Error(c(435,e.tag))}}function vs(e,t){var n=rb(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var i=pb.bind(null,e,l);l.then(i,i)}})}function Sn(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var i=n[l],s=e,h=t,g=h;e:for(;g!==null;){switch(g.tag){case 27:if(ia(g.type)){xt=g.stateNode,xn=!1;break e}break;case 5:xt=g.stateNode,xn=!1;break e;case 3:case 4:xt=g.stateNode.containerInfo,xn=!0;break e}g=g.return}if(xt===null)throw Error(c(160));th(s,h,i),xt=null,xn=!1,s=i.alternate,s!==null&&(s.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ah(t,e),t=t.sibling}var el=null;function ah(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Sn(t,e),wn(e),l&4&&(Pl(3,e,e.return),er(3,e),Pl(5,e,e.return));break;case 1:Sn(t,e),wn(e),l&512&&(Ut||n===null||cl(n,n.return)),l&64&&Al&&(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 i=el;if(Sn(t,e),wn(e),l&512&&(Ut||n===null||cl(n,n.return)),l&4){var s=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,i=i.ownerDocument||i;t:switch(l){case"title":s=i.getElementsByTagName("title")[0],(!s||s[rl]||s[fe]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=i.createElement(l),i.head.insertBefore(s,i.querySelector("head > title"))),nn(s,l,n),s[fe]=e,Q(s),l=s;break e;case"link":var h=am("link","href",i).get(l+(n.href||""));if(h){for(var g=0;g<h.length;g++)if(s=h[g],s.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&s.getAttribute("rel")===(n.rel==null?null:n.rel)&&s.getAttribute("title")===(n.title==null?null:n.title)&&s.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){h.splice(g,1);break t}}s=i.createElement(l),nn(s,l,n),i.head.appendChild(s);break;case"meta":if(h=am("meta","content",i).get(l+(n.content||""))){for(g=0;g<h.length;g++)if(s=h[g],s.getAttribute("content")===(n.content==null?null:""+n.content)&&s.getAttribute("name")===(n.name==null?null:n.name)&&s.getAttribute("property")===(n.property==null?null:n.property)&&s.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&s.getAttribute("charset")===(n.charSet==null?null:n.charSet)){h.splice(g,1);break t}}s=i.createElement(l),nn(s,l,n),i.head.appendChild(s);break;default:throw Error(c(468,l))}s[fe]=e,Q(s),l=s}e.stateNode=l}else im(i,e.type,e.stateNode);else e.stateNode=lm(i,l,e.memoizedProps);else s!==l?(s===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):s.count--,l===null?im(i,e.type,e.stateNode):lm(i,l,e.memoizedProps)):l===null&&e.stateNode!==null&&xc(e,e.memoizedProps,n.memoizedProps)}break;case 27:Sn(t,e),wn(e),l&512&&(Ut||n===null||cl(n,n.return)),n!==null&&l&4&&xc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Sn(t,e),wn(e),l&512&&(Ut||n===null||cl(n,n.return)),e.flags&32){i=e.stateNode;try{Bn(i,"")}catch(oe){st(e,e.return,oe)}}l&4&&e.stateNode!=null&&(i=e.memoizedProps,xc(e,i,n!==null?n.memoizedProps:i)),l&1024&&(Cc=!0);break;case 6:if(Sn(t,e),wn(e),l&4){if(e.stateNode===null)throw Error(c(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(oe){st(e,e.return,oe)}}break;case 3:if(Os=null,i=el,el=zs(t.containerInfo),Sn(t,e),el=i,wn(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{Si(t.containerInfo)}catch(oe){st(e,e.return,oe)}Cc&&(Cc=!1,ih(e));break;case 4:l=el,el=zs(e.stateNode.containerInfo),Sn(t,e),wn(e),el=l;break;case 12:Sn(t,e),wn(e);break;case 31:Sn(t,e),wn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,vs(e,l)));break;case 13:Sn(t,e),wn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ss=ee()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,vs(e,l)));break;case 22:i=e.memoizedState!==null;var x=n!==null&&n.memoizedState!==null,E=Al,B=Ut;if(Al=E||i,Ut=B||x,Sn(t,e),Ut=B,Al=E,wn(e),l&8192)e:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||x||Al||Ut||ka(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){x=n=t;try{if(s=x.stateNode,i)h=s.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none";else{g=x.stateNode;var G=x.memoizedProps.style,A=G!=null&&G.hasOwnProperty("display")?G.display:null;g.style.display=A==null||typeof A=="boolean"?"":(""+A).trim()}}catch(oe){st(x,x.return,oe)}}}else if(t.tag===6){if(n===null){x=t;try{x.stateNode.nodeValue=i?"":x.memoizedProps}catch(oe){st(x,x.return,oe)}}}else if(t.tag===18){if(n===null){x=t;try{var k=x.stateNode;i?Qh(k,!0):Qh(x.stateNode,!1)}catch(oe){st(x,x.return,oe)}}}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,vs(e,n))));break;case 19:Sn(t,e),wn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,vs(e,l)));break;case 30:break;case 21:break;default:Sn(t,e),wn(e)}}function wn(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(Jf(l)){n=l;break}l=l.return}if(n==null)throw Error(c(160));switch(n.tag){case 27:var i=n.stateNode,s=Sc(e);ys(e,s,i);break;case 5:var h=n.stateNode;n.flags&32&&(Bn(h,""),n.flags&=-33);var g=Sc(e);ys(e,g,h);break;case 3:case 4:var x=n.stateNode.containerInfo,E=Sc(e);wc(e,E,x);break;default:throw Error(c(161))}}catch(B){st(e,e.return,B)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ih(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ih(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ml(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)$f(e,t.alternate,t),t=t.sibling}function ka(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),ka(t);break;case 1:cl(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Qf(t,t.return,n),ka(t);break;case 27:ur(t.stateNode);case 26:case 5:cl(t,t.return),ka(t);break;case 22:t.memoizedState===null&&ka(t);break;case 30:ka(t);break;default:ka(t)}e=e.sibling}}function kl(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,i=e,s=t,h=s.flags;switch(s.tag){case 0:case 11:case 15:kl(i,s,n),er(4,s);break;case 1:if(kl(i,s,n),l=s,i=l.stateNode,typeof i.componentDidMount=="function")try{i.componentDidMount()}catch(E){st(l,l.return,E)}if(l=s,i=l.updateQueue,i!==null){var g=l.stateNode;try{var x=i.shared.hiddenCallbacks;if(x!==null)for(i.shared.hiddenCallbacks=null,i=0;i<x.length;i++)Od(x[i],g)}catch(E){st(l,l.return,E)}}n&&h&64&&Zf(s),tr(s,s.return);break;case 27:Wf(s);case 26:case 5:kl(i,s,n),n&&l===null&&h&4&&If(s),tr(s,s.return);break;case 12:kl(i,s,n);break;case 31:kl(i,s,n),n&&h&4&&nh(i,s);break;case 13:kl(i,s,n),n&&h&4&&lh(i,s);break;case 22:s.memoizedState===null&&kl(i,s,n),tr(s,s.return);break;case 30:break;default:kl(i,s,n)}t=t.sibling}}function Tc(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&&Ki(n))}function Nc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ki(e))}function tl(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)rh(e,t,n,l),t=t.sibling}function rh(e,t,n,l){var i=t.flags;switch(t.tag){case 0:case 11:case 15:tl(e,t,n,l),i&2048&&er(9,t);break;case 1:tl(e,t,n,l);break;case 3:tl(e,t,n,l),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ki(e)));break;case 12:if(i&2048){tl(e,t,n,l),e=t.stateNode;try{var s=t.memoizedProps,h=s.id,g=s.onPostCommit;typeof g=="function"&&g(h,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(x){st(t,t.return,x)}}else tl(e,t,n,l);break;case 31:tl(e,t,n,l);break;case 13:tl(e,t,n,l);break;case 23:break;case 22:s=t.stateNode,h=t.alternate,t.memoizedState!==null?s._visibility&2?tl(e,t,n,l):nr(e,t):s._visibility&2?tl(e,t,n,l):(s._visibility|=2,ui(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),i&2048&&Tc(h,t);break;case 24:tl(e,t,n,l),i&2048&&Nc(t.alternate,t);break;default:tl(e,t,n,l)}}function ui(e,t,n,l,i){for(i=i&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var s=e,h=t,g=n,x=l,E=h.flags;switch(h.tag){case 0:case 11:case 15:ui(s,h,g,x,i),er(8,h);break;case 23:break;case 22:var B=h.stateNode;h.memoizedState!==null?B._visibility&2?ui(s,h,g,x,i):nr(s,h):(B._visibility|=2,ui(s,h,g,x,i)),i&&E&2048&&Tc(h.alternate,h);break;case 24:ui(s,h,g,x,i),i&&E&2048&&Nc(h.alternate,h);break;default:ui(s,h,g,x,i)}t=t.sibling}}function nr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,i=l.flags;switch(l.tag){case 22:nr(n,l),i&2048&&Tc(l.alternate,l);break;case 24:nr(n,l),i&2048&&Nc(l.alternate,l);break;default:nr(n,l)}t=t.sibling}}var lr=8192;function di(e,t,n){if(e.subtreeFlags&lr)for(e=e.child;e!==null;)sh(e,t,n),e=e.sibling}function sh(e,t,n){switch(e.tag){case 26:di(e,t,n),e.flags&lr&&e.memoizedState!==null&&Fb(n,el,e.memoizedState,e.memoizedProps);break;case 5:di(e,t,n);break;case 3:case 4:var l=el;el=zs(e.stateNode.containerInfo),di(e,t,n),el=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=lr,lr=16777216,di(e,t,n),lr=l):di(e,t,n));break;default:di(e,t,n)}}function oh(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 ar(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];Qt=l,uh(l,e)}oh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ch(e),e=e.sibling}function ch(e){switch(e.tag){case 0:case 11:case 15:ar(e),e.flags&2048&&Pl(9,e,e.return);break;case 3:ar(e);break;case 12:ar(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,xs(e)):ar(e);break;default:ar(e)}}function xs(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];Qt=l,uh(l,e)}oh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Pl(8,t,t.return),xs(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,xs(t));break;default:xs(t)}e=e.sibling}}function uh(e,t){for(;Qt!==null;){var n=Qt;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:Ki(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,Qt=l;else e:for(n=e;Qt!==null;){l=Qt;var i=l.sibling,s=l.return;if(eh(l),l===n){Qt=null;break e}if(i!==null){i.return=s,Qt=i;break e}Qt=s}}}var sb={getCacheForType:function(e){var t=en(Dt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return en(Dt).controller.signal}},ob=typeof WeakMap=="function"?WeakMap:Map,nt=0,ht=null,Ve=null,Fe=0,rt=0,jn=null,$l=!1,fi=!1,Ec=!1,_l=0,Et=0,ea=0,_a=0,Rc=0,Mn=0,hi=0,ir=null,Cn=null,Ac=!1,Ss=0,dh=0,ws=1/0,Cs=null,ta=null,Vt=0,na=null,mi=null,zl=0,jc=0,Mc=null,fh=null,rr=0,kc=null;function kn(){return(nt&2)!==0&&Fe!==0?Fe&-Fe:j.T!==null?Uc():ie()}function hh(){if(Mn===0)if((Fe&536870912)===0||Je){var e=hl;hl<<=1,(hl&3932160)===0&&(hl=262144),Mn=e}else Mn=536870912;return e=Rn.current,e!==null&&(e.flags|=32),Mn}function Tn(e,t,n){(e===ht&&(rt===2||rt===9)||e.cancelPendingCommit!==null)&&(pi(e,0),la(e,Fe,Mn,!1)),al(e,n),((nt&2)===0||e!==ht)&&(e===ht&&((nt&2)===0&&(_a|=n),Et===4&&la(e,Fe,Mn,!1)),ul(e))}function mh(e,t,n){if((nt&6)!==0)throw Error(c(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||pn(e,t),i=l?db(e,t):zc(e,t,!0),s=l;do{if(i===0){fi&&!l&&la(e,t,0,!1);break}else{if(n=e.current.alternate,s&&!cb(n)){i=zc(e,t,!1),s=!1;continue}if(i===2){if(s=t,e.errorRecoveryDisabledLanes&s)var h=0;else h=e.pendingLanes&-536870913,h=h!==0?h:h&536870912?536870912:0;if(h!==0){t=h;e:{var g=e;i=ir;var x=g.current.memoizedState.isDehydrated;if(x&&(pi(g,h).flags|=256),h=zc(g,h,!1),h!==2){if(Ec&&!x){g.errorRecoveryDisabledLanes|=s,_a|=s,i=4;break e}s=Cn,Cn=i,s!==null&&(Cn===null?Cn=s:Cn.push.apply(Cn,s))}i=h}if(s=!1,i!==2)continue}}if(i===1){pi(e,0),la(e,t,0,!0);break}e:{switch(l=e,s=i,s){case 0:case 1:throw Error(c(345));case 4:if((t&4194048)!==t)break;case 6:la(l,t,Mn,!$l);break e;case 2:Cn=null;break;case 3:case 5:break;default:throw Error(c(329))}if((t&62914560)===t&&(i=Ss+300-ee(),10<i)){if(la(l,t,Mn,!$l),un(l,0,!0)!==0)break e;zl=t,l.timeoutHandle=Xh(ph.bind(null,l,n,Cn,Cs,Ac,t,Mn,_a,hi,$l,s,"Throttled",-0,0),i);break e}ph(l,n,Cn,Cs,Ac,t,Mn,_a,hi,$l,s,null,-0,0)}}break}while(!0);ul(e)}function ph(e,t,n,l,i,s,h,g,x,E,B,G,A,k){if(e.timeoutHandle=-1,G=t.subtreeFlags,G&8192||(G&16785408)===16785408){G={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Hn},sh(t,s,G);var oe=(s&62914560)===s?Ss-ee():(s&4194048)===s?dh-ee():0;if(oe=Zb(G,oe),oe!==null){zl=s,e.cancelPendingCommit=oe(Ch.bind(null,e,t,s,n,l,i,h,g,x,B,G,null,A,k)),la(e,s,h,!E);return}}Ch(e,t,s,n,l,i,h,g,x)}function cb(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 i=n[l],s=i.getSnapshot;i=i.value;try{if(!Nn(s(),i))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 la(e,t,n,l){t&=~Rc,t&=~_a,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var i=t;0<i;){var s=31-wt(i),h=1<<s;l[s]=-1,i&=~h}n!==0&&gl(e,n,t)}function Ts(){return(nt&6)===0?(sr(0),!1):!0}function _c(){if(Ve!==null){if(rt===0)var e=Ve.return;else e=Ve,wl=Ca=null,Qo(e),ii=null,qi=0,e=Ve;for(;e!==null;)Ff(e.alternate,e),e=e.return;Ve=null}}function pi(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,jb(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),zl=0,_c(),ht=e,Ve=n=xl(e.current,null),Fe=t,rt=0,jn=null,$l=!1,fi=pn(e,t),Ec=!1,hi=Mn=Rc=_a=ea=Et=0,Cn=ir=null,Ac=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var i=31-wt(l),s=1<<i;t|=e[i],l&=~s}return _l=t,Xr(),n}function gh(e,t){Oe=null,j.H=Wi,t===ai||t===$r?(t=kd(),rt=3):t===Lo?(t=kd(),rt=4):rt=t===uc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,jn=t,Ve===null&&(Et=1,hs(e,Kn(t,e.current)))}function bh(){var e=Rn.current;return e===null?!0:(Fe&4194048)===Fe?Xn===null:(Fe&62914560)===Fe||(Fe&536870912)!==0?e===Xn:!1}function yh(){var e=j.H;return j.H=Wi,e===null?Wi:e}function vh(){var e=j.A;return j.A=sb,e}function Ns(){Et=4,$l||(Fe&4194048)!==Fe&&Rn.current!==null||(fi=!0),(ea&134217727)===0&&(_a&134217727)===0||ht===null||la(ht,Fe,Mn,!1)}function zc(e,t,n){var l=nt;nt|=2;var i=yh(),s=vh();(ht!==e||Fe!==t)&&(Cs=null,pi(e,t)),t=!1;var h=Et;e:do try{if(rt!==0&&Ve!==null){var g=Ve,x=jn;switch(rt){case 8:_c(),h=6;break e;case 3:case 2:case 9:case 6:Rn.current===null&&(t=!0);var E=rt;if(rt=0,jn=null,gi(e,g,x,E),n&&fi){h=0;break e}break;default:E=rt,rt=0,jn=null,gi(e,g,x,E)}}ub(),h=Et;break}catch(B){gh(e,B)}while(!0);return t&&e.shellSuspendCounter++,wl=Ca=null,nt=l,j.H=i,j.A=s,Ve===null&&(ht=null,Fe=0,Xr()),h}function ub(){for(;Ve!==null;)xh(Ve)}function db(e,t){var n=nt;nt|=2;var l=yh(),i=vh();ht!==e||Fe!==t?(Cs=null,ws=ee()+500,pi(e,t)):fi=pn(e,t);e:do try{if(rt!==0&&Ve!==null){t=Ve;var s=jn;t:switch(rt){case 1:rt=0,jn=null,gi(e,t,s,1);break;case 2:case 9:if(jd(s)){rt=0,jn=null,Sh(t);break}t=function(){rt!==2&&rt!==9||ht!==e||(rt=7),ul(e)},s.then(t,t);break e;case 3:rt=7;break e;case 4:rt=5;break e;case 7:jd(s)?(rt=0,jn=null,Sh(t)):(rt=0,jn=null,gi(e,t,s,7));break;case 5:var h=null;switch(Ve.tag){case 26:h=Ve.memoizedState;case 5:case 27:var g=Ve;if(h?rm(h):g.stateNode.complete){rt=0,jn=null;var x=g.sibling;if(x!==null)Ve=x;else{var E=g.return;E!==null?(Ve=E,Es(E)):Ve=null}break t}}rt=0,jn=null,gi(e,t,s,5);break;case 6:rt=0,jn=null,gi(e,t,s,6);break;case 8:_c(),Et=6;break e;default:throw Error(c(462))}}fb();break}catch(B){gh(e,B)}while(!0);return wl=Ca=null,j.H=l,j.A=i,nt=n,Ve!==null?0:(ht=null,Fe=0,Xr(),Et)}function fb(){for(;Ve!==null&&!Ft();)xh(Ve)}function xh(e){var t=Vf(e.alternate,e,_l);e.memoizedProps=e.pendingProps,t===null?Es(e):Ve=t}function Sh(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Bf(n,t,t.pendingProps,t.type,void 0,Fe);break;case 11:t=Bf(n,t,t.pendingProps,t.type.render,t.ref,Fe);break;case 5:Qo(t);default:Ff(n,t),t=Ve=yd(t,_l),t=Vf(n,t,_l)}e.memoizedProps=e.pendingProps,t===null?Es(e):Ve=t}function gi(e,t,n,l){wl=Ca=null,Qo(t),ii=null,qi=0;var i=t.return;try{if(eb(e,i,t,n,Fe)){Et=1,hs(e,Kn(n,e.current)),Ve=null;return}}catch(s){if(i!==null)throw Ve=i,s;Et=1,hs(e,Kn(n,e.current)),Ve=null;return}t.flags&32768?(Je||l===1?e=!0:fi||(Fe&536870912)!==0?e=!1:($l=e=!0,(l===2||l===9||l===3||l===6)&&(l=Rn.current,l!==null&&l.tag===13&&(l.flags|=16384))),wh(t,e)):Es(t)}function Es(e){var t=e;do{if((t.flags&32768)!==0){wh(t,$l);return}e=t.return;var n=lb(t.alternate,t,_l);if(n!==null){Ve=n;return}if(t=t.sibling,t!==null){Ve=t;return}Ve=t=e}while(t!==null);Et===0&&(Et=5)}function wh(e,t){do{var n=ab(e.alternate,e);if(n!==null){n.flags&=32767,Ve=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ve=e;return}Ve=e=n}while(e!==null);Et=6,Ve=null}function Ch(e,t,n,l,i,s,h,g,x){e.cancelPendingCommit=null;do Rs();while(Vt!==0);if((nt&6)!==0)throw Error(c(327));if(t!==null){if(t===e.current)throw Error(c(177));if(s=t.lanes|t.childLanes,s|=So,Bl(e,n,s,h,g,x),e===ht&&(Ve=ht=null,Fe=0),mi=t,na=e,zl=n,jc=s,Mc=i,fh=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,gb(et,function(){return Ah(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=j.T,j.T=null,i=q.p,q.p=2,h=nt,nt|=4;try{ib(e,t,n)}finally{nt=h,q.p=i,j.T=l}}Vt=1,Th(),Nh(),Eh()}}function Th(){if(Vt===1){Vt=0;var e=na,t=mi,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=j.T,j.T=null;var l=q.p;q.p=2;var i=nt;nt|=4;try{ah(t,e);var s=Xc,h=cd(e.containerInfo),g=s.focusedElem,x=s.selectionRange;if(h!==g&&g&&g.ownerDocument&&od(g.ownerDocument.documentElement,g)){if(x!==null&&go(g)){var E=x.start,B=x.end;if(B===void 0&&(B=E),"selectionStart"in g)g.selectionStart=E,g.selectionEnd=Math.min(B,g.value.length);else{var G=g.ownerDocument||document,A=G&&G.defaultView||window;if(A.getSelection){var k=A.getSelection(),oe=g.textContent.length,Te=Math.min(x.start,oe),dt=x.end===void 0?Te:Math.min(x.end,oe);!k.extend&&Te>dt&&(h=dt,dt=Te,Te=h);var T=sd(g,Te),w=sd(g,dt);if(T&&w&&(k.rangeCount!==1||k.anchorNode!==T.node||k.anchorOffset!==T.offset||k.focusNode!==w.node||k.focusOffset!==w.offset)){var N=G.createRange();N.setStart(T.node,T.offset),k.removeAllRanges(),Te>dt?(k.addRange(N),k.extend(w.node,w.offset)):(N.setEnd(w.node,w.offset),k.addRange(N))}}}}for(G=[],k=g;k=k.parentNode;)k.nodeType===1&&G.push({element:k,left:k.scrollLeft,top:k.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<G.length;g++){var K=G[g];K.element.scrollLeft=K.left,K.element.scrollTop=K.top}}Hs=!!Vc,Xc=Vc=null}finally{nt=i,q.p=l,j.T=n}}e.current=t,Vt=2}}function Nh(){if(Vt===2){Vt=0;var e=na,t=mi,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=j.T,j.T=null;var l=q.p;q.p=2;var i=nt;nt|=4;try{$f(e,t.alternate,t)}finally{nt=i,q.p=l,j.T=n}}Vt=3}}function Eh(){if(Vt===4||Vt===3){Vt=0,Yt();var e=na,t=mi,n=zl,l=fh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Vt=5:(Vt=0,mi=na=null,Rh(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(ta=null),Y(n),t=t.stateNode,at&&typeof at.onCommitFiberRoot=="function")try{at.onCommitFiberRoot(ln,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=j.T,i=q.p,q.p=2,j.T=null;try{for(var s=e.onRecoverableError,h=0;h<l.length;h++){var g=l[h];s(g.value,{componentStack:g.stack})}}finally{j.T=t,q.p=i}}(zl&3)!==0&&Rs(),ul(e),i=e.pendingLanes,(n&261930)!==0&&(i&42)!==0?e===kc?rr++:(rr=0,kc=e):rr=0,sr(0)}}function Rh(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ki(t)))}function Rs(){return Th(),Nh(),Eh(),Ah()}function Ah(){if(Vt!==5)return!1;var e=na,t=jc;jc=0;var n=Y(zl),l=j.T,i=q.p;try{q.p=32>n?32:n,j.T=null,n=Mc,Mc=null;var s=na,h=zl;if(Vt=0,mi=na=null,zl=0,(nt&6)!==0)throw Error(c(331));var g=nt;if(nt|=4,ch(s.current),rh(s,s.current,h,n),nt=g,sr(0,!1),at&&typeof at.onPostCommitFiberRoot=="function")try{at.onPostCommitFiberRoot(ln,s)}catch{}return!0}finally{q.p=i,j.T=l,Rh(e,t)}}function jh(e,t,n){t=Kn(n,t),t=cc(e.stateNode,t,2),e=Il(e,t,2),e!==null&&(al(e,2),ul(e))}function st(e,t,n){if(e.tag===3)jh(e,e,n);else for(;t!==null;){if(t.tag===3){jh(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ta===null||!ta.has(l))){e=Kn(n,e),n=Mf(2),l=Il(t,n,2),l!==null&&(kf(n,l,t,e),al(l,2),ul(l));break}}t=t.return}}function Dc(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new ob;var i=new Set;l.set(t,i)}else i=l.get(t),i===void 0&&(i=new Set,l.set(t,i));i.has(n)||(Ec=!0,i.add(n),e=hb.bind(null,e,t,n),t.then(e,e))}function hb(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ht===e&&(Fe&n)===n&&(Et===4||Et===3&&(Fe&62914560)===Fe&&300>ee()-Ss?(nt&2)===0&&pi(e,0):Rc|=n,hi===Fe&&(hi=0)),ul(e)}function Mh(e,t){t===0&&(t=Ya()),e=xa(e,t),e!==null&&(al(e,t),ul(e))}function mb(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Mh(e,n)}function pb(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(c(314))}l!==null&&l.delete(t),Mh(e,n)}function gb(e,t){return Ht(e,t)}var As=null,bi=null,Oc=!1,js=!1,Lc=!1,aa=0;function ul(e){e!==bi&&e.next===null&&(bi===null?As=bi=e:bi=bi.next=e),js=!0,Oc||(Oc=!0,yb())}function sr(e,t){if(!Lc&&js){Lc=!0;do for(var n=!1,l=As;l!==null;){if(e!==0){var i=l.pendingLanes;if(i===0)var s=0;else{var h=l.suspendedLanes,g=l.pingedLanes;s=(1<<31-wt(42|e)+1)-1,s&=i&~(h&~g),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,Dh(l,s))}else s=Fe,s=un(l,l===ht?s:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(s&3)===0||pn(l,s)||(n=!0,Dh(l,s));l=l.next}while(n);Lc=!1}}function bb(){kh()}function kh(){js=Oc=!1;var e=0;aa!==0&&Ab()&&(e=aa);for(var t=ee(),n=null,l=As;l!==null;){var i=l.next,s=_h(l,t);s===0?(l.next=null,n===null?As=i:n.next=i,i===null&&(bi=n)):(n=l,(e!==0||(s&3)!==0)&&(js=!0)),l=i}Vt!==0&&Vt!==5||sr(e),aa!==0&&(aa=0)}function _h(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes&-62914561;0<s;){var h=31-wt(s),g=1<<h,x=i[h];x===-1?((g&n)===0||(g&l)!==0)&&(i[h]=pl(g,t)):x<=t&&(e.expiredLanes|=g),s&=~g}if(t=ht,n=Fe,n=un(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(rt===2||rt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Qe(l),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||pn(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&Qe(l),Y(n)){case 2:case 8:n=We;break;case 32:n=et;break;case 268435456:n=pt;break;default:n=et}return l=zh.bind(null,e),n=Ht(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&Qe(l),e.callbackPriority=2,e.callbackNode=null,2}function zh(e,t){if(Vt!==0&&Vt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Rs()&&e.callbackNode!==n)return null;var l=Fe;return l=un(e,e===ht?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(mh(e,l,t),_h(e,ee()),e.callbackNode!=null&&e.callbackNode===n?zh.bind(null,e):null)}function Dh(e,t){if(Rs())return null;mh(e,t,!0)}function yb(){Mb(function(){(nt&6)!==0?Ht(Ke,bb):kh()})}function Uc(){if(aa===0){var e=ni;e===0&&(e=Ln,Ln<<=1,(Ln&261888)===0&&(Ln=256)),aa=e}return aa}function Oh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:pa(""+e)}function Lh(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 vb(e,t,n,l,i){if(t==="submit"&&n&&n.stateNode===i){var s=Oh((i[ke]||null).action),h=l.submitter;h&&(t=(t=h[ke]||null)?Oh(t.formAction):h.getAttribute("formAction"),t!==null&&(s=t,h=null));var g=new Kr("action","action",null,l,i);e.push({event:g,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(aa!==0){var x=h?Lh(i,h):new FormData(i);lc(n,{pending:!0,data:x,method:i.method,action:s},null,x)}}else typeof s=="function"&&(g.preventDefault(),x=h?Lh(i,h):new FormData(i),lc(n,{pending:!0,data:x,method:i.method,action:s},s,x))},currentTarget:i}]})}}for(var Bc=0;Bc<xo.length;Bc++){var Hc=xo[Bc],xb=Hc.toLowerCase(),Sb=Hc[0].toUpperCase()+Hc.slice(1);$n(xb,"on"+Sb)}$n(fd,"onAnimationEnd"),$n(hd,"onAnimationIteration"),$n(md,"onAnimationStart"),$n("dblclick","onDoubleClick"),$n("focusin","onFocus"),$n("focusout","onBlur"),$n(Ug,"onTransitionRun"),$n(Bg,"onTransitionStart"),$n(Hg,"onTransitionCancel"),$n(pd,"onTransitionEnd"),ne("onMouseEnter",["mouseout","mouseover"]),ne("onMouseLeave",["mouseout","mouseover"]),ne("onPointerEnter",["pointerout","pointerover"]),ne("onPointerLeave",["pointerout","pointerover"]),Ie("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ie("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ie("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ie("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ie("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ie("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var or="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(" "),wb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(or));function Uh(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],i=l.event;l=l.listeners;e:{var s=void 0;if(t)for(var h=l.length-1;0<=h;h--){var g=l[h],x=g.instance,E=g.currentTarget;if(g=g.listener,x!==s&&i.isPropagationStopped())break e;s=g,i.currentTarget=E;try{s(i)}catch(B){Vr(B)}i.currentTarget=null,s=x}else for(h=0;h<l.length;h++){if(g=l[h],x=g.instance,E=g.currentTarget,g=g.listener,x!==s&&i.isPropagationStopped())break e;s=g,i.currentTarget=E;try{s(i)}catch(B){Vr(B)}i.currentTarget=null,s=x}}}}function Xe(e,t){var n=t[bt];n===void 0&&(n=t[bt]=new Set);var l=e+"__bubble";n.has(l)||(Bh(t,e,2,!1),n.add(l))}function Yc(e,t,n){var l=0;t&&(l|=4),Bh(n,e,l,t)}var Ms="_reactListening"+Math.random().toString(36).slice(2);function Kc(e){if(!e[Ms]){e[Ms]=!0,ue.forEach(function(n){n!=="selectionchange"&&(wb.has(n)||Yc(n,!1,e),Yc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ms]||(t[Ms]=!0,Yc("selectionchange",!1,t))}}function Bh(e,t,n,l){switch(hm(t)){case 2:var i=Jb;break;case 8:i=Wb;break;default:i=nu}n=i.bind(null,t,n,e),i=void 0,!Pt||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),l?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Gc(e,t,n,l,i){var s=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var h=l.tag;if(h===3||h===4){var g=l.stateNode.containerInfo;if(g===i)break;if(h===4)for(h=l.return;h!==null;){var x=h.tag;if((x===3||x===4)&&h.stateNode.containerInfo===i)return;h=h.return}for(;g!==null;){if(h=yl(g),h===null)return;if(x=h.tag,x===5||x===6||x===26||x===27){l=s=h;continue e}g=g.parentNode}}l=l.return}me(function(){var E=s,B=le(n),G=[];e:{var A=gd.get(e);if(A!==void 0){var k=Kr,oe=e;switch(e){case"keypress":if(Hr(n)===0)break e;case"keydown":case"keyup":k=pg;break;case"focusin":oe="focus",k=uo;break;case"focusout":oe="blur",k=uo;break;case"beforeblur":case"afterblur":k=uo;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=Xu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":k=lg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":k=yg;break;case fd:case hd:case md:k=rg;break;case pd:k=xg;break;case"scroll":case"scrollend":k=tg;break;case"wheel":k=wg;break;case"copy":case"cut":case"paste":k=og;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":k=Zu;break;case"toggle":case"beforetoggle":k=Tg}var Te=(t&4)!==0,dt=!Te&&(e==="scroll"||e==="scrollend"),T=Te?A!==null?A+"Capture":null:A;Te=[];for(var w=E,N;w!==null;){var K=w;if(N=K.stateNode,K=K.tag,K!==5&&K!==26&&K!==27||N===null||T===null||(K=ot(w,T),K!=null&&Te.push(cr(w,K,N))),dt)break;w=w.return}0<Te.length&&(A=new k(A,oe,null,n,B),G.push({event:A,listeners:Te}))}}if((t&7)===0){e:{if(A=e==="mouseover"||e==="pointerover",k=e==="mouseout"||e==="pointerout",A&&n!==I&&(oe=n.relatedTarget||n.fromElement)&&(yl(oe)||oe[Tt]))break e;if((k||A)&&(A=B.window===B?B:(A=B.ownerDocument)?A.defaultView||A.parentWindow:window,k?(oe=n.relatedTarget||n.toElement,k=E,oe=oe?yl(oe):null,oe!==null&&(dt=f(oe),Te=oe.tag,oe!==dt||Te!==5&&Te!==27&&Te!==6)&&(oe=null)):(k=null,oe=E),k!==oe)){if(Te=Xu,K="onMouseLeave",T="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(Te=Zu,K="onPointerLeave",T="onPointerEnter",w="pointer"),dt=k==null?A:Hl(k),N=oe==null?A:Hl(oe),A=new Te(K,w+"leave",k,n,B),A.target=dt,A.relatedTarget=N,K=null,yl(B)===E&&(Te=new Te(T,w+"enter",oe,n,B),Te.target=N,Te.relatedTarget=dt,K=Te),dt=K,k&&oe)t:{for(Te=Cb,T=k,w=oe,N=0,K=T;K;K=Te(K))N++;K=0;for(var be=w;be;be=Te(be))K++;for(;0<N-K;)T=Te(T),N--;for(;0<K-N;)w=Te(w),K--;for(;N--;){if(T===w||w!==null&&T===w.alternate){Te=T;break t}T=Te(T),w=Te(w)}Te=null}else Te=null;k!==null&&Hh(G,A,k,Te,!1),oe!==null&&dt!==null&&Hh(G,dt,oe,Te,!0)}}e:{if(A=E?Hl(E):window,k=A.nodeName&&A.nodeName.toLowerCase(),k==="select"||k==="input"&&A.type==="file")var Pe=td;else if($u(A))if(nd)Pe=Dg;else{Pe=_g;var ce=kg}else k=A.nodeName,!k||k.toLowerCase()!=="input"||A.type!=="checkbox"&&A.type!=="radio"?E&&Kl(E.elementType)&&(Pe=td):Pe=zg;if(Pe&&(Pe=Pe(e,E))){ed(G,Pe,n,B);break e}ce&&ce(e,A,E),e==="focusout"&&E&&A.type==="number"&&E.memoizedProps.value!=null&&Va(A,"number",A.value)}switch(ce=E?Hl(E):window,e){case"focusin":($u(ce)||ce.contentEditable==="true")&&(Qa=ce,bo=E,Bi=null);break;case"focusout":Bi=bo=Qa=null;break;case"mousedown":yo=!0;break;case"contextmenu":case"mouseup":case"dragend":yo=!1,ud(G,n,B);break;case"selectionchange":if(Lg)break;case"keydown":case"keyup":ud(G,n,B)}var Be;if(ho)e:{switch(e){case"compositionstart":var Ze="onCompositionStart";break e;case"compositionend":Ze="onCompositionEnd";break e;case"compositionupdate":Ze="onCompositionUpdate";break e}Ze=void 0}else Za?Wu(e,n)&&(Ze="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ze="onCompositionStart");Ze&&(Qu&&n.locale!=="ko"&&(Za||Ze!=="onCompositionStart"?Ze==="onCompositionEnd"&&Za&&(Be=qu()):(qt=B,Gl="value"in qt?qt.value:qt.textContent,Za=!0)),ce=ks(E,Ze),0<ce.length&&(Ze=new Fu(Ze,e,null,n,B),G.push({event:Ze,listeners:ce}),Be?Ze.data=Be:(Be=Pu(n),Be!==null&&(Ze.data=Be)))),(Be=Eg?Rg(e,n):Ag(e,n))&&(Ze=ks(E,"onBeforeInput"),0<Ze.length&&(ce=new Fu("onBeforeInput","beforeinput",null,n,B),G.push({event:ce,listeners:Ze}),ce.data=Be)),vb(G,e,E,n,B)}Uh(G,t)})}function cr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ks(e,t){for(var n=t+"Capture",l=[];e!==null;){var i=e,s=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||s===null||(i=ot(e,n),i!=null&&l.unshift(cr(e,i,s)),i=ot(e,t),i!=null&&l.push(cr(e,i,s))),e.tag===3)return l;e=e.return}return[]}function Cb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Hh(e,t,n,l,i){for(var s=t._reactName,h=[];n!==null&&n!==l;){var g=n,x=g.alternate,E=g.stateNode;if(g=g.tag,x!==null&&x===l)break;g!==5&&g!==26&&g!==27||E===null||(x=E,i?(E=ot(n,s),E!=null&&h.unshift(cr(n,E,x))):i||(E=ot(n,s),E!=null&&h.push(cr(n,E,x)))),n=n.return}h.length!==0&&e.push({event:t,listeners:h})}var Tb=/\r\n?/g,Nb=/\u0000|\uFFFD/g;function Yh(e){return(typeof e=="string"?e:""+e).replace(Tb,`
33
+ `).replace(Nb,"")}function Kh(e,t){return t=Yh(t),Yh(e)===t}function ut(e,t,n,l,i,s){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||Bn(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&Bn(e,""+l);break;case"className":Wn(e,"class",l);break;case"tabIndex":Wn(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Wn(e,n,l);break;case"style":ki(e,l,s);break;case"data":if(t!=="object"){Wn(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=pa(""+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 s=="function"&&(n==="formAction"?(t!=="input"&&ut(e,t,"name",i.name,i,null),ut(e,t,"formEncType",i.formEncType,i,null),ut(e,t,"formMethod",i.formMethod,i,null),ut(e,t,"formTarget",i.formTarget,i,null)):(ut(e,t,"encType",i.encType,i,null),ut(e,t,"method",i.method,i,null),ut(e,t,"target",i.target,i,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=pa(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=Hn);break;case"onScroll":l!=null&&Xe("scroll",e);break;case"onScrollEnd":l!=null&&Xe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(c(61));if(n=l.__html,n!=null){if(i.children!=null)throw Error(c(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=pa(""+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":Xe("beforetoggle",e),Xe("toggle",e),rn(e,"popover",l);break;case"xlinkActuate":dn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":dn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":dn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":dn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":dn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":dn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":dn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":dn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":dn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":rn(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=Xa.get(n)||n,rn(e,n,l))}}function qc(e,t,n,l,i,s){switch(n){case"style":ki(e,l,s);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(c(61));if(n=l.__html,n!=null){if(i.children!=null)throw Error(c(60));e.innerHTML=n}}break;case"children":typeof l=="string"?Bn(e,l):(typeof l=="number"||typeof l=="bigint")&&Bn(e,""+l);break;case"onScroll":l!=null&&Xe("scroll",e);break;case"onScrollEnd":l!=null&&Xe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Hn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ge.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(i=n.endsWith("Capture"),t=n.slice(2,i?n.length-7:void 0),s=e[ke]||null,s=s!=null?s[n]:null,typeof s=="function"&&e.removeEventListener(t,s,i),typeof l=="function")){typeof s!="function"&&s!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,i);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):rn(e,n,l)}}}function nn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Xe("error",e),Xe("load",e);var l=!1,i=!1,s;for(s in n)if(n.hasOwnProperty(s)){var h=n[s];if(h!=null)switch(s){case"src":l=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:ut(e,t,s,h,n,null)}}i&&ut(e,t,"srcSet",n.srcSet,n,null),l&&ut(e,t,"src",n.src,n,null);return;case"input":Xe("invalid",e);var g=s=h=i=null,x=null,E=null;for(l in n)if(n.hasOwnProperty(l)){var B=n[l];if(B!=null)switch(l){case"name":i=B;break;case"type":h=B;break;case"checked":x=B;break;case"defaultChecked":E=B;break;case"value":s=B;break;case"defaultValue":g=B;break;case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(c(137,t));break;default:ut(e,t,l,B,n,null)}}Lr(e,s,g,x,E,h,i,!1);return;case"select":Xe("invalid",e),l=h=s=null;for(i in n)if(n.hasOwnProperty(i)&&(g=n[i],g!=null))switch(i){case"value":s=g;break;case"defaultValue":h=g;break;case"multiple":l=g;default:ut(e,t,i,g,n,null)}t=s,n=h,e.multiple=!!l,t!=null?Gt(e,!!l,t,!1):n!=null&&Gt(e,!!l,n,!0);return;case"textarea":Xe("invalid",e),s=i=l=null;for(h in n)if(n.hasOwnProperty(h)&&(g=n[h],g!=null))switch(h){case"value":l=g;break;case"defaultValue":i=g;break;case"children":s=g;break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(c(91));break;default:ut(e,t,h,g,n,null)}Br(e,l,i,s);return;case"option":for(x in n)if(n.hasOwnProperty(x)&&(l=n[x],l!=null))switch(x){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ut(e,t,x,l,n,null)}return;case"dialog":Xe("beforetoggle",e),Xe("toggle",e),Xe("cancel",e),Xe("close",e);break;case"iframe":case"object":Xe("load",e);break;case"video":case"audio":for(l=0;l<or.length;l++)Xe(or[l],e);break;case"image":Xe("error",e),Xe("load",e);break;case"details":Xe("toggle",e);break;case"embed":case"source":case"link":Xe("error",e),Xe("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(E in n)if(n.hasOwnProperty(E)&&(l=n[E],l!=null))switch(E){case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:ut(e,t,E,l,n,null)}return;default:if(Kl(t)){for(B in n)n.hasOwnProperty(B)&&(l=n[B],l!==void 0&&qc(e,t,B,l,n,void 0));return}}for(g in n)n.hasOwnProperty(g)&&(l=n[g],l!=null&&ut(e,t,g,l,n,null))}function Eb(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 i=null,s=null,h=null,g=null,x=null,E=null,B=null;for(k in n){var G=n[k];if(n.hasOwnProperty(k)&&G!=null)switch(k){case"checked":break;case"value":break;case"defaultValue":x=G;default:l.hasOwnProperty(k)||ut(e,t,k,null,l,G)}}for(var A in l){var k=l[A];if(G=n[A],l.hasOwnProperty(A)&&(k!=null||G!=null))switch(A){case"type":s=k;break;case"name":i=k;break;case"checked":E=k;break;case"defaultChecked":B=k;break;case"value":h=k;break;case"defaultValue":g=k;break;case"children":case"dangerouslySetInnerHTML":if(k!=null)throw Error(c(137,t));break;default:k!==G&&ut(e,t,A,k,l,G)}}ji(e,h,g,x,E,B,s,i);return;case"select":k=h=g=A=null;for(s in n)if(x=n[s],n.hasOwnProperty(s)&&x!=null)switch(s){case"value":break;case"multiple":k=x;default:l.hasOwnProperty(s)||ut(e,t,s,null,l,x)}for(i in l)if(s=l[i],x=n[i],l.hasOwnProperty(i)&&(s!=null||x!=null))switch(i){case"value":A=s;break;case"defaultValue":g=s;break;case"multiple":h=s;default:s!==x&&ut(e,t,i,s,l,x)}t=g,n=h,l=k,A!=null?Gt(e,!!n,A,!1):!!l!=!!n&&(t!=null?Gt(e,!!n,t,!0):Gt(e,!!n,n?[]:"",!1));return;case"textarea":k=A=null;for(g in n)if(i=n[g],n.hasOwnProperty(g)&&i!=null&&!l.hasOwnProperty(g))switch(g){case"value":break;case"children":break;default:ut(e,t,g,null,l,i)}for(h in l)if(i=l[h],s=n[h],l.hasOwnProperty(h)&&(i!=null||s!=null))switch(h){case"value":A=i;break;case"defaultValue":k=i;break;case"children":break;case"dangerouslySetInnerHTML":if(i!=null)throw Error(c(91));break;default:i!==s&&ut(e,t,h,i,l,s)}Ur(e,A,k);return;case"option":for(var oe in n)if(A=n[oe],n.hasOwnProperty(oe)&&A!=null&&!l.hasOwnProperty(oe))switch(oe){case"selected":e.selected=!1;break;default:ut(e,t,oe,null,l,A)}for(x in l)if(A=l[x],k=n[x],l.hasOwnProperty(x)&&A!==k&&(A!=null||k!=null))switch(x){case"selected":e.selected=A&&typeof A!="function"&&typeof A!="symbol";break;default:ut(e,t,x,A,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 Te in n)A=n[Te],n.hasOwnProperty(Te)&&A!=null&&!l.hasOwnProperty(Te)&&ut(e,t,Te,null,l,A);for(E in l)if(A=l[E],k=n[E],l.hasOwnProperty(E)&&A!==k&&(A!=null||k!=null))switch(E){case"children":case"dangerouslySetInnerHTML":if(A!=null)throw Error(c(137,t));break;default:ut(e,t,E,A,l,k)}return;default:if(Kl(t)){for(var dt in n)A=n[dt],n.hasOwnProperty(dt)&&A!==void 0&&!l.hasOwnProperty(dt)&&qc(e,t,dt,void 0,l,A);for(B in l)A=l[B],k=n[B],!l.hasOwnProperty(B)||A===k||A===void 0&&k===void 0||qc(e,t,B,A,l,k);return}}for(var T in n)A=n[T],n.hasOwnProperty(T)&&A!=null&&!l.hasOwnProperty(T)&&ut(e,t,T,null,l,A);for(G in l)A=l[G],k=n[G],!l.hasOwnProperty(G)||A===k||A==null&&k==null||ut(e,t,G,A,l,k)}function Gh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Rb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var i=n[l],s=i.transferSize,h=i.initiatorType,g=i.duration;if(s&&g&&Gh(h)){for(h=0,g=i.responseEnd,l+=1;l<n.length;l++){var x=n[l],E=x.startTime;if(E>g)break;var B=x.transferSize,G=x.initiatorType;B&&Gh(G)&&(x=x.responseEnd,h+=B*(x<g?1:(g-E)/(x-E)))}if(--l,t+=8*(s+h)/(i.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 Vc=null,Xc=null;function _s(e){return e.nodeType===9?e:e.ownerDocument}function qh(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 Vh(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 Fc(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 Zc=null;function Ab(){var e=window.event;return e&&e.type==="popstate"?e===Zc?!1:(Zc=e,!0):(Zc=null,!1)}var Xh=typeof setTimeout=="function"?setTimeout:void 0,jb=typeof clearTimeout=="function"?clearTimeout:void 0,Fh=typeof Promise=="function"?Promise:void 0,Mb=typeof queueMicrotask=="function"?queueMicrotask:typeof Fh<"u"?function(e){return Fh.resolve(null).then(e).catch(kb)}:Xh;function kb(e){setTimeout(function(){throw e})}function ia(e){return e==="head"}function Zh(e,t){var n=t,l=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(i),Si(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")ur(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,ur(n);for(var s=n.firstChild;s;){var h=s.nextSibling,g=s.nodeName;s[rl]||g==="SCRIPT"||g==="STYLE"||g==="LINK"&&s.rel.toLowerCase()==="stylesheet"||n.removeChild(s),s=h}}else n==="body"&&ur(e.ownerDocument.body);n=i}while(n);Si(t)}function Qh(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 Qc(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":Qc(n),Ga(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function _b(e,t,n,l){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[rl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(s=e.getAttribute("rel"),s==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(s!==i.rel||e.getAttribute("href")!==(i.href==null||i.href===""?null:i.href)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute("title")!==(i.title==null?null:i.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(s=e.getAttribute("src"),(s!==(i.src==null?null:i.src)||e.getAttribute("type")!==(i.type==null?null:i.type)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin))&&s&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var s=i.name==null?null:""+i.name;if(i.type==="hidden"&&e.getAttribute("name")===s)return e}else return e;if(e=Fn(e.nextSibling),e===null)break}return null}function zb(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Fn(e.nextSibling),e===null))return null;return e}function Ih(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Fn(e.nextSibling),e===null))return null;return e}function Ic(e){return e.data==="$?"||e.data==="$~"}function Jc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Db(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 Fn(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 Wc=null;function Jh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Fn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Wh(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 Ph(e,t,n){switch(t=_s(n),e){case"html":if(e=t.documentElement,!e)throw Error(c(452));return e;case"head":if(e=t.head,!e)throw Error(c(453));return e;case"body":if(e=t.body,!e)throw Error(c(454));return e;default:throw Error(c(451))}}function ur(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ga(e)}var Zn=new Map,$h=new Set;function zs(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Dl=q.d;q.d={f:Ob,r:Lb,D:Ub,C:Bb,L:Hb,m:Yb,X:Gb,S:Kb,M:qb};function Ob(){var e=Dl.f(),t=Ts();return e||t}function Lb(e){var t=vl(e);t!==null&&t.tag===5&&t.type==="form"?gf(t):Dl.r(e)}var yi=typeof document>"u"?null:document;function em(e,t,n){var l=yi;if(l&&typeof t=="string"&&t){var i=bn(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),$h.has(i)||($h.add(i),e={rel:e,crossOrigin:n,href:t},l.querySelector(i)===null&&(t=l.createElement("link"),nn(t,"link",e),Q(t),l.head.appendChild(t)))}}function Ub(e){Dl.D(e),em("dns-prefetch",e,null)}function Bb(e,t){Dl.C(e,t),em("preconnect",e,t)}function Hb(e,t,n){Dl.L(e,t,n);var l=yi;if(l&&e&&t){var i='link[rel="preload"][as="'+bn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+bn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+bn(n.imageSizes)+'"]')):i+='[href="'+bn(e)+'"]';var s=i;switch(t){case"style":s=vi(e);break;case"script":s=xi(e)}Zn.has(s)||(e=C({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Zn.set(s,e),l.querySelector(i)!==null||t==="style"&&l.querySelector(dr(s))||t==="script"&&l.querySelector(fr(s))||(t=l.createElement("link"),nn(t,"link",e),Q(t),l.head.appendChild(t)))}}function Yb(e,t){Dl.m(e,t);var n=yi;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+bn(l)+'"][href="'+bn(e)+'"]',s=i;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=xi(e)}if(!Zn.has(s)&&(e=C({rel:"modulepreload",href:e},t),Zn.set(s,e),n.querySelector(i)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(fr(s)))return}l=n.createElement("link"),nn(l,"link",e),Q(l),n.head.appendChild(l)}}}function Kb(e,t,n){Dl.S(e,t,n);var l=yi;if(l&&e){var i=V(l).hoistableStyles,s=vi(e);t=t||"default";var h=i.get(s);if(!h){var g={loading:0,preload:null};if(h=l.querySelector(dr(s)))g.loading=5;else{e=C({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Zn.get(s))&&Pc(e,n);var x=h=l.createElement("link");Q(x),nn(x,"link",e),x._p=new Promise(function(E,B){x.onload=E,x.onerror=B}),x.addEventListener("load",function(){g.loading|=1}),x.addEventListener("error",function(){g.loading|=2}),g.loading|=4,Ds(h,t,l)}h={type:"stylesheet",instance:h,count:1,state:g},i.set(s,h)}}}function Gb(e,t){Dl.X(e,t);var n=yi;if(n&&e){var l=V(n).hoistableScripts,i=xi(e),s=l.get(i);s||(s=n.querySelector(fr(i)),s||(e=C({src:e,async:!0},t),(t=Zn.get(i))&&$c(e,t),s=n.createElement("script"),Q(s),nn(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(i,s))}}function qb(e,t){Dl.M(e,t);var n=yi;if(n&&e){var l=V(n).hoistableScripts,i=xi(e),s=l.get(i);s||(s=n.querySelector(fr(i)),s||(e=C({src:e,async:!0,type:"module"},t),(t=Zn.get(i))&&$c(e,t),s=n.createElement("script"),Q(s),nn(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(i,s))}}function tm(e,t,n,l){var i=(i=he.current)?zs(i):null;if(!i)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=vi(n.href),n=V(i).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=vi(n.href);var s=V(i).hoistableStyles,h=s.get(e);if(h||(i=i.ownerDocument||i,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,h),(s=i.querySelector(dr(e)))&&!s._p&&(h.instance=s,h.state.loading=5),Zn.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},Zn.set(e,n),s||Vb(i,e,n,h.state))),t&&l===null)throw Error(c(528,""));return h}if(t&&l!==null)throw Error(c(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=xi(n),n=V(i).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(c(444,e))}}function vi(e){return'href="'+bn(e)+'"'}function dr(e){return'link[rel="stylesheet"]['+e+"]"}function nm(e){return C({},e,{"data-precedence":e.precedence,precedence:null})}function Vb(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}),nn(t,"link",n),Q(t),e.head.appendChild(t))}function xi(e){return'[src="'+bn(e)+'"]'}function fr(e){return"script[async]"+e}function lm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+bn(n.href)+'"]');if(l)return t.instance=l,Q(l),l;var i=C({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Q(l),nn(l,"style",i),Ds(l,n.precedence,e),t.instance=l;case"stylesheet":i=vi(n.href);var s=e.querySelector(dr(i));if(s)return t.state.loading|=4,t.instance=s,Q(s),s;l=nm(n),(i=Zn.get(i))&&Pc(l,i),s=(e.ownerDocument||e).createElement("link"),Q(s);var h=s;return h._p=new Promise(function(g,x){h.onload=g,h.onerror=x}),nn(s,"link",l),t.state.loading|=4,Ds(s,n.precedence,e),t.instance=s;case"script":return s=xi(n.src),(i=e.querySelector(fr(s)))?(t.instance=i,Q(i),i):(l=n,(i=Zn.get(s))&&(l=C({},n),$c(l,i)),e=e.ownerDocument||e,i=e.createElement("script"),Q(i),nn(i,"link",l),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Ds(l,n.precedence,e));return t.instance}function Ds(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=l.length?l[l.length-1]:null,s=i,h=0;h<l.length;h++){var g=l[h];if(g.dataset.precedence===t)s=g;else if(s!==i)break}s?s.parentNode.insertBefore(e,s.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Pc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function $c(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Os=null;function am(e,t,n){if(Os===null){var l=new Map,i=Os=new Map;i.set(n,l)}else i=Os,l=i.get(n),l||(l=new Map,i.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var s=n[i];if(!(s[rl]||s[fe]||e==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var h=s.getAttribute(t)||"";h=e+h;var g=l.get(h);g?g.push(s):l.set(h,[s])}}return l}function im(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Xb(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 rm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Fb(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 i=vi(l.href),s=t.querySelector(dr(i));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ls.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,Q(s);return}s=t.ownerDocument||t,l=nm(l),(i=Zn.get(i))&&Pc(l,i),s=s.createElement("link"),Q(s);var h=s;h._p=new Promise(function(g,x){h.onload=g,h.onerror=x}),nn(s,"link",l),n.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Ls.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var eu=0;function Zb(e,t){return e.stylesheets&&e.count===0&&Bs(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&Bs(e,e.stylesheets),e.unsuspend){var s=e.unsuspend;e.unsuspend=null,s()}},6e4+t);0<e.imgBytes&&eu===0&&(eu=62500*Rb());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Bs(e,e.stylesheets),e.unsuspend)){var s=e.unsuspend;e.unsuspend=null,s()}},(e.imgBytes>eu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(i)}}:null}function Ls(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bs(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Us=null;function Bs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Us=new Map,t.forEach(Qb,e),Us=null,Ls.call(e))}function Qb(e,t){if(!(t.state.loading&4)){var n=Us.get(e);if(n)var l=n.get(null);else{n=new Map,Us.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<i.length;s++){var h=i[s];(h.nodeName==="LINK"||h.getAttribute("media")!=="not all")&&(n.set(h.dataset.precedence,h),l=h)}l&&n.set(null,l)}i=t.instance,h=i.getAttribute("data-precedence"),s=n.get(h)||l,s===l&&n.set(null,i),n.set(h,i),this.count++,l=Ls.bind(this),i.addEventListener("load",l),i.addEventListener("error",l),s?s.parentNode.insertBefore(i,s.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var hr={$$typeof:J,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function Ib(e,t,n,l,i,s,h,g,x){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=Ul(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ul(0),this.hiddenUpdates=Ul(null),this.identifierPrefix=l,this.onUncaughtError=i,this.onCaughtError=s,this.onRecoverableError=h,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=x,this.incompleteTransitions=new Map}function sm(e,t,n,l,i,s,h,g,x,E,B,G){return e=new Ib(e,t,n,h,x,E,B,G,g),t=1,s===!0&&(t|=24),s=En(3,null,null,t),e.current=s,s.stateNode=e,t=zo(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:l,isDehydrated:n,cache:t},Uo(s),e}function om(e){return e?(e=Wa,e):Wa}function cm(e,t,n,l,i,s){i=om(i),l.context===null?l.context=i:l.pendingContext=i,l=Ql(t),l.payload={element:n},s=s===void 0?null:s,s!==null&&(l.callback=s),n=Il(e,l,t),n!==null&&(Tn(n,e,t),Xi(n,e,t))}function um(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function tu(e,t){um(e,t),(e=e.alternate)&&um(e,t)}function dm(e){if(e.tag===13||e.tag===31){var t=xa(e,67108864);t!==null&&Tn(t,e,67108864),tu(e,67108864)}}function fm(e){if(e.tag===13||e.tag===31){var t=kn();t=L(t);var n=xa(e,t);n!==null&&Tn(n,e,t),tu(e,t)}}var Hs=!0;function Jb(e,t,n,l){var i=j.T;j.T=null;var s=q.p;try{q.p=2,nu(e,t,n,l)}finally{q.p=s,j.T=i}}function Wb(e,t,n,l){var i=j.T;j.T=null;var s=q.p;try{q.p=8,nu(e,t,n,l)}finally{q.p=s,j.T=i}}function nu(e,t,n,l){if(Hs){var i=lu(l);if(i===null)Gc(e,t,l,Ys,n),mm(e,l);else if($b(i,e,t,n,l))l.stopPropagation();else if(mm(e,l),t&4&&-1<Pb.indexOf(e)){for(;i!==null;){var s=vl(i);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var h=Jt(s.pendingLanes);if(h!==0){var g=s;for(g.pendingLanes|=2,g.entangledLanes|=2;h;){var x=1<<31-wt(h);g.entanglements[1]|=x,h&=~x}ul(s),(nt&6)===0&&(ws=ee()+500,sr(0))}}break;case 31:case 13:g=xa(s,2),g!==null&&Tn(g,s,2),Ts(),tu(s,2)}if(s=lu(l),s===null&&Gc(e,t,l,Ys,n),s===i)break;i=s}i!==null&&l.stopPropagation()}else Gc(e,t,l,null,n)}}function lu(e){return e=le(e),au(e)}var Ys=null;function au(e){if(Ys=null,e=yl(e),e!==null){var t=f(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=p(t),e!==null)return e;e=null}else if(n===31){if(e=m(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 Ys=e,null}function hm(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(Re()){case Ke:return 2;case We:return 8;case et:case hn:return 32;case pt:return 268435456;default:return 32}default:return 32}}var iu=!1,ra=null,sa=null,oa=null,mr=new Map,pr=new Map,ca=[],Pb="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 mm(e,t){switch(e){case"focusin":case"focusout":ra=null;break;case"dragenter":case"dragleave":sa=null;break;case"mouseover":case"mouseout":oa=null;break;case"pointerover":case"pointerout":mr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":pr.delete(t.pointerId)}}function gr(e,t,n,l,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:s,targetContainers:[i]},t!==null&&(t=vl(t),t!==null&&dm(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function $b(e,t,n,l,i){switch(t){case"focusin":return ra=gr(ra,e,t,n,l,i),!0;case"dragenter":return sa=gr(sa,e,t,n,l,i),!0;case"mouseover":return oa=gr(oa,e,t,n,l,i),!0;case"pointerover":var s=i.pointerId;return mr.set(s,gr(mr.get(s)||null,e,t,n,l,i)),!0;case"gotpointercapture":return s=i.pointerId,pr.set(s,gr(pr.get(s)||null,e,t,n,l,i)),!0}return!1}function pm(e){var t=yl(e.target);if(t!==null){var n=f(t);if(n!==null){if(t=n.tag,t===13){if(t=p(n),t!==null){e.blockedOn=t,Ae(e.priority,function(){fm(n)});return}}else if(t===31){if(t=m(n),t!==null){e.blockedOn=t,Ae(e.priority,function(){fm(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 Ks(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=lu(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);I=l,n.target.dispatchEvent(l),I=null}else return t=vl(n),t!==null&&dm(t),e.blockedOn=n,!1;t.shift()}return!0}function gm(e,t,n){Ks(e)&&n.delete(t)}function ey(){iu=!1,ra!==null&&Ks(ra)&&(ra=null),sa!==null&&Ks(sa)&&(sa=null),oa!==null&&Ks(oa)&&(oa=null),mr.forEach(gm),pr.forEach(gm)}function Gs(e,t){e.blockedOn===t&&(e.blockedOn=null,iu||(iu=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,ey)))}var qs=null;function bm(e){qs!==e&&(qs=e,o.unstable_scheduleCallback(o.unstable_NormalPriority,function(){qs===e&&(qs=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],i=e[t+2];if(typeof l!="function"){if(au(l||n)===null)continue;break}var s=vl(n);s!==null&&(e.splice(t,3),t-=3,lc(s,{pending:!0,data:i,method:n.method,action:l},l,i))}}))}function Si(e){function t(x){return Gs(x,e)}ra!==null&&Gs(ra,e),sa!==null&&Gs(sa,e),oa!==null&&Gs(oa,e),mr.forEach(t),pr.forEach(t);for(var n=0;n<ca.length;n++){var l=ca[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<ca.length&&(n=ca[0],n.blockedOn===null);)pm(n),n.blockedOn===null&&ca.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var i=n[l],s=n[l+1],h=i[ke]||null;if(typeof s=="function")h||bm(n);else if(h){var g=null;if(s&&s.hasAttribute("formAction")){if(i=s,h=s[ke]||null)g=h.formAction;else if(au(i)!==null)continue}else g=h.action;typeof g=="function"?n[l+1]=g:(n.splice(l,3),l-=3),bm(n)}}}function ym(){function e(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(h){return i=h})},focusReset:"manual",scroll:"manual"})}function t(){i!==null&&(i(),i=null),l||setTimeout(n,20)}function n(){if(!l&&!navigation.transition){var s=navigation.currentEntry;s&&s.url!=null&&navigation.navigate(s.url,{state:s.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,i=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),i!==null&&(i(),i=null)}}}function ru(e){this._internalRoot=e}Vs.prototype.render=ru.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));var n=t.current,l=kn();cm(n,l,e,t,null,null)},Vs.prototype.unmount=ru.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cm(e.current,2,null,e,null,null),Ts(),t[Tt]=null}};function Vs(e){this._internalRoot=e}Vs.prototype.unstable_scheduleHydration=function(e){if(e){var t=ie();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ca.length&&t!==0&&t<ca[n].priority;n++);ca.splice(n,0,e),n===0&&pm(e)}};var vm=a.version;if(vm!=="19.2.8")throw Error(c(527,vm,"19.2.8"));q.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(c(188)):(e=Object.keys(e).join(","),Error(c(268,e)));return e=S(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var ty={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xs=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xs.isDisabled&&Xs.supportsFiber)try{ln=Xs.inject(ty),at=Xs}catch{}}return yr.createRoot=function(e,t){if(!d(e))throw Error(c(299));var n=!1,l="",i=Ef,s=Rf,h=Af;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(h=t.onRecoverableError)),t=sm(e,1,!1,null,null,n,l,null,i,s,h,ym),e[Tt]=t.current,Kc(e),new ru(t)},yr.hydrateRoot=function(e,t,n){if(!d(e))throw Error(c(299));var l=!1,i="",s=Ef,h=Rf,g=Af,x=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onUncaughtError!==void 0&&(s=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(g=n.onRecoverableError),n.formState!==void 0&&(x=n.formState)),t=sm(e,1,!0,t,n??null,l,i,x,s,h,g,ym),t.context=om(null),n=t.current,l=kn(),l=L(l),i=Ql(l),i.callback=null,Il(n,i,l),n=l,t.current.lanes=n,al(t,n),ul(t),e[Tt]=t.current,Kc(e),new Vs(t)},yr.version="19.2.8",yr}var Nm;function my(){if(Nm)return ou.exports;Nm=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(a){console.error(a)}}return o(),ou.exports=hy(),ou.exports}var py=my();const gy=up(py),Ne={ESC:"\x1B",TAB:" ",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~"},by=new TextEncoder;function ju(o){return by.encode(o)}function yy(o){if(!o||o.length===0)return"";const r=o.toUpperCase().charCodeAt(0);return r>=65&&r<=90?String.fromCharCode(r-64):o==="@"||o===" "?"\0":o==="["?"\x1B":o==="\\"?"":o==="]"?"":o==="^"?"":o==="_"?"":o==="?"?"":o}function vy(o){return`\x1B${o}`}function xy(o,a){let r=o;return a.shift&&o.length===1&&!a.ctrl&&(r=o.toUpperCase()),a.ctrl&&(r=yy(r)),a.alt&&(r=vy(r)),r}const fp=27,hp=91,Sy=60,Em=59,mp=77,pp=48,wy=57,Cy=64,Ty=-30,du=32,Rm=255;function gp(o){return Number.isInteger(o)&&(o&Ty)===Cy}function Ny(o){return o>=pp&&o<=wy}function fu(o,a){let r=a,c=0;for(;r<o.length&&Ny(o[r]);){if(c=c*10+(o[r]-pp),c>65535)return null;r+=1}return r===a?null:{value:c,next:r}}function Ey(o,a){if(o[a]!==fp||o[a+1]!==hp||o[a+2]!==Sy)return-1;const r=fu(o,a+3);if(!r||!gp(r.value)||o[r.next]!==Em)return-1;const c=fu(o,r.next+1);if(!c||o[c.next]!==Em)return-1;const d=fu(o,c.next+1);return!d||o[d.next]!==mp?-1:d.next+1}function Ry(o,a){if(o[a]!==fp||o[a+1]!==hp||o[a+2]!==mp||a+6>o.length)return-1;const r=o[a+3]-du,c=o[a+4],d=o[a+5];return!gp(r)||c<du||c>Rm||d<du||d>Rm?-1:a+6}function kr(o){if(!o)return!1;const a=o instanceof Uint8Array?o:new Uint8Array(o);if(a.length===0)return!1;let r=0;for(;r<a.length;){const c=Ey(a,r);if(c>r){r=c;continue}const d=Ry(a,r);if(d>r){r=d;continue}return!1}return!0}class Ay{constructor(a){Se(this,"ws",null);Se(this,"config");Se(this,"state","disconnected");Se(this,"currentRole","viewer");Se(this,"controllerId");Se(this,"hostId");Se(this,"assignedClientId");Se(this,"reconnectAttempts",0);Se(this,"reconnectTimer",null);Se(this,"pingTimer",null);Se(this,"pingTimestamp",null);Se(this,"isManuallyClosed",!1);Se(this,"authFailureDetail",null);Se(this,"authFailureCode",null);Se(this,"temporaryFailureCode",null);Se(this,"pendingInputSegments",[]);Se(this,"isFlushScheduled",!1);Se(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});Se(this,"terminalCols",80);Se(this,"terminalRows",24);this.config={...a}}updateConfig(a){this.config={...this.config,...a}}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(a,r){return this.listeners[a].add(r),()=>{this.listeners[a].delete(r)}}emit(a,...r){this.listeners[a].forEach(d=>{try{d(...r)}catch(f){console.error(`Error in event listener for ${a}:`,f)}})}setState(a,r,c){this.state!==a&&(this.state=a,this.emit("stateChange",a,r,c))}connect(a){if(a&&(this.terminalCols=a.cols,this.terminalRows=a.rows),!(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))){this.teardownSocket(1e3,"Replaced by a new connection"),this.isManuallyClosed=!1,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.clearTimers(),this.setState("connecting");try{const r=this.resolveWsUrl(this.config.wsUrl),c=new WebSocket(r);this.ws=c,c.binaryType="arraybuffer",c.onopen=()=>{this.isStaleSocket(c)||this.handleOpen()},c.onmessage=d=>{this.isStaleSocket(c)||this.handleMessage(d)},c.onerror=d=>{this.isStaleSocket(c)||this.handleError(d)},c.onclose=d=>{this.isStaleSocket(c)||this.handleClose(d)}}catch(r){this.setState("error",r instanceof Error?r.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(a){return this.ws!==a}teardownSocket(a=1e3,r="Client closed the connection"){this.pendingInputSegments=[],this.isFlushScheduled=!1;const c=this.ws;if(c){this.ws=null,c.onopen=null,c.onmessage=null,c.onerror=null,c.onclose=null;try{(c.readyState===WebSocket.OPEN||c.readyState===WebSocket.CONNECTING)&&c.close(a,r)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.pendingInputSegments=[],this.isFlushScheduled=!1,this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(a){this.updateConfig(a),this.clearTimers(),this.teardownSocket(1e3,"Reconnecting with new credentials"),this.isManuallyClosed=!1,this.reconnectAttempts=0,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.connect()}handleOpen(){this.sendHello(),this.startHeartbeat()}async handleMessage(a){if(typeof a.data=="string")try{const r=JSON.parse(a.data);this.processJsonMessage(r)}catch(r){console.warn("Received unparseable text frame from server:",r)}else if(a.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(a.data));else if(typeof Blob<"u"&&a.data instanceof Blob)try{const r=await a.data.arrayBuffer();this.emit("binaryData",new Uint8Array(r))}catch(r){console.error("Failed to convert Blob to ArrayBuffer:",r)}}processJsonMessage(a){switch(a.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=a.role,this.controllerId=a.controllerId,this.hostId=a.hostId,this.assignedClientId=a.clientId,this.emit("ready",a),this.emit("roleChange",a.role,a.controllerId,a.hostId,a.clientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount);break}case"paired":{this.emit("paired",{token:a.token,deviceId:a.deviceId,hostId:a.hostId,expiresAt:a.expiresAt});break}case"control_state":{this.currentRole=a.role,this.controllerId=a.controllerId,this.emit("controlState",a.role,a.controllerId),this.emit("roleChange",a.role,a.controllerId,this.hostId,this.assignedClientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",a.code||"host_reconnecting"),this.emit("hostReconnecting",a.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",a.cols,a.rows,a.terminalPalette,a.hostname);break}case"control_revoked":{this.currentRole="viewer",this.emit("controlRevoked",a.reason),this.emit("roleChange","viewer",this.controllerId,this.hostId,this.assignedClientId);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",a);break}case"exit":{this.emit("exit",a.code,a.reason);break}case"control_granted":{this.currentRole="controller",this.controllerId=this.assignedClientId||this.config.clientId,this.emit("controlGranted"),this.emit("roleChange","controller",this.controllerId,this.hostId,this.assignedClientId);break}case"control_denied":{this.emit("controlDenied",a.message);break}case"status":{this.emit("status",a);break}case"error":{a.code==="host_offline"||a.code==="host_reconnecting"||a.code==="host_reconnect_timeout"||a.code==="rate_limited"?(this.temporaryFailureCode=String(a.code),this.setState("reconnecting",a.message,String(a.code))):(a.code==="auth_required"||a.code==="unauthorized"||a.code==="device_revoked"||a.code==="invalid_handshake"||a.code==="too_many_hosts"||a.code===401||a.code===403)&&(this.authFailureDetail=a.message,this.authFailureCode=String(a.code),this.setState("error",a.message,this.authFailureCode)),this.emit("error",{code:a.code,message:a.message});break}case"pong":{if(this.pingTimestamp){const r=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(r))}break}case"paste_file_ready":{this.emit("pasteFileReady",a.path);break}}}handleError(a){console.error("WebSocket error:",a),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(a){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(a.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",a.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(a.code===1008){this.setState("error",a.reason||"The relay rejected the connection",String(a.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${a.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${a.reason||a.code}`,"connection_closed")}scheduleReconnect(){if(this.isManuallyClosed||!this.config.autoReconnect)return;if(this.config.maxReconnectAttempts>0&&this.reconnectAttempts>=this.config.maxReconnectAttempts){this.setState("error","Max reconnect attempts reached");return}this.reconnectAttempts++;const a=this.config.reconnectIntervalMs||2e3,c=Math.min(3e4,Math.floor(a*Math.pow(1.5,this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},c)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const a=this.config.pingIntervalMs||1e4;this.pingTimer=setInterval(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN&&this.sendPing()},a)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=null)}sendHello(){const a={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(a.token=this.config.token),this.config.pairCode&&(a.pairCode=this.config.pairCode),this.sendJson(a)}claimControl(a=!1){const r={type:"claim_control",...a?{force:!0}:{}};this.sendJson(r)}releaseControl(){const a={type:"release_control"};this.sendJson(a)}sendResize(a,r){this.terminalCols=a,this.terminalRows=r;const c={type:"resize",cols:a,rows:r};this.sendJson(c)}sendPing(){this.pingTimestamp=performance.now();const a={type:"ping"};this.sendJson(a)}sendPasteFile(a,r){this.sendJson({type:"paste_file",mime:a,dataBase64:r})}sendJson(a){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(a))}sendInput(a){const r=a instanceof Uint8Array?a:new Uint8Array(a);if(r.length!==0){if(this.pendingInputSegments.push(r),!kr(r)){this.flushInput();return}this.isFlushScheduled||(this.isFlushScheduled=!0,queueMicrotask(()=>this.flushInput()))}}flushInput(){if(this.isFlushScheduled=!1,this.pendingInputSegments.length===0)return;let a=this.pendingInputSegments;if(this.pendingInputSegments=[],this.ws&&(this.ws.bufferedAmount??0)>256*1024&&(a=a.filter(c=>!kr(c))),a.length===0)return;let r;if(a.length===1)r=a[0];else{let c=0;for(let f=0;f<a.length;f++)c+=a[f].byteLength;r=new Uint8Array(c);let d=0;for(let f=0;f<a.length;f++)r.set(a[f],d),d+=a[f].byteLength}this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(r)}sendBinary(a){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(a)}sendText(a){const r=ju(a);this.sendInput(r)}resolveWsUrl(a){if(/^wss?:\/\//i.test(a))return a;if(/^https?:\/\//i.test(a)){const r=new URL(a);return r.protocol=r.protocol==="https:"?"wss:":"ws:",(!r.pathname||r.pathname==="/")&&(r.pathname="/ws/client"),r.toString()}if(typeof window<"u"&&window.location){const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host,f=a.startsWith("/")?a:`/${a}`;return`${c}//${d}${f}`}return"ws://127.0.0.1:8787/ws/client"}}const jy=10,My=24,lo=15,Mu=13,ku=640;function ky(){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 Ti()<ku}function Ti(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function hu(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function $s(o,a=lo){const r=typeof o=="number"?o:Number(o);return!Number.isFinite(r)||r<=0?a:Math.min(My,Math.max(jy,Math.round(r)))}function Am(o,a=Ti()){if(a<ku){const c=$s(o,Mu);return Math.min(15,Math.max(12,c))}return $s(o,lo)}const bp=[{id:"esc",label:"ESC",code:Ne.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:Ne.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:Ne.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:Ne.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:Ne.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:Ne.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{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:"enter",label:"Enter",code:Ne.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],_y=[{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:Ne.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:Ne.TAB,type:"key",enabled:!0,title:"Tab"},{id:"enter",label:"Enter",code:Ne.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:Ne.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:Ne.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:Ne.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:Ne.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:Ne.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:Ne.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:Ne.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:Ne.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:Ne.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:Ne.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:Ne.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:Ne.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:Ne.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:Ne.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:Ne.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:Ne.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:Ne.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:Ne.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:Ne.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:Ne.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:Ne.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:Ne.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:Ne.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:Ne.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:Ne.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:Ne.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:Ne.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:Ne.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:Ne.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:Ne.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:Ne.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 _r(){return JSON.parse(JSON.stringify(bp))}const jm=["esc","tab","ctrl","alt","left","up","down","right","enter","drawer_chords","drawer_symbols","drawer_fn"];function zy(o){return o.length!==jm.length?!1:o.every((a,r)=>a.id===jm[r]&&a.enabled!==!1)}function Dy(o){if(!Array.isArray(o)||o.length===0)return _r();const a=o.filter(r=>typeof r=="object"&&r!==null&&typeof r.id=="string"&&typeof r.label=="string"&&typeof r.code=="string");return zy(a)?_r():a}function Su(o,a){if(a){const r=`keyTitles.${o.id}`,c=a(r);if(c&&c!==r)return c}return o.title||o.label}const wu='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',Oy='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',Mm="JetBrains Mono, Menlo, Monaco, Consolas, monospace",Ni="herdr_remote_settings_v1",jr="herdr_remote_session_view_v1",yp=64,zr=4096,Cu={local:{},session:{}};function eo(o,a){if(typeof window>"u")return Cu[o][a]||null;try{return(o==="local"?window.localStorage:window.sessionStorage).getItem(a)}catch{return Cu[o][a]||null}}function Da(o,a,r){if(Cu[o][a]=r,!(typeof window>"u"))try{(o==="local"?window.localStorage:window.sessionStorage).setItem(a,r)}catch(c){console.warn(`Failed to write to ${o}Storage:`,c)}}function Ly(){return`client-${Math.random().toString(36).substring(2,8)}`}function _u(){const o=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${o}`}function Uy(o,a){return(typeof o=="string"?o.trim().slice(0,yp):"")||a}function to(o,a){if(!o||typeof o!="object"||Array.isArray(o))return null;const r=o,c=typeof r.wsUrl=="string"?r.wsUrl.trim().slice(0,2048):"",d=typeof r.token=="string"?r.token.slice(0,zr):"",f=typeof r.pairCode=="string"?r.pairCode.trim().toUpperCase().slice(0,32):"";if(!c||!c.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(c)||!d&&!f)return null;const p=Date.now(),m=typeof r.id=="string"&&r.id.length>0?r.id.slice(0,128):_u(),b=typeof r.hostname=="string"&&r.hostname.trim()?r.hostname.trim().slice(0,yp):`Herdr ${a+1}`;return{id:m,displayName:Uy(r.displayName,b),wsUrl:c,token:d,...f?{pairCode:f}:{},...typeof r.hostId=="string"&&r.hostId.trim()?{hostId:r.hostId.trim().slice(0,128)}:{},...typeof r.hostname=="string"&&r.hostname.trim()?{hostname:r.hostname.trim().slice(0,128)}:{},...typeof r.deviceId=="string"&&r.deviceId.trim()?{deviceId:r.deviceId.trim().slice(0,128)}:{},autoReconnect:r.autoReconnect!==!1,createdAt:Number.isFinite(r.createdAt)?Number(r.createdAt):p,lastUsedAt:Number.isFinite(r.lastUsedAt)?Number(r.lastUsedAt):p}}function km(o,a=0){const r=to({...o,id:o.id||_u()},a);if(!r)throw new Error("a connection profile requires a relay URL and token or pairing code");return r}function _m(o){let a=o.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const r=new URL(o.wsUrl,window.location.origin);r.protocol=r.protocol==="wss:"?"https:":"http:",r.pathname=r.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",r.search="",r.hash="",a=r.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${a}::${o.hostId||""}`}function vp(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function xp(){const o=typeof window<"u"&&window.innerWidth<640;return{wsUrl:"/ws/client",token:"",pairCode:"",clientId:Ly(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:o?Mu:lo,fontFamily:wu,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",language:vp(),virtualKeys:_r(),adminToken:"",adminTokens:{}}}const By=["wsUrl","token","pairCode","clientId","autoReconnect","language"],Hy=["wsUrl","token","pairCode","autoReconnect"],zu=["fontSize","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","adminToken","adminTokens"],Yy=zu.filter(o=>o!=="adminToken"&&o!=="adminTokens"),zm=["theme","colorMode"];function Tu(o){const a=o;if(!zm.some(d=>a[d]!==void 0))return{data:o,changed:!1};const c={...a};for(const d of zm)delete c[d];return{data:c,changed:!0}}function Sp(o){if(!o||typeof o!="object"||Array.isArray(o))return{};const a={};for(const[r,c]of Object.entries(o).slice(0,32))typeof c!="string"||c.length===0||(a[r.slice(0,512)]=c.slice(0,zr));return a}function wp(o){var f;const a=[];if((Array.isArray(o.profiles)?o.profiles.slice(0,64):[]).forEach((p,m)=>{const b=to(p,m);b&&!a.some(S=>S.id===b.id)&&a.push(b)}),a.length===0&&(typeof o.token=="string"&&o.token||typeof o.pairCode=="string"&&o.pairCode)){const p=to({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof o.wsUrl=="string"&&o.wsUrl.trim()?o.wsUrl:"/ws/client",token:o.token||"",pairCode:o.pairCode||"",autoReconnect:o.autoReconnect!==!1},0);p&&a.push(p)}const c=typeof o.activeProfileId=="string"?o.activeProfileId:"",d=a.some(p=>p.id===c)?c:((f=a[0])==null?void 0:f.id)||"";return{profiles:a,activeProfileId:d}}function Cp(){const o=xp();if(typeof window>"u")return o;let a={};const r=eo("local",Ni);if(r)try{a=JSON.parse(r)}catch(te){console.warn("Failed to parse localStorage settings:",te)}const c=Tu(a);c.changed&&(a=c.data,Da("local",Ni,JSON.stringify(a)));let d=null;const f=eo("session",jr);if(f)try{d=JSON.parse(f)}catch(te){console.warn("Failed to parse sessionStorage settings:",te)}if(!d){const te={};for(const je of zu)a[je]!==void 0&&(te[je]=a[je]);d=te,Da("session",jr,JSON.stringify(d))}let p=d.fontFamily??a.fontFamily??o.fontFamily;(!p||p===Mm||p===Oy)&&(p=wu);const m=window.innerWidth<640?Mu:lo,b=d.fontSize??a.fontSize??o.fontSize,S=$s(b,m),v=d.virtualKeys??a.virtualKeys??o.virtualKeys,C=Dy(v),D=a.language??o.language,_=D==="zh"||D==="en"?D:vp(),z=wp(a),X=z.profiles.find(te=>te.id===z.activeProfileId),M=Tu(d);M.changed&&(d=M.data,Da("session",jr,JSON.stringify(d)));const Z=d.toolbarVisible??a.toolbarVisible??o.toolbarVisible,$=d.toolbarPosition??a.toolbarPosition??o.toolbarPosition,J=d.vibrateOnKeyPress??a.vibrateOnKeyPress??o.vibrateOnKeyPress,ae=(d==null?void 0:d.predictiveEcho)??(a==null?void 0:a.predictiveEcho)??o.predictiveEcho,ye=ae==="always"||ae==="off"||ae==="auto"?ae:"auto",O=typeof d.adminToken=="string"?d.adminToken.slice(0,zr):typeof a.adminToken=="string"?a.adminToken.slice(0,zr):o.adminToken,U=Sp(d.adminTokens),R={...o,...a,...d,wsUrl:(X==null?void 0:X.wsUrl)||(typeof a.wsUrl=="string"?a.wsUrl:o.wsUrl),token:(X==null?void 0:X.token)||"",pairCode:(X==null?void 0:X.pairCode)||"",autoReconnect:(X==null?void 0:X.autoReconnect)??o.autoReconnect,profiles:z.profiles,activeProfileId:z.activeProfileId,clientId:typeof a.clientId=="string"&&a.clientId.trim()?a.clientId.trim().slice(0,128):o.clientId,fontFamily:p,fontSize:S,toolbarVisible:Z,toolbarPosition:$,vibrateOnKeyPress:J,predictiveEcho:ye,virtualKeys:C,language:_,adminToken:O,adminTokens:U};return a.fontFamily===Mm&&(a.fontFamily=wu,Da("local",Ni,JSON.stringify(a))),R}function da(o){var D;const r={...Cp(),...o};r.adminTokens=Sp(r.adminTokens),typeof r.adminToken=="string"&&(r.adminToken=r.adminToken.slice(0,zr)),o.fontSize!==void 0&&(r.fontSize=$s(o.fontSize)),o.predictiveEcho!==void 0&&(o.predictiveEcho==="auto"||o.predictiveEcho==="always"||o.predictiveEcho==="off"?r.predictiveEcho=o.predictiveEcho:r.predictiveEcho="auto");const c=wp(r);let d=c.profiles,f=c.activeProfileId;if(Hy.some(_=>o[_]!==void 0)){const _=d.findIndex(M=>M.id===f),z=_>=0?{...d[_]}:{id:_u(),displayName:`Herdr ${d.length+1}`,wsUrl:r.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};z.wsUrl=r.wsUrl,z.token=r.token,z.pairCode=r.pairCode||void 0,z.autoReconnect=r.autoReconnect,z.lastUsedAt=Date.now();const X=to(z,Math.max(_,0));X?_>=0?d[_]=X:(d.push(X),f=X.id):_>=0&&(d=d.filter(M=>M.id!==f),f=((D=d[0])==null?void 0:D.id)||"")}d.length>0&&!d.some(_=>_.id===f)&&(f=d[0].id);const m=d.find(_=>_.id===f);r.profiles=d,r.activeProfileId=f,r.wsUrl=(m==null?void 0:m.wsUrl)||r.wsUrl||"/ws/client",r.token=(m==null?void 0:m.token)||"",r.pairCode=(m==null?void 0:m.pairCode)||"",r.autoReconnect=(m==null?void 0:m.autoReconnect)??r.autoReconnect;const b=eo("local",Ni);let S={};if(b)try{S=JSON.parse(b)}catch{}S=Tu(S).data;for(const _ of By)r[_]!==void 0&&(S[_]=r[_]);S.profiles=d,S.activeProfileId=f,Da("local",Ni,JSON.stringify(S));const v=eo("session",jr);let C={};if(v)try{C=JSON.parse(v)}catch{}for(const _ of zu)r[_]!==void 0&&(C[_]=r[_]);Da("session",jr,JSON.stringify(C));for(const _ of Yy)r[_]!==void 0&&(S[_]=r[_]);return Da("local",Ni,JSON.stringify(S)),r}const Ky={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"},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:",step1CopyPlugin:"Using Herdr Plugin:",step1CopyCli:"Copy CLI Command",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",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:"Speculatively render typed characters under high latency and reconcile with server echo.",touchKeyToolbar:"Touch Key Toolbar",touchKeyToolbarDesc:"Show modifier and navigation keys",touchHaptics:"Haptic Feedback",touchHapticsDesc:"Vibrate on key press",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."},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",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_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_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"},clipboard:{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"}},Gy={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:"会话已断开"},onboarding:{title:"配对 Herdr Remote",subtitle:"连接手机或浏览器至本地终端会话",description:"在浏览器或移动设备中控制 Herdr 会话。",firstTimeSetup:"首次配对",authRequired:"需要认证",authRequiredDesc:"使用配对码配对设备,或提供有效访问令牌。",step1Title:"在 Herdr 宿主机生成配对码",step1Desc:"在运行 Herdr 的主机终端执行:",step1CopyPlugin:"使用 Herdr 插件:",step1CopyCli:"复制 CLI 命令",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:"虚拟按键",fontFamilyLabel:"等宽字体",fontSizeLabel:"终端字号 ({size}px)",fontSizeCompact:"10px (紧凑)",fontSizeDefault:"15px (默认)",fontSizeLarge:"24px (大字号)",mobileFontNote:"小屏设备自动适配字号,保持 80 列完整显示。",colorPassthroughNote:"终端配色与光标样式透传自宿主环境。",predictiveEchoLabel:"预测回显",predictiveEchoAuto:"自动",predictiveEchoAlways:"始终开启",predictiveEchoOff:"关闭",predictiveEchoDesc:"高延迟时本地预先显示输入字符,服务端回显到达后自动校正。",touchKeyToolbar:"底部触控按键条",touchKeyToolbarDesc:"显示移动端修饰键与方向键工具栏",touchHaptics:"触控振动反馈",touchHapticsDesc:"移动端按键时轻微震动",languageLabel:"显示语言",languageDesc:"选择 English 或 简体中文",resetDefaults:"恢复默认设置",resetDefaultsToast:"设置已恢复默认",windowZoomSharedNote:"当前宿主未启用视图隔离,字号调整仅影响本地窗口。",fontSizeZoomHelp:"仅调节当前窗口字号,不影响其他窗口。"},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",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_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_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"},clipboard:{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:"移除图片"}},mu={en:Ky,zh:Gy};function Du(o,a,r){const c=mu[o]||mu.en,d=a.split(".");let f=c;for(const p of d)if(f&&typeof f=="object"&&p in f)f=f[p];else{let m=mu.en;for(const b of d)if(m&&typeof m=="object"&&b in m)m=m[b];else return a;f=m;break}if(typeof f!="string")return a;if(r){let p=f;for(const[m,b]of Object.entries(r))p=p.replaceAll(`{${m}}`,String(b));return p}return f}const Dm="#11111b",Nu=[{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 Om(o){if(!o||typeof o!="string")return Nu[0].font;const a=o.trim();if(a.includes("Symbols Nerd Font"))return a;if(/^['"]?monospace['"]?$/i.test(a))return'"Symbols Nerd Font Mono", monospace';const r=/,\s*['"]?monospace['"]?\s*$/i;return r.test(a)?a.replace(r,', "Symbols Nerd Font Mono", monospace'):`${a}, "Symbols Nerd Font Mono", monospace`}function qy(o){if(!o)return null;const a={};return o.background&&(a.background=o.background,a.cursorAccent=o.background),o.foreground&&(a.foreground=o.foreground),o.cursor&&(a.cursor=o.cursor),o.ansi&&Object.assign(a,o.ansi),Object.keys(a).length===0?null:a}function Lm(o){if(typeof o!="string")return null;const a=o.trim();return/^#[0-9a-f]{3}$/i.test(a)?[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]:/^#[0-9a-f]{6}$/i.test(a)?[parseInt(a.slice(1,3),16),parseInt(a.slice(3,5),16),parseInt(a.slice(5,7),16)]:null}function Vy(o,a,r){const c=Lm(o),d=Lm(a);if(!c||!d)return;const f=Math.min(1,Math.max(0,r)),p=m=>{const b=Math.round(c[m]+(d[m]-c[m])*f);return Math.min(255,Math.max(0,b)).toString(16).padStart(2,"0")};return`#${p(0)}${p(1)}${p(2)}`}function Tp(){if(typeof document>"u")return;const o=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",o==null||o.setAttribute("content",Dm),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=Dm}const Np=1568,Xy=3*1024*1024,Fy=[.85,.7,.55,.4],nl={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function Zy(o,a,r=Np){if(o<=0||a<=0)return{width:Math.max(1,o),height:Math.max(1,a)};const c=Math.max(o,a);if(c<=r)return{width:o,height:a};const d=r/c;return{width:Math.max(1,Math.round(o*d)),height:Math.max(1,Math.round(a*d))}}function Qy(o){if(typeof o!="string"||o.length===0)return 0;const a=o.length;let r=0;o.endsWith("==")?r=2:o.endsWith("=")&&(r=1);const c=Math.floor(a*3/4)-r;return Number.isFinite(c)&&c>0?c:0}function Iy(o){return o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/(1024*1024)).toFixed(1)} MB`}async function Jy(o){if(typeof createImageBitmap=="function")try{const a=await createImageBitmap(o,{imageOrientation:"from-image"});return{source:a,width:a.width,height:a.height,cleanup:()=>{typeof a.close=="function"&&a.close()}}}catch{try{const a=await createImageBitmap(o);return{source:a,width:a.width,height:a.height,cleanup:()=>{typeof a.close=="function"&&a.close()}}}catch{}}return new Promise((a,r)=>{if(typeof Image>"u")return r(new Error("Image decoding not supported in this environment"));const c=new Image,d=URL.createObjectURL(o);c.onload=()=>{a({source:c,width:c.naturalWidth||c.width,height:c.naturalHeight||c.height,cleanup:()=>{try{URL.revokeObjectURL(d)}catch{}}})},c.onerror=()=>{try{URL.revokeObjectURL(d)}catch{}r(new Error("Failed to decode image source"))},c.src=d})}async function Ep(o,a=Np,r=Xy){var d;if(!o||o.size===0||o.type&&!o.type.startsWith("image/"))return null;let c;try{c=await Jy(o)}catch(f){return console.warn("Failed to decode image for paste:",f),null}try{const{width:f,height:p}=Zy(c.width,c.height,a),m=document.createElement("canvas");m.width=f,m.height=p;const b=m.getContext("2d");if(!b)return null;b.drawImage(c.source,0,0,f,p);let S="image/webp";try{m.toDataURL("image/webp",.85).startsWith("data:image/webp")||(S="image/jpeg")}catch{S="image/jpeg"}for(const v of Fy){let C;try{C=m.toDataURL(S,v)}catch{continue}if(!C||!C.startsWith("data:"))continue;const D=C.indexOf(","),_=D!==-1?C.slice(D+1):"",z=Qy(_);if(z<=r)return{mime:S,dataBase64:_,dataUrl:C,byteLength:z,width:f,height:p}}return null}finally{(d=c.cleanup)==null||d.call(c)}}const Wy=4e3,Py=3,$y=4096,ev=8*1024*1024,Rp=y.createContext(null);function wi(o){return{wsUrl:o.wsUrl,token:o.token||void 0,pairCode:o.pairCode||void 0,clientId:o.clientId,autoReconnect:o.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}const tv=({children:o})=>{const[a,r]=y.useState(Cp),[c,d]=y.useState("disconnected"),[f,p]=y.useState(),[m,b]=y.useState(),[S,v]=y.useState("viewer"),[C,D]=y.useState(),[_,z]=y.useState(),[X,M]=y.useState(),[Z,$]=y.useState(null),[J,ae]=y.useState(),[ye,O]=y.useState(null),[U,R]=y.useState(1),[te,je]=y.useState(0),[Me,Ee]=y.useState(null),[de,_e]=y.useState(null),[Le,j]=y.useState({cols:80,rows:24}),[q,W]=y.useState([]);y.useEffect(()=>{Tp()},[]);const Ce=y.useRef(a);Ce.current=a;const H=y.useRef(null),qe=y.useRef(!1),F=y.useRef(Le);F.current=Le;const pe=y.useRef(new Set),[ze,ve]=y.useState(nl),he=y.useRef(null),St=y.useRef(0),Ue=y.useRef(null),we=y.useCallback((L,Y)=>Du(a.language,L,Y),[a.language]),ft=y.useRef(we);ft.current=we;const lt=y.useRef(null),mt=y.useRef([]),Bt=y.useRef(0),gt=y.useCallback(L=>{for(mt.current.push(L),Bt.current+=L.byteLength;mt.current.length>$y||Bt.current>ev;){const Y=mt.current.shift();if(!Y)break;Bt.current-=Y.byteLength}},[]),zn=y.useCallback(L=>{const Y=lt.current;if(Y)try{Y(L);return}catch(ie){console.debug("Terminal output sink threw, buffering chunk instead:",ie)}gt(L)},[gt]),Dn=y.useRef(zn);Dn.current=zn;const kt=y.useCallback(L=>{lt.current=L;const Y=mt.current;mt.current=[],Bt.current=0;for(let ie=0;ie<Y.length;ie++)try{L(Y[ie])}catch(Ae){console.debug("Terminal sink threw while flushing, re-buffering the tail:",Ae);for(let xe=ie;xe<Y.length;xe++)gt(Y[xe]);break}return()=>{lt.current===L&&(lt.current=null)}},[gt]),cn=y.useRef(null),On=y.useCallback(L=>(cn.current=L,()=>{cn.current===L&&(cn.current=null)}),[]),Ht=y.useCallback(()=>mt.current.length,[]),Qe=y.useCallback(()=>{mt.current=[],Bt.current=0},[]),Ft=y.useCallback((L=!0)=>{v("viewer"),D(void 0),z(void 0),M(void 0),$(null),ae(void 0),O(null),R(1),Ee(null),Qe(),L&&je(Y=>Y+1)},[Qe]),Yt=y.useRef([]),ee=y.useRef(new Map),Re=y.useCallback(L=>{Yt.current=L,W(L)},[]),Ke=y.useCallback(L=>{const Y=ee.current.get(L);Y&&(clearTimeout(Y),ee.current.delete(L)),Re(Yt.current.filter(ie=>ie.id!==L))},[Re]),We=y.useRef(Ke);We.current=Ke;const et=y.useCallback((L,Y)=>{const ie=Date.now(),Ae=Yt.current,xe=Ae.find(bt=>bt.type===L&&bt.message===Y),fe=xe?xe.id:`${ie}-${Math.random().toString(36).substring(2,6)}`;let ke;if(xe)ke=Ae.map(bt=>bt.id===fe?{...bt,count:bt.count+1,timestamp:ie}:bt);else for(ke=[...Ae,{id:fe,type:L,message:Y,timestamp:ie,count:1}];ke.length>Py;){const[bt,...Un]=ke,il=ee.current.get(bt.id);il&&(clearTimeout(il),ee.current.delete(bt.id)),ke=Un}Re(ke);const Tt=ee.current.get(fe);Tt&&clearTimeout(Tt),ee.current.set(fe,setTimeout(()=>We.current(fe),Wy))},[Re]),hn=y.useCallback(L=>{We.current(L)},[]),pt=y.useRef(!0);y.useEffect(()=>{S==="controller"&&(pt.current=!0)},[S]);const Rt=y.useCallback(()=>{pt.current&&(pt.current=!1,et("warning",ft.current("toasts.viewerModeWarning")))},[et]);y.useEffect(()=>{const L=ee.current;return()=>{for(const Y of L.values())clearTimeout(Y);L.clear()}},[]);const It=y.useCallback(L=>{const Y=da(L);Ce.current=Y,r(Y)},[]),ln=y.useCallback(L=>{It({language:L})},[It]),at=y.useCallback(L=>{Ce.current=L,r(L)},[]),_t=y.useCallback(L=>{var xe;const Y=Ce.current,ie=km({...L,wsUrl:L.wsUrl||"/ws/client",token:L.token||"",displayName:L.displayName||`Herdr ${Y.profiles.length+1}`,autoReconnect:L.autoReconnect!==!1},Y.profiles.length),Ae=da({profiles:[...Y.profiles,ie],activeProfileId:ie.id,wsUrl:ie.wsUrl,token:ie.token,pairCode:ie.pairCode||"",autoReconnect:ie.autoReconnect});at(Ae),Ft(),(xe=H.current)==null||xe.reconnectWith(wi(Ae))},[at,Ft]),wt=y.useCallback(L=>{var xe;const Y=Ce.current,ie=Y.profiles.find(fe=>fe.id===L);if(!ie||ie.id===Y.activeProfileId)return;const Ae=da({activeProfileId:ie.id,wsUrl:ie.wsUrl,token:ie.token,pairCode:ie.pairCode||"",autoReconnect:ie.autoReconnect,profiles:Y.profiles.map(fe=>fe.id===ie.id?{...fe,lastUsedAt:Date.now()}:fe)});at(Ae),Ft(),(xe=H.current)==null||xe.reconnectWith(wi(Ae))},[at,Ft]),Ba=y.useCallback((L,Y)=>{const ie=Ce.current;if(!ie.profiles.find(ke=>ke.id===L))return;const xe=Y.trim().slice(0,64);if(!xe)return;const fe=da({profiles:ie.profiles.map(ke=>ke.id===L?{...ke,displayName:xe}:ke)});at(fe)},[at]),mn=y.useCallback(L=>{var fe;const Y=Ce.current;if(!Y.profiles.some(ke=>ke.id===L))return;const ie=Y.profiles.filter(ke=>ke.id!==L),Ae=ie.find(ke=>ke.id===Y.activeProfileId)||ie[0],xe=da(Ae?{profiles:ie,activeProfileId:Ae.id,wsUrl:Ae.wsUrl,token:Ae.token,pairCode:Ae.pairCode||"",autoReconnect:Ae.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:"/ws/client",token:"",pairCode:""});at(xe),L===Y.activeProfileId&&(Ft(),(fe=H.current)==null||fe.reconnectWith(wi(xe)))},[at,Ft]),Ha=y.useCallback(L=>{const Y=Ce.current,ie=Y.profiles.find(gn=>gn.id===Y.activeProfileId),Ae=L.hostId?_m({wsUrl:Y.wsUrl,hostId:L.hostId}):null,xe=Ae?Y.profiles.findIndex(gn=>_m(gn)===Ae):-1,fe=xe>=0?xe:Math.max(0,Y.profiles.findIndex(gn=>gn.id===Y.activeProfileId)),Tt={...Y.profiles[fe]||ie||km({wsUrl:Y.wsUrl||"/ws/client",token:"",pairCode:Y.pairCode||"PENDING",displayName:`Herdr ${Y.profiles.length+1}`},Y.profiles.length),token:L.token,pairCode:void 0,...L.hostId?{hostId:L.hostId}:{},...L.deviceId?{deviceId:L.deviceId}:{},lastUsedAt:Date.now()};let bt=[...Y.profiles];fe>=0&&fe<bt.length?bt[fe]=Tt:bt.push(Tt);const Un=ie==null?void 0:ie.id;bt=bt.filter((gn,rl)=>rl===fe||gn.id===Tt.id?!0:!(xe>=0&&Un&&gn.id===Un));const il=da({profiles:bt,activeProfileId:Tt.id,wsUrl:Tt.wsUrl,token:Tt.token,pairCode:"",autoReconnect:Tt.autoReconnect});return at(il),il},[at]),Ln=y.useCallback(L=>{const Y=Ce.current,ie=Y.profiles.find(ke=>ke.id===Y.activeProfileId);if(!ie||!L.hostId&&!L.hostname)return;const Ae=/^Herdr \d+$/.test(ie.displayName),xe={...ie,...L.hostId?{hostId:L.hostId}:{},...L.hostname?{hostname:L.hostname}:{},...L.hostname&&Ae?{displayName:L.hostname}:{}},fe=da({profiles:Y.profiles.map(ke=>ke.id===ie.id?xe:ke)});at(fe)},[at]);if(!H.current){const L=new Ay(wi(a));H.current=L,L.on("stateChange",(Y,ie,Ae)=>{d(Y),b(Ae);const xe=Ae?`serverErrors.${Ae}`:null,fe=xe?ft.current(xe):null,ke=fe&&fe!==xe?fe:ie;p(ke),Y==="connected"?et("success",ft.current("toasts.connected")):Y==="error"&&et("error",ke||ft.current("toasts.connectionError"))}),L.on("ready",Y=>{qe.current&&(Qe(),je(ie=>ie+1)),qe.current=!0,v(Y.role),D(Y.controllerId),z(Y.hostId),M(Y.hostname),Ln(Y),Y.clientId&&ae(Y.clientId),$(Y.terminalPalette||null)}),L.on("hostReconnecting",Y=>{b(Y||"host_reconnecting"),p(ft.current(`serverErrors.${Y||"host_reconnecting"}`)),v("viewer"),D(void 0),M(void 0),$(null),O(null),R(1),Ee(null),Qe()}),L.on("sessionRestarted",(Y,ie,Ae,xe)=>{Qe(),M(xe),Ln({hostId:L.getHostId(),hostname:xe}),$(Ae||null),je(fe=>fe+1)}),L.on("roleChange",(Y,ie,Ae,xe)=>{v(Y),D(ie),Ae&&z(Ae),xe&&ae(xe)}),L.on("controlGranted",()=>{v("controller"),et("success",ft.current("toasts.controlGranted"))}),L.on("controlDenied",Y=>{et("warning",Y||ft.current("toasts.controlDenied"))}),L.on("controlRevoked",Y=>{v("viewer"),et("warning",Y||ft.current("toasts.controlRevoked"))}),L.on("paired",Y=>{const ie=Ha(Y);et("success",ft.current("toasts.pairedSuccess")),_e(Date.now()),L.reconnectWith(wi(ie))}),L.on("exit",(Y,ie)=>{et("info",`${ft.current("toasts.sessionEnded")}${ie?`: ${ie}`:""}${Y!==void 0?` (${Y})`:""}`)}),L.on("status",Y=>{Ee(Y)}),L.on("error",Y=>{he.current!==null&&(Ue.current&&(clearTimeout(Ue.current),Ue.current=null),he.current=null,ve(nl));const Ae=`serverErrors.${String(Y.code)}`,xe=ft.current(Ae),fe=xe&&xe!==Ae?xe:Y.message||`[${Y.code}]`;et("error",fe)}),L.on("pasteFileReady",Y=>{const ie=he.current;ie!==null&&(Ue.current&&(clearTimeout(Ue.current),Ue.current=null),ve({active:!0,phase:"completed",ratio:1,percent:100,statusText:ft.current("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{he.current===ie&&(he.current=null,ve(nl))},1200));for(const Ae of pe.current)try{Ae(Y)}catch(xe){console.error("Error in pasteFileReady listener:",xe)}}),L.on("rttUpdate",Y=>{O(Y)}),L.on("peerCount",Y=>{R(Math.max(1,Y))}),L.on("sessionReady",()=>{d("connected")}),L.on("binaryData",Y=>{Dn.current(Y)})}const hl=H.current,ml=a.profiles.find(L=>L.id===a.activeProfileId);y.useEffect(()=>{var L;(L=H.current)==null||L.updateConfig(wi(a))},[a]);const Jt=y.useCallback(L=>{H.current&&(L&&H.current.updateConfig(L),H.current.connect(F.current))},[]),un=y.useCallback(()=>{H.current&&H.current.disconnect()},[]),pn=y.useCallback((L=!1)=>{H.current&&H.current.claimControl(L)},[]),pl=y.useCallback(()=>{var L;(L=H.current)==null||L.releaseControl()},[]),Ya=y.useCallback(L=>{var ie;if(S!=="controller"){Rt();return}if(!H.current)return;const Y=ju(L);H.current.sendInput(Y),(ie=cn.current)==null||ie.call(cn,Y)},[S,Rt]),Ul=y.useCallback(L=>{S!=="controller"&&!kr(L)||H.current&&H.current.sendInput(L)},[S]),al=y.useCallback((L,Y)=>{F.current={cols:L,rows:Y},j({cols:L,rows:Y}),H.current&&H.current.sendResize(L,Y)},[]),Bl=y.useCallback((L,Y)=>S!=="controller"?(Rt(),!1):H.current?(H.current.sendPasteFile(L,Y),!0):!1,[S,Rt]),gl=y.useCallback(L=>(pe.current.add(L),()=>{pe.current.delete(L)}),[]),bl=y.useCallback(()=>{Ue.current&&(clearTimeout(Ue.current),Ue.current=null),he.current=null,ve(nl)},[]);y.useEffect(()=>{c!=="connected"&&he.current!==null&&(Ue.current&&(clearTimeout(Ue.current),Ue.current=null),he.current=null,ve(nl))},[c]),y.useEffect(()=>()=>{Ue.current&&clearTimeout(Ue.current)},[]);const Ka=y.useCallback(async L=>{if(S!=="controller")return Rt(),!1;if(!H.current||c!=="connected")return et("error",we("serverErrors.host_offline")),!1;if(he.current!==null)return!1;const Y=++St.current;he.current=Y,Ue.current&&(clearTimeout(Ue.current),Ue.current=null);const ie="dataBase64"in L&&typeof L.dataBase64=="string";try{let Ae;if(ie)Ae=L;else{const fe=L;if(ve({active:!0,phase:"reading",ratio:.1,percent:10,statusText:we("virtualKeyboard.uploadProgressReading")}),!fe||fe.size===0)return et("error",we("clipboard.fileEmpty")),he.current=null,ve(nl),!1;if(fe.type&&!fe.type.startsWith("image/"))return et("error",we("clipboard.unsupportedType")),he.current=null,ve(nl),!1;ve({active:!0,phase:"processing",ratio:.35,percent:35,statusText:we("virtualKeyboard.uploadProgressProcessing")});const ke=await Ep(fe);if(he.current!==Y)return!1;if(!ke)return et("error",we("clipboard.imageTooLarge")),he.current=null,ve(nl),!1;Ae=ke,ve({active:!0,phase:"processing",ratio:.6,percent:60,statusText:we("virtualKeyboard.uploadProgressProcessing")})}ve({active:!0,phase:"sending",ratio:.75,percent:75,statusText:we("virtualKeyboard.uploadProgressSending")});const xe=Bl(Ae.mime,Ae.dataBase64);return he.current!==Y?!1:xe?(ve({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:we("virtualKeyboard.uploadProgressWaitingHost")}),Ue.current=setTimeout(()=>{he.current===Y&&(he.current=null,et("error",we("serverErrors.paste_file_write_failed")),ve(nl))},3e4),!0):(he.current=null,ve(nl),!1)}catch(Ae){return console.error("Failed to process/upload image:",Ae),he.current===Y&&(he.current=null,et("error",we("clipboard.imageTooLarge")),ve(nl)),!1}},[S,c,Rt,et,we,Bl]);return u.jsx(Rp.Provider,{value:{connectionState:c,stateDetail:f,stateCode:m,role:S,controllerId:C,hostId:_,hostname:X,assignedClientId:J,profiles:a.profiles,activeProfileId:a.activeProfileId,activeProfile:ml,isController:S==="controller",sharedWindowCount:U,terminalResetVersion:te,rttMs:ye,statusPayload:Me,lastPairedAt:de,settings:a,hostPalette:Z,terminalDimensions:Le,toasts:q,adapter:hl,language:a.language,t:we,setLanguage:ln,connect:Jt,disconnect:un,switchProfile:wt,addProfileAndConnect:_t,renameProfile:Ba,removeProfile:mn,claimControl:pn,releaseControl:pl,sendKey:Ya,sendBinary:Ul,sendResize:al,updateSettings:It,addToast:et,removeToast:hn,warnViewerMode:Rt,subscribeToOutput:kt,registerInputObserver:On,getPendingOutputChunkCount:Ht,sendPasteFile:Bl,subscribeToPasteFileReady:gl,uploadProgress:ze,uploadImage:Ka,resetUploadProgress:bl},children:o})};function Ct(){const o=y.useContext(Rp);if(!o)throw new Error("useTerminal must be used within a TerminalProvider");return o}function Ap(o){var a,r,c="";if(typeof o=="string"||typeof o=="number")c+=o;else if(typeof o=="object")if(Array.isArray(o)){var d=o.length;for(a=0;a<d;a++)o[a]&&(r=Ap(o[a]))&&(c&&(c+=" "),c+=r)}else for(r in o)o[r]&&(c&&(c+=" "),c+=r);return c}function nv(){for(var o,a,r=0,c="",d=arguments.length;r<d;r++)(o=arguments[r])&&(a=Ap(o))&&(c&&(c+=" "),c+=a);return c}const lv=(o,a)=>{const r=new Array(o.length+a.length);for(let c=0;c<o.length;c++)r[c]=o[c];for(let c=0;c<a.length;c++)r[o.length+c]=a[c];return r},av=(o,a)=>({classGroupId:o,validator:a}),jp=(o=new Map,a=null,r)=>({nextPart:o,validators:a,classGroupId:r}),no="-",Um=[],iv="arbitrary..",rv=o=>{const a=ov(o),{conflictingClassGroups:r,conflictingClassGroupModifiers:c}=o;return{getClassGroupId:p=>{if(p.startsWith("[")&&p.endsWith("]"))return sv(p);const m=p.split(no),b=m[0]===""&&m.length>1?1:0;return Mp(m,b,a)},getConflictingClassGroupIds:(p,m)=>{if(m){const b=c[p],S=r[p];return b?S?lv(S,b):b:S||Um}return r[p]||Um}}},Mp=(o,a,r)=>{if(o.length-a===0)return r.classGroupId;const d=o[a],f=r.nextPart.get(d);if(f){const S=Mp(o,a+1,f);if(S)return S}const p=r.validators;if(p===null)return;const m=a===0?o.join(no):o.slice(a).join(no),b=p.length;for(let S=0;S<b;S++){const v=p[S];if(v.validator(m))return v.classGroupId}},sv=o=>o.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=o.slice(1,-1),r=a.indexOf(":"),c=a.slice(0,r);return c?iv+c:void 0})(),ov=o=>{const{theme:a,classGroups:r}=o;return cv(r,a)},cv=(o,a)=>{const r=jp();for(const c in o){const d=o[c];Ou(d,r,c,a)}return r},Ou=(o,a,r,c)=>{const d=o.length;for(let f=0;f<d;f++){const p=o[f];uv(p,a,r,c)}},uv=(o,a,r,c)=>{if(typeof o=="string"){dv(o,a,r);return}if(typeof o=="function"){fv(o,a,r,c);return}hv(o,a,r,c)},dv=(o,a,r)=>{const c=o===""?a:kp(a,o);c.classGroupId=r},fv=(o,a,r,c)=>{if(mv(o)){Ou(o(c),a,r,c);return}a.validators===null&&(a.validators=[]),a.validators.push(av(r,o))},hv=(o,a,r,c)=>{const d=Object.entries(o),f=d.length;for(let p=0;p<f;p++){const[m,b]=d[p];Ou(b,kp(a,m),r,c)}},kp=(o,a)=>{let r=o;const c=a.split(no),d=c.length;for(let f=0;f<d;f++){const p=c[f];let m=r.nextPart.get(p);m||(m=jp(),r.nextPart.set(p,m)),r=m}return r},mv=o=>"isThemeGetter"in o&&o.isThemeGetter===!0,pv=o=>{if(o<1)return{get:()=>{},set:()=>{}};let a=0,r=Object.create(null),c=Object.create(null);const d=(f,p)=>{r[f]=p,a++,a>o&&(a=0,c=r,r=Object.create(null))};return{get(f){let p=r[f];if(p!==void 0)return p;if((p=c[f])!==void 0)return d(f,p),p},set(f,p){f in r?r[f]=p:d(f,p)}}},Eu="!",Bm=":",gv=[],Hm=(o,a,r,c,d)=>({modifiers:o,hasImportantModifier:a,baseClassName:r,maybePostfixModifierPosition:c,isExternal:d}),bv=o=>{const{prefix:a,experimentalParseClassName:r}=o;let c=d=>{const f=[];let p=0,m=0,b=0,S;const v=d.length;for(let X=0;X<v;X++){const M=d[X];if(p===0&&m===0){if(M===Bm){f.push(d.slice(b,X)),b=X+1;continue}if(M==="/"){S=X;continue}}M==="["?p++:M==="]"?p--:M==="("?m++:M===")"&&m--}const C=f.length===0?d:d.slice(b);let D=C,_=!1;C.endsWith(Eu)?(D=C.slice(0,-1),_=!0):C.startsWith(Eu)&&(D=C.slice(1),_=!0);const z=S&&S>b?S-b:void 0;return Hm(f,_,D,z)};if(a){const d=a+Bm,f=c;c=p=>p.startsWith(d)?f(p.slice(d.length)):Hm(gv,!1,p,void 0,!0)}if(r){const d=c;c=f=>r({className:f,parseClassName:d})}return c},yv=o=>{const a=new Map;return o.orderSensitiveModifiers.forEach((r,c)=>{a.set(r,1e6+c)}),r=>{const c=[];let d=[];for(let f=0;f<r.length;f++){const p=r[f],m=p[0]==="[",b=a.has(p);m||b?(d.length>0&&(d.sort(),c.push(...d),d=[]),c.push(p)):d.push(p)}return d.length>0&&(d.sort(),c.push(...d)),c}},vv=o=>({cache:pv(o.cacheSize),parseClassName:bv(o),sortModifiers:yv(o),postfixLookupClassGroupIds:xv(o),...rv(o)}),xv=o=>{const a=Object.create(null),r=o.postfixLookupClassGroups;if(r)for(let c=0;c<r.length;c++)a[r[c]]=!0;return a},Sv=/\s+/,wv=(o,a)=>{const{parseClassName:r,getClassGroupId:c,getConflictingClassGroupIds:d,sortModifiers:f,postfixLookupClassGroupIds:p}=a,m=[],b=o.trim().split(Sv);let S="";for(let v=b.length-1;v>=0;v-=1){const C=b[v],{isExternal:D,modifiers:_,hasImportantModifier:z,baseClassName:X,maybePostfixModifierPosition:M}=r(C);if(D){S=C+(S.length>0?" "+S:S);continue}let Z=!!M,$;if(Z){const U=X.substring(0,M);$=c(U);const R=$&&p[$]?c(X):void 0;R&&R!==$&&($=R,Z=!1)}else $=c(X);if(!$){if(!Z){S=C+(S.length>0?" "+S:S);continue}if($=c(X),!$){S=C+(S.length>0?" "+S:S);continue}Z=!1}const J=_.length===0?"":_.length===1?_[0]:f(_).join(":"),ae=z?J+Eu:J,ye=ae+$;if(m.indexOf(ye)>-1)continue;m.push(ye);const O=d($,Z);for(let U=0;U<O.length;++U){const R=O[U];m.push(ae+R)}S=C+(S.length>0?" "+S:S)}return S},Cv=(...o)=>{let a=0,r,c,d="";for(;a<o.length;)(r=o[a++])&&(c=_p(r))&&(d&&(d+=" "),d+=c);return d},_p=o=>{if(typeof o=="string")return o;let a,r="";for(let c=0;c<o.length;c++)o[c]&&(a=_p(o[c]))&&(r&&(r+=" "),r+=a);return r},Tv=(o,...a)=>{let r,c,d,f;const p=b=>{const S=a.reduce((v,C)=>C(v),o());return r=vv(S),c=r.cache.get,d=r.cache.set,f=m,m(b)},m=b=>{const S=c(b);if(S)return S;const v=wv(b,r);return d(b,v),v};return f=p,(...b)=>f(Cv(...b))},Nv=[],Xt=o=>{const a=r=>r[o]||Nv;return a.isThemeGetter=!0,a},zp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Dp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ev=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Rv=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Av=/\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$/,jv=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Mv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kv=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fa=o=>Ev.test(o),Ye=o=>!!o&&!Number.isNaN(Number(o)),dl=o=>!!o&&Number.isInteger(Number(o)),pu=o=>o.endsWith("%")&&Ye(o.slice(0,-1)),Ol=o=>Rv.test(o),Op=()=>!0,_v=o=>Av.test(o)&&!jv.test(o),Lu=()=>!1,zv=o=>Mv.test(o),Dv=o=>kv.test(o),Ov=o=>!re(o)&&!se(o),Lv=o=>o.startsWith("@container")&&(o[10]==="/"&&o[11]!==void 0||o[11]==="s"&&o[16]!==void 0&&o.startsWith("-size/",10)||o[11]==="n"&&o[18]!==void 0&&o.startsWith("-normal/",10)),Uv=o=>ma(o,Bp,Lu),re=o=>zp.test(o),za=o=>ma(o,Hp,_v),Ym=o=>ma(o,Xv,Ye),Bv=o=>ma(o,Kp,Op),Hv=o=>ma(o,Yp,Lu),Km=o=>ma(o,Lp,Lu),Yv=o=>ma(o,Up,Dv),Fs=o=>ma(o,Gp,zv),se=o=>Dp.test(o),vr=o=>Ua(o,Hp),Kv=o=>Ua(o,Yp),Gm=o=>Ua(o,Lp),Gv=o=>Ua(o,Bp),qv=o=>Ua(o,Up),Zs=o=>Ua(o,Gp,!0),Vv=o=>Ua(o,Kp,!0),ma=(o,a,r)=>{const c=zp.exec(o);return c?c[1]?a(c[1]):r(c[2]):!1},Ua=(o,a,r=!1)=>{const c=Dp.exec(o);return c?c[1]?a(c[1]):r:!1},Lp=o=>o==="position"||o==="percentage",Up=o=>o==="image"||o==="url",Bp=o=>o==="length"||o==="size"||o==="bg-size",Hp=o=>o==="length",Xv=o=>o==="number",Yp=o=>o==="family-name",Kp=o=>o==="number"||o==="weight",Gp=o=>o==="shadow",Fv=()=>{const o=Xt("color"),a=Xt("font"),r=Xt("text"),c=Xt("font-weight"),d=Xt("tracking"),f=Xt("leading"),p=Xt("breakpoint"),m=Xt("container"),b=Xt("spacing"),S=Xt("radius"),v=Xt("shadow"),C=Xt("inset-shadow"),D=Xt("text-shadow"),_=Xt("drop-shadow"),z=Xt("blur"),X=Xt("perspective"),M=Xt("aspect"),Z=Xt("ease"),$=Xt("animate"),J=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ae=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],ye=()=>[...ae(),se,re],O=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto","contain","none"],R=()=>[se,re,b],te=()=>[fa,"full","auto",...R()],je=()=>[dl,"none","subgrid",se,re],Me=()=>["auto",{span:["full",dl,se,re]},dl,se,re],Ee=()=>[dl,"auto",se,re],de=()=>["auto","min","max","fr",se,re],_e=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Le=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...R()],q=()=>[fa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],W=()=>[fa,"screen","full","dvw","lvw","svw","min","max","fit",...R()],Ce=()=>[fa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],H=()=>[o,se,re],qe=()=>[...ae(),Gm,Km,{position:[se,re]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],pe=()=>["auto","cover","contain",Gv,Uv,{size:[se,re]}],ze=()=>[pu,vr,za],ve=()=>["","none","full",S,se,re],he=()=>["",Ye,vr,za],St=()=>["solid","dashed","dotted","double"],Ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],we=()=>[Ye,pu,Gm,Km],ft=()=>["","none",z,se,re],lt=()=>["none",Ye,se,re],mt=()=>["none",Ye,se,re],Bt=()=>[Ye,se,re],gt=()=>[fa,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ol],breakpoint:[Ol],color:[Op],container:[Ol],"drop-shadow":[Ol],ease:["in","out","in-out"],font:[Ov],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ol],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ol],shadow:[Ol],spacing:["px",Ye],text:[Ol],"text-shadow":[Ol],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",fa,re,se,M]}],container:["container"],"container-type":[{"@container":["","normal","size",se,re]}],"container-named":[Lv],columns:[{columns:[Ye,re,se,m]}],"break-after":[{"break-after":J()}],"break-before":[{"break-before":J()}],"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:ye()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:U()}],"overscroll-x":[{"overscroll-x":U()}],"overscroll-y":[{"overscroll-y":U()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:te()}],"inset-x":[{"inset-x":te()}],"inset-y":[{"inset-y":te()}],start:[{"inset-s":te(),start:te()}],end:[{"inset-e":te(),end:te()}],"inset-bs":[{"inset-bs":te()}],"inset-be":[{"inset-be":te()}],top:[{top:te()}],right:[{right:te()}],bottom:[{bottom:te()}],left:[{left:te()}],visibility:["visible","invisible","collapse"],z:[{z:[dl,"auto",se,re]}],basis:[{basis:[fa,"full","auto",m,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ye,fa,"auto","initial","none",re]}],grow:[{grow:["",Ye,se,re]}],shrink:[{shrink:["",Ye,se,re]}],order:[{order:[dl,"first","last","none",se,re]}],"grid-cols":[{"grid-cols":je()}],"col-start-end":[{col:Me()}],"col-start":[{"col-start":Ee()}],"col-end":[{"col-end":Ee()}],"grid-rows":[{"grid-rows":je()}],"row-start-end":[{row:Me()}],"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":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[..._e(),"normal"]}],"justify-items":[{"justify-items":[...Le(),"normal"]}],"justify-self":[{"justify-self":["auto",...Le()]}],"align-content":[{content:["normal",..._e()]}],"align-items":[{items:[...Le(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Le(),{baseline:["","last"]}]}],"place-content":[{"place-content":_e()}],"place-items":[{"place-items":[...Le(),"baseline"]}],"place-self":[{"place-self":["auto",...Le()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...Ce()]}],"min-block-size":[{"min-block":["auto",...Ce()]}],"max-block-size":[{"max-block":["none",...Ce()]}],w:[{w:[m,"screen",...q()]}],"min-w":[{"min-w":[m,"screen","none",...q()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[p]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",r,vr,za]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[c,Vv,Bv]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",pu,re]}],"font-family":[{font:[Kv,Hv,a]}],"font-features":[{"font-features":[re]}],"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:[d,se,re]}],"line-clamp":[{"line-clamp":[Ye,"none",se,Ym]}],leading:[{leading:[f,...R()]}],"list-image":[{"list-image":["none",se,re]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,re]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...St(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ye,"from-font","auto",se,za]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[Ye,"auto",se,re]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"tab-size":[{tab:[dl,se,re]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,re]}],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",se,re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:qe()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:pe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},dl,se,re],radial:["",se,re],conic:[dl,se,re]},qv,Yv]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:ze()}],"gradient-via-pos":[{via:ze()}],"gradient-to-pos":[{to:ze()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:ve()}],"rounded-s":[{"rounded-s":ve()}],"rounded-e":[{"rounded-e":ve()}],"rounded-t":[{"rounded-t":ve()}],"rounded-r":[{"rounded-r":ve()}],"rounded-b":[{"rounded-b":ve()}],"rounded-l":[{"rounded-l":ve()}],"rounded-ss":[{"rounded-ss":ve()}],"rounded-se":[{"rounded-se":ve()}],"rounded-ee":[{"rounded-ee":ve()}],"rounded-es":[{"rounded-es":ve()}],"rounded-tl":[{"rounded-tl":ve()}],"rounded-tr":[{"rounded-tr":ve()}],"rounded-br":[{"rounded-br":ve()}],"rounded-bl":[{"rounded-bl":ve()}],"border-w":[{border:he()}],"border-w-x":[{"border-x":he()}],"border-w-y":[{"border-y":he()}],"border-w-s":[{"border-s":he()}],"border-w-e":[{"border-e":he()}],"border-w-bs":[{"border-bs":he()}],"border-w-be":[{"border-be":he()}],"border-w-t":[{"border-t":he()}],"border-w-r":[{"border-r":he()}],"border-w-b":[{"border-b":he()}],"border-w-l":[{"border-l":he()}],"divide-x":[{"divide-x":he()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":he()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...St(),"hidden","none"]}],"divide-style":[{divide:[...St(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-bs":[{"border-bs":H()}],"border-color-be":[{"border-be":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...St(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ye,se,re]}],"outline-w":[{outline:["",Ye,vr,za]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",v,Zs,Fs]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",C,Zs,Fs]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[Ye,za]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",D,Zs,Fs]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[Ye,se,re]}],"mix-blend":[{"mix-blend":[...Ue(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ue()}],"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":[Ye]}],"mask-image-linear-from-pos":[{"mask-linear-from":we()}],"mask-image-linear-to-pos":[{"mask-linear-to":we()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":we()}],"mask-image-t-to-pos":[{"mask-t-to":we()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":we()}],"mask-image-r-to-pos":[{"mask-r-to":we()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":we()}],"mask-image-b-to-pos":[{"mask-b-to":we()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":we()}],"mask-image-l-to-pos":[{"mask-l-to":we()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":we()}],"mask-image-x-to-pos":[{"mask-x-to":we()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":we()}],"mask-image-y-to-pos":[{"mask-y-to":we()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[se,re]}],"mask-image-radial-from-pos":[{"mask-radial-from":we()}],"mask-image-radial-to-pos":[{"mask-radial-to":we()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"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":ae()}],"mask-image-conic-pos":[{"mask-conic":[Ye]}],"mask-image-conic-from-pos":[{"mask-conic-from":we()}],"mask-image-conic-to-pos":[{"mask-conic-to":we()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:qe()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:pe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,re]}],filter:[{filter:["","none",se,re]}],blur:[{blur:ft()}],brightness:[{brightness:[Ye,se,re]}],contrast:[{contrast:[Ye,se,re]}],"drop-shadow":[{"drop-shadow":["","none",_,Zs,Fs]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",Ye,se,re]}],"hue-rotate":[{"hue-rotate":[Ye,se,re]}],invert:[{invert:["",Ye,se,re]}],saturate:[{saturate:[Ye,se,re]}],sepia:[{sepia:["",Ye,se,re]}],"backdrop-filter":[{"backdrop-filter":["","none",se,re]}],"backdrop-blur":[{"backdrop-blur":ft()}],"backdrop-brightness":[{"backdrop-brightness":[Ye,se,re]}],"backdrop-contrast":[{"backdrop-contrast":[Ye,se,re]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ye,se,re]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ye,se,re]}],"backdrop-invert":[{"backdrop-invert":["",Ye,se,re]}],"backdrop-opacity":[{"backdrop-opacity":[Ye,se,re]}],"backdrop-saturate":[{"backdrop-saturate":[Ye,se,re]}],"backdrop-sepia":[{"backdrop-sepia":["",Ye,se,re]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,re]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ye,"initial",se,re]}],ease:[{ease:["linear","initial",Z,se,re]}],delay:[{delay:[Ye,se,re]}],animate:[{animate:["none",$,se,re]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[X,se,re]}],"perspective-origin":[{"perspective-origin":ye()}],rotate:[{rotate:lt()}],"rotate-x":[{"rotate-x":lt()}],"rotate-y":[{"rotate-y":lt()}],"rotate-z":[{"rotate-z":lt()}],scale:[{scale:mt()}],"scale-x":[{"scale-x":mt()}],"scale-y":[{"scale-y":mt()}],"scale-z":[{"scale-z":mt()}],"scale-3d":["scale-3d"],skew:[{skew:Bt()}],"skew-x":[{"skew-x":Bt()}],"skew-y":[{"skew-y":Bt()}],transform:[{transform:[se,re,"","none","gpu","cpu"]}],"transform-origin":[{origin:ye()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:gt()}],"translate-x":[{"translate-x":gt()}],"translate-y":[{"translate-y":gt()}],"translate-z":[{"translate-z":gt()}],"translate-none":["translate-none"],zoom:[{zoom:[dl,se,re]}],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"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",se,re]}],"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":H()}],"scrollbar-track-color":[{"scrollbar-track":H()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",se,re]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[Ye,vr,za,Ym]}],stroke:[{stroke:["none",...H()]}],"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"]}},Zv=Tv(Fv);function P(...o){return Zv(nv(o))}var Qv=dp();const Ge={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},Qn={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"}},Dr={ok:Qn.ok.text,warn:Qn.warn.text,bad:Qn.bad.text,idle:Qn.idle.text,accent:Qn.accent.text,alt:Qn.alt.text,info:Qn.info.text},Jn=({level:o,className:a})=>u.jsx("span",{"aria-hidden":"true",className:P("select-none leading-none",Dr[o],a),children:o==="idle"?Ge.off:Ge.on}),qp=({className:o})=>u.jsx("span",{"aria-hidden":"true",className:P("select-none text-tui-faint",o),children:Ge.dot}),on=({title:o,aside:a,tone:r="accent",className:c,bodyClassName:d,children:f,...p})=>u.jsxs("fieldset",{className:P("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",o?"px-3 pb-3 pt-1":"p-3",c),...p,children:[o?u.jsx("legend",{className:P("flex items-center gap-2 text-tui font-bold",Dr[r]),children:u.jsx("span",{children:o})}):null,a?u.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:a}):null,u.jsx("div",{className:P("min-w-0",d),children:f})]}),ll=({label:o,labelWidth:a=16,className:r,children:c})=>u.jsxs("div",{className:P("flex items-baseline gap-2 text-tui",r),children:[u.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${a}ch`},title:typeof o=="string"?o:void 0,children:o}),u.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:c})]}),Oa=({className:o,label:a})=>a?u.jsxs("div",{className:P("flex items-center gap-2",o),children:[u.jsx("span",{className:"h-px w-3 bg-tui-border-dim","aria-hidden":"true"}),u.jsx("span",{className:"text-tui-sm text-tui-faint",children:a}),u.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):u.jsx("div",{className:P("h-px w-full bg-tui-border-dim",o),"aria-hidden":"true"}),Iv={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"},He=({variant:o="default",brackets:a=!0,glyph:r,block:c=!1,className:d,children:f,type:p="button",...m})=>u.jsxs("button",{type:p,className:P("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",Iv[o],c&&"w-full",d),...m,children:[a?u.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,r?u.jsx("span",{"aria-hidden":"true",className:"leading-none",children:r}):null,u.jsx("span",{className:"truncate",children:f}),a?u.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),ao=({tone:o="accent",dot:a=!1,className:r,children:c})=>u.jsxs("span",{className:P("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",Dr[o],r),children:[a?u.jsx(Jn,{level:o}):null,c]}),Uu=({tabs:o,activeId:a,onSelect:r,ariaLabel:c,className:d,labelClassName:f})=>u.jsx("nav",{className:P("flex items-center gap-2",d),"aria-label":c,children:o.map((p,m)=>{const b=p.id===a;return u.jsxs(fl.Fragment,{children:[m>0?u.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:Ge.tabDivider}):null,u.jsxs("button",{type:"button",onClick:()=>r(p.id),"aria-current":b?"page":void 0,"aria-label":p.ariaLabel??p.label,title:p.title,className:P("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",b?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[p.index!==void 0?u.jsx("span",{"aria-hidden":"true",className:P("text-tui-faint",b&&"text-tui-accent"),children:p.index}):null,u.jsx("span",{"aria-hidden":"true",className:P("ml-1",f),children:p.label})]})]},p.id)})}),Vp=({hints:o,className:a})=>u.jsx("div",{className:P("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",a),children:o.map((r,c)=>u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx("kbd",{className:"border border-tui-border-dim px-1 not-italic text-tui-muted",children:r.keys}),u.jsx("span",{children:r.action})]},`${r.keys}-${c}`))}),_n=({htmlFor:o,hint:a,className:r,children:c})=>u.jsxs("label",{htmlFor:o,className:P("block text-tui-sm font-bold text-tui-muted",r),children:[c,a?u.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:a}):null]}),In=fl.forwardRef(({className:o,...a},r)=>u.jsx("input",{ref:r,className:P("tui-input w-full px-2 py-1 text-tui",o),...a}));In.displayName="Input";const Bu=fl.forwardRef(({className:o,children:a,...r},c)=>u.jsx("select",{ref:c,className:P("tui-input w-full px-2 py-1 text-tui",o),...r,children:a}));Bu.displayName="Select";const Ru=({checked:o,onChange:a,disabled:r=!1,label:c,description:d,className:f,id:p})=>u.jsxs("label",{className:P("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",r&&"cursor-not-allowed opacity-60",f),children:[u.jsx("input",{id:p,type:"checkbox",className:"sr-only",checked:o,disabled:r,onChange:m=>a(m.target.checked)}),u.jsx("span",{"aria-hidden":"true",className:P("mt-px shrink-0 font-bold leading-tight",o?"text-tui-ok":"text-tui-faint",!r&&"group-hover:text-tui-accent"),children:o?"[x]":"[ ]"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:P("block",o?"text-tui-text":"text-tui-muted"),children:c}),d?u.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:d}):null]})]}),xr=({checked:o,onChange:a,name:r,disabled:c=!1,label:d,description:f,className:p})=>u.jsxs("label",{className:P("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",c&&"cursor-not-allowed opacity-60",p),children:[u.jsx("input",{type:"radio",name:r,className:"sr-only",checked:o,disabled:c,onChange:a}),u.jsx("span",{"aria-hidden":"true",className:P("mt-px shrink-0 font-bold leading-tight",o?"text-tui-accent":"text-tui-faint",!c&&"group-hover:text-tui-accent"),children:o?"(•)":"( )"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:P("block",o?"text-tui-text":"text-tui-muted"),children:d}),f?u.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:f}):null]})]}),Jv=({value:o,width:a=20,tone:r="accent",className:c})=>{const d=Number.isFinite(o)?Math.min(1,Math.max(0,o)):0,f=Math.round(d*a);return u.jsxs("span",{className:P("inline-flex select-none whitespace-pre font-mono leading-none",c),role:"presentation",children:[u.jsx("span",{className:Dr[r],children:Ge.meterFull.repeat(f)}),u.jsx("span",{className:"text-tui-border",children:Ge.meterEmpty.repeat(Math.max(0,a-f))})]})},Wv={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"},Pv=({ratio:o,label:a,tone:r="accent",className:c,...d})=>{const f=Number.isFinite(o)?Math.min(1,Math.max(0,o)):0;return u.jsxs("div",{className:P("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",c),role:"progressbar","aria-valuenow":Math.round(f*100),"aria-valuemin":0,"aria-valuemax":100,...d,children:[u.jsx("div",{className:P("absolute inset-y-0 left-0",Wv[r]),style:{width:`${f*100}%`},"aria-hidden":"true"}),a!==void 0?u.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:a}):null]})};function Hu({columns:o,items:a,rowKey:r,empty:c,className:d}){return a.length===0?u.jsx("div",{className:P("px-1 py-4 text-center text-tui text-tui-faint",d),children:c}):u.jsx("div",{className:P("w-full overflow-x-auto",d),children:u.jsxs("table",{className:"w-full border-collapse text-tui",children:[u.jsx("thead",{children:u.jsx("tr",{className:"border-b border-tui-border",children:o.map(f=>u.jsx("th",{scope:"col",style:f.width?{width:`${f.width}ch`}:void 0,className:P("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",f.align==="right"?"text-right":"text-left",f.className),children:f.header},f.key))})}),u.jsx("tbody",{children:a.map((f,p)=>u.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:o.map(m=>u.jsx("td",{className:P("px-2 py-1 align-top text-tui-text",m.align==="right"?"text-right":"text-left",m.className),children:m.render(f,p)},m.key))},r(f,p)))})]})})}const Yu=({isOpen:o,onClose:a,title:r,subtitle:c,closeLabel:d,footer:f,hints:p,size:m="md",className:b,children:S})=>{if(!o)return null;const v=m==="sm"?"max-w-md":m==="lg"?"max-w-3xl":"max-w-xl",C=`tui-modal-${r.replace(/\s+/g,"-").toLowerCase()}`,D=u.jsx("div",{className:"fixed inset-0 inset-x-0 z-50 grid place-items-center overflow-y-auto bg-tui-crust/85 p-3 sm:p-6",style:{height:"var(--app-height, 100dvh)",width:"100vw"},role:"dialog","aria-modal":"true","aria-labelledby":C,onMouseDown:_=>{_.target===_.currentTarget&&a()},children:u.jsxs("div",{className:P("flex w-full flex-col border border-tui-border bg-tui-base",v,b),style:{maxHeight:"calc(var(--app-height, 100dvh) - 1.5rem)"},children:[u.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-tui-border bg-tui-mantle px-3 py-1.5",children:[u.jsx("h2",{id:C,className:"truncate text-tui font-bold text-tui-accent",children:r}),c?u.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-sm text-tui-faint",children:c}):u.jsx("span",{className:"flex-1"}),u.jsx(He,{variant:"ghost",onClick:a,"aria-label":d,title:d,children:"esc"})]}),u.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:S}),f||p?u.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:[p?u.jsx(Vp,{hints:p}):u.jsx("span",{}),f?u.jsx("div",{className:"flex items-center gap-2",children:f}):null]}):null]})});return typeof document>"u"?D:Qv.createPortal(D,document.body)},Ps=({tone:o="accent",className:a,children:r,action:c})=>{const d=o==="ok"?Ge.check:o==="bad"?Ge.cross:o==="warn"?Ge.warn:"›",f=Qn[o].edgeL;return u.jsxs("div",{className:P("flex items-start gap-2 border border-tui-border-dim border-l-2 bg-tui-mantle px-2 py-1.5 text-tui",f,a),children:[u.jsx("span",{"aria-hidden":"true",className:P("shrink-0 font-bold",Dr[o]),children:d}),u.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:r}),c?u.jsx("div",{className:"shrink-0",children:c}):null]})},$v=({active:o=!1,className:a,children:r})=>u.jsx("span",{className:P("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",o?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",a),children:r}),qm=({items:o,className:a})=>{const r=o.filter(Boolean);return u.jsx("span",{className:P("flex min-w-0 items-center gap-1.5",a),children:r.map((c,d)=>u.jsxs(fl.Fragment,{children:[d>0?u.jsx(qp,{className:"shrink-0"}):null,c]},d))})},Xp=({left:o,right:a,className:r})=>u.jsxs("footer",{className:P("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",r),children:[u.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:o}),u.jsx("div",{className:"flex shrink-0 items-center gap-3",children:a})]}),ex=({name:o,tagline:a,aside:r,tabs:c,activeTabId:d,onSelectTab:f,tabsAriaLabel:p,hints:m,footerAside:b,bodyClassName:S,className:v,children:C})=>u.jsxs("div",{className:P("flex h-full min-h-0 w-full flex-col bg-tui-crust",v),children:[u.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:[u.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[u.jsx("span",{className:"shrink-0 font-bold text-tui-accent",children:o}),a?u.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:a}):null]}),r?u.jsx("span",{className:"flex shrink-0 items-center gap-2",children:r}):null]}),c&&c.length>0&&d!==void 0&&f?u.jsx("div",{className:"scrollbar-none shrink-0 overflow-x-auto border-b border-tui-border bg-tui-mantle px-2",children:u.jsx(Uu,{tabs:c,activeId:d,onSelect:f,ariaLabel:p,className:"gap-3"})}):null,u.jsx("div",{className:P("min-h-0 flex-1 overflow-y-auto p-2",S),children:C}),m||b?u.jsx(Xp,{left:m?u.jsx(Vp,{hints:m}):null,right:b}):null]}),Vm=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],Ei=({className:o,label:a})=>{const[r,c]=fl.useState(0);return fl.useEffect(()=>{const d=setInterval(()=>c(f=>(f+1)%Vm.length),90);return()=>clearInterval(d)},[]),u.jsxs("span",{className:P("inline-flex items-center gap-1.5",o),role:"status",children:[u.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:Vm[r]}),a?u.jsx("span",{children:a}):null]})},Qs="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",Is="text-tui-muted hover:border-tui-border hover:text-tui-accent",tx="border-tui-accent bg-tui-accent text-tui-crust",nx=({currentView:o,onNavigate:a,showAdminEntry:r=!0,onOpenPairing:c,onOpenSettings:d,onToggleVirtualKeyboard:f,isVirtualKeyboardOpen:p})=>{const{addToast:m,language:b,setLanguage:S,t:v}=Ct(),C=()=>{const _=b==="zh"?"en":"zh";S(_),m("info",Du(_,"toasts.switchedLanguage",{lang:_==="zh"?"简体中文":"English"}))},D=[{id:"terminal",label:v("header.terminalTab"),index:1,ariaLabel:v("header.terminalTab")},...r||o==="admin"?[{id:"admin",label:v("header.adminTab"),index:2,ariaLabel:v("header.adminTab")}]:[]];return u.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:u.jsxs("div",{className:"scrollbar-none flex min-h-[var(--tui-row)] items-center gap-2 overflow-x-auto text-tui",children:[u.jsxs("span",{className:"flex shrink-0 items-baseline gap-2",children:[u.jsx("span",{className:"font-bold text-tui-accent",children:"herdr-remote"}),u.jsx("span",{className:"hidden text-tui-sm text-tui-faint sm:inline",children:v("header.tagline")})]}),u.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),u.jsx(Uu,{tabs:D,activeId:o,onSelect:_=>a(_),ariaLabel:v("header.mainNavigationAria"),className:"shrink-0 gap-3"}),u.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),u.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[u.jsx("button",{type:"button",onClick:C,className:P(Qs,Is),title:v("header.languageToggleTitle"),"aria-label":v("header.languageToggleTitle"),children:v("header.languageShort")}),o==="terminal"&&u.jsx("button",{type:"button",onClick:f,className:P(Qs,p?tx:Is),title:v("header.virtualKeyboardTitle"),"aria-label":v("header.virtualKeyboardTitle"),children:v("header.actionKeyboard")}),u.jsx("button",{type:"button",onClick:c,className:P(Qs,Is),title:v("header.pairingTitle"),"aria-label":v("header.pairingTitle"),children:v("header.actionPairing")}),u.jsx("button",{type:"button",onClick:d,className:P(Qs,Is),title:v("header.settingsTitle"),"aria-label":v("header.settingsTitle"),children:v("header.actionSettings")})]})]})})},Js=({tone:o,glyph:a,message:r,assertive:c=!1,action:d})=>u.jsxs("aside",{className:P("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",Qn[o].edgeB),"aria-live":c?"assertive":"polite",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx("span",{"aria-hidden":"true",className:P("shrink-0",Qn[o].text),children:a}),u.jsx("span",{className:"truncate text-tui-text",children:r})]}),d]}),lx=()=>{const{connectionState:o,stateDetail:a,connect:r,settings:c,t:d}=Ct();return o==="connected"||!c.token&&!c.pairCode&&o==="disconnected"?null:o==="connecting"?u.jsx(Js,{tone:"accent",glyph:u.jsx(Ei,{}),message:d("statusBanner.connecting")}):o==="reconnecting"?u.jsx(Js,{tone:"warn",glyph:u.jsx(Ei,{}),assertive:!0,message:a||d("statusBanner.reconnectingDefault"),action:u.jsx(He,{variant:"warn",onClick:()=>r(),className:"shrink-0",children:d("statusBanner.reconnectNow")})}):o==="error"?u.jsx(Js,{tone:"bad",glyph:Ge.cross,assertive:!0,message:a||d("statusBanner.errorDefault"),action:u.jsx(He,{variant:"danger",onClick:()=>r(),className:"shrink-0",children:d("common.retry")})}):o==="disconnected"?u.jsx(Js,{tone:"idle",glyph:Ge.off,message:d("statusBanner.disconnected"),action:u.jsx(He,{variant:"primary",onClick:()=>r(),className:"shrink-0",children:d("common.connect")})}):null};var ax=iy(),ix=ry();const rx=20,sx=6,ox=500,cx=300,Ri=13,Fp=.602,Zp=1.3;function Ll(o,a){return Number.isFinite(o)&&o>0?o:a}function Xm(o,a,r){return Math.min(r,Math.max(a,o))}function Fm(o){const{width:a,height:r,cellWidth:c,cellHeight:d,minCols:f=rx,minRows:p=sx,maxCols:m=ox,maxRows:b=cx}=o,S=Ll(c,Ri*Fp),v=Ll(d,Ri*Zp);return{cols:Xm(Math.floor(Ll(a,0)/S),f,m),rows:Xm(Math.floor(Ll(r,0)/v),p,b)}}function ha(o,a=Ri){var c,d,f;if(o)try{const p=o._core,m=(f=(d=(c=p==null?void 0:p._renderService)==null?void 0:c.dimensions)==null?void 0:d.css)==null?void 0:f.cell;if(m&&m.width&&m.width>0&&m.height&&m.height>0)return{cellWidth:m.width,cellHeight:m.height,measured:!0}}catch{}const r=Ll(a,Ri);return{cellWidth:Math.round(r*Fp*100)/100,cellHeight:Math.round(r*Zp*100)/100,measured:!1}}function ux(o){var c;const a=(c=o==null?void 0:o.querySelector)==null?void 0:c.call(o,".xterm-viewport");if(!a)return 0;const r=(a.offsetWidth||0)-(a.clientWidth||0);return Number.isFinite(r)&&r>0?r:0}function gu(o,a,r){if(!o)return{width:a,height:r};let c=0,d=0;if(typeof o.getBoundingClientRect=="function"){const f=o.getBoundingClientRect();c=(f==null?void 0:f.width)||0,d=(f==null?void 0:f.height)||0}return{width:Ll(c,Ll(o.clientWidth,a)),height:Ll(d,Ll(o.clientHeight,r))}}function Qp(o,a,r,c){const d=Number.isFinite(c)&&c>.01?c:1;return{clientX:r.left+(o-r.left)/d,clientY:r.top+(a-r.top)/d}}function Sr(o){var a,r;if(!o)return!1;try{const c=o.modes;if(c&&typeof c.mouseTrackingMode=="string"&&c.mouseTrackingMode!=="none")return!0;const d=o._core;if((a=d==null?void 0:d._coreMouseService)!=null&&a.areMouseEventsActive||(r=d==null?void 0:d.coreMouseService)!=null&&r.areMouseEventsActive||d!=null&&d.mouseMode&&d.mouseMode!=="none")return!0}catch{}return!1}function dx(o,a){const r=a.button??0,c=a.buttons??(o==="mouseup"?0:1);return new MouseEvent(o,{bubbles:!0,cancelable:!0,clientX:a.clientX,clientY:a.clientY,screenX:a.clientX,screenY:a.clientY,button:r,buttons:c})}function Zm(o,a,r){const c=dx(a,r);return o.dispatchEvent(c)}class fx{constructor(a){Se(this,"options");Se(this,"state","idle");Se(this,"startX",0);Se(this,"startY",0);Se(this,"lastX",0);Se(this,"lastY",0);Se(this,"activeTarget",null);Se(this,"longPressTimer",null);Se(this,"capturedPointerId",null);Se(this,"captureElement",null);Se(this,"scrollRemainderY",0);Se(this,"isSnapshotScrolling",!1);Se(this,"snapshotRows",0);this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...a}}getState(){return this.state}setGestureState(a){var r,c;this.state!==a&&(this.state=a,(c=(r=this.options).onGestureStateChange)==null||c.call(r,a))}getActiveBuffer(a){var r;try{return((r=a.buffer)==null?void 0:r.active)||null}catch{return null}}getViewportY(a){var c;const r=(c=this.getActiveBuffer(a))==null?void 0:c.viewportY;return typeof r=="number"&&Number.isFinite(r)?r:null}blurTerminal(a){var r;try{(r=a.blur)==null||r.call(a)}catch{}}getLogicalCoordinates(a,r){const c=this.options.getScale?this.options.getScale():1,d=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(c!==1&&d&&typeof d.getBoundingClientRect=="function"){const f=d.getBoundingClientRect();return Qp(a,r,f,c)}return{clientX:a,clientY:r}}getViewportElement(a){var d;const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(r==null?void 0:r.querySelector(".xterm-viewport"))||((d=a.element)==null?void 0:d.querySelector(".xterm-viewport"))||null}isInputLineHit(a,r){var $;const c=($=r.buffer)==null?void 0:$.active,d=this.options.getSurfaceElement?this.options.getSurfaceElement():null,f=(d==null?void 0:d.querySelector(".xterm-screen"))||r.element||d,p=ha(r);if(!f||typeof f.getBoundingClientRect!="function"||p.cellHeight<=0)return!1;const m=f.getBoundingClientRect(),b=this.getLogicalCoordinates(a.clientX,a.clientY),S=m.width>0&&m.height>0;if(![c==null?void 0:c.cursorY,c==null?void 0:c.viewportY,c==null?void 0:c.baseY].every(J=>typeof J=="number"&&Number.isFinite(J)))return!1;const C=c==null?void 0:c.cursorY,D=c==null?void 0:c.viewportY,z=(c==null?void 0:c.baseY)+C-D,X=m.top+z*p.cellHeight,M=X+p.cellHeight,Z=Number(r.rows);return z>=0&&(!Number.isFinite(Z)||z<Z)&&b.clientY>=X-2&&b.clientY<=M+2&&(!S||b.clientX>=m.left&&b.clientX<=m.right)}resolveDispatchTarget(a,r){var m;const c=this.options.getSurfaceElement?this.options.getSurfaceElement():null,d=(c==null?void 0:c.querySelector(".xterm-screen"))||r.querySelector(".xterm-screen")||null,f=((m=d==null?void 0:d.closest)==null?void 0:m.call(d,".xterm"))||null;let p=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(p=document.elementFromPoint(a.clientX,a.clientY)),p&&f&&(p===f||f.contains(p))?p:d||c||r}getMouseReport(a,r){const c=this.options.getSurfaceElement?this.options.getSurfaceElement():null,d=(c==null?void 0:c.querySelector(".xterm-screen"))||r.element;if(!d||typeof d.getBoundingClientRect!="function")return null;const f=d.getBoundingClientRect(),p=this.getLogicalCoordinates(a.clientX,a.clientY),m=ha(r);if(m.cellWidth<=0||m.cellHeight<=0)return null;const b=Math.max(1,f.width||r.cols*m.cellWidth),S=Math.max(1,f.height||r.rows*m.cellHeight),v=Math.max(0,Math.min(b-1,p.clientX-f.left)),C=Math.max(0,Math.min(S-1,p.clientY-f.top)),D=Math.max(0,Math.min(r.cols-1,Math.floor(v/m.cellWidth))),_=Math.max(0,Math.min(r.rows-1,Math.floor(C/m.cellHeight)));return{col:D,row:_,x:Math.floor(v),y:Math.floor(C),button:0,action:0}}getCoreMouseService(a){var c,d;const r=a;return r.coreMouseService||((c=r._core)==null?void 0:c.coreMouseService)||((d=r._core)==null?void 0:d._coreMouseService)||null}getCoreService(a){var c;const r=a;return r.coreService||((c=r._core)==null?void 0:c.coreService)||null}getWheelDispatchTarget(a){const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(r==null?void 0:r.querySelector(".xterm"))||a.element||null}dispatchWheel(a,r,c,d){const f=this.getWheelDispatchTarget(c);if(!f||typeof WheelEvent>"u"||r===0)return!1;const p=this.getLogicalCoordinates(a.clientX,a.clientY),m=r<0?-1:1;let b=0;for(let S=0;S<Math.abs(r);S+=1)try{const v=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:p.clientX,clientY:p.clientY,deltaX:0,deltaY:m,deltaMode:1,ctrlKey:!!(d!=null&&d.ctrlKey),altKey:!!(d!=null&&d.altKey),shiftKey:!!(d!=null&&d.shiftKey)});f.dispatchEvent(v),b+=1}catch{return b>0}return b>0}emitWheel(a,r,c,d){if(r===0)return!1;if(this.dispatchWheel(a,r,c,d))return!0;const f=this.getCoreMouseService(c);if(!(f!=null&&f.triggerMouseEvent))return!1;let p=0;for(let m=0;m<Math.abs(r);m+=1){const b=this.getMouseReport(a,c);b&&(b.button=4,b.action=r<0?0:1,b.ctrl=!!(d!=null&&d.ctrlKey),b.alt=!!(d!=null&&d.altKey),b.shift=!!(d!=null&&d.shiftKey),f.triggerMouseEvent(b)&&(p+=1))}return p>0}scrollAlternateBuffer(a,r,c,d){var p;if(r===0)return"none";const f=Sr(c);if(!f&&!this.options.getIsController())return"none";if(this.emitWheel(a,r,c,d))return f?"application-mouse":"application-keys";if(!f){const m=this.getCoreService(c);if(!(m!=null&&m.triggerDataEvent))return"none";const S=`\x1B${!!((p=m.decPrivateModes)!=null&&p.applicationCursorKeys)?"O":"["}${r<0?"A":"B"}`;return m.triggerDataEvent(S.repeat(Math.abs(r)),!0),"application-keys"}return"none"}emitMouse(a,r,c){const d=this.options.getTerminal();if(!d)return;const f=this.getCoreMouseService(d);if(f!=null&&f.triggerMouseEvent){const m=this.getMouseReport(r,d);m&&(m.action=a==="mousedown"?1:a==="mouseup"?0:32,m.ctrl=!!(c!=null&&c.ctrlKey),m.alt=!!(c!=null&&c.altKey),m.shift=!!(c!=null&&c.shiftKey),f.triggerMouseEvent(m));return}if(this.options.allowSyntheticMouseFallback===!1||!this.activeTarget)return;const p=this.getLogicalCoordinates(r.clientX,r.clientY);Zm(this.activeTarget,a,{clientX:p.clientX,clientY:p.clientY,button:0,buttons:a==="mouseup"?0:1})}beginGesture(a,r){this.startX=a.clientX,this.startY=a.clientY,this.lastX=a.clientX,this.lastY=a.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.resolveDispatchTarget(a,r),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var c,d;this.state==="pending"&&(this.setGestureState("longpress"),(d=(c=this.options).onLongPress)==null||d.call(c,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(a,r){var S,v,C,D;if(this.state==="longpress"){(v=(S=this.options).onSelectionExtend)==null||v.call(S,{clientX:a.clientX,clientY:a.clientY}),r!=null&&r.cancelable&&((C=r.preventDefault)==null||C.call(r));return}if(this.state==="idle")return;const c=a.clientX-this.startX,d=a.clientY-this.startY,f=Math.hypot(c,d);if(this.state==="scrolling"){this.scrollGesture(a,r);return}const p=this.options.getTerminal(),m=this.options.getIsController(),b=Sr(p);if(!(f<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(d)>=Math.abs(c)||!b||!m){this.setGestureState("scrolling"),p&&this.blurTerminal(p),this.lastX=a.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(a,r);return}if(b&&m){this.state==="pending"&&(this.setGestureState("dragging"),this.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},r)),this.state==="dragging"&&(this.lastX=a.clientX,this.lastY=a.clientY,this.emitMouse("mousemove",a,r),r!=null&&r.cancelable&&((D=r.preventDefault)==null||D.call(r)));return}this.lastX=a.clientX,this.lastY=a.clientY}}scrollGesture(a,r){var z,X,M,Z,$,J,ae;const c=this.options.getTerminal();if(!c)return;const d=a.clientY-this.lastY;this.lastX=a.clientX,this.lastY=a.clientY;const f=ha(c),p=f.measured?f.cellHeight:this.options.scrollLineHeightPx||f.cellHeight||18;this.scrollRemainderY+=d;const m=Math.trunc(this.scrollRemainderY/p),b=-m;let S=!1,v="none";const C=this.getActiveBuffer(c),D=Sr(c);if(b!==0){if((C==null?void 0:C.type)==="alternate")v=this.scrollAlternateBuffer(a,b,c,r),S=v!=="none",S&&(this.isSnapshotScrolling||(this.isSnapshotScrolling=!0,this.snapshotRows=0,(X=(z=this.options).onSnapshotScrollStart)==null||X.call(z)),this.snapshotRows-=b,(Z=(M=this.options).onSnapshotScrollMove)==null||Z.call(M,this.snapshotRows));else{const ye=this.getViewportY(c);c.scrollLines(b);const O=this.getViewportY(c);v="buffer",S=ye===null||O===null||ye!==O}this.scrollRemainderY-=m*p}const _=this.getViewportElement(c);(J=($=this.options).onGestureScroll)==null||J.call($,{deltaY:d,lines:b,viewportY:this.getViewportY(c),scrollTop:(_==null?void 0:_.scrollTop)??null,scrollHeight:(_==null?void 0:_.scrollHeight)??null,clientHeight:(_==null?void 0:_.clientHeight)??null,moved:S,bufferType:(C==null?void 0:C.type)||null,baseY:typeof(C==null?void 0:C.baseY)=="number"?C.baseY:null,cursorY:typeof(C==null?void 0:C.cursorY)=="number"?C.cursorY:null,hasScrollback:typeof(C==null?void 0:C.hasScrollback)=="boolean"?C.hasScrollback:null,mouseTracking:D,scrollMode:v}),r!=null&&r.cancelable&&((ae=r.preventDefault)==null||ae.call(r))}endGesture(a,r){var p,m,b;this.clearLongPressTimer();const c=this.options.getTerminal(),d=this.options.getIsController(),f=Sr(c);if(this.state==="pending"){if(f&&d){const v={clientX:this.startX,clientY:this.startY};this.emitMouse("mousedown",v,r),this.emitMouse("mouseup",v,r)}const S={clientX:this.startX,clientY:this.startY};d&&c&&this.isInputLineHit(S,c)&&((m=(p=this.options).onFocus)==null||m.call(p))}else if(this.state==="dragging"&&f&&d){const S=a??{clientX:this.lastX,clientY:this.lastY};this.emitMouse("mouseup",S,r),r!=null&&r.cancelable&&((b=r.preventDefault)==null||b.call(r))}this.reset()}handlePointerDown(a,r){if(a.pointerType==="mouse")return!1;if(!a.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(a.cancelable&&a.preventDefault(),this.beginGesture(a,r),a.pointerType!=="touch")try{typeof r.setPointerCapture=="function"&&(r.setPointerCapture(a.pointerId),this.capturedPointerId=a.pointerId,this.captureElement=r)}catch{}return!0}handlePointerMove(a){a.pointerType==="mouse"||this.state==="idle"||this.moveGesture(a,a)}handlePointerUp(a){a.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(a,a))}handlePointerCancel(a){a&&a.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(a,r){if(a.touches.length!==1){this.reset();return}a.cancelable&&a.preventDefault(),this.beginGesture(a.touches[0],r)}handleTouchMove(a){a.touches.length===1&&this.moveGesture(a.touches[0],a)}handleTouchEnd(a){a.cancelable&&a.preventDefault(),this.endGesture(null,a)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const a=this.options.getTerminal(),r=this.options.getIsController(),c=Sr(a);if(this.state==="dragging"&&c&&r&&this.activeTarget){const d=this.getLogicalCoordinates(this.lastX,this.lastY);Zm(this.activeTarget,"mouseup",{clientX:d.clientX,clientY:d.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const a=this.captureElement,r=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!a||r===null))try{typeof a.releasePointerCapture=="function"&&(typeof a.hasPointerCapture!="function"||a.hasPointerCapture(r))&&a.releasePointerCapture(r)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){var a,r;this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null,this.isSnapshotScrolling&&(this.isSnapshotScrolling=!1,this.snapshotRows=0,(r=(a=this.options).onSnapshotScrollEnd)==null||r.call(a))}}var bu=sy(),hx=oy();const Mr="herdr_remote_renderer_probe_v1",Ws=1,mx=720*60*60*1e3,Au={};function Ip(){let o=null;if(typeof window>"u")o=Au[Mr]||null;else try{o=window.localStorage?window.localStorage.getItem(Mr):null}catch{o=Au[Mr]||null}if(!o)return{v:Ws,ua:{}};try{const a=JSON.parse(o);return typeof a=="object"&&a!==null&&a.v===Ws&&typeof a.ua=="object"&&a.ua!==null?a:{v:Ws,ua:{}}}catch{return{v:Ws,ua:{}}}}function px(o,a=Date.now()){var d;const r=Ip();r.ua[o]={failedAt:a};const c=JSON.stringify(r);if(Au[Mr]=c,typeof window<"u")try{(d=window.localStorage)==null||d.setItem(Mr,c)}catch(f){console.warn("Failed to write renderer probe result to localStorage:",f)}}function gx(o,a=Date.now()){const r=typeof navigator<"u"?navigator.userAgent:"";if(!r)return!1;const d=Ip().ua[r];return!(!d||typeof d.failedAt!="number"||a-d.failedAt>mx)}function Qm(o,a=Date.now()){const r=typeof navigator<"u"?navigator.userAgent:"";r&&px(r,a)}function bx(o){if(o.length<4)return!0;const a=o[0],r=o[1],c=o[2],d=o[3];for(let f=4;f<o.length;f+=4)if(o[f]!==a||o[f+1]!==r||o[f+2]!==c||o[f+3]!==d)return!1;return!0}function yx(o){if(!o||o.width<=0||o.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let a=null;try{a=o.getContext("2d",{willReadFrequently:!0})||o.getContext("2d")}catch(d){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",d),"inconclusive"}if(!a)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const r=Math.min(o.width,640),c=Math.min(o.height,240);if(r<=0||c<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const d=a.getImageData(0,0,r,c);return bx(d.data)?"blank":"healthy"}catch(d){return console.debug("Canvas probe inconclusive: getImageData threw exception:",d),"inconclusive"}}function vx(o=2){return new Promise(a=>{if(typeof requestAnimationFrame!="function"){setTimeout(a,32);return}let r=o;const c=()=>{r--,r<=0?a():requestAnimationFrame(c)};requestAnimationFrame(c)})}function xx(o,a){if(a.coarsePointer){if(gx())return{kind:"dom",dispose:()=>{},verify:async()=>{}};try{const r=new bu.CanvasAddon;o.loadAddon(r);let c="canvas",d=!1,f=null;const p=()=>{var b;if(c!=="dom"){Qm();try{r.dispose()}catch{}c="dom",(b=a.onRendererSwapped)==null||b.call(a,"dom")}};return{get kind(){return c},dispose:()=>{d=!0;try{r.dispose()}catch{}},verify:async()=>{if(!(d||c!=="canvas"))return f||(f=(async()=>{var b;try{if(await vx(2),d||c!=="canvas")return;const S=(b=o.element)==null?void 0:b.querySelector("canvas.xterm-text-layer"),v=yx(S);v==="blank"?p():v==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(S){console.debug("Canvas probe inconclusive: unexpected error during verify():",S)}finally{f=null}})(),f)}}}catch(r){return console.debug("Canvas renderer constructor/addon load unavailable for coarse pointer, falling back to DOM:",r),Qm(),{kind:"dom",dispose:()=>{},verify:async()=>{}}}}try{const r=new hx.WebglAddon;let c=null,d="webgl",f=!1;return r.onContextLoss(()=>{var p,m;if(!f){try{r.dispose()}catch{}try{c=new bu.CanvasAddon,o.loadAddon(c),d="canvas",(p=a.onRendererSwapped)==null||p.call(a,"canvas")}catch(b){console.debug("Canvas fallback failed after WebGL context loss:",b),d="dom",(m=a.onRendererSwapped)==null||m.call(a,"dom")}}}),o.loadAddon(r),{get kind(){return d},dispose:()=>{f=!0;for(const p of[c,r])try{p==null||p.dispose()}catch{}},verify:async()=>{}}}catch(r){console.debug("WebGL renderer unavailable, falling back to canvas:",r)}try{const r=new bu.CanvasAddon;return o.loadAddon(r),{kind:"canvas",dispose:()=>{try{r.dispose()}catch{}},verify:async()=>{}}}catch(r){console.debug("Canvas renderer unavailable, using the DOM renderer:",r)}return{kind:"dom",dispose:()=>{},verify:async()=>{}}}function Im(o,a){const r=typeof window<"u"?window:void 0,c=r&&typeof r.devicePixelRatio=="number"&&r.devicePixelRatio>0?r.devicePixelRatio:1,d=r&&r.visualViewport&&typeof r.visualViewport.scale=="number"&&r.visualViewport.scale>0?r.visualViewport.scale:1,f=Math.max(0,o.width),p=Math.max(0,o.height),m=Math.round(f*c*100)/100,b=Math.round(p*c*100)/100;return{dpr:c,scale:d,cssWidth:f,cssHeight:p,physicalWidth:m,physicalHeight:b}}function Sx(o){const{lastSnapshot:a,currentSnapshot:r,physicalTolerancePx:c=6}=o;if(!a)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const d=Math.abs(r.scale-a.scale)>.01,f=Math.abs(r.scale-1)>.01;if(d||f)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(r.dpr-a.dpr)>.01){const S=Math.abs(r.physicalWidth-a.physicalWidth),v=Math.abs(r.physicalHeight-a.physicalHeight);if(S<=c&&v<=c)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const m=Math.abs(r.cssWidth-a.cssWidth),b=Math.abs(r.cssHeight-a.cssHeight);return m<1&&b<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const wx=" ()[]{}'\"\\`";function Jm(o,a,r,c=1){var M,Z;if(!a||!((M=a.buffer)!=null&&M.active)||a.cols<=0||a.rows<=0)return null;const d=r||((Z=a.element)==null?void 0:Z.querySelector(".xterm-screen"))||a.element;if(!d||typeof d.getBoundingClientRect!="function")return null;const f=d.getBoundingClientRect(),p=Qp(o.clientX,o.clientY,f,c),m=ha(a);if(m.cellWidth<=0||m.cellHeight<=0)return null;const b=Math.max(1,f.width||a.cols*m.cellWidth),S=Math.max(1,f.height||a.rows*m.cellHeight),v=Math.max(0,Math.min(b-1,p.clientX-f.left)),C=Math.max(0,Math.min(S-1,p.clientY-f.top)),D=Math.max(0,Math.min(a.cols-1,Math.floor(v/m.cellWidth))),_=Math.max(0,Math.min(a.rows-1,Math.floor(C/m.cellHeight))),X=(a.buffer.active.viewportY??0)+_;return{col:D,bufferRow:X}}function Cx(o,a){if(!o||o.length===0||o==="\0")return!0;for(const r of o)if(r==="\0"||/\s/.test(r)||a.includes(r))return!0;return!1}function Tx(o,a,r){var D,_;if(!o||!((D=o.buffer)!=null&&D.active)||a<0||a>=o.cols)return null;const c=o.buffer.active.getLine(r);if(!c)return null;const d=((_=o.options)==null?void 0:_.wordSeparator)??wx,f=new Array(o.cols).fill(null),p=Math.min(o.cols,c.length);let m=0;for(;m<p;){const z=c.getCell(m);if(!z){f[m]={startCol:m,endCol:m+1,isSeparator:!0},m++;continue}const X=z.getWidth();if(X===0){f[m]||(f[m]={startCol:m,endCol:m+1,isSeparator:!0}),m++;continue}const M=z.getChars(),Z=Cx(M,d),$=Math.min(o.cols,m+X),J={startCol:m,endCol:$,isSeparator:Z};for(let ae=m;ae<$;ae++)f[ae]=J;m+=Math.max(1,X)}for(let z=p;z<o.cols;z++)f[z]||(f[z]={startCol:z,endCol:z+1,isSeparator:!0});const b=f[a];if(!b||b.isSeparator)return null;let S=b.startCol;for(;S>0;){const z=f[S-1];if(z&&!z.isSeparator)S=z.startCol;else break}let v=b.endCol;for(;v<o.cols;){const z=f[v];if(z&&!z.isSeparator)v=z.endCol;else break}const C=v-S;return C<=0?null:{startCol:S,length:C}}function Nx(o){var f;if(!o||!((f=o.buffer)!=null&&f.active))return"";const a=o.buffer.active,r=a.viewportY??0,c=o.rows,d=[];for(let p=0;p<c;p++){const m=a.getLine(r+p);d.push(m?m.translateToString(!0):"")}for(;d.length>0&&d[d.length-1]==="";)d.pop();return d.join(`
34
+ `)}const Wm=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),Ex=.6,Rx=new Set(["─","━","═","┄","┅","┈","┉","-"]),Ax=.8;function yu(o,a){if(!o)return!1;let r=0;const c=Math.min(a,o.length);for(let d=0;d<c;d++){const f=o.getCell(d);if(f){const p=f.getChars();p&&Rx.has(p)&&r++}}return r>=Math.max(5,Math.min(a*.25,10))}function vu(o,a,r){var _;if(!o||!((_=o.buffer)!=null&&_.active)||o.cols<=0)return{startCol:0,endCol:0};const c=o.buffer.active,d=o.cols,f=Math.max(0,Math.min(d-1,a)),p=c.viewportY??0,m=o.rows>0?o.rows:1,b=new Int32Array(d);let S=0;for(let z=0;z<m;z++){const X=c.getLine(p+z);if(S++,!X)continue;const M=Math.min(d,X.length);for(let Z=0;Z<M;Z++){const $=X.getCell(Z);if($){const J=$.getChars();J&&Wm.has(J)&&b[Z]++}}}if(S===0)return{startCol:0,endCol:d-1};const v=S*Ex,C=z=>b[z]>=v;let D=!1;for(let z=0;z<d;z++)if(C(z)){D=!0;break}if(D){if(C(f))return{startCol:f,endCol:f};let z=-1;for(let M=f-1;M>=0;M--)if(C(M)){z=M;break}let X=d;for(let M=f+1;M<d;M++)if(C(M)){X=M;break}return{startCol:z+1,endCol:X-1}}if(r!==void 0){const z=Math.max(p,Math.min(p+m-1,r)),X=c.getLine(z);if(!yu(X,d)){let M=p;for(let J=z-1;J>=p;J--)if(yu(c.getLine(J),d)){M=J+1;break}let Z=p+m-1;for(let J=z+1;J<=p+m-1;J++)if(yu(c.getLine(J),d)){Z=J-1;break}const $=Z-M+1;if($>=2){const J=new Int32Array(d);for(let U=M;U<=Z;U++){const R=c.getLine(U);if(!R)continue;const te=Math.min(d,R.length);for(let je=0;je<te;je++){const Me=R.getCell(je);if(Me){const Ee=Me.getChars();Ee&&Wm.has(Ee)&&J[je]++}}}const ae=$*Ax,ye=U=>J[U]>=ae;let O=!1;for(let U=0;U<d;U++)if(ye(U)){O=!0;break}if(O){if(ye(f))return{startCol:f,endCol:f};let U=-1;for(let te=f-1;te>=0;te--)if(ye(te)){U=te;break}let R=d;for(let te=f+1;te<d;te++)if(ye(te)){R=te;break}return{startCol:U+1,endCol:R-1}}}}}return{startCol:0,endCol:d-1}}function Pm(o,a){const r=Math.min(o.startCol,o.endCol),c=Math.max(o.startCol,o.endCol),d=Math.min(o.startRow,o.endRow),f=Math.max(o.startRow,o.endRow);return{startCol:Math.max(a.startCol,Math.min(a.endCol,r)),endCol:Math.max(a.startCol,Math.min(a.endCol,c)),startRow:d,endRow:f}}function xu(o,a){var S;if(!o||!((S=o.buffer)!=null&&S.active)||o.cols<=0)return"";const r=o.buffer.active,c=o.cols,d=Math.min(a.startRow,a.endRow),f=Math.max(a.startRow,a.endRow),p=Math.max(0,Math.min(a.startCol,a.endCol)),m=Math.min(c-1,Math.max(a.startCol,a.endCol));if(p>m||d>f)return"";const b=[];for(let v=d;v<=f;v++){const C=r.getLine(v);if(!C){b.push("");continue}const D=C.translateToString(!0,p,m+1);b.push(D.trimEnd())}return b.join(`
35
+ `)}async function La(o){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(o),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let a=null,r=null,c=null;try{if(a=document.createElement("textarea"),a.style.userSelect="text",a.style.webkitUserSelect="text",a.style.position="fixed",a.style.top="0",a.style.left="0",a.style.width="1px",a.style.height="1px",a.style.padding="0",a.style.border="none",a.style.outline="none",a.style.boxShadow="none",a.style.background="transparent",a.style.opacity="0",a.style.fontSize="16px",a.setAttribute("readonly",""),a.setAttribute("aria-hidden","true"),a.value=o,typeof window<"u"&&typeof window.getSelection=="function"&&(c=window.getSelection(),c&&c.rangeCount>0&&(r=c.getRangeAt(0))),document.body.appendChild(a),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const p=document.createRange();p.selectNodeContents(a),c&&(c.removeAllRanges(),c.addRange(p)),a.setSelectionRange(0,o.length)}else a.focus({preventScroll:!0}),a.select();if(document.execCommand("copy"))return"exec"}catch{}finally{a&&a.parentNode&&a.parentNode.removeChild(a),c&&(c.removeAllRanges(),r&&c.addRange(r))}}return"failed"}async function jx(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const a=await navigator.clipboard.readText();return!a||a.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:a}}catch(a){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(a==null?void 0:a.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function Mx(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const a=await navigator.clipboard.read();if(!a||a.length===0)return{ok:!1,reason:"empty"};for(const r of a){const c=r.types.find(d=>d.startsWith("image/"));if(c){const d=await r.getType(c);if(d&&d.size>0)return{ok:!0,blob:d}}}return{ok:!1,reason:"empty"}}catch(a){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const r=a==null?void 0:a.name;return r==="SecurityError"?{ok:!1,reason:"insecure"}:r==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function Jp(o){const a=o.clipboardData;if(!a)return null;if(a.files&&a.files.length>0)for(let r=0;r<a.files.length;r++){const c=a.files[r];if(c&&c.type.startsWith("image/"))return c}if(a.items&&a.items.length>0)for(let r=0;r<a.items.length;r++){const c=a.items[r];if(c&&c.type.startsWith("image/")){const d=c.getAsFile();if(d)return d}}return null}function kx(o){if(!o||o.length===0)return null;for(let a=0;a<o.length;a++){const r=o[a];if(r&&(r.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(r.name)))return r}return null}const wr="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Cr="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",_x=({anchorPoint:o,hasSelection:a,isController:r,vibrateOnKeyPress:c=!1,onCopySelection:d,onCopyLine:f,onCopyScreen:p,onPaste:m,onClose:b})=>{const{t:S}=Ct(),v=y.useRef(null),[C,D]=y.useState(null);y.useEffect(()=>{if(c&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[c]),y.useLayoutEffect(()=>{const M=v.current;if(!M||!M.parentElement)return;const Z=M.parentElement.getBoundingClientRect(),$=M.getBoundingClientRect(),J=$.width||208,ae=$.height||220,ye=Z.width,O=Z.height;let U=o.x-J/2;U=Math.max(8,Math.min(Math.max(8,ye-J-8),U));let R=o.y-ae-8;R<8&&(R=o.y+8),R=Math.max(8,Math.min(Math.max(8,O-ae-8),R)),D({x:U,y:R})},[o.x,o.y,a,r]);const _=Math.max(8,o.x-104),z=Math.max(8,o.y-200),X={position:"absolute",left:`${C?C.x:_}px`,top:`${C?C.y:z}px`,visibility:C?"visible":"hidden"};return u.jsx("div",{ref:v,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:X,onMouseDown:M=>M.stopPropagation(),onTouchStart:M=>M.stopPropagation(),onPointerDown:M=>M.stopPropagation(),children:u.jsxs(on,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[a&&u.jsxs("button",{type:"button",role:"menuitem",className:P(wr,Cr),onClick:()=>{d(),b()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ge.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.copySelection")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:P(wr,Cr),onClick:()=>{f(),b()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ge.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.copyLine")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:P(wr,Cr),onClick:()=>{p(),b()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ge.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.copyScreen")})]}),r&&u.jsxs("button",{type:"button",role:"menuitem",className:P(wr,Cr),onClick:()=>{m(),b()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ge.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.paste")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:P(wr,Cr),onClick:b,children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ge.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.cancel")})]})]})})},zx=({isOpen:o,onClose:a,onSend:r,onSendImage:c})=>{const{t:d,addToast:f}=Ct(),[p,m]=y.useState(""),[b,S]=y.useState(null),[v,C]=y.useState(!1),D=y.useRef(null),_=y.useRef(null),z=y.useRef(null);y.useEffect(()=>{o&&(m(""),S(null),C(!1),D.current&&(D.current.value=""),_.current&&(_.current.value=""))},[o]);const X=async O=>{if(O.size===0){f("error",d("clipboard.fileEmpty"));return}C(!0);try{const U=await Ep(O);U?(S(U),m("")):f("error",d("clipboard.imageTooLarge"))}catch(U){console.error("Failed to process image:",U),f("error",d("clipboard.imageTooLarge"))}finally{C(!1)}},M=async O=>{const U=Jp(O);U&&(O.preventDefault(),await X(U))},Z=async O=>{const U=kx(O.target.files);O.target.value="",U&&await X(U)},$=O=>{const U=O.target.value;m(U),U&&b&&S(null)},J=()=>{S(null),D.current&&(D.current.value=""),_.current&&(_.current.value="")},ae=()=>{b?(c==null||c(b),a()):p.trim()&&(r(p),a())},ye=!!(p.trim()||b);return u.jsx(Yu,{isOpen:o,onClose:a,title:d("clipboard.pasteTitle"),closeLabel:d("clipboard.cancel"),size:"sm",footer:u.jsxs("div",{className:"flex items-center justify-end gap-2",children:[u.jsx(He,{variant:"ghost",onClick:a,children:d("clipboard.cancel")}),u.jsx(He,{variant:"primary",onClick:ae,disabled:!ye||v,children:d("clipboard.pasteSend")})]}),children:u.jsxs("div",{className:"flex flex-col gap-3 p-3 font-mono select-text",children:[u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx("label",{htmlFor:"paste-fallback-input",className:"text-tui-sm text-tui-muted font-sans font-medium",children:d("clipboard.pasteHint")}),u.jsx("textarea",{ref:z,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:d("clipboard.pasteHint"),value:p,onChange:$,onPaste:M,disabled:!!b||v,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"})]}),u.jsxs("div",{className:"relative my-1",children:[u.jsx("div",{className:"absolute inset-0 flex items-center",children:u.jsx("div",{className:"w-full border-t border-tui-border"})}),u.jsx("div",{className:"relative flex justify-center text-tui-xs uppercase",children:u.jsx("span",{className:"bg-tui-bg px-2 text-tui-muted font-sans",children:d("clipboard.imageSectionTitle")})})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx("input",{ref:D,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:Z}),u.jsx("input",{ref:_,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:Z}),b?u.jsxs("div",{className:"flex flex-col items-center gap-2 p-3 border border-tui-border bg-tui-bg rounded",children:[u.jsx("img",{src:b.dataUrl,alt:"Pasted preview","data-testid":"pasted-image-preview",className:"max-h-40 max-w-full object-contain rounded border border-tui-border"}),u.jsxs("div",{className:"flex items-center justify-between w-full text-tui-xs text-tui-muted pt-1",children:[u.jsx("span",{children:d("clipboard.imageCompressedSize",{size:Iy(b.byteLength)})}),u.jsx(He,{variant:"ghost",onClick:J,"aria-label":d("clipboard.removeImage"),children:d("clipboard.cancel")})]})]}):u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx(He,{variant:"default",onClick:()=>{var O;return(O=D.current)==null?void 0:O.click()},disabled:v||!!p.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":d("clipboard.chooseImage"),children:d("clipboard.chooseImage")}),u.jsx(He,{variant:"default",onClick:()=>{var O;return(O=_.current)==null?void 0:O.click()},disabled:v||!!p.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":d("clipboard.takePhoto"),children:d("clipboard.takePhoto")})]}),v&&u.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:u.jsx("span",{children:d("clipboard.imageCompressing")})})]})]})})},Dx=[[4352,4447],[11904,12350],[12353,13311],[13312,19903],[19968,40959],[40960,42191],[43360,43391],[44032,55203],[63744,64255],[65040,65049],[65072,65135],[65280,65376],[65504,65510]],Ox=[[161,767],[880,1023],[1024,1327]];function $m(o,a){for(const[r,c]of a){if(o>=r&&o<=c)return!0;if(o<r)return!1}return!1}function Lx(o){return o>=32&&o<=126?1:o<160||o>65535?null:$m(o,Dx)?2:$m(o,Ox)?1:null}const Ux=3;class Bx{constructor(a){Se(this,"getTerminal");Se(this,"now");Se(this,"textDecoder",new TextDecoder("utf-8"));Se(this,"state","tentative");Se(this,"predictions",[]);Se(this,"predictedCursor",null);Se(this,"srtt",null);Se(this,"isSuppressed",!1);Se(this,"suppressCursor",null);Se(this,"suppressSentAt",0);Se(this,"consecutiveMismatches",0);Se(this,"lineStartCursor",null);this.getTerminal=a.getTerminal,this.now=a.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}handleUserInput(a){if(this.pruneExpired(),a.length===0)return;const r=this.textDecoder.decode(a,{stream:!1});if(!r)return;const c=this.getTerminal();if(!c){this.reset("terminal unavailable",!0);return}for(const d of r){const f=d.codePointAt(0);if(f===void 0)continue;if(f===10||f===13){this.handleLineFeed(c);return}if(f===27||f===9||f<32&&f!==8){this.reset("control or escape sequence",!0);return}if(f===8||f===127){this.handleBackspace(c);continue}const p=Lx(f);if(p===null){this.reset("character of unknown width",!0);return}this.handlePrintable(d,p,c)}}onServerOutput(){if(this.isSuppressed){const f=this.getTerminal(),p=Math.max(300,(this.srtt??300)*1.5),m=this.now()-this.suppressSentAt>=p;let b=!1;if(f&&this.suppressCursor){const S=f.buffer.active.baseY+f.buffer.active.cursorY,v=f.buffer.active.cursorX;b=S!==this.suppressCursor.row||v!==this.suppressCursor.col}(b||m)&&(this.isSuppressed=!1,this.suppressCursor=null,this.lineStartCursor=null)}if(this.pruneExpired(),this.predictions.length===0)return;const a=this.getTerminal();if(!a)return;const r=[],c=a.buffer.active.type==="alternate";let d=!1;for(let f=0;f<this.predictions.length;f++){const p=this.predictions[f],m=a.buffer.active.getLine(p.row),b=m?m.getCell(p.col):void 0,S=b?b.getChars():"";if(S===p.charBefore)r.push(p);else if(S===p.char){const v=Math.max(0,this.now()-p.sentAt);this.updateSrtt(v),this.state="confident",this.consecutiveMismatches=0}else if(c&&this.consecutiveMismatches+1<Ux){this.consecutiveMismatches++,d=!0;continue}else{this.predictions=[],this.predictedCursor=null,this.lineStartCursor=null,this.state="tentative",this.isSuppressed=!1,this.suppressCursor=null,this.consecutiveMismatches=0;return}}this.predictions=r,r.length===0&&d&&(this.predictedCursor=null)}reset(a,r){if(this.predictions=[],this.predictedCursor=null,this.lineStartCursor=null,this.consecutiveMismatches=0,typeof r=="boolean"?r:(r==null?void 0:r.suppress)??!0){this.isSuppressed=!0,this.suppressSentAt=this.now();const d=this.getTerminal();d?this.suppressCursor={row:d.buffer.active.baseY+d.buffer.active.cursorY,col:d.buffer.active.cursorX}:this.suppressCursor=null}else this.isSuppressed=!1,this.suppressCursor=null}getVisiblePredictions(){return this.pruneExpired(),this.state!=="confident"?[]:this.predictions.map(a=>({row:a.row,col:a.col,char:a.char,width:a.width}))}getPredictedCursor(){return this.pruneExpired(),this.predictedCursor??this.lineStartCursor}getVisibleCursor(){if(this.state!=="confident")return null;const a=this.getPredictedCursor();if(!a)return null;const r=this.getTerminal();if(!r)return null;const c=r.buffer.active.baseY+r.buffer.active.cursorY,d=r.buffer.active.cursorX;return a.row===c&&a.col===d||a.col<0||a.col>=r.cols||a.row<r.buffer.active.baseY||a.row>=r.buffer.active.baseY+r.rows?null:a}getState(){return this.state}getBufferType(){var a;return((a=this.getTerminal())==null?void 0:a.buffer.active.type)??null}getEchoSrttMs(){return this.srtt}handleLineFeed(a){const r=a.buffer.active.baseY+a.buffer.active.cursorY;this.reset("line feed",!0),a.buffer.active.type!=="alternate"&&(r+1>=a.buffer.active.baseY+a.rows||(this.lineStartCursor={row:r+1,col:0}))}handlePrintable(a,r,c){if(this.isSuppressed){const m=Math.max(300,(this.srtt??300)*1.5);if(this.now()-this.suppressSentAt>=m)this.isSuppressed=!1,this.suppressCursor=null,this.lineStartCursor=null;else return}if(this.predictedCursor||(this.predictedCursor={row:c.buffer.active.baseY+c.buffer.active.cursorY,col:c.buffer.active.cursorX}),this.predictedCursor.col+r>=c.cols){this.reset("cursor would reach or exceed column boundary",!0);return}const d=c.buffer.active.getLine(this.predictedCursor.row),f=d?d.getCell(this.predictedCursor.col):void 0,p=f?f.getChars():"";this.predictions.push({row:this.predictedCursor.row,col:this.predictedCursor.col,char:a,charBefore:p,width:r,sentAt:this.now()}),this.predictedCursor.col+=r}handleBackspace(a){if(this.predictedCursor&&this.predictions.length>0){const r=this.predictions[this.predictions.length-1];if(r.row===this.predictedCursor.row&&r.col===this.predictedCursor.col-r.width){this.predictions.pop(),this.predictedCursor.col-=r.width;return}}this.predictErase(a)||this.reset("backspace into server content",!0)}predictErase(a){if(a.buffer.active.type==="alternate"||this.isSuppressed)return!1;const r=this.predictedCursor??{row:a.buffer.active.baseY+a.buffer.active.cursorY,col:a.buffer.active.cursorX};if(r.col<=0)return!1;const c=a.buffer.active.getLine(r.row);if(!c)return!1;const d=c.getCell(r.col-1);if(!d)return!1;const f=d.getChars(),p=typeof d.getWidth=="function"?d.getWidth():void 0;if(p===0){if(r.col-2<0)return!1;const m=c.getCell(r.col-2),b=(m==null?void 0:m.getChars())??"";return b?(this.pushErase(r.row,r.col-2,b,2),this.predictedCursor={row:r.row,col:r.col-2},!0):!1}return!f||p!==void 0&&p!==1?!1:(this.pushErase(r.row,r.col-1,f,1),this.predictedCursor={row:r.row,col:r.col-1},!0)}pushErase(a,r,c,d){this.predictions.push({row:a,col:r,char:" ",charBefore:c,width:d,sentAt:this.now()})}pruneExpired(){if(this.predictions.length===0)return;const a=this.now(),r=[];for(const c of this.predictions)a-c.sentAt<=1500&&r.push(c);r.length!==this.predictions.length&&(this.predictions=r,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(a){this.srtt===null?this.srtt=a:this.srtt=this.srtt*.8+a*.2}}const ep="cursor";function tp(o){return typeof o=="string"&&/^#[0-9a-fA-F]{6}$/.test(o)}class Hx{constructor(a){Se(this,"options");Se(this,"activeDecorations",new Map);this.options=a}sync(a,r){var f;const c=this.options.getTerminal();if(!c){this.clear();return}if(a.length===0&&!r){this.clear();return}if(typeof c.registerMarker!="function"||typeof c.registerDecoration!="function"||!((f=c.buffer)!=null&&f.active)){this.clear();return}const d=new Set;for(const p of a){const m=`${p.row}:${p.col}`;d.add(m),this.mount(c,m,p.row,p.col,p.char,p.width??1,!1)}r&&(d.add(ep),this.mount(c,ep,r.row,r.col," ",1,!0));for(const[p,m]of this.activeDecorations)d.has(p)||(this.disposeEntry(m),this.activeDecorations.delete(p))}mount(a,r,c,d,f,p,m){var S;const b=this.activeDecorations.get(r);if(b){if(b.char===f&&b.isCursor===m&&b.row===c&&b.col===d){b.decoration.element&&this.applyStyleToElement(b.decoration.element,b.char,m);return}this.disposeEntry(b),this.activeDecorations.delete(r)}try{const v=a.buffer.active.baseY+a.buffer.active.cursorY,C=c-v,D=a.registerMarker(C);if(!D||D.isDisposed||D.line===-1)return;const _=this.options.getStyle(),z={marker:D,anchor:"left",x:d,width:Math.max(1,p),height:1,layer:"top"},X=m?_.cursorColor??_.color:_.background,M=m?_.background:_.color;tp(X)&&(z.backgroundColor=X),tp(M)&&(z.foregroundColor=M);const Z=a.registerDecoration(z);if(!Z||Z.isDisposed){try{D.dispose()}catch{}return}Z.element&&this.applyStyleToElement(Z.element,f,m),Z.onRender($=>{this.applyStyleToElement($,f,m)}),(S=D.onDispose)==null||S.call(D,()=>{this.activeDecorations.delete(r)}),this.activeDecorations.set(r,{decoration:Z,marker:D,char:f,isCursor:m,row:c,col:d})}catch(v){console.debug("Failed to create prediction decoration:",v)}}clear(){for(const a of this.activeDecorations.values())this.disposeEntry(a);this.activeDecorations.clear()}dispose(){this.clear()}applyStyleToElement(a,r,c=!1){const d=this.options.getStyle();a.textContent=r,a.style.pointerEvents="none",a.style.userSelect="none";const f=c?d.background:d.color,p=c?d.cursorColor??d.color:d.background;f&&(a.style.color=f),p&&(a.style.backgroundColor=p),a.style.textDecoration=!c&&d.underline?"underline":"none",a.style.fontFamily="inherit",a.style.fontSize="inherit",a.style.overflow="hidden",a.style.whiteSpace="pre"}disposeEntry(a){try{a.decoration.dispose()}catch{}try{a.marker.dispose()}catch{}}}const np=120,Yx=400;class Kx{constructor(a){Se(this,"options");Se(this,"state","idle");Se(this,"layer",null);Se(this,"content",null);Se(this,"releaseTimer",null);Se(this,"fadeTimer",null);this.options=a}getState(){return this.state}isActive(){return this.state!=="idle"}capture(){this.dispose();const a=this.options.getFrameElement(),r=this.options.getScreenElement();if(!a||!r)return!1;const c=this.options.getRendererKind();if(c==="webgl")return!1;const d=c==="dom"?this.cloneScreen(r):this.compositeCanvases(r);if(!d)return!1;const f=document.createElement("div");f.dataset.testid="terminal-scroll-snapshot",f.setAttribute("aria-hidden","true"),f.style.position="absolute",f.style.inset="0",f.style.overflow="hidden",f.style.pointerEvents="none",f.style.userSelect="none",f.style.zIndex="10",f.style.opacity="1",f.style.transition=`opacity ${np}ms linear`;const p=this.options.getBackgroundColor();return p&&(f.style.backgroundColor=p),d.style.position="absolute",d.style.top="0",d.style.left="0",d.style.width="100%",d.style.height="100%",d.style.willChange="transform",d.style.transform="translateY(0px)",f.appendChild(d),a.appendChild(f),this.layer=f,this.content=d,this.state="tracking",!0}translateRows(a){if(!this.content||this.state!=="tracking")return;const r=this.options.getRowHeight();!Number.isFinite(r)||r<=0||(this.content.style.transform=`translateY(${a*r}px)`)}release(){this.state==="tracking"&&(this.state="releasing",this.clearReleaseTimer(),this.releaseTimer=setTimeout(()=>{this.releaseTimer=null,this.beginFade()},Yx))}settle(){this.state==="releasing"&&(this.clearReleaseTimer(),this.beginFade())}dispose(){var a;this.clearReleaseTimer(),this.clearFadeTimer(),(a=this.layer)!=null&&a.parentNode&&this.layer.parentNode.removeChild(this.layer),this.layer=null,this.content=null,this.state="idle"}beginFade(){if(!this.layer){this.dispose();return}this.state="fading",this.layer.style.opacity="0",this.clearFadeTimer(),this.fadeTimer=setTimeout(()=>{this.fadeTimer=null,this.dispose()},np)}clearReleaseTimer(){this.releaseTimer&&(clearTimeout(this.releaseTimer),this.releaseTimer=null)}clearFadeTimer(){this.fadeTimer&&(clearTimeout(this.fadeTimer),this.fadeTimer=null)}compositeCanvases(a){const r=Array.from(a.querySelectorAll("canvas"));if(r.length===0)return null;const c=r[0].width,d=r[0].height;if(!(c>0)||!(d>0))return null;const f=document.createElement("canvas");f.width=c,f.height=d;let p=null;try{p=f.getContext("2d")}catch{return null}if(!p)return null;try{for(const m of r)m.width<=0||m.height<=0||p.drawImage(m,0,0,c,d)}catch{return null}return f.style.display="block",f}cloneScreen(a){let r;try{r=a.cloneNode(!0)}catch{return null}return r.removeAttribute("id"),r.setAttribute("aria-hidden","true"),r}}const Gx=40,qx=.45;function lp(o,a){return o==="off"?!1:o==="always"?!0:a!==null&&a>Gx}const Vx=250,Xx=({onTerminalFocus:o,isActive:a=!0})=>{var rl,Ga,yl,vl,Hl;const r=y.useRef(null),c=y.useRef(null),d=y.useRef(null),f=y.useRef(null),p=y.useRef(1),m=y.useRef({cols:0,rows:0}),b=y.useRef(null),S=y.useRef(null),v=y.useRef(null),C=y.useRef(null),D=y.useRef({width:0,height:0}),_=y.useRef(null),z=ky(),X=z||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,M=typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1",[Z,$]=y.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}),[J,ae]=y.useState({framesPerSec:0,bytesPerSec:0}),[ye,O]=y.useState(null),U=y.useRef(null),R=y.useRef(!1),te=y.useRef(!1),je=y.useRef([]);y.useEffect(()=>{if(!M)return;const V=setInterval(()=>{const ue=performance.now()-1e3,ge=je.current;for(;ge.length>0&&ge[0].time<ue;)ge.shift();let Ie=0;for(let ne=0;ne<ge.length;ne++)Ie+=ge[ne].bytes;ae({framesPerSec:ge.length,bytesPerSec:Ie})},1e3);return()=>clearInterval(V)},[M]);const{isController:Me,connectionState:Ee,settings:de,hostPalette:_e,terminalResetVersion:Le,sendResize:j,sendBinary:q,addToast:W,warnViewerMode:Ce,connect:H,subscribeToOutput:qe,registerInputObserver:F,subscribeToPasteFileReady:pe,uploadImage:ze,t:ve,rttMs:he}=Ct(),St=fl.useMemo(()=>qy(_e),[_e]),Ue=y.useRef(St);Ue.current=St;const we=y.useRef(Me);we.current=Me;const ft=y.useRef(q);ft.current=q;const lt=y.useRef(W);lt.current=W;const mt=y.useRef(Ce);mt.current=Ce;const Bt=y.useRef(j);Bt.current=j;const gt=y.useRef(ze);gt.current=ze;const zn=y.useRef(a);zn.current=a;const Dn=y.useRef(de);Dn.current=de;const kt=y.useRef(ve);kt.current=ve;const cn=y.useRef(F);cn.current=F;const On=y.useRef(()=>{}),Ht=y.useRef(()=>{}),Qe=y.useRef(null),Ft=y.useRef(null),Yt=y.useRef(null),ee=y.useRef(null),Re=y.useCallback(V=>{const Q=f.current;if(!Q){ee.current=null;return}if(V){ee.current===null&&(ee.current=Q.options.cursorStyle??"block"),Q.options.cursorStyle!=="underline"&&(Q.options.cursorStyle="underline");return}ee.current!==null&&(Q.options.cursorStyle=ee.current,ee.current=null)},[]),Ke=y.useCallback(()=>{var V;(V=Ft.current)==null||V.clear(),Re(!1)},[Re]);On.current=Re,Ht.current=Ke;const We=y.useRef(null),[et,hn]=y.useState(null),pt=y.useRef(null);pt.current=et;const[Rt,It]=y.useState(null),ln=y.useRef(null);ln.current=Rt;const[at,_t]=y.useState(""),wt=y.useRef("");wt.current=at;const[Ba,mn]=y.useState(!1),Ha=y.useRef(!1);Ha.current=Ba;const Ln=y.useRef(!1),[hl,ml]=y.useState(0),Jt=y.useRef(null),un=y.useRef(null),pn=y.useRef(null),pl=y.useRef(null),[Ya,Ul]=y.useState(!1),al=y.useCallback(V=>{var Ie;const Q=f.current;if(!Q)return;const ue=((Ie=d.current)==null?void 0:Ie.querySelector(".xterm-screen"))||d.current,ge=Jm(V,Q,ue,p.current);if(ge){pn.current=ge;const ne=vu(Q,ge.col,ge.bufferRow);pl.current=ne;const an=Tx(Q,ge.col,ge.bufferRow);if(an){const Wt={startCol:an.startCol,endCol:an.startCol+an.length-1,startRow:ge.bufferRow,endRow:ge.bufferRow},zt=Pm(Wt,ne),it=xu(Q,zt);It(zt),_t(it),mn(!0)}else It(null),_t(""),mn(!1),pn.current=null,pl.current=null}else It(null),_t(""),mn(!1),pn.current=null,pl.current=null;Jt.current=V,un.current=null},[]),Bl=y.useCallback(V=>{var it;const Q=f.current,ue=pn.current;if(!Q||!ue)return;un.current=V;const ge=((it=d.current)==null?void 0:it.querySelector(".xterm-screen"))||d.current,Ie=Jm(V,Q,ge,p.current);if(!Ie)return;const ne=pl.current??vu(Q,ue.col,ue.bufferRow),an={startCol:Math.min(ue.col,Ie.col),endCol:Math.max(ue.col,Ie.col),startRow:Math.min(ue.bufferRow,Ie.bufferRow),endRow:Math.max(ue.bufferRow,Ie.bufferRow)},Wt=Pm(an,ne),zt=xu(Q,Wt);It(Wt),_t(zt),mn(!0)},[]),gl=y.useRef(al);gl.current=al;const bl=y.useRef(Bl);bl.current=Bl;const Ka=y.useCallback(async()=>{const V=wt.current;if(!V)return;await La(V)==="failed"?lt.current("error",kt.current("clipboard.copyFailed")):lt.current("success",kt.current("clipboard.copied"))},[]),L=y.useCallback(async()=>{var Wt,zt,it,rn;const V=f.current;if(!V)return;const Q=(Wt=V.buffer)==null?void 0:Wt.active;if(!Q)return;const ue=((zt=ln.current)==null?void 0:zt.startRow)??((it=pn.current)==null?void 0:it.bufferRow)??Q.viewportY,ge=pl.current??vu(V,((rn=pn.current)==null?void 0:rn.col)??0,ue),Ie={startCol:ge.startCol,endCol:ge.endCol,startRow:ue,endRow:ue},ne=xu(V,Ie);await La(ne)==="failed"?lt.current("error",kt.current("clipboard.copyFailed")):lt.current("success",kt.current("clipboard.copied"))},[]),Y=y.useCallback(async()=>{const V=f.current;if(!V)return;const Q=Nx(V);await La(Q)==="failed"?lt.current("error",kt.current("clipboard.copyFailed")):lt.current("success",kt.current("clipboard.copied"))},[]),ie=y.useCallback(async()=>{var Q;const V=f.current;if(V){if(!we.current){mt.current();return}try{const ue=await Mx();if(ue.ok){await gt.current(ue.blob);return}}catch{}try{const ue=await jx();if(ue.ok){(Q=Qe.current)==null||Q.reset("paste"),Ht.current(),V.paste(ue.text),lt.current("success",kt.current("clipboard.pasted"));return}else if(ue.reason==="empty"){lt.current("info",kt.current("clipboard.pasteUnavailable"));return}}catch{}Ul(!0)}},[]),Ae=y.useCallback(V=>{var ue;const Q=f.current;if(Q){if(!we.current){mt.current();return}(ue=Qe.current)==null||ue.reset("paste"),Ht.current(),Q.paste(V),lt.current("success",kt.current("clipboard.pasted"))}},[]),xe=y.useCallback(V=>{if(f.current){if(!we.current){mt.current();return}gt.current(V)}},[]);y.useEffect(()=>pe(Q=>{var ge;const ue=f.current;ue&&((ge=Qe.current)==null||ge.reset("paste"),Ht.current(),ue.paste(Q),lt.current("success",kt.current("clipboard.pasted")))}),[pe]);const fe=y.useCallback((V,Q)=>{!Number.isFinite(V)||!Number.isFinite(Q)||V<=0||Q<=0||V===m.current.cols&&Q===m.current.rows||(b.current={cols:V,rows:Q},!S.current&&(S.current=setTimeout(()=>{var ge;S.current=null;const ue=b.current;b.current=null,ue&&(ue.cols===m.current.cols&&ue.rows===m.current.rows||(m.current=ue,Bt.current(ue.cols,ue.rows),(ge=Qe.current)==null||ge.reset("resize"),Ht.current()))},Vx)))},[]),ke=y.useCallback((V=!1)=>{var dn;const Q=f.current,ue=r.current,ge=d.current,Ie=c.current;if(!Q||!ue||!ge||!Ie)return;const ne=gu(ue,Ti(),hu());if(ne.width<=0||ne.height<=0)return;Ie.style.width="100%",Ie.style.height="100%",ge.style.width="100%",ge.style.height="100%",ge.style.transform="none",ge.style.transformOrigin="top left",p.current=1;const an=Im(ne),Wt=Sx({lastSnapshot:_.current,currentSnapshot:an});if(Wt.isVisualZoom&&!V){_.current=an;try{Q.refresh(0,Math.max(0,Q.rows-1))}catch{}return}if(Wt.shouldIgnore&&!V)return;_.current=an;const zt=ha(Q,Ri),it=Fm({width:ne.width-ux(ge),height:ne.height,cellWidth:zt.cellWidth,cellHeight:zt.cellHeight}),rn=Math.abs(ne.width-D.current.width)>1||Math.abs(ne.height-D.current.height)>1;if(Q.cols!==it.cols||Q.rows!==it.rows)try{Q.resize(it.cols,it.rows)}catch(Kt){console.debug("Error resizing terminal grid:",Kt)}R.current&&!te.current&&(rn||Q.cols!==it.cols||Q.rows!==it.rows)&&(te.current=!0,(dn=U.current)==null||dn.verify());const Wn=it.cols!==m.current.cols||it.rows!==m.current.rows;zn.current&&(rn||V||Wn)&&(D.current={width:ne.width,height:ne.height},fe(it.cols,it.rows));try{Q.refresh(0,Math.max(0,Q.rows-1))}catch{}},[fe]),Tt=y.useRef(ke);Tt.current=ke;const bt=y.useCallback(()=>{if(v.current===null){if(typeof requestAnimationFrame!="function"){Tt.current();return}v.current=requestAnimationFrame(()=>{v.current=null,Tt.current()})}},[]),Un=y.useCallback((V=30)=>{C.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(C.current),C.current=null);let Q=0;const ue=()=>{C.current=null,Q++;const ge=Q>=V;Tt.current(!0),!ge&&Q<2&&typeof requestAnimationFrame=="function"&&(C.current=requestAnimationFrame(ue))};typeof requestAnimationFrame=="function"?C.current=requestAnimationFrame(ue):ue()},[]);y.useEffect(()=>{var pa,Hn;if(!r.current||!d.current)return;const V=r.current,Q=gu(V,Ti(),hu()),ue=ha(null,Ri),ge=Fm({width:Q.width,height:Q.height,cellWidth:ue.cellWidth,cellHeight:ue.cellHeight});Bt.current(ge.cols,ge.rows),D.current={width:Q.width,height:Q.height},_.current=Im(Q);const Ie=Am(de.fontSize,Q.width),ne=new ax.Terminal({fontSize:Ie,fontFamily:Om(de.fontFamily),lineHeight:1.15,...Ue.current?{theme:{...Ue.current}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:ge.cols,rows:ge.rows,screenReaderMode:!1});try{const I=new ix.Unicode11Addon;ne.loadAddon(I),ne.unicode.activeVersion="11"}catch(I){console.debug("Unicode11 addon unavailable, using default width table:",I)}ne.open(d.current),f.current=ne;const an=new Bx({getTerminal:()=>f.current});Qe.current=an;const Wt=new Hx({getTerminal:()=>f.current,getStyle:()=>{var Zt,yn,me,ot,tt,Pt,sn,qt,Gl;const I=((Zt=Ue.current)==null?void 0:Zt.foreground)??((me=(yn=f.current)==null?void 0:yn.options.theme)==null?void 0:me.foreground),le=((ot=Ue.current)==null?void 0:ot.background)??((Pt=(tt=f.current)==null?void 0:tt.options.theme)==null?void 0:Pt.background),De=Vy(I,le,qx)??I,At=((sn=Ue.current)==null?void 0:sn.cursor)??((Gl=(qt=f.current)==null?void 0:qt.options.theme)==null?void 0:Gl.cursor)??I;return{color:De,background:le,underline:!0,cursorColor:At}}});Ft.current=Wt;const zt=()=>{const I=Qe.current,le=Ft.current;if(!I||!le)return;const De=Dn.current.predictiveEcho,At=I.getEchoSrttMs();if(!lp(De,At)){Ht.current();return}const Zt=I.getVisibleCursor();le.sync(I.getVisiblePredictions(),Zt),On.current(Zt!==null)};let it=null,rn=!1;const Wn=()=>{if(it!==null){rn=!0;return}zt(),typeof requestAnimationFrame=="function"&&(it=requestAnimationFrame(()=>{it=null,rn&&(rn=!1,zt())}))};z&&ne.textarea&&(ne.textarea.readOnly=!1,ne.textarea.tabIndex=0,ne.textarea.inputMode="text");let dn=()=>{};if(M&&ne.textarea){const I=()=>{$(le=>({...le,focused:document.activeElement===ne.textarea}))};ne.textarea.addEventListener("focus",I),ne.textarea.addEventListener("blur",I),dn=()=>{var le,De;(le=ne.textarea)==null||le.removeEventListener("focus",I),(De=ne.textarea)==null||De.removeEventListener("blur",I)},I()}const Kt=async I=>{var De;(De=Qe.current)==null||De.reset("paste"),Ht.current();const le=Jp(I);if(le){if(I.preventDefault(),I.stopPropagation(),!we.current){mt.current();return}await gt.current(le)}};(pa=ne.textarea)==null||pa.addEventListener("paste",Kt),V.addEventListener("paste",Kt);const Yl=xx(ne,{coarsePointer:z,onRendererSwapped:I=>{V&&(V.dataset.renderer=I),O(I);try{ne.refresh(0,Math.max(0,ne.rows-1))}catch{}}});U.current=Yl,V&&(V.dataset.renderer=Yl.kind),O(Yl.kind);const ro=kt.current("terminal.bannerTitle"),Ai=kt.current("terminal.bannerSubtitle");if(ne.writeln(" ___ ___ .___ "),ne.writeln(` / | \\ ____ _______| _/______ \x1B[1m${ro}\x1B[0m`),ne.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${Ai}\x1B[0m`),ne.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),ne.writeln(" \\___|_ / \\___ >|__| /___/____ >"),ne.writeln(" \\/ \\/ \\/ "),ne.writeln(""),R.current=!0,Yl.verify(),!z)try{ne.focus()}catch{}typeof document<"u"&&"fonts"in document&&typeof((Hn=document.fonts)==null?void 0:Hn.load)=="function"&&document.fonts.load('13px "Symbols Nerd Font Mono"').then(()=>{if(f.current){try{f.current.refresh(0,Math.max(0,f.current.rows-1))}catch{}Un(5)}}).catch(()=>{});const Or=ne.onData(I=>{var De;const le=ju(I);if(!we.current&&!kr(le)){mt.current();return}ft.current(le),(De=Qe.current)==null||De.handleUserInput(le),zt()}),qa=cn.current(I=>{var le;(le=Qe.current)==null||le.handleUserInput(I),zt()}),so=ne.onBinary(I=>{const le=new Uint8Array(I.length);for(let De=0;De<I.length;De++)le[De]=I.charCodeAt(De)&255;!we.current&&!kr(le)||ft.current(le)}),bn=typeof ne.onWriteParsed=="function"?ne.onWriteParsed(()=>{var I,le;Ln.current=!0,(I=Qe.current)==null||I.onServerOutput(),Wn(),(le=Yt.current)==null||le.settle()}):{dispose:()=>{}},ji=typeof ne.onRender=="function"?ne.onRender(I=>{const le=ne.buffer.active.viewportY??0;ml(le);const De=ln.current;if(De&&Ha.current){const At=De.startRow-le,Zt=De.endRow-le;Ln.current&&I.start<=Zt&&I.end>=At&&(mn(!1),Ln.current=!1)}else Ln.current=!1}):{dispose:()=>{}},Lr=typeof ne.onScroll=="function"?ne.onScroll(()=>{var le;const I=ne.buffer.active.viewportY??0;ml(I),(le=Qe.current)==null||le.reset("scroll"),Ht.current()}):{dispose:()=>{}},Va=new Kx({getFrameElement:()=>c.current,getScreenElement:()=>{var I;return((I=d.current)==null?void 0:I.querySelector(".xterm-screen"))??d.current},getRendererKind:()=>{var I;return((I=U.current)==null?void 0:I.kind)??"dom"},getRowHeight:()=>ha(f.current).cellHeight,getBackgroundColor:()=>{var I,le,De;return((I=Ue.current)==null?void 0:I.background)??((De=(le=f.current)==null?void 0:le.options.theme)==null?void 0:De.background)}});Yt.current=Va;const Gt=new fx({getTerminal:()=>f.current,getIsController:()=>we.current,getScale:()=>p.current,getSurfaceElement:()=>d.current,allowSyntheticMouseFallback:!1,onFocus:()=>{try{ne.focus()}catch{}M&&$(I=>({...I,focused:document.activeElement===ne.textarea})),o==null||o()},onGestureStateChange:I=>{M&&$(le=>({...le,state:I}))},onGestureScroll:({deltaY:I,lines:le,viewportY:De,scrollTop:At,scrollHeight:Zt,clientHeight:yn,moved:me,bufferType:ot,baseY:tt,cursorY:Pt,hasScrollback:sn,mouseTracking:qt,scrollMode:Gl})=>{M&&$(ga=>({...ga,deltaY:I,lines:le,viewportY:De,scrollTop:At,scrollHeight:Zt,clientHeight:yn,moved:me,focused:document.activeElement===ne.textarea,bufferType:ot,baseY:tt,cursorY:Pt,hasScrollback:sn,mouseTracking:qt,scrollMode:Gl,scrollCalls:ga.scrollCalls+(le!==0?1:0),lastScrollLines:le}))},onSnapshotScrollStart:()=>{var I;(I=Yt.current)==null||I.capture()},onSnapshotScrollMove:I=>{var le;(le=Yt.current)==null||le.translateRows(I)},onSnapshotScrollEnd:()=>{var I;(I=Yt.current)==null||I.release()},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:z?(I=>{var le;return(le=gl.current)==null?void 0:le.call(gl,I)}):void 0,onSelectionExtend:z?(I=>{var le;return(le=bl.current)==null?void 0:le.call(bl,I)}):void 0}),Ur=typeof window<"u"&&"PointerEvent"in window,Br=typeof TouchEvent<"u",Bn=[],Pn=(I,le=!1)=>{const De=I.target;return De instanceof Node&&V.contains(De)||le&&Gt.getState()!=="idle"};if(Ur){const I={passive:!1,capture:!0},le=me=>{M&&$(ot=>({...ot,pointerEvents:ot.pointerEvents+1,lastInputEvent:me}))},De=me=>{if(!Pn(me))return;if(le("pointerdown"),pt.current){hn(null),pt.current=null,It(null),ln.current=null,_t(""),wt.current="",mn(!1),Jt.current=null,un.current=null,me.cancelable&&me.preventDefault(),me.stopPropagation();return}Gt.handlePointerDown(me,V)&&me.stopPropagation()},At=me=>{Pn(me,!0)&&(le("pointermove"),Gt.handlePointerMove(me),me.pointerType!=="mouse"&&me.stopPropagation())},Zt=me=>{if(!Pn(me,!0))return;if(le("pointerup"),Gt.getState()==="longpress"&&We.current){const tt=un.current??Jt.current;if(tt){const Pt=We.current.getBoundingClientRect(),sn=tt.clientX-Pt.left,qt=tt.clientY-Pt.top;hn({x:sn,y:qt}),pt.current={x:sn,y:qt}}}Gt.handlePointerUp(me),me.pointerType!=="mouse"&&me.stopPropagation()},yn=me=>{var ot;Pn(me,!0)&&(le("pointercancel"),hn(null),pt.current=null,It(null),ln.current=null,_t(""),wt.current="",mn(!1),Jt.current=null,un.current=null,Gt.handlePointerCancel(me),(ot=Yt.current)==null||ot.dispose(),me.pointerType!=="mouse"&&me.stopPropagation())};if(document.addEventListener("pointerdown",De,I),document.addEventListener("pointermove",At,I),document.addEventListener("pointerup",Zt,I),document.addEventListener("pointercancel",yn,I),Bn.push(()=>{document.removeEventListener("pointerdown",De,I),document.removeEventListener("pointermove",At,I),document.removeEventListener("pointerup",Zt,I),document.removeEventListener("pointercancel",yn,I)}),Br){const me=tt=>{Pn(tt,!0)&&(M&&$(Pt=>({...Pt,touchEvents:Pt.touchEvents+1})),tt.cancelable&&tt.preventDefault(),tt.stopPropagation())},ot=["touchstart","touchmove","touchend","touchcancel"];for(const tt of ot)document.addEventListener(tt,me,I);Bn.push(()=>{for(const tt of ot)document.removeEventListener(tt,me,I)})}}else{const I={passive:!1,capture:!0},le=me=>{M&&$(ot=>({...ot,touchEvents:ot.touchEvents+1,lastInputEvent:me}))},De=me=>{if(Pn(me)){if(le("touchstart"),pt.current){hn(null),pt.current=null,It(null),ln.current=null,_t(""),wt.current="",mn(!1),Jt.current=null,un.current=null,me.cancelable&&me.preventDefault(),me.stopPropagation();return}me.touches.length===1&&me.stopPropagation(),Gt.handleTouchStart(me,V)}},At=me=>{Pn(me,!0)&&(le("touchmove"),me.touches.length===1&&me.stopPropagation(),Gt.handleTouchMove(me))},Zt=me=>{if(!Pn(me,!0))return;if(le("touchend"),Gt.getState()==="longpress"&&We.current){const tt=un.current??Jt.current;if(tt){const Pt=We.current.getBoundingClientRect(),sn=tt.clientX-Pt.left,qt=tt.clientY-Pt.top;hn({x:sn,y:qt}),pt.current={x:sn,y:qt}}}me.stopPropagation(),Gt.handleTouchEnd(me)},yn=me=>{var ot;Pn(me,!0)&&(le("touchcancel"),hn(null),pt.current=null,It(null),ln.current=null,_t(""),wt.current="",mn(!1),Jt.current=null,un.current=null,me.stopPropagation(),Gt.handleTouchCancel(),(ot=Yt.current)==null||ot.dispose())};document.addEventListener("touchstart",De,I),document.addEventListener("touchmove",At,I),document.addEventListener("touchend",Zt,I),document.addEventListener("touchcancel",yn,I),Bn.push(()=>{document.removeEventListener("touchstart",De,I),document.removeEventListener("touchmove",At,I),document.removeEventListener("touchend",Zt,I),document.removeEventListener("touchcancel",yn,I)})}const Mi=I=>{I.preventDefault()};V.addEventListener("contextmenu",Mi),Bn.push(()=>{V.removeEventListener("contextmenu",Mi)});const ki=new ResizeObserver(()=>{bt()});ki.observe(V);const Kl=()=>{bt()},Xa=()=>{var I,le;if(document.visibilityState==="visible"){Un(10);try{(le=f.current)==null||le.refresh(0,Math.max(0,(((I=f.current)==null?void 0:I.rows)||1)-1))}catch{}}};window.addEventListener("resize",Kl),window.addEventListener("orientationchange",Kl),document.addEventListener("visibilitychange",Xa),window.addEventListener("pageshow",Xa);const Fa=()=>{bt()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",Fa),window.visualViewport.addEventListener("scroll",Fa)),()=>{var I,le;Or.dispose(),so.dispose(),ji.dispose(),Lr.dispose(),bn.dispose(),qa(),it!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(it),it=null),On.current(!1),(I=Ft.current)==null||I.dispose(),Ft.current=null,Qe.current=null,Va.dispose(),Yt.current=null,Gt.handlePointerCancel();for(const De of Bn)De();ki.disconnect(),window.removeEventListener("resize",Kl),window.removeEventListener("orientationchange",Kl),document.removeEventListener("visibilitychange",Xa),window.removeEventListener("pageshow",Xa),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",Fa),window.visualViewport.removeEventListener("scroll",Fa)),S.current&&(clearTimeout(S.current),S.current=null),v.current!==null&&(cancelAnimationFrame(v.current),v.current=null),C.current!==null&&(cancelAnimationFrame(C.current),C.current=null),dn(),(le=ne.textarea)==null||le.removeEventListener("paste",Kt),V.removeEventListener("paste",Kt),Yl.dispose(),U.current=null,ne.dispose(),f.current=null}},[]),y.useEffect(()=>{const V=f.current;if(!V)return;const Q=gu(r.current,Ti(),hu());V.options.fontSize=Am(de.fontSize,Q.width),V.options.fontFamily=Om(de.fontFamily);try{V.refresh(0,Math.max(0,V.rows-1))}catch{}Un(10)},[de.fontSize,de.fontFamily]),y.useEffect(()=>{const V=Qe.current,Q=Ft.current;if(!V||!Q)return;const ue=V.getEchoSrttMs();if(!lp(de.predictiveEcho,ue))Ke();else{const ge=V.getVisibleCursor();Q.sync(V.getVisiblePredictions(),ge),Re(ge!==null)}},[de.predictiveEcho,Ke,Re]);const il=y.useRef(Le);y.useEffect(()=>{var Q,ue,ge;if(il.current===Le)return;il.current=Le,(Q=Qe.current)==null||Q.reset("resetVersion"),Ht.current(),(ue=Yt.current)==null||ue.dispose();const V=f.current;if(V)try{(ge=V.reset)==null||ge.call(V),V.clear(),V.refresh(0,Math.max(0,V.rows-1))}catch{}},[Le]),y.useEffect(()=>{var V,Q;(V=Qe.current)==null||V.reset("connectionState"),Ht.current(),(Q=Yt.current)==null||Q.dispose()},[Ee]),y.useEffect(()=>{const V=f.current;if(!(!V||!St)){V.options.theme={...St};try{V.refresh(0,Math.max(0,V.rows-1))}catch{}}},[St]),y.useEffect(()=>qe(Q=>{const ue=f.current;if(!ue)throw new Error("terminal not ready");if(ue.write(Q),M){const ge=performance.now(),Ie=je.current;Ie.push({time:ge,bytes:Q.byteLength});const ne=ge-1e3;for(;Ie.length>0&&Ie[0].time<ne;)Ie.shift()}}),[qe,M]),y.useEffect(()=>{if(!a)return;Un(10);const V=f.current;if(V){try{V.refresh(0,Math.max(0,V.rows-1))}catch{}if(!z)try{V.focus()}catch{}}},[a,z,Un]),y.useEffect(()=>{Ee==="disconnected"&&H()},[]);const gn=V=>{V.preventDefault()};return u.jsxs("main",{ref:We,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:gn,"aria-label":ve("terminal.windowAriaLabel"),children:[u.jsx("div",{id:"terminal-container",ref:r,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:X?"none":"auto"},tabIndex:0,onContextMenu:gn,"aria-label":ve("terminal.bufferAriaLabel"),role:"region",children:u.jsx("div",{id:"terminal-frame",ref:c,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:u.jsx("div",{id:"terminal-surface",ref:d,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),M&&u.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: ${Z.state}
36
+ `,`deltaY: ${Z.deltaY} lines: ${Z.lines}
37
+ `,`viewportY: ${Z.viewportY??"-"} focus: ${Z.focused}
38
+ `,`buffer: ${Z.bufferType??"-"} base: ${Z.baseY??"-"} cursor: ${Z.cursorY??"-"} scrollback: ${Z.hasScrollback??"-"}
39
+ `,`scroll: ${Z.scrollTop??"-"} / ${Z.scrollHeight??"-"} (h ${Z.clientHeight??"-"}) moved: ${Z.moved}
40
+ `,`mode: ${Z.scrollMode} calls: ${Z.scrollCalls} lines: ${Z.lastScrollLines??"-"} mouse: ${Z.mouseTracking}
41
+ `,`event: ${Z.lastInputEvent||"-"} pointer: ${Z.pointerEvents} touch: ${Z.touchEvents}
42
+ `,`rtt: ${he!==null?`${he}ms`:"-"} frames/s: ${J.framesPerSec} bytes/s: ${J.bytesPerSec} renderer: ${ye??"-"}
43
+ `,`prediction: ${((rl=Qe.current)==null?void 0:rl.getState())??"-"} mode: ${de.predictiveEcho} buf: ${((Ga=Qe.current)==null?void 0:Ga.getBufferType())??"-"} pending: ${((yl=Qe.current)==null?void 0:yl.getVisiblePredictions().length)??0} srtt: ${((vl=Qe.current)==null?void 0:vl.getEchoSrttMs())!==null&&((Hl=Qe.current)==null?void 0:Hl.getEchoSrttMs())!==void 0?`${Math.round(Qe.current.getEchoSrttMs())}ms`:"-"}
44
+ `,`caret: ${(()=>{var Q;const V=(Q=Qe.current)==null?void 0:Q.getVisibleCursor();return V?`${V.row},${V.col}`:"-"})()} real cursor: ${Z.cursorY??"-"} borrowed: ${ee.current??"-"}`]}),z&&Rt&&Ba&&(()=>{var Wn;const V=f.current;if(!V||!We.current)return null;const Q=ha(V);if(Q.cellWidth<=0||Q.cellHeight<=0)return null;const ue=((Wn=d.current)==null?void 0:Wn.querySelector(".xterm-screen"))||d.current;if(!ue)return null;const ge=ue.getBoundingClientRect(),Ie=We.current.getBoundingClientRect(),ne=Rt.startRow-hl;if(Rt.endRow-hl<0||ne>=V.rows)return null;const Wt=ge.top-Ie.top+ne*Q.cellHeight,zt=ge.left-Ie.left+Rt.startCol*Q.cellWidth,it=(Rt.endCol-Rt.startCol+1)*Q.cellWidth,rn=(Rt.endRow-Rt.startRow+1)*Q.cellHeight;return u.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${Wt}px`,left:`${zt}px`,width:`${it}px`,height:`${rn}px`}})})(),z&&et&&u.jsx(_x,{anchorPoint:et,hasSelection:!!at,isController:Me,vibrateOnKeyPress:de.vibrateOnKeyPress,onCopySelection:Ka,onCopyLine:L,onCopyScreen:Y,onPaste:ie,onClose:()=>{hn(null),pt.current=null,It(null),ln.current=null,_t(""),wt.current="",mn(!1)}}),z&&u.jsx(zx,{isOpen:Ya,onClose:()=>Ul(!1),onSend:Ae,onSendImage:xe})]})},Fx=({onPairedSuccess:o})=>{const{settings:a,updateSettings:r,connect:c,connectionState:d,stateDetail:f,addToast:p,t:m}=Ct(),[b,S]=y.useState(""),[v,C]=y.useState(null),[D,_]=y.useState(!1),[z,X]=y.useState(a.wsUrl||"/ws/client"),[M,Z]=y.useState(a.token||""),[$,J]=y.useState(a.clientId||""),ae="node bin/service.js pair",ye="node bin/config-tui.js",O="herdr plugin pane open --plugin herdr.remote.web --entrypoint config --placement zoomed --focus",U=Me=>{La(Me).then(Ee=>{if(Ee==="failed"){p("error",m("clipboard.copyFailed"));return}C(Me),p("success",m("toasts.commandCopied")),setTimeout(()=>C(null),2e3)})},R=Me=>{Me.preventDefault();const Ee=b.trim().toUpperCase();if(!Ee&&!M.trim()){p("warning",m("toasts.connectionError"));return}const de={pairCode:Ee,wsUrl:z.trim()||"/ws/client",clientId:$.trim()||a.clientId};M.trim()&&(de.token=M.trim()),r(de),c({pairCode:Ee||void 0,token:M.trim()||void 0,wsUrl:z.trim()||"/ws/client",clientId:$.trim()||a.clientId}),o&&o()},te=d==="connecting"||d==="reconnecting",je=({n:Me})=>u.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",Me,"]"]});return u.jsx("div",{className:"flex h-full w-full flex-1 justify-center overflow-y-auto bg-tui-crust p-2 sm:p-4",children:u.jsxs("div",{className:"my-auto w-full max-w-3xl space-y-3",children:[u.jsxs("div",{className:"border border-tui-border bg-tui-base px-3 py-2",children:[u.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[u.jsx("span",{"aria-hidden":"true",className:"font-bold text-tui-accent",children:"herdr-remote"}),u.jsx("h1",{className:"text-tui font-bold text-tui-text",children:m("onboarding.title")}),u.jsx("span",{className:"text-tui uppercase text-tui-warn",children:m("onboarding.firstTimeSetup")})]}),u.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:m("onboarding.description")})]}),d==="error"&&u.jsxs(Ps,{tone:"warn",action:u.jsx(He,{variant:"warn",onClick:()=>c(),children:m("common.retry")}),children:[u.jsx("span",{className:"block font-bold",children:m("onboarding.authRequired")}),u.jsx("span",{className:"block text-tui-muted",children:f||m("onboarding.authRequiredDesc")})]}),u.jsxs("form",{onSubmit:R,className:"grid gap-3",children:[u.jsx(on,{title:m("onboarding.step1Title"),className:"min-w-0",children:u.jsxs("div",{className:"space-y-2",children:[u.jsxs("p",{className:"flex items-start gap-2 text-tui text-tui-muted",children:[u.jsx(je,{n:1}),u.jsx("span",{className:"leading-snug",children:m("onboarding.step1Desc")})]}),u.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),u.jsx("code",{className:"min-w-0 flex-1 truncate text-tui text-tui-text",children:ae}),u.jsx(He,{onClick:()=>U(ae),glyph:v===ae?Ge.check:"⧉",className:P("shrink-0",v===ae&&"border-tui-ok text-tui-ok"),children:m(v===ae?"common.copied":"common.copy")})]}),u.jsxs("div",{className:"space-y-0.5 text-tui-sm",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsx("span",{className:"truncate text-tui-faint",children:m("onboarding.step1CopyPlugin")}),u.jsx("button",{type:"button",onClick:()=>U(O),className:"tui-focusable shrink-0 text-tui-accent underline-offset-2 hover:underline",children:m(v===O?"common.copied":"onboarding.step1CopyCli")})]}),u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsx("span",{className:"truncate text-tui-faint",children:m("onboarding.step1TuiNote")}),u.jsx("code",{onClick:()=>U(ye),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:m("common.clickToCopy"),children:ye})]})]})]})}),u.jsx(on,{title:m("onboarding.step2Title"),className:"min-w-0",children:u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(je,{n:2}),u.jsx(In,{type:"text",value:b,onChange:Me=>S(Me.target.value.toUpperCase()),placeholder:m("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":m("onboarding.step2Title"),className:"font-bold uppercase"})]}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:m("onboarding.step2Note")})]})}),u.jsx(He,{variant:"primary",type:"submit",block:!0,disabled:te,className:"py-1.5",children:te?u.jsx(Ei,{label:m("onboarding.connectingAndPairing")}):m("onboarding.connectAndPair")}),u.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[u.jsxs("button",{type:"button",onClick:()=>_(!D),"aria-expanded":D,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:[u.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:D?Ge.chevronDown:Ge.chevronRight}),u.jsx("span",{className:"uppercase",children:m("onboarding.advancedTitle")})]}),D&&u.jsxs("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(_n,{htmlFor:"onboarding-token",children:m("onboarding.manualTokenLabel")}),u.jsx(In,{id:"onboarding-token",type:"password",value:M,onChange:Me=>Z(Me.target.value),placeholder:m("onboarding.manualTokenPlaceholder")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_n,{htmlFor:"onboarding-ws",children:m("onboarding.wsEndpointLabel")}),u.jsx(In,{id:"onboarding-ws",type:"text",value:z,onChange:Me=>X(Me.target.value),placeholder:m("onboarding.wsEndpointPlaceholder")})]}),u.jsx(Oa,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_n,{htmlFor:"onboarding-client-id",children:m("onboarding.clientIdLabel")}),u.jsx(In,{id:"onboarding-client-id",type:"text",value:$,onChange:Me=>J(Me.target.value)})]})]})]})]})]})})},Ci="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",Tr="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",Zx="border-tui-accent bg-tui-accent text-tui-crust font-bold",Qx="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",Ix=({compact:o=!1})=>{const{sendKey:a,settings:r,updateSettings:c,isController:d,warnViewerMode:f,t:p,uploadProgress:m,uploadImage:b}=Ct(),S="h-9 min-w-[2.25rem] px-2",v="h-9 w-9",C="h-9 px-2",D=y.useRef(null),_=y.useRef(null),z=y.useCallback(()=>{if(r.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[r.vibrateOnKeyPress]),X=y.useCallback(()=>{var F;if(z(),!d){f();return}m.active||(F=D.current)==null||F.click()},[z,d,f,m.active]),M=y.useCallback(F=>{const pe=F.target.files,ze=pe&&pe[0];F.target.value="",ze&&b(ze)},[b]),Z=()=>u.jsxs(u.Fragment,{children:[u.jsx("input",{ref:D,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"key-toolbar-file-input",onChange:M}),u.jsx("input",{ref:_,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:M})]}),$=(F=!1)=>m.active?u.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:u.jsx(Pv,{ratio:m.ratio,label:m.statusText,tone:m.phase==="completed"?"ok":m.phase==="error"?"bad":"accent","aria-label":m.statusText})}):null,J=()=>{const F=m.active;return u.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:X,disabled:F,className:P(Ci,S,F?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":Tr),title:F?m.statusText:p("virtualKeyboard.uploadImageTitle"),"aria-label":p("virtualKeyboard.uploadImage"),children:u.jsx("span",{className:"font-medium",children:F?`${m.percent}%`:p("virtualKeyboard.image")})})},[ae,ye]=y.useState(!1),[O,U]=y.useState(!1),[R,te]=y.useState(!1),[je,Me]=y.useState(!1),[Ee,de]=y.useState(!1),[_e,Le]=y.useState(!1),j=y.useCallback((F,pe=!1)=>{if(z(),!d){f();return}let ze=F;pe&&(ae||O||R)&&(ze=xy(F,{ctrl:ae,alt:O,shift:R})),a(ze),ae&&ye(!1),O&&U(!1),R&&te(!1)},[d,ae,O,R,a,f,z,p]);if(!r.toolbarVisible)return u.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:[Z(),$(!0),u.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:u.jsxs("button",{type:"button",onClick:()=>c({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:p("virtualKeyboard.expandToolbar"),"aria-label":p("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[u.jsx("span",{"aria-hidden":"true",children:"▴"}),u.jsx("span",{"aria-hidden":"true",children:p("common.keyBar")})]})})]});const q=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys.filter(F=>F.enabled):bp,W=F=>F.id==="left"?u.jsx("span",{"aria-hidden":"true",children:"←"}):F.id==="up"?u.jsx("span",{"aria-hidden":"true",children:"↑"}):F.id==="down"?u.jsx("span",{"aria-hidden":"true",children:"↓"}):F.id==="right"?u.jsx("span",{"aria-hidden":"true",children:"→"}):F.id==="enter"?u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx("span",{"aria-hidden":"true",children:"⏎"}),u.jsx("span",{className:"hidden sm:inline",children:p("virtualKeyboard.keyEnter")})]}):F.id==="drawer_chords"?u.jsx("span",{children:"^C"}):F.id==="drawer_fn"?u.jsxs("span",{className:"flex items-center gap-0.5",children:[u.jsx("span",{children:"Fn"}),u.jsx("span",{"aria-hidden":"true",children:je?"▾":"▴"})]}):u.jsx("span",{children:F.label}),Ce=F=>{if(z(),F.type==="modifier"){F.modifierType==="ctrl"?ye(!ae):F.modifierType==="alt"?U(!O):F.modifierType==="shift"?te(!R):F.modifierType==="meta"&&j(Ne.ESC);return}if(F.type==="drawer"){F.drawerType==="fn"?(Me(!je),de(!1),Le(!1)):F.drawerType==="chords"?(Le(!_e),Me(!1),de(!1)):F.drawerType==="symbols"&&(de(!Ee),Me(!1),Le(!1));return}j(F.code,F.isPlainChar||F.type==="symbol")},H=F=>{if(F.type==="modifier"){if(F.modifierType==="ctrl")return ae;if(F.modifierType==="alt")return O;if(F.modifierType==="shift")return R}if(F.type==="drawer"){if(F.drawerType==="fn")return je;if(F.drawerType==="chords")return _e;if(F.drawerType==="symbols")return Ee}return!1},qe=(F,pe,ze,ve,he="default")=>u.jsxs("button",{type:"button",onClick:()=>j(F),className:P(Ci,"h-8 gap-1.5 px-2",he==="bad"?"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust":he==="warn"?"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust":Tr),title:ze,children:[u.jsx("span",{className:"font-bold",children:pe}),u.jsx("span",{className:"text-tui-sm opacity-70",children:ve})]});return u.jsxs("div",{"data-testid":"key-toolbar",className:P("z-20 flex shrink-0 select-none flex-col border-t border-tui-border bg-tui-mantle",o?"pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]":"pb-[max(env(safe-area-inset-bottom,0px),0.25rem)]"),role:"toolbar","aria-label":p("virtualKeyboard.touchKeyboardShortcuts"),children:[Z(),$(!1),je&&u.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 pe=`F${F}`;return u.jsxs("button",{type:"button",onClick:()=>j(Ne[pe]),className:P(Ci,Tr,"h-8"),children:["F",F]},pe)})}),_e&&u.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:[qe(Ne.CTRL_C,"^C",p("virtualKeyboard.ctrlCTitle"),p("virtualKeyboard.badgeSigint"),"bad"),qe(Ne.CTRL_D,"^D",p("virtualKeyboard.ctrlDTitle"),p("virtualKeyboard.badgeEof")),qe(Ne.CTRL_Z,"^Z",p("virtualKeyboard.ctrlZTitle"),p("virtualKeyboard.badgeTstp"),"warn"),qe(Ne.CTRL_L,"^L",p("virtualKeyboard.ctrlLTitle"),p("virtualKeyboard.badgeClear")),qe(Ne.CTRL_R,"^R",p("virtualKeyboard.ctrlRTitle"),p("virtualKeyboard.badgeSearch")),qe(Ne.CTRL_A,"^A",p("virtualKeyboard.ctrlATitle"),p("virtualKeyboard.badgeStart")),qe(Ne.CTRL_E,"^E",p("virtualKeyboard.ctrlETitle"),p("virtualKeyboard.badgeEnd")),qe(Ne.CTRL_K,"^K",p("virtualKeyboard.ctrlKTitle"),p("virtualKeyboard.badgeKill"))]}),Ee&&u.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=>u.jsx("button",{type:"button",onClick:()=>j(F,!0),className:P(Ci,Tr,"h-8 w-8 font-bold"),children:F},F))}),u.jsxs("div",{"data-testid":"key-toolbar-row",className:P("flex flex-wrap items-center justify-center gap-1",o?"px-1.5 py-1":"px-2 py-1.5"),children:[u.jsx("button",{type:"button",onClick:()=>c({toolbarVisible:!1}),className:P(Ci,v,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:p("virtualKeyboard.collapseToolbar"),"aria-label":p("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:u.jsx("span",{"aria-hidden":"true",children:"▾"})}),q.map(F=>{const pe=H(F),ze=F.id==="enter",ve=["left","up","down","right"].includes(F.id),he=F.type==="drawer",St=Su(F,p),Ue=u.jsx("button",{type:"button",onClick:()=>Ce(F),className:P(Ci,ve?v:he?C:S,ze?Qx:pe?Zx:Tr),title:St,"aria-label":St,"aria-pressed":pe,children:W(F)},F.id);return ze?u.jsxs(fl.Fragment,{children:[J(),Ue]},"enter-with-image"):Ue}),!q.some(F=>F.id==="enter")&&J()]})]})},Jx=["ls -la","clear","git status","pwd","top","exit","cat"],Wx=({isOpen:o,onClose:a})=>{const{sendKey:r,isController:c,warnViewerMode:d,t:f}=Ct(),[p,m]=y.useState("");if(!o)return null;const b=v=>{if(v&&v.preventDefault(),!c){d();return}p.length>0?(r(p+"\r"),m("")):r("\r")},S=v=>{if(!c){d();return}r(v+"\r")};return u.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":f("virtualKeyboard.helperTitle"),children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-tui font-bold uppercase text-tui-accent",children:f("virtualKeyboard.helperTitle")}),u.jsx(He,{variant:"ghost",onClick:a,"aria-label":f("virtualKeyboard.closeHelper"),children:"esc"})]}),u.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:Jx.map(v=>u.jsx("button",{type:"button",onClick:()=>S(v),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:v},v))}),u.jsxs("form",{onSubmit:b,className:"flex items-center gap-1.5",children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none font-bold text-tui-ok",children:"$"}),u.jsxs("div",{className:"relative flex-1",children:[u.jsx("label",{htmlFor:"virtual-keyboard-input",className:"sr-only",children:f("virtualKeyboard.placeholder")}),u.jsx(In,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:p,onChange:v=>m(v.target.value),placeholder:f("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),p.length>0&&u.jsx("button",{type:"button",onClick:()=>m(""),className:"tui-focusable absolute right-1 top-1/2 -translate-y-1/2 px-1 text-tui-faint hover:text-tui-bad","aria-label":f("virtualKeyboard.clearInput"),children:u.jsx("span",{"aria-hidden":"true",children:Ge.cross})})]}),u.jsx(He,{variant:"primary",type:"submit",title:f("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:u.jsx("span",{className:"hidden sm:inline",children:f("virtualKeyboard.sendButton")})})]})]})};function io(o,a){const r=(c,d)=>a?a(c):d;switch(o){case"connected":return{label:r("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:r("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:r("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:r("connection.reconnectNow","Reconnect now")};case"error":return{label:r("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:r("connection.retry","Retry")};default:return{label:r("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:r("connection.connect","Connect")}}}const Px={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},$x=({isOpen:o,onClose:a,isAddMode:r=!1})=>{const{settings:c,updateSettings:d,connect:f,disconnect:p,connectionState:m,hostId:b,addToast:S,t:v,activeProfile:C,activeProfileId:D,addProfileAndConnect:_,renameProfile:z}=Ct(),[X,M]=y.useState(c.wsUrl),[Z,$]=y.useState(c.token),[J,ae]=y.useState(c.pairCode),[ye,O]=y.useState(c.clientId),[U,R]=y.useState((C==null?void 0:C.displayName)||""),[te,je]=y.useState(c.autoReconnect),[Me,Ee]=y.useState(!1);if(y.useEffect(()=>{o&&(M(c.wsUrl),$(r?"":c.token),ae(r?"":c.pairCode),O(c.clientId),R(r?"":(C==null?void 0:C.displayName)||""),je(c.autoReconnect))},[o,r,c,C]),!o)return null;const de=q=>{q.preventDefault();const W={wsUrl:X.trim()||"/ws/client",token:Z.trim(),pairCode:J.trim().toUpperCase(),clientId:ye.trim()||c.clientId,autoReconnect:te};if(!W.token&&!W.pairCode){S("warning",v("pairing.credentialsRequired"));return}r?_({...W,displayName:U.trim()||void 0}):(d(W),D&&U.trim()&&z(D,U),p(),f({wsUrl:W.wsUrl,token:W.token||void 0,pairCode:W.pairCode||void 0,clientId:W.clientId,autoReconnect:te})),a()},_e=()=>{const q=`client-${Math.random().toString(36).substring(2,8)}`;O(q)},Le=()=>{const q=new URL(window.location.href);q.search="",J.trim()&&q.searchParams.set("pairCode",J.trim().toUpperCase()),La(q.toString()).then(W=>{if(W==="failed"){S("error",v("clipboard.copyFailed"));return}Ee(!0),S("success",v("toasts.pairingLinkCopied")),setTimeout(()=>Ee(!1),2e3)})},j=Px[m]??"idle";return u.jsxs(Yu,{isOpen:o,onClose:a,title:v(r?"pairing.addTitle":"pairing.title"),subtitle:v("pairing.subtitle"),closeLabel:v("common.closeDialog"),hints:[{keys:"esc",action:v("common.close")},{keys:"⏎",action:v("pairing.saveAndConnect")}],footer:u.jsxs(u.Fragment,{children:[m==="connected"&&u.jsx(He,{variant:"danger",onClick:()=>{p(),a()},children:v("common.disconnect")}),u.jsx(He,{variant:"primary",type:"submit",form:"pairing-form",children:v("pairing.saveAndConnect")})]}),children:[u.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:[u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Jn,{level:j}),u.jsx("span",{className:"text-tui-muted",children:v("common.status")}),u.jsx("span",{className:P(j==="ok"?"text-tui-ok":j==="bad"?"text-tui-bad":j==="warn"?"text-tui-warn":"text-tui-faint"),children:io(m,v).label})]}),b&&u.jsxs("span",{className:"flex items-center gap-1.5 text-tui-muted",children:[v("common.host")," ",u.jsx("span",{className:"text-tui-text",children:b})]})]}),u.jsxs("form",{id:"pairing-form",onSubmit:de,className:"space-y-3",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(_n,{htmlFor:"pairing-name",children:v("pairing.displayNameLabel")}),u.jsx(In,{id:"pairing-name",type:"text",value:U,onChange:q=>R(q.target.value),placeholder:v("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:v("pairing.displayNameHelp")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_n,{htmlFor:"pairing-code",hint:v("pairing.pairCodeNote"),children:v("pairing.pairCodeLabel")}),u.jsx(In,{id:"pairing-code",type:"text",value:J,onChange:q=>ae(q.target.value.toUpperCase()),placeholder:v("pairing.pairCodePlaceholder"),maxLength:12,className:"uppercase"}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:v("pairing.pairCodeHelp")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_n,{htmlFor:"pairing-token",hint:v("pairing.tokenNote"),children:v("pairing.tokenLabel")}),u.jsx(In,{id:"pairing-token",type:"password",value:Z,onChange:q=>$(q.target.value),placeholder:v("pairing.tokenPlaceholder")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_n,{htmlFor:"pairing-ws",children:v("pairing.wsUrlLabel")}),u.jsx(In,{id:"pairing-ws",type:"text",value:X,onChange:q=>M(q.target.value),placeholder:v("pairing.wsUrlPlaceholder")}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:v("pairing.wsUrlDefaultNote")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_n,{htmlFor:"pairing-client-id",children:v("pairing.clientIdLabel")}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(In,{id:"pairing-client-id",type:"text",value:ye,onChange:q=>O(q.target.value),className:"flex-1"}),u.jsx(He,{onClick:_e,title:v("pairing.regenerateClientIdTitle"),className:"shrink-0",children:v("pairing.newIdButton")})]})]}),u.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:u.jsx(Ru,{checked:te,onChange:je,label:v("pairing.autoReconnectLabel"),description:v("pairing.autoReconnectDesc")})}),u.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:u.jsx(He,{onClick:Le,block:!0,glyph:Me?Ge.check:"⧉",className:P(Me&&"border-tui-ok text-tui-ok"),children:v("pairing.copyDirectLink")})})]})]})},e0=({isOpen:o,onClose:a})=>{const{settings:r,updateSettings:c,addToast:d,language:f,setLanguage:p,t:m}=Ct(),[b,S]=y.useState("appearance"),[v,C]=y.useState(!1);if(!o)return null;const D=Nu.find(O=>O.font===r.fontFamily),_=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys:_r(),z=()=>{const O=xp();c({fontSize:O.fontSize,fontFamily:O.fontFamily,toolbarVisible:O.toolbarVisible,vibrateOnKeyPress:O.vibrateOnKeyPress,predictiveEcho:O.predictiveEcho,language:O.language,virtualKeys:O.virtualKeys}),d("info",m("settings.resetDefaultsToast"))},X=O=>{const U=_.map(R=>R.id===O?{...R,enabled:!R.enabled}:R);c({virtualKeys:U})},M=(O,U)=>{const R=U==="up"?O-1:O+1;if(R<0||R>=_.length)return;const te=[..._],je=te[O];te[O]=te[R],te[R]=je,c({virtualKeys:te})},Z=O=>{if(_.some(R=>R.id===O.id)){const R=_.map(te=>te.id===O.id?{...te,enabled:!0}:te);c({virtualKeys:R})}else{const R=[..._,{...O,enabled:!0}];c({virtualKeys:R})}C(!1)},$=O=>{const U=_.filter(R=>R.id!==O);c({virtualKeys:U})},J=()=>{c({virtualKeys:_r()}),d("info",m("toasts.keyLayoutReset"))},ae=10,ye=24;return u.jsxs(Yu,{isOpen:o,onClose:a,title:m("settings.title"),subtitle:m("settings.subtitle"),closeLabel:m("common.closeDialog"),size:"lg",hints:[{keys:"esc",action:m("common.close")}],footer:u.jsxs(u.Fragment,{children:[u.jsx(He,{variant:"ghost",onClick:z,children:m("settings.resetDefaults")}),u.jsx(He,{variant:"primary",onClick:a,children:m("common.done")})]}),children:[u.jsx(Uu,{tabs:[{id:"appearance",label:m("settings.tabAppearance"),index:1},{id:"virtualKeys",label:m("settings.tabVirtualKeys"),index:2}],activeId:b,onSelect:O=>S(O),className:"mb-3 border-b border-tui-border-dim pb-1"}),b==="appearance"&&u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(_n,{children:m("settings.languageLabel")}),u.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2",children:[u.jsx(xr,{name:"ui-language",checked:f==="zh",onChange:()=>p("zh"),label:"简体中文"}),u.jsx(xr,{name:"ui-language",checked:f==="en",onChange:()=>p("en"),label:"English"})]})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_n,{htmlFor:"terminal-font-select",children:m("settings.fontFamilyLabel")}),u.jsxs(Bu,{id:"terminal-font-select",value:r.fontFamily,onChange:O=>c({fontFamily:O.target.value}),"aria-label":m("settings.fontFamilyLabel"),children:[!D&&u.jsx("option",{value:r.fontFamily,children:r.fontFamily}),Nu.map(O=>u.jsx("option",{value:O.font,children:m(`fontPresets.${O.id}`)||O.name},O.id))]}),u.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:[u.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_n,{htmlFor:"terminal-font-size",children:m("settings.fontSizeLabel",{size:r.fontSize})}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Jv,{value:(r.fontSize-ae)/(ye-ae),width:24,className:"hidden shrink-0 sm:inline-flex"}),u.jsx("input",{id:"terminal-font-size",type:"range",min:ae,max:ye,step:1,value:r.fontSize,onChange:O=>c({fontSize:Number(O.target.value)}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})]}),u.jsxs("div",{className:"flex justify-between text-tui-sm text-tui-faint",children:[u.jsx("span",{children:m("settings.fontSizeCompact")}),u.jsx("span",{children:m("settings.fontSizeDefault")}),u.jsx("span",{children:m("settings.fontSizeLarge")})]}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:m("settings.mobileFontNote")}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:m("settings.windowZoomSharedNote")})]}),u.jsx(Oa,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_n,{children:m("settings.predictiveEchoLabel")}),u.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-3",children:[u.jsx(xr,{name:"predictive-echo",checked:r.predictiveEcho==="auto",onChange:()=>c({predictiveEcho:"auto"}),label:m("settings.predictiveEchoAuto")}),u.jsx(xr,{name:"predictive-echo",checked:r.predictiveEcho==="always",onChange:()=>c({predictiveEcho:"always"}),label:m("settings.predictiveEchoAlways")}),u.jsx(xr,{name:"predictive-echo",checked:r.predictiveEcho==="off",onChange:()=>c({predictiveEcho:"off"}),label:m("settings.predictiveEchoOff")})]}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:m("settings.predictiveEchoDesc")})]}),u.jsx(Oa,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(Ru,{checked:r.toolbarVisible,onChange:O=>c({toolbarVisible:O}),label:m("settings.touchKeyToolbar"),description:m("settings.touchKeyToolbarDesc")}),u.jsx(Ru,{checked:r.vibrateOnKeyPress,onChange:O=>c({vibrateOnKeyPress:O}),label:m("settings.touchHaptics"),description:m("settings.touchHapticsDesc")})]}),u.jsx(Oa,{}),u.jsxs("p",{className:"text-tui-sm leading-snug text-tui-faint",children:[u.jsx("span",{"aria-hidden":"true",className:"mr-1",children:Ge.arrowRight}),m("settings.colorPassthroughNote")]})]}),b==="virtualKeys"&&u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"flex items-start justify-between gap-2",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("h3",{className:"text-tui font-bold uppercase text-tui-accent",children:m("virtualKeyboard.customizeTitle")}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:m("virtualKeyboard.customizeDesc")})]}),u.jsx(He,{variant:"ghost",onClick:J,className:"shrink-0",children:m("virtualKeyboard.resetLayout")})]}),u.jsx("div",{className:"max-h-72 overflow-y-auto border border-tui-border bg-tui-mantle",children:_.map((O,U)=>u.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:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx("input",{type:"checkbox",checked:O.enabled,onChange:()=>X(O.id),className:"sr-only",id:`toggle-${O.id}`}),u.jsx("label",{htmlFor:`toggle-${O.id}`,className:P("shrink-0 cursor-pointer select-none font-bold",O.enabled?"text-tui-ok":"text-tui-faint"),"aria-hidden":"true",children:O.enabled?"[x]":"[ ]"}),u.jsx($v,{className:P(!O.enabled&&"opacity-50"),children:O.label}),u.jsx("span",{className:"truncate text-tui-sm text-tui-muted",children:Su(O,m)})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.jsx(He,{variant:"ghost",brackets:!1,disabled:U===0,onClick:()=>M(U,"up"),title:m("virtualKeyboard.moveUp"),"aria-label":m("virtualKeyboard.moveUp"),className:"px-1",children:"↑"}),u.jsx(He,{variant:"ghost",brackets:!1,disabled:U===_.length-1,onClick:()=>M(U,"down"),title:m("virtualKeyboard.moveDown"),"aria-label":m("virtualKeyboard.moveDown"),className:"px-1",children:"↓"}),u.jsx(He,{variant:"ghost",brackets:!1,onClick:()=>$(O.id),title:m("virtualKeyboard.deleteKeyTitle"),"aria-label":m("virtualKeyboard.deleteKeyTitle"),className:"px-1 text-tui-bad hover:text-tui-bad",children:Ge.cross})]})]},O.id))}),u.jsx(He,{block:!0,glyph:"+",onClick:()=>C(!v),className:"border-dashed",children:m("virtualKeyboard.addKey")}),v&&u.jsxs("div",{className:"space-y-2 border border-tui-border bg-tui-mantle p-2",children:[u.jsx(Oa,{label:m("virtualKeyboard.availableKeys")}),u.jsx("div",{className:"flex max-h-48 flex-wrap gap-1 overflow-y-auto",children:_y.map(O=>{const U=_.some(R=>R.id===O.id);return u.jsxs("button",{type:"button",onClick:()=>Z(O),title:Su(O,m),className:P("tui-focusable flex select-none items-center gap-1 border px-1.5 py-0.5 text-tui-sm transition-colors",U?"border-tui-border-dim text-tui-faint":"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent"),children:[u.jsx("span",{children:O.label}),u.jsx("span",{"aria-hidden":"true",className:U?"text-tui-ok":"text-tui-accent",children:U?Ge.check:"+"})]},O.id)})})]})]})]})},t0={success:"ok",warning:"warn",error:"bad",info:"accent"},n0={success:Ge.check,warning:Ge.warn,error:Ge.cross,info:"›"},l0=()=>{const{toasts:o,removeToast:a,t:r}=Ct();return o.length===0?null:u.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:o.map(c=>{const d=t0[c.type];return u.jsxs("div",{className:P("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",Qn[d].edgeL),role:"alert",children:[u.jsx("span",{"aria-hidden":"true",className:P("shrink-0 font-bold",Qn[d].text),children:n0[c.type]}),u.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:c.message}),c.count>1&&u.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted","aria-label":`×${c.count}`,children:["×",c.count]}),u.jsx("button",{type:"button",onClick:()=>a(c.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":r("common.dismissNotification"),children:u.jsx("span",{"aria-hidden":"true",children:Ge.cross})})]},c.id)})})},Ku=({onAddProfile:o,mobile:a=!1,statusBar:r=!1})=>{const{profiles:c,activeProfileId:d,activeProfile:f,connectionState:p,switchProfile:m,renameProfile:b,removeProfile:S,t:v}=Ct(),[C,D]=y.useState(!1),[_,z]=y.useState(null),[X,M]=y.useState(""),Z=y.useRef(null);y.useEffect(()=>{if(!C)return;const U=R=>{Z.current&&!Z.current.contains(R.target)&&D(!1)};return document.addEventListener("pointerdown",U),()=>document.removeEventListener("pointerdown",U)},[C]);const $=(U,R)=>{z(U),M(R)},J=U=>{const R=X.trim();R&&b(U,R),z(null)},ae=U=>{typeof window<"u"&&!window.confirm(v("profiles.removeConfirm"))||(S(U),z(null))},ye=(f==null?void 0:f.displayName)||v("profiles.addHost"),O=p==="connected"?"ok":p==="connecting"||p==="reconnecting"?"warn":p==="error"?"bad":"idle";return u.jsxs("div",{ref:Z,className:P("relative min-w-0",a&&"w-full",r&&"flex-1"),children:[u.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":C,"aria-label":v("profiles.switcherLabel"),onClick:()=>D(U=>!U),className:P("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",r?"min-h-11 w-full max-w-none px-2":a?"min-h-11 w-full px-2":"min-h-[24px] max-w-[18rem] px-1"),children:[u.jsx(Jn,{level:O}),u.jsx("span",{className:P("truncate text-tui-text",r&&"min-w-0 flex-1"),children:ye}),u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:C?Ge.chevronDown:Ge.chevronRight})]}),C&&u.jsxs("div",{role:"menu","aria-label":v("profiles.switcherLabel"),className:P("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",r?"w-80 max-w-[calc(100vw-1rem)]":a?"inset-x-0 bottom-auto top-full mt-1 mb-0 w-full":"w-80 max-w-[calc(100vw-1rem)]"),children:[u.jsx("div",{className:"border-b border-tui-border-dim px-2 py-1 text-tui-sm uppercase text-tui-faint",children:v("profiles.title")}),c.length===0?u.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:v("profiles.empty")}):c.map(U=>{const R=U.id===d,te=U.id===_;return u.jsxs("div",{role:"none",className:"border-b border-tui-border-dim last:border-b-0",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsxs("button",{type:"button",role:"menuitem","aria-current":R?"true":void 0,onClick:()=>{m(U.id),D(!1)},className:P("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",R?"text-tui-accent":"text-tui-text"),children:[u.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:R?Ge.cursor:""}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate font-bold",children:U.displayName}),u.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:U.hostname||U.hostId,children:U.hostname||U.hostId||U.wsUrl})]}),R&&u.jsx("span",{className:"shrink-0 text-tui-sm text-tui-ok",children:v("profiles.current")})]}),u.jsx("button",{type:"button",role:"menuitem","aria-label":v("profiles.rename"),title:v("profiles.rename"),onClick:()=>$(U.id,U.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:Ge.ellipsis})]}),te&&u.jsxs("div",{className:"flex items-center gap-1 px-2 pb-2",children:[u.jsx("input",{autoFocus:!0,value:X,maxLength:64,onChange:je=>M(je.target.value),onKeyDown:je=>{je.key==="Enter"&&J(U.id),je.key==="Escape"&&z(null)},"aria-label":v("profiles.rename"),className:"tui-input min-w-0 flex-1 px-2 py-1 text-tui"}),u.jsx(He,{onClick:()=>J(U.id),variant:"primary",className:"min-h-11",children:v("common.save")}),u.jsx(He,{onClick:()=>ae(U.id),variant:"danger",className:"min-h-11",children:v("profiles.remove")})]})]},U.id)}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{D(!1),o()},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:[u.jsx("span",{"aria-hidden":"true",children:"+"}),u.jsx("span",{children:v("profiles.addHost")})]})]})]})},a0=({onAddProfile:o=()=>{}})=>{const{connectionState:a,role:r,hostId:c,assignedClientId:d,sharedWindowCount:f,settings:p,rttMs:m,t:b}=Ct(),S=io(a,b),v=a==="connected";return u.jsx(Xp,{left:u.jsxs(u.Fragment,{children:[u.jsx(Ku,{onAddProfile:o}),u.jsx(qm,{items:[u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Jn,{level:S.level}),u.jsx("span",{className:"text-tui-text",children:S.label})]},"status"),v?u.jsx(ao,{tone:r==="controller"?"ok":"warn",children:b(r==="controller"?"role.sharedControl":"common.viewer")},"role"):null,v&&f>1?u.jsx("span",{className:"text-tui-muted",children:b("role.sharedWindows",{count:f})},"windows"):null,c?u.jsxs("span",{children:[u.jsxs("span",{className:"text-tui-faint",children:[b("common.host"),":"]})," ",u.jsx("span",{className:"text-tui-text",children:c})]},"host"):null,u.jsxs("span",{children:[u.jsx("span",{className:"text-tui-faint",children:b("header.clientIdLabel")})," ",u.jsx("span",{className:"text-tui-text",children:d||p.clientId})]},"client")]})]}),right:u.jsx(qm,{items:[m!==null?u.jsxs("span",{className:"text-tui-muted",children:[b("header.latencyTitle"),": ",u.jsxs("span",{className:"text-tui-text",children:[m,"ms"]})]},"rtt"):null,u.jsx("span",{className:"hidden text-tui-faint sm:inline",children:b("header.tagline")},"mode")]})})},i0=[[/\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"]],r0=[[/\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 ap(o,a){for(const[r,c]of o)if(r.test(a))return c;return null}function Gu(o){const a=typeof o=="string"?o.trim():"";if(!a)return{label:"",raw:""};const r=ap(i0,a),c=ap(r0,a);return r&&c?{label:`${r} · ${c}`,raw:a}:r?{label:r,raw:a}:c?{label:c,raw:a}:{label:a.length>32?`${a.slice(0,32)}…`:a,raw:a}}function ip(o){if(o===0)return"0 B";const a=1024,r=["B","KB","MB","GB"],c=Math.floor(Math.log(o)/Math.log(a));return`${(o/Math.pow(a,c)).toFixed(1)} ${r[c]}`}const s0=({clients:o})=>{const{t:a}=Ct(),r=[{key:"id",header:a("admin.colClientId"),render:c=>u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Jn,{level:"ok"}),u.jsx("span",{className:"font-bold text-tui-text",children:c.id})]})},{key:"role",header:a("admin.colRole"),width:12,render:c=>{const d=c.role==="controller";return u.jsx(ao,{tone:d?"ok":"warn",children:a(d?"common.controller":"common.viewer")})}},{key:"device",header:a("admin.colDevice"),render:c=>{const d=Gu(c.userAgent);return d.label?u.jsx("span",{className:"text-tui-muted",title:d.raw,children:d.label}):u.jsx("span",{className:"text-tui-faint",children:a("admin.unknownDevice")})}},{key:"ip",header:a("admin.colIp"),render:c=>u.jsx("span",{className:"text-tui-muted",children:c.ip||"127.0.0.1"})},{key:"connectedAt",header:a("admin.colConnectedAt"),render:c=>u.jsx("span",{className:"text-tui-muted",children:c.connectedAt?new Date(c.connectedAt).toLocaleTimeString():a("admin.startedRecently")})},{key:"traffic",header:a("admin.colTraffic"),align:"right",render:c=>u.jsxs("span",{className:"whitespace-nowrap",children:[u.jsx("span",{className:"text-tui-accent",children:ip(c.bytesReceived||0)}),u.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),u.jsx("span",{className:"text-tui-ok",children:ip(c.bytesSent||0)})]})}];return u.jsx(on,{title:a("admin.connectedClientsTitle",{count:o.length}),bodyClassName:"-mx-1",children:u.jsx(Hu,{columns:r,items:o,rowKey:c=>c.id,empty:a("admin.noClients")})})},rp={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function o0(o=[],a=[]){const r=new Map;for(const f of a){if(!(f!=null&&f.hostId))continue;const p=r.get(f.hostId);p?p.push(f):r.set(f.hostId,[f])}const c=o.map(f=>{const p=r.get(f.id)||[];return{id:f.id,hostname:f.hostname||f.id,status:f.status||"online",connectedDeviceCount:f.connectedDeviceCount??0,pairedDeviceCount:f.pairedDeviceCount??p.length,devices:p,fromRosterOnly:!1}}),d=new Set(c.map(f=>f.id));for(const[f,p]of r)d.has(f)||c.push({id:f,hostname:f,status:"offline",connectedDeviceCount:0,pairedDeviceCount:p.length,devices:p,fromRosterOnly:!0});return c.sort((f,p)=>f.fromRosterOnly!==p.fromRosterOnly?f.fromRosterOnly?1:-1:f.hostname.localeCompare(p.hostname))}const c0=({hosts:o,devices:a})=>{const{t:r}=Ct(),c=o0(o,a),d={online:r("admin.hostStatusOnline"),busy:r("admin.hostStatusBusy"),reconnecting:r("admin.hostStatusReconnecting"),offline:r("admin.hostStatusOffline")};return u.jsx(on,{title:r("admin.hostsTitle",{count:c.length}),bodyClassName:"space-y-2",children:c.length===0?u.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:r("admin.noHosts")}):c.map(f=>u.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[u.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:[u.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-tui",children:[u.jsx(Jn,{level:rp[f.status]}),u.jsx("span",{className:"truncate font-bold text-tui-text",children:f.hostname}),f.hostname!==f.id?u.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:f.id}):null]}),u.jsxs("span",{className:"flex shrink-0 items-center gap-3 text-tui-sm",children:[u.jsx(ao,{tone:rp[f.status],children:d[f.status]}),u.jsx("span",{className:"text-tui-accent",children:r("admin.hostConnectedDevices",{count:f.connectedDeviceCount})}),u.jsx("span",{className:"text-tui-muted",children:r("admin.hostPairedDevices",{count:f.pairedDeviceCount})})]})]}),f.devices.length>0?u.jsx("ul",{className:"divide-y divide-tui-border-dim",children:f.devices.map(p=>{const m=Gu(p.userAgent);return u.jsxs("li",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5 px-2 py-0.5 text-tui",children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:"·"}),u.jsx("span",{className:"truncate text-tui-text",title:m.raw,children:m.label||r("admin.unknownDevice")}),u.jsx("code",{className:"truncate text-tui-sm text-tui-muted",children:p.deviceId}),u.jsx("span",{className:"ml-auto shrink-0 text-tui-sm text-tui-faint",children:p.lastIp||"—"})]},p.deviceId)})}):u.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:f.pairedDeviceCount>0?r("admin.hostRosterOperatorOnly"):r("admin.noDevices")})]},f.id))})},u0=({ptys:o})=>{const{t:a}=Ct(),r=[{key:"id",header:a("admin.colPtyId"),render:c=>u.jsx("span",{className:"font-bold text-tui-accent",children:c.id})},{key:"pid",header:a("admin.colPid"),width:9,render:c=>u.jsx("span",{className:"text-tui-muted",children:c.pid})},{key:"command",header:a("admin.colCommand"),render:c=>u.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:c.command})},{key:"grid",header:a("admin.colGrid"),width:11,render:c=>u.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[c.cols,u.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),c.rows]})},{key:"cwd",header:a("admin.colCwd"),className:"max-w-xs truncate",render:c=>u.jsx("span",{className:"text-tui-muted",children:c.cwd||"~"})},{key:"viewers",header:a("admin.colViewers"),align:"right",width:9,render:c=>u.jsx("span",{className:"font-bold text-tui-ok",children:c.activeClients})}];return u.jsx(on,{title:a("admin.activePtysTitle",{count:o.length}),bodyClassName:"-mx-1",children:u.jsx(Hu,{columns:r,items:o,rowKey:c=>c.id,empty:a("admin.noPtys")})})};function d0(o){if(!o)return"—";const a=new Date(o);return Number.isNaN(a.getTime())?"—":a.toLocaleString()}const f0=({devices:o,onRevoke:a})=>{const{t:r}=Ct(),[c,d]=y.useState(null),[f,p]=y.useState(null),m=async S=>{if(c!==S){d(S);return}p(S);try{await a(S)}finally{p(null),d(null)}},b=[{key:"device",header:r("admin.colDevice"),render:S=>{const v=Gu(S.userAgent);return u.jsx("span",{className:"text-tui-text",title:v.raw,children:v.label||r("admin.unknownDevice")})}},{key:"deviceId",header:r("admin.colDeviceId"),render:S=>u.jsx("span",{className:"text-tui-muted",children:S.deviceId})},{key:"ip",header:r("admin.colIp"),render:S=>u.jsx("span",{className:"text-tui-muted",children:S.lastIp||"—"})},{key:"lastSeen",header:r("admin.colLastSeen"),render:S=>u.jsx("span",{className:"whitespace-nowrap text-tui-muted",children:d0(S.lastSeenAt)})},{key:"actions",header:r("admin.colActions"),align:"right",render:S=>{const v=c===S.deviceId,C=f===S.deviceId;return u.jsx(He,{variant:"danger",disabled:C,onClick:()=>void m(S.deviceId),onBlur:()=>d(D=>D===S.deviceId?null:D),"aria-label":r("admin.revokeDevice"),className:v?"bg-tui-bad text-tui-crust":void 0,children:C?u.jsx(Ei,{}):r(v?"admin.revokeConfirm":"admin.revokeDevice")})}}];return u.jsx(on,{title:r("admin.pairedDevicesTitle",{count:o.length}),bodyClassName:"-mx-1",children:u.jsx(Hu,{columns:b,items:o,rowKey:S=>S.deviceId,empty:r("admin.noDevices")})})};function Wp(o){if(typeof window>"u"||!o||o.startsWith("/"))return"";try{const a=new URL(o.replace(/^ws/,"http")),r=a.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return a.origin===window.location.origin&&!r?"":`${a.origin}${r}`}catch{return""}}function Nr(o,a){const r=Wp(o);return r?`${r}${a.startsWith("/")?a:`/${a}`}`:a}const h0=({onBackToTerminal:o,onOpenPairing:a})=>{var ft,lt,mt,Bt,gt,zn,Dn,kt,cn,On,Ht,Qe,Ft,Yt;const{settings:r,updateSettings:c,addToast:d,t:f}=Ct(),p=Wp(r.wsUrl)||(typeof window<"u"?window.location.origin:"local"),m=((ft=r.adminTokens)==null?void 0:ft[p])||(p===(typeof window<"u"?window.location.origin:"local")?r.adminToken:"")||"",[b,S]=y.useState(null),[v,C]=y.useState(null),[D,_]=y.useState(!1),[z,X]=y.useState(!0),[M,Z]=y.useState(null),[$,J]=y.useState(!1),[ae,ye]=y.useState(3e3),[O,U]=y.useState(null),[R,te]=y.useState("overview"),[je,Me]=y.useState(!1),[Ee,de]=y.useState(m),[_e,Le]=y.useState(!!m),j="node bin/service.js pair";y.useEffect(()=>{de(m),Le(!!m),S(null),C(null),_(!1)},[p]);const q=()=>{La(j).then(ee=>{if(ee==="failed"){d("error",f("clipboard.copyFailed"));return}Me(!0),d("success",f("toasts.commandCopied")),setTimeout(()=>Me(!1),2e3)})};y.useEffect(()=>{let ee=!0;X(!0);async function Re(){try{const Ke=await fetch(Nr(r.wsUrl,"/api/info"),{headers:{Accept:"application/json"}});if(Ke.ok){const We=await Ke.json();ee&&(C(We),_(!0));return}}catch{}if(ee){const Ke=!!(r.wsUrl&&!r.wsUrl.startsWith("/")&&!r.wsUrl.includes("localhost")&&!r.wsUrl.includes("127.0.0.1")&&typeof window<"u"&&!r.wsUrl.startsWith(window.location.origin.replace("http","ws")));C({ok:!0,version:"0.1.0",protocol:1,relayMode:Ke?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}),_(!0)}}return Re(),()=>{ee=!1}},[r.wsUrl,p]);const W=(v==null?void 0:v.relayMode)==="remote",Ce=()=>{if(v!=null&&v.adminPath)return v.publicUrl?`${v.publicUrl.replace(/\/$/,"")}${v.adminPath}`:Nr(r.wsUrl,v.adminPath);if(b!=null&&b.remoteAdminUrl)return b.remoteAdminUrl;if(r.wsUrl)try{return Nr(r.wsUrl,"/admin")}catch{}return"/admin"},H=y.useCallback(async()=>{if(D){if(W){if(!_e&&!Ee){S(null),X(!1),Z(null),J(!1);return}try{X(!0);const ee=Nr(r.wsUrl,(v==null?void 0:v.adminStatusPath)||"/api/admin/status"),Ke=await fetch(ee,{headers:{Accept:"application/json","X-Relay-Admin-Token":Ee}});if(Ke.status===401||Ke.status===403){J(!0),Z(f("admin.relayAdminAuthError")),S(null);return}if(!Ke.ok)throw new Error(`HTTP ${Ke.status}: ${Ke.statusText}`);const We=await Ke.json();S(We),Z(null),J(!1),U(new Date)}catch(ee){console.warn("GET /api/admin/status request failed:",ee),J(!1),Z(ee instanceof Error?ee.message:"Failed to fetch remote admin status"),S(null)}finally{X(!1)}return}try{X(!0);const ee={Accept:"application/json"};r.token&&(ee.Authorization=`Bearer ${r.token}`);const Re=await fetch("/api/status",{headers:ee});if(Re.status===401||Re.status===403){J(!0),Z(`Authentication failed (HTTP ${Re.status}): Access denied. Please configure an authorized token or pair with the host.`),S(null);return}if(!Re.ok)throw new Error(`HTTP ${Re.status}: ${Re.statusText}`);const Ke=await Re.json();S(Ke),Z(null),J(!1),U(new Date)}catch(ee){console.warn("GET /api/status request failed:",ee),J(!1),Z(ee instanceof Error?ee.message:"Failed to fetch status"),S(null)}finally{X(!1)}}},[D,W,_e,Ee,v,r.token,r.wsUrl,p,f]),qe=y.useCallback(async ee=>{try{if(!(await fetch(Nr(r.wsUrl,`/api/admin/devices/${encodeURIComponent(ee)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":Ee}})).ok){Z(f("admin.revokeFailed"));return}await H()}catch{Z(f("admin.revokeFailed"))}},[Ee,H,r.wsUrl,f]);y.useEffect(()=>{if(!D)return;H();let ee=null;const Re=()=>{ae>0&&!ee&&(ee=setInterval(()=>{document.visibilityState==="visible"&&H()},ae))},Ke=()=>{ee&&(clearInterval(ee),ee=null)},We=()=>{document.visibilityState==="visible"?(H(),Re()):Ke()};return Re(),document.addEventListener("visibilitychange",We),()=>{Ke(),document.removeEventListener("visibilitychange",We)}},[D,H,ae]);const F=ee=>{ee.preventDefault();const Re=Ee.trim();c({adminToken:Re,adminTokens:{...r.adminTokens||{},[p]:Re}}),Le(!!Re)},pe=ee=>{const Re=Math.max(0,Math.floor(ee)),Ke=Math.floor(Re/86400),We=Math.floor(Re%86400/3600),et=Math.floor(Re%3600/60),hn=Re%60,pt=(Rt,It)=>`${Rt}${f(`admin.unit${It}`)}`;return Ke>0?[pt(Ke,"Day"),pt(We,"Hour"),pt(et,"Minute")].join(" "):We>0?[pt(We,"Hour"),pt(et,"Minute"),pt(hn,"Second")].join(" "):[pt(et,"Minute"),pt(hn,"Second")].join(" ")},ze=ee=>{if(!ee||ee===0)return"0 B";const Re=1024,Ke=["B","KB","MB","GB"],We=Math.floor(Math.log(ee)/Math.log(Re));return`${(ee/Math.pow(Re,We)).toFixed(1)} ${Ke[We]}`},ve=()=>{const ee=Ce();window.open(ee,"_blank","noopener,noreferrer")},he=b?b.activeUserCount??((lt=b.clients)==null?void 0:lt.length)??0:0,St=b?[{id:"overview",label:f("admin.tabOverview"),index:1},{id:"clients",label:f("admin.tabClients",{count:((mt=b.clients)==null?void 0:mt.length)||0}),index:2},{id:"ptys",label:f("admin.tabPtys",{count:((Bt=b.ptys)==null?void 0:Bt.length)||0}),index:3},...b.devices?[{id:"devices",label:f("admin.tabDevices",{count:b.devices.length}),index:4}]:[]]:[],Ue=St.map(ee=>ee.id);y.useEffect(()=>{const ee=Re=>{if(Re.ctrlKey||Re.altKey||Re.metaKey)return;const Ke=Re.target;if(Ke instanceof HTMLInputElement||Ke instanceof HTMLTextAreaElement||Ke instanceof HTMLSelectElement||Ke!=null&&Ke.isContentEditable||document.querySelector('[role="dialog"]'))return;if(Re.key==="Escape"&&o){Re.preventDefault(),o();return}if(Re.key.toLowerCase()==="r"){Re.preventDefault(),H();return}const We=Number.parseInt(Re.key,10)-1;Number.isInteger(We)&&We>=0&&We<Ue.length&&(Re.preventDefault(),te(Ue[We]))};return window.addEventListener("keydown",ee),()=>window.removeEventListener("keydown",ee)},[H,Ue.join("|")]);const we=u.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[o&&u.jsx(He,{variant:"ghost",onClick:o,title:f("admin.returnToTerminal"),"aria-label":f("admin.returnToTerminal"),glyph:Ge.arrowLeft,brackets:!1,className:"shrink-0",children:u.jsx("span",{className:"sr-only",children:f("admin.returnToTerminal")})}),u.jsxs("span",{className:"hidden text-tui-sm text-tui-accent sm:inline",children:["v",(v==null?void 0:v.version)||(b==null?void 0:b.version)||"0.1.0"]}),u.jsx(ao,{tone:W?"alt":"ok",children:f(W?"admin.modeRemote":"admin.localWorkstationBadge")}),u.jsxs("label",{className:"hidden items-center gap-1.5 text-tui-sm text-tui-muted md:flex",children:[u.jsx("span",{children:f("admin.autoRefresh")}),u.jsxs(Bu,{value:ae,onChange:ee=>ye(Number(ee.target.value)),"aria-label":f("admin.autoRefresh"),className:"w-auto",children:[u.jsx("option",{value:0,children:f("admin.paused")}),u.jsx("option",{value:1e3,children:"1s"}),u.jsx("option",{value:3e3,children:"3s"}),u.jsx("option",{value:5e3,children:"5s"}),u.jsx("option",{value:1e4,children:"10s"})]})]}),u.jsx(He,{variant:"primary",onClick:H,disabled:z,title:f("admin.refreshNow"),children:z?u.jsx(Ei,{}):f("admin.refreshNow")})]});return u.jsxs(ex,{name:f("admin.title"),tagline:f("admin.subtitle"),aside:we,tabs:St,activeTabId:R,onSelectTab:ee=>te(ee),tabsAriaLabel:f("header.mainNavigationAria"),hints:[{keys:"1–4",action:f("admin.hintTabs")},{keys:"r",action:f("admin.hintRefresh")},...o?[{keys:"esc",action:f("admin.hintBack")}]:[]],footerAside:O?u.jsx("span",{className:"text-tui-faint",children:f("admin.updatedAt",{time:O.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!D&&u.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:u.jsx(Ei,{label:f("admin.loadingStatus")})}),D&&W&&!_e&&u.jsxs(on,{title:f("admin.remoteRelayTitle"),aside:f("admin.remoteRelayBadge"),bodyClassName:"space-y-2",children:[u.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:f("admin.remoteRelayNotice")}),u.jsxs("div",{className:"space-y-0.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[u.jsx(ll,{label:f("admin.remoteRelayEndpoint"),labelWidth:18,children:u.jsx("code",{className:"break-all text-tui-accent",children:r.wsUrl})}),u.jsx(ll,{label:f("admin.remoteRelayAdminUrl"),labelWidth:18,children:u.jsx("code",{className:"break-all text-tui-ok",children:Ce()})})]}),u.jsx(Oa,{}),u.jsxs("div",{className:"flex flex-col items-start justify-between gap-2 sm:flex-row sm:items-center",children:[u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:f("admin.remoteRelayHelp")}),u.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[u.jsx(He,{onClick:()=>Le(!0),children:f("admin.relayAdminLoginBtn")}),u.jsx(He,{variant:"primary",onClick:ve,glyph:Ge.arrowRight,children:f("admin.openRemoteAdminBtn")})]})]})]}),D&&W&&_e&&!b&&u.jsxs(on,{title:f("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[u.jsx(Ps,{tone:(v==null?void 0:v.adminConfigured)===!1?"warn":"bad",children:(v==null?void 0:v.adminConfigured)===!1?f("admin.relayAdminNotConfigured"):f("admin.relayAdminAuthError")}),u.jsxs("form",{onSubmit:F,className:"space-y-2",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(_n,{htmlFor:"relay-admin-token",children:f("admin.relayAdminTokenLabel")}),u.jsx(In,{id:"relay-admin-token",type:"password",value:Ee,onChange:ee=>de(ee.target.value),placeholder:f("admin.relayAdminTokenPlaceholder")})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(He,{variant:"primary",type:"submit",children:f("admin.relayAdminLoginBtn")}),u.jsx(He,{variant:"ghost",onClick:()=>Le(!1),children:f("common.cancel")})]})]})]}),D&&!W&&$&&u.jsxs(on,{title:f("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[u.jsx(Ps,{tone:"bad",children:f("admin.unauthorizedDesc")}),u.jsxs("div",{className:"space-y-1.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[u.jsx("span",{className:"block text-tui-sm uppercase text-tui-muted",children:f("admin.pairingStepsTitle")}),u.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-crust px-2 py-1",children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),u.jsx("code",{className:"min-w-0 flex-1 truncate text-tui-text",children:j}),u.jsx(He,{onClick:q,glyph:je?Ge.check:"⧉",className:P("shrink-0",je&&"border-tui-ok text-tui-ok"),children:f(je?"admin.copiedJson":"common.copy")})]}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:f("admin.pairingStepsHelp")})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[a&&u.jsx(He,{variant:"primary",onClick:a,children:f("admin.enterPairCodeBtn")}),u.jsx(He,{onClick:H,children:f("admin.retryFetchBtn")})]})]}),D&&M&&!$&&!(!W&&$)&&u.jsx(Ps,{tone:"warn",action:u.jsx(He,{variant:"warn",onClick:H,children:f("common.retry")}),children:f("admin.errorConnecting",{error:M})}),b&&u.jsxs(u.Fragment,{children:[R==="overview"&&u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2",children:[u.jsxs(on,{title:f("admin.accessPanel"),aside:pe(b.uptimeSeconds||0),bodyClassName:"space-y-0.5",children:[u.jsx(ll,{label:f("admin.connectedHosts"),labelWidth:14,children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Jn,{level:(gt=b.hosts)!=null&&gt.length?"ok":"idle"}),u.jsx("span",{className:"font-bold",children:((zn=b.hosts)==null?void 0:zn.length)||0})]})}),u.jsx(ll,{label:f("admin.activeUsers"),labelWidth:14,children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Jn,{level:he?"ok":"idle"}),u.jsx("span",{className:"font-bold",children:he}),u.jsx("span",{className:"text-tui-faint",children:f("admin.acrossWindows",{count:((Dn=b.clients)==null?void 0:Dn.length)||0})})]})}),u.jsxs(ll,{label:f("admin.activePtys"),labelWidth:14,children:[u.jsx("span",{className:"font-bold",children:((kt=b.ptys)==null?void 0:kt.length)||0}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.terminalShells")})]}),u.jsx(ll,{label:f("admin.uptime"),labelWidth:14,children:u.jsx("span",{className:"text-tui-muted",children:b.startTime?f("admin.startedAt",{time:new Date(b.startTime).toLocaleTimeString()}):f("admin.startedRecently")})})]}),u.jsxs(on,{title:f("admin.throughput"),aside:f("admin.perSecond",{value:ze(((cn=b.throughput)==null?void 0:cn.bytesOutPerSec)||0)}),bodyClassName:"space-y-0.5",children:[u.jsxs(ll,{label:f("admin.bytesInTotal"),labelWidth:13,children:[u.jsx("span",{className:"font-bold text-tui-accent",children:ze(((On=b.throughput)==null?void 0:On.bytesIn)||0)}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.perSecond",{value:ze(((Ht=b.throughput)==null?void 0:Ht.bytesInPerSec)||0)})})]}),u.jsxs(ll,{label:f("admin.bytesOutTotal"),labelWidth:13,children:[u.jsx("span",{className:"font-bold text-tui-ok",children:ze(((Qe=b.throughput)==null?void 0:Qe.bytesOut)||0)}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.perSecond",{value:ze(((Ft=b.throughput)==null?void 0:Ft.bytesOutPerSec)||0)})})]}),u.jsx(Oa,{}),u.jsx(ll,{label:f("admin.frameRate"),labelWidth:13,children:u.jsx("span",{className:"font-bold",children:f("admin.framesPerSecond",{count:(((Yt=b.throughput)==null?void 0:Yt.framesOutPerSec)||0).toFixed(0)})})})]})]}),u.jsx(c0,{hosts:b.hosts||[],devices:b.devices})]}),R==="clients"&&u.jsx(s0,{clients:b.clients||[]}),R==="ptys"&&u.jsx(u0,{ptys:b.ptys||[]}),R==="devices"&&u.jsx(f0,{devices:b.devices||[],onRevoke:qe})]})]})},m0=({compact:o=!1})=>{const{role:a,connectionState:r,sharedWindowCount:c,assignedClientId:d,t:f}=Ct();if(!(r==="connected"))return u.jsxs("div",{className:"inline-flex select-none items-center gap-1.5 text-tui uppercase text-tui-faint",role:"status","aria-label":f("terminal.offlineStatusAria"),children:[u.jsx(Jn,{level:"idle"}),u.jsx("span",{children:f("common.offline")})]});const m=a==="controller",b=c>1,S=u.jsxs("div",{className:P("inline-flex min-w-0 select-none items-center gap-1.5 text-tui uppercase",m?"text-tui-ok":"text-tui-warn"),role:"status","aria-label":f(m?"role.controllerMode":"role.viewerMode"),children:[u.jsx(Jn,{level:m?"ok":"warn"}),u.jsx("span",{className:"truncate",children:f(m?"role.sharedControl":"role.viewerReadOnly")}),b?u.jsx("span",{className:"shrink-0 normal-case text-tui-muted",children:f("role.sharedWindows",{count:c})}):null]});return o?S:u.jsxs("div",{className:"flex w-full flex-col gap-1",children:[S,u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:f("role.sharedControlDesc")}),d?u.jsx(ll,{label:f("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:u.jsx("span",{className:"truncate text-tui-muted",children:d})}):null]})},Er="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Rr="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",p0="border-tui-accent bg-tui-selection text-tui-accent",Ar=({active:o=!1})=>u.jsx("span",{"aria-hidden":"true",className:P("shrink-0",o?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:Ge.cursor}),g0=({onClose:o,onNavigateAdmin:a,showAdminEntry:r=!0,onOpenPairing:c,onOpenSettings:d,onAddProfile:f=()=>{}})=>{const{connectionState:p,stateDetail:m,rttMs:b,hostId:S,settings:v,updateSettings:C,connect:D,addToast:_,language:z,setLanguage:X,t:M}=Ct(),[Z,$]=fl.useState(!1),J=io(p,M),ae=U=>()=>{var te;const R=document.activeElement;(te=R==null?void 0:R.blur)==null||te.call(R),U()},ye=()=>{La(v.clientId).then(U=>{if(U==="failed"){_("error",M("clipboard.copyFailed"));return}$(!0),_("info",M("toasts.clientIdCopied",{id:v.clientId})),setTimeout(()=>$(!1),2e3)})},O=()=>{const U=z==="zh"?"en":"zh";X(U),_("info",Du(U,"toasts.switchedLanguage",{lang:U==="zh"?"简体中文":"English"}))};return u.jsxs("div",{className:"flex flex-col gap-3 px-3 pb-2 pt-2",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border pb-1.5",children:[u.jsx("h2",{className:"text-tui font-bold uppercase text-tui-accent",children:M("mobile.sessionControls")}),u.jsx(He,{variant:"ghost",onClick:o,"aria-label":M("mobile.closeSessionControls"),children:"esc"})]}),u.jsx(on,{title:M("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:u.jsx(Ku,{mobile:!0,onAddProfile:f})}),u.jsxs(on,{title:M("common.status"),tone:J.level==="ok"?"ok":J.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2","aria-label":M("mobile.connectionStatusAria"),children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[u.jsx(Jn,{level:J.level}),u.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:J.label}),p==="connected"&&b!==null&&u.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[b,"ms"]})]}),J.actionLabel&&u.jsx(He,{variant:"primary",onClick:()=>D(),className:"shrink-0",children:J.actionLabel})]}),J.needsAttention&&m&&u.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:m}),S&&u.jsx(ll,{label:M("common.host"),labelWidth:9,children:S}),u.jsxs("button",{type:"button",onClick:ye,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:M("header.copyClientIdTitle"),children:[u.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:M("header.clientIdLabel")}),u.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:v.clientId}),u.jsx("span",{"aria-hidden":"true",className:P("shrink-0",Z?"text-tui-ok":"text-tui-faint"),children:Z?Ge.check:"⧉"})]})]}),u.jsx(on,{title:M("mobile.inputControl"),tone:"accent","aria-label":M("mobile.terminalControlAria"),children:u.jsx(m0,{})}),u.jsxs(on,{title:M("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[u.jsxs("button",{type:"button",onClick:O,className:P(Er,Rr),"aria-label":M("header.languageToggleTitle"),children:[u.jsx(Ar,{}),u.jsx("span",{className:"truncate",children:z==="zh"?"English":"中文"})]}),u.jsxs("button",{type:"button",onClick:ae(d),className:P(Er,Rr),"aria-label":M("mobile.settingsAria"),children:[u.jsx(Ar,{}),u.jsx("span",{className:"truncate",children:M("common.settings")})]}),u.jsxs("button",{type:"button",onClick:ae(c),className:P(Er,Rr),"aria-label":M("mobile.pairingAria"),children:[u.jsx(Ar,{}),u.jsx("span",{className:"truncate",children:M("common.pairing")})]}),r&&u.jsxs("button",{type:"button",onClick:ae(a),className:P(Er,Rr),"aria-label":M("mobile.adminAria"),children:[u.jsx(Ar,{}),u.jsx("span",{className:"truncate",children:M("common.admin")})]}),u.jsxs("button",{type:"button",onClick:()=>C({toolbarVisible:!v.toolbarVisible}),className:P(Er,v.toolbarVisible?p0:Rr),"aria-label":M("mobile.keybarAria"),"aria-pressed":v.toolbarVisible,children:[u.jsx(Ar,{active:v.toolbarVisible}),u.jsx("span",{className:"truncate",children:M("common.keyBar")}),u.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:v.toolbarVisible?"[x]":"[ ]"})]})]})]})},b0=({onAddProfile:o})=>{const{rttMs:a,t:r}=Ct();return u.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":r("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:[u.jsx(Ku,{statusBar:!0,onAddProfile:o}),u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),u.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:r("header.latencyTitle"),children:[u.jsx("span",{className:"text-tui-faint",children:"RTT"}),u.jsx("span",{className:P(a===null?"text-tui-faint":"text-tui-text"),children:a===null?"—":`${a}ms`})]})]})},y0=({onNavigateAdmin:o,showAdminEntry:a=!0,onOpenPairing:r,onOpenSettings:c,onAddProfile:d=()=>{}})=>{const{connectionState:f,isController:p,t:m}=Ct(),[b,S]=y.useState(!1),v=y.useRef(null),C=y.useCallback(()=>S(!1),[]);y.useEffect(()=>{if(!b)return;const _=z=>{if(!(z.ctrlKey||z.altKey||z.metaKey)&&z.key==="Escape"){const X=z.target;X&&typeof X.closest=="function"&&!!X.closest("#terminal-container")||(z.stopPropagation(),z.preventDefault(),C())}};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[b,C]),y.useEffect(()=>{var _;b&&((_=v.current)==null||_.focus({preventScroll:!0}))},[b]);const D=io(f,m);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":m("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:[u.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-sm text-tui-muted",children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:"herdr"}),u.jsx(qp,{className:"shrink-0"}),u.jsx(Jn,{level:D.level}),u.jsx("span",{className:"truncate uppercase",children:D.label})]}),u.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>S(!0),"aria-label":m("mobile.sessionControls"),"aria-expanded":b,"aria-haspopup":"dialog",className:P("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",D.needsAttention?"border-tui-warn text-tui-warn":p?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!p&&!D.needsAttention&&u.jsx("span",{className:"max-w-[8rem] truncate",children:m("common.viewer")}),u.jsx("span",{"aria-hidden":"true",className:"text-tui",children:Ge.chevronDown}),u.jsx("span",{"aria-hidden":"true",children:m("mobile.menu")})]})]}),b&&u.jsxs(u.Fragment,{children:[u.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:C,"aria-hidden":"true"}),u.jsx("div",{ref:v,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":m("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:u.jsx(g0,{onClose:C,showAdminEntry:a,onNavigateAdmin:()=>{C(),o()},onOpenPairing:()=>{C(),r()},onOpenSettings:()=>{C(),c()},onAddProfile:()=>{C(),d()}})})]}),u.jsx(b0,{onAddProfile:d})]})},Pp="--app-height",$p="--keyboard-inset",v0=80;function x0(){if(typeof window>"u")return{height:768,keyboardInset:0};const o=window.innerHeight||768,a=window.visualViewport;if(a&&typeof a.height=="number"&&a.height>0){const r=o-a.height-(a.offsetTop||0),c=r>=v0?Math.round(r):0;return{height:Math.round(a.height),keyboardInset:c}}return{height:o,keyboardInset:0}}function sp(o,a=x0()){return o.style.setProperty(Pp,`${a.height}px`),o.style.setProperty($p,`${a.keyboardInset}px`),a}function S0(o=typeof document<"u"?document.documentElement:null){if(!o||typeof window>"u")return()=>{};let a=null;const r=()=>{a=null,sp(o)},c=()=>{if(a===null){if(typeof requestAnimationFrame!="function"){r();return}a=requestAnimationFrame(r)}};sp(o);const d=window.visualViewport;return d==null||d.addEventListener("resize",c),d==null||d.addEventListener("scroll",c),window.addEventListener("resize",c),window.addEventListener("orientationchange",c),()=>{a!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(a),a=null),d==null||d.removeEventListener("resize",c),d==null||d.removeEventListener("scroll",c),window.removeEventListener("resize",c),window.removeEventListener("orientationchange",c),o.style.removeProperty(Pp),o.style.removeProperty($p)}}const w0=900;function op(){if(typeof window>"u")return!1;const o=Ti();return o<ku?!0:o<=w0}function C0(){const[o,a]=y.useState(op);return y.useEffect(()=>{var d,f;const r=()=>{const p=op();a(m=>m===p?m:p)};r();let c=null;try{c=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{c=null}return(d=c==null?void 0:c.addEventListener)==null||d.call(c,"change",r),window.addEventListener("resize",r),window.addEventListener("orientationchange",r),(f=window.visualViewport)==null||f.addEventListener("resize",r),()=>{var p,m;(p=c==null?void 0:c.removeEventListener)==null||p.call(c,"change",r),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),(m=window.visualViewport)==null||m.removeEventListener("resize",r)}},[]),o}function T0(o){const a=o.target;if(!a)return!1;if(a.id==="terminal-container"||a.id==="terminal-frame"||a.id==="terminal-surface"||a.classList.contains("xterm-helper-textarea")||a.classList.contains("xterm")||a.closest("#terminal-container")||a.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const r=document.activeElement;if(r.id==="terminal-container"||r.classList.contains("xterm-helper-textarea")||r.closest("#terminal-container")||r.closest(".xterm"))return!0}return!1}function N0(o,a={}){if(typeof window>"u")return()=>{};const r=c=>{var d;c.ctrlKey||c.altKey||c.metaKey||c.key==="Escape"&&(a.isModalOpen||a.isSheetOpen)&&(T0(c)||(c.preventDefault(),c.stopPropagation(),(d=o.onCloseModals)==null||d.call(o)))};return window.addEventListener("keydown",r),()=>{window.removeEventListener("keydown",r)}}function E0(){const[o,a]=y.useState("terminal"),[r,c]=y.useState(!1),[d,f]=y.useState(!1),[p,m]=y.useState(!1),[b,S]=y.useState(!1),{updateSettings:v,settings:C,connectionState:D,stateDetail:_,stateCode:z,lastPairedAt:X}=Ct(),M=C0();y.useEffect(()=>S0(),[]);const[Z,$]=y.useState(!0);y.useEffect(()=>{let de=!1;return fetch("/api/info",{headers:{Accept:"application/json"}}).then(_e=>_e.ok?_e.json():null).then(_e=>{de||!_e||$(!_e.isRemoteRelay)}).catch(()=>{}),()=>{de=!0}},[]),y.useEffect(()=>{Tp()},[]),y.useEffect(()=>{const de=r||p||b;if(de)return N0({onCloseModals:()=>{c(!1),m(!1),S(!1)}},{isModalOpen:de})},[r,p,b]),y.useEffect(()=>{const de=()=>{const _e=window.location.pathname,Le=window.location.hash;a(_e==="/admin"||Le==="#admin"?"admin":"terminal")};de(),window.addEventListener("popstate",de),window.addEventListener("hashchange",de);try{const _e=new URL(window.location.href),Le=_e.searchParams.get("token"),j=_e.searchParams.get("pairCode"),q=_e.searchParams.get("ws")||_e.searchParams.get("wsUrl"),W={};Le&&(W.token=Le),j&&(W.pairCode=j.toUpperCase()),q&&(W.wsUrl=q),Object.keys(W).length>0&&v(W);let Ce=!1;if(_e.searchParams.has("token")&&(_e.searchParams.delete("token"),Ce=!0),_e.searchParams.has("pairCode")&&(_e.searchParams.delete("pairCode"),Ce=!0),Ce){const H=_e.searchParams.toString(),qe=_e.pathname+(H?`?${H}`:"")+_e.hash;window.history.replaceState({},"",qe)}}catch(_e){console.warn("Failed to parse URL query params:",_e)}return()=>{window.removeEventListener("popstate",de),window.removeEventListener("hashchange",de)}},[]);const J=(de=!1)=>{f(de),c(!0)},ae=()=>{c(!1),f(!1)},ye=de=>{a(de),de==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},O=!C.token&&!C.pairCode&&D!=="connected",U=D==="error"&&(["auth_required","unauthorized","device_revoked"].includes(z||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(_||"")),R=O||U,[te,je]=y.useState(!R);y.useEffect(()=>{R||je(!0)},[R]),y.useEffect(()=>{X&&(c(!1),je(!0),a("terminal"))},[X]);const Me=o==="terminal"&&!R,Ee=de=>({visibility:de?"visible":"hidden",opacity:de?1:0,pointerEvents:de?"auto":"none",zIndex:de?1:0});return u.jsxs("div",{"data-testid":"app-shell",style:M?{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:de=>{de.preventDefault(),de.stopPropagation()},children:[!M&&u.jsx(nx,{currentView:o,onNavigate:ye,showAdminEntry:Z,onOpenPairing:()=>J(!1),onOpenSettings:()=>m(!0),onToggleVirtualKeyboard:()=>S(!b),isVirtualKeyboardOpen:b}),!M&&!R&&u.jsx(lx,{}),u.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[te&&u.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${M?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:Ee(Me),"aria-hidden":!Me,children:[u.jsx(Xx,{isActive:Me}),!M&&u.jsx(Wx,{isOpen:b,onClose:()=>S(!1)}),u.jsx(Ix,{compact:M})]}),o==="terminal"&&R&&u.jsx("div",{"data-testid":"onboarding-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-10",children:u.jsx(Fx,{onPairedSuccess:()=>{}})}),o==="admin"&&u.jsx("div",{"data-testid":"admin-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-20",children:u.jsx(h0,{onBackToTerminal:()=>ye("terminal"),onOpenPairing:()=>J(!1)})}),M&&Me&&u.jsx(y0,{onNavigateAdmin:()=>ye("admin"),showAdminEntry:Z,onOpenPairing:()=>J(!1),onOpenSettings:()=>m(!0),onAddProfile:()=>J(!0)})]}),!M&&o!=="admin"&&u.jsx(a0,{onAddProfile:()=>J(!0)}),u.jsx($x,{isOpen:r,isAddMode:d,onClose:ae}),u.jsx(e0,{isOpen:p,onClose:()=>m(!1)}),u.jsx(l0,{})]})}function R0(){return u.jsx(tv,{children:u.jsx(E0,{})})}const eg=document.getElementById("root");if(!eg)throw new Error("Root element not found");gy.createRoot(eg).render(u.jsx(fl.StrictMode,{children:u.jsx(R0,{})}));