herdr-remote-relay 0.2.12 → 0.2.13

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.
@@ -1,41 +0,0 @@
1
- var Zg=Object.defineProperty;var Fg=(r,s,o)=>s in r?Zg(r,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[s]=o;var $e=(r,s,o)=>Fg(r,typeof s!="symbol"?s+"":s,o);import{r as Qh,g as Jh,a as Ih}from"./vendor-react-CYSfZuHu.js";import{r as Qg,a as Jg,b as Ig,c as Wg}from"./vendor-xterm-Bldps5fz.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))c(f);new MutationObserver(f=>{for(const m of f)if(m.type==="childList")for(const b of m.addedNodes)b.tagName==="LINK"&&b.rel==="modulepreload"&&c(b)}).observe(document,{childList:!0,subtree:!0});function o(f){const m={};return f.integrity&&(m.integrity=f.integrity),f.referrerPolicy&&(m.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?m.credentials="include":f.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(f){if(f.ep)return;f.ep=!0;const m=o(f);fetch(f.href,m)}})();var Vc={exports:{}},$i={};/**
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 uh;function Pg(){if(uh)return $i;uh=1;var r=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function o(c,f,m){var b=null;if(m!==void 0&&(b=""+m),f.key!==void 0&&(b=""+f.key),"key"in f){m={};for(var p in f)p!=="key"&&(m[p]=f[p])}else m=f;return f=m.ref,{$$typeof:r,type:c,key:b,ref:f!==void 0?f:null,props:m}}return $i.Fragment=s,$i.jsx=o,$i.jsxs=o,$i}var dh;function $g(){return dh||(dh=1,Vc.exports=Pg()),Vc.exports}var u=$g(),x=Qh();const el=Jh(x);var Zc={exports:{}},es={},Fc={exports:{}},Qc={};/**
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 fh;function ey(){return fh||(fh=1,(function(r){function s(R,q){var Q=R.length;R.push(q);e:for(;0<Q;){var me=Q-1>>>1,B=R[me];if(0<f(B,q))R[me]=q,R[Q]=B,Q=me;else break e}}function o(R){return R.length===0?null:R[0]}function c(R){if(R.length===0)return null;var q=R[0],Q=R.pop();if(Q!==q){R[0]=Q;e:for(var me=0,B=R.length,Ue=B>>>1;me<Ue;){var je=2*(me+1)-1,X=R[je],ve=je+1,fe=R[ve];if(0>f(X,Q))ve<B&&0>f(fe,X)?(R[me]=fe,R[ve]=Q,me=ve):(R[me]=X,R[je]=Q,me=je);else if(ve<B&&0>f(fe,Q))R[me]=fe,R[ve]=Q,me=ve;else break e}}return q}function f(R,q){var Q=R.sortIndex-q.sortIndex;return Q!==0?Q:R.id-q.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;r.unstable_now=function(){return m.now()}}else{var b=Date,p=b.now();r.unstable_now=function(){return b.now()-p}}var g=[],S=[],v=1,C=null,Y=3,L=!1,O=!1,V=!1,k=!1,Z=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function ce(R){for(var q=o(S);q!==null;){if(q.callback===null)c(S);else if(q.startTime<=R)c(S),q.sortIndex=q.expirationTime,s(g,q);else break;q=o(S)}}function ue(R){if(V=!1,ce(R),!O)if(o(g)!==null)O=!0,H||(H=!0,Te());else{var q=o(S);q!==null&&Oe(ue,q.startTime-R)}}var H=!1,z=-1,A=5,te=-1;function ze(){return k?!0:!(r.unstable_now()-te<A)}function Ee(){if(k=!1,H){var R=r.unstable_now();te=R;var q=!0;try{e:{O=!1,V&&(V=!1,P(z),z=-1),L=!0;var Q=Y;try{t:{for(ce(R),C=o(g);C!==null&&!(C.expirationTime>R&&ze());){var me=C.callback;if(typeof me=="function"){C.callback=null,Y=C.priorityLevel;var B=me(C.expirationTime<=R);if(R=r.unstable_now(),typeof B=="function"){C.callback=B,ce(R),q=!0;break t}C===o(g)&&c(g),ce(R)}else c(g);C=o(g)}if(C!==null)q=!0;else{var Ue=o(S);Ue!==null&&Oe(ue,Ue.startTime-R),q=!1}}break e}finally{C=null,Y=Q,L=!1}q=void 0}}finally{q?Te():H=!1}}}var Te;if(typeof F=="function")Te=function(){F(Ee)};else if(typeof MessageChannel<"u"){var Ne=new MessageChannel,Me=Ne.port2;Ne.port1.onmessage=Ee,Te=function(){Me.postMessage(null)}}else Te=function(){Z(Ee,0)};function Oe(R,q){z=Z(function(){R(r.unstable_now())},q)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(R){R.callback=null},r.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<R?Math.floor(1e3/R):5},r.unstable_getCurrentPriorityLevel=function(){return Y},r.unstable_next=function(R){switch(Y){case 1:case 2:case 3:var q=3;break;default:q=Y}var Q=Y;Y=q;try{return R()}finally{Y=Q}},r.unstable_requestPaint=function(){k=!0},r.unstable_runWithPriority=function(R,q){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var Q=Y;Y=R;try{return q()}finally{Y=Q}},r.unstable_scheduleCallback=function(R,q,Q){var me=r.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?me+Q:me):Q=me,R){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=Q+B,R={id:v++,callback:q,priorityLevel:R,startTime:Q,expirationTime:B,sortIndex:-1},Q>me?(R.sortIndex=Q,s(S,R),o(g)===null&&R===o(S)&&(V?(P(z),z=-1):V=!0,Oe(ue,Q-me))):(R.sortIndex=B,s(g,R),O||L||(O=!0,H||(H=!0,Te()))),R},r.unstable_shouldYield=ze,r.unstable_wrapCallback=function(R){var q=Y;return function(){var Q=Y;Y=q;try{return R.apply(this,arguments)}finally{Y=Q}}}})(Qc)),Qc}var mh;function ty(){return mh||(mh=1,Fc.exports=ey()),Fc.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 hh;function ny(){if(hh)return es;hh=1;var r=ty(),s=Qh(),o=Ih();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 f(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function m(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 b(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(m(e)!==e)throw Error(c(188))}function S(e){var t=e.alternate;if(!t){if(t=m(e),t===null)throw Error(c(188));return t!==e?null:e}for(var n=e,l=t;;){var a=n.return;if(a===null)break;var i=a.alternate;if(i===null){if(l=a.return,l!==null){n=l;continue}break}if(a.child===i.child){for(i=a.child;i;){if(i===n)return g(a),e;if(i===l)return g(a),t;i=i.sibling}throw Error(c(188))}if(n.return!==l.return)n=a,l=i;else{for(var d=!1,h=a.child;h;){if(h===n){d=!0,n=a,l=i;break}if(h===l){d=!0,l=a,n=i;break}h=h.sibling}if(!d){for(h=i.child;h;){if(h===n){d=!0,n=i,l=a;break}if(h===l){d=!0,l=i,n=a;break}h=h.sibling}if(!d)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,Y=Symbol.for("react.element"),L=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),V=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),Z=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),F=Symbol.for("react.context"),ce=Symbol.for("react.forward_ref"),ue=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),te=Symbol.for("react.activity"),ze=Symbol.for("react.memo_cache_sentinel"),Ee=Symbol.iterator;function Te(e){return e===null||typeof e!="object"?null:(e=Ee&&e[Ee]||e["@@iterator"],typeof e=="function"?e:null)}var Ne=Symbol.for("react.client.reference");function Me(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ne?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case V:return"Fragment";case Z:return"Profiler";case k:return"StrictMode";case ue:return"Suspense";case H:return"SuspenseList";case te:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case O:return"Portal";case F:return e.displayName||"Context";case P:return(e._context.displayName||"Context")+".Consumer";case ce:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case z:return t=e.displayName||null,t!==null?t:Me(e.type)||"Memo";case A:t=e._payload,e=e._init;try{return Me(e(t))}catch{}}return null}var Oe=Array.isArray,R=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},me=[],B=-1;function Ue(e){return{current:e}}function je(e){0>B||(e.current=me[B],me[B]=null,B--)}function X(e,t){B++,me[B]=e.current,e.current=t}var ve=Ue(null),fe=Ue(null),ie=Ue(null),rt=Ue(null);function Ke(e,t){switch(X(ie,t),X(fe,e),X(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?km(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=km(t),e=Dm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}je(ve),X(ve,e)}function ye(){je(ve),je(fe),je(ie)}function Fe(e){e.memoizedState!==null&&X(rt,e);var t=ve.current,n=Dm(t,e.type);t!==n&&(X(fe,e),X(ve,n))}function ot(e){fe.current===e&&(je(ve),je(fe)),rt.current===e&&(je(rt),Ji._currentValue=Q)}var et,mt;function pt(e){if(et===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);et=t&&t[1]||"",mt=-1<n.stack.indexOf(`
26
- at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
27
- `+et+e+mt}var zt=!1;function Yt(e,t){if(!e||zt)return"";zt=!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(M){var j=M}Reflect.construct(e,[],G)}else{try{G.call()}catch(M){j=M}e.call(G.prototype)}}else{try{throw Error()}catch(M){j=M}(G=e())&&typeof G.catch=="function"&&G.catch(function(){})}}catch(M){if(M&&j&&typeof M.stack=="string")return[M.stack,j.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=l.DetermineComponentFrameRoot(),d=i[0],h=i[1];if(d&&h){var y=d.split(`
28
- `),E=h.split(`
29
- `);for(a=l=0;l<y.length&&!y[l].includes("DetermineComponentFrameRoot");)l++;for(;a<E.length&&!E[a].includes("DetermineComponentFrameRoot");)a++;if(l===y.length||a===E.length)for(l=y.length-1,a=E.length-1;1<=l&&0<=a&&y[l]!==E[a];)a--;for(;1<=l&&0<=a;l--,a--)if(y[l]!==E[a]){if(l!==1||a!==1)do if(l--,a--,0>a||y[l]!==E[a]){var U=`
30
- `+y[l].replace(" at new "," at ");return e.displayName&&U.includes("<anonymous>")&&(U=U.replace("<anonymous>",e.displayName)),U}while(1<=l&&0<=a);break}}}finally{zt=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?pt(n):""}function tl(e,t){switch(e.tag){case 26:case 27:case 5:return pt(e.type);case 16:return pt("Lazy");case 13:return e.child!==t&&t!==null?pt("Suspense Fallback"):pt("Suspense");case 19:return pt("SuspenseList");case 0:case 15:return Yt(e.type,!1);case 11:return Yt(e.type.render,!1);case 1:return Yt(e.type,!0);case 31:return pt("Activity");default:return""}}function Lt(e){try{var t="",n=null;do t+=tl(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
31
- Error generating stack: `+l.message+`
32
- `+l.stack}}var Jt=Object.prototype.hasOwnProperty,Ot=r.unstable_scheduleCallback,cn=r.unstable_cancelCallback,It=r.unstable_shouldYield,Kt=r.unstable_requestPaint,$=r.unstable_now,Ce=r.unstable_getCurrentPriorityLevel,he=r.unstable_ImmediatePriority,ut=r.unstable_UserBlockingPriority,Wt=r.unstable_NormalPriority,Pt=r.unstable_LowPriority,Ut=r.unstable_IdlePriority,qn=r.log,wt=r.unstable_setDisableYieldValue,nl=null,Gt=null;function yn(e){if(typeof qn=="function"&&wt(e),Gt&&typeof Gt.setStrictMode=="function")try{Gt.setStrictMode(nl,e)}catch{}}var qt=Math.clz32?Math.clz32:xa,ci=Math.log,va=Math.LN2;function xa(e){return e>>>=0,e===0?32:31-(ci(e)/va|0)|0}var ll=256,Ln=262144,Xn=4194304;function $t(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 al(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var a=0,i=e.suspendedLanes,d=e.pingedLanes;e=e.warmLanes;var h=l&134217727;return h!==0?(l=h&~i,l!==0?a=$t(l):(d&=h,d!==0?a=$t(d):n||(n=h&~e,n!==0&&(a=$t(n))))):(h=l&~i,h!==0?a=$t(h):d!==0?a=$t(d):n||(n=l&~e,n!==0&&(a=$t(n)))),a===0?0:t!==0&&t!==a&&(t&i)===0&&(i=a&-a,n=t&-t,i>=n||i===32&&(n&4194048)!==0)?t:a}function Vn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function W(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 ee(){var e=Xn;return Xn<<=1,(Xn&62914560)===0&&(Xn=4194304),e}function Ae(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function He(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function bt(e,t,n,l,a,i){var d=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 h=e.entanglements,y=e.expirationTimes,E=e.hiddenUpdates;for(n=d&~n;0<n;){var U=31-qt(n),G=1<<U;h[U]=0,y[U]=-1;var j=E[U];if(j!==null)for(E[U]=null,U=0;U<j.length;U++){var M=j[U];M!==null&&(M.lane&=-536870913)}n&=~G}l!==0&&se(e,l,0),i!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=i&~(d&~t))}function se(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-qt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function _(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-qt(n),a=1<<l;a&t|e[l]&t&&(e[l]|=t),n&=~a}}function D(e,t){var n=t&-t;return n=(n&42)!==0?1:I(n),(n&(e.suspendedLanes|t))!==0?0:n}function I(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 ne(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function pe(){var e=q.p;return e!==0?e:(e=window.event,e===void 0?32:lh(e.type))}function Re(e,t){var n=q.p;try{return q.p=e,t()}finally{q.p=n}}var _e=Math.random().toString(36).slice(2),Pe="__reactFiber$"+_e,Qe="__reactProps$"+_e,un="__reactContainer$"+_e,vt="__reactEvents$"+_e,vn="__reactListeners$"+_e,ui="__reactHandles$"+_e,Nl="__reactResources$"+_e,en="__reactMarker$"+_e;function Sa(e){delete e[Pe],delete e[Qe],delete e[vt],delete e[vn],delete e[ui]}function il(e){var t=e[Pe];if(t)return t;for(var n=e.parentNode;n;){if(t=n[un]||n[Pe]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Km(e);e!==null;){if(n=e[Pe])return n;e=Km(e)}return t}e=n,n=e.parentNode}return null}function On(e){if(e=e[Pe]||e[un]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Zn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(c(33))}function Un(e){var t=e[Nl];return t||(t=e[Nl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ct(e){e[en]=!0}var di=new Set,le={};function be(e,t){tt(e,t),tt(e+"Capture",t)}function tt(e,t){for(le[e]=t,e=0;e<t.length;e++)di.add(t[e])}var xn=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]*$"),Sn={},Fn={};function xe(e){return Jt.call(Fn,e)?!0:Jt.call(Sn,e)?!1:xn.test(e)?Fn[e]=!0:(Sn[e]=!0,!1)}function Bt(e,t,n){if(xe(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function gt(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 Et(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 jt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Qn(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ur(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 a=l.get,i=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(d){n=""+d,i.call(this,d)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(d){n=""+d},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function wa(e){if(!e._valueTracker){var t=Qn(e)?"checked":"value";e._valueTracker=Ur(e,t,""+e[t])}}function Nu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=Qn(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function hs(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 Yp=/[\n"\\]/g;function wn(e){return e.replace(Yp,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Br(e,t,n,l,a,i,d,h){e.name="",d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"?e.type=d:e.removeAttribute("type"),t!=null?d==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+jt(t)):e.value!==""+jt(t)&&(e.value=""+jt(t)):d!=="submit"&&d!=="reset"||e.removeAttribute("value"),t!=null?Hr(e,d,jt(t)):n!=null?Hr(e,d,jt(n)):l!=null&&e.removeAttribute("value"),a==null&&i!=null&&(e.defaultChecked=!!i),a!=null&&(e.checked=a&&typeof a!="function"&&typeof a!="symbol"),h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.name=""+jt(h):e.removeAttribute("name")}function Eu(e,t,n,l,a,i,d,h){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||n!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){wa(e);return}n=n!=null?""+jt(n):"",t=t!=null?""+jt(t):n,h||t===e.value||(e.value=t),e.defaultValue=t}l=l??a,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=h?e.checked:!!l,e.defaultChecked=!!l,d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.name=d),wa(e)}function Hr(e,t,n){t==="number"&&hs(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ca(e,t,n,l){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&l&&(e[n].defaultSelected=!0)}else{for(n=""+jt(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,l&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function ju(e,t,n){if(t!=null&&(t=""+jt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+jt(n):""}function Au(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(c(92));if(Oe(l)){if(1<l.length)throw Error(c(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=jt(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),wa(e)}function Ta(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Kp=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 Ru(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||Kp.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Mu(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 a in t)l=t[a],t.hasOwnProperty(a)&&n[a]!==l&&Ru(e,a,l)}else for(var i in t)t.hasOwnProperty(i)&&Ru(e,i,t[i])}function Yr(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 Gp=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"]]),qp=/^[\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 ps(e){return qp.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function sl(){}var Kr=null;function Gr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Na=null,Ea=null;function _u(e){var t=On(e);if(t&&(e=t.stateNode)){var n=e[Qe]||null;e:switch(e=t.stateNode,t.type){case"input":if(Br(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="'+wn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var a=l[Qe]||null;if(!a)throw Error(c(90));Br(l,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&Nu(l)}break e;case"textarea":ju(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Ca(e,!!n.multiple,t,!1)}}}var qr=!1;function zu(e,t,n){if(qr)return e(t,n);qr=!0;try{var l=e(t);return l}finally{if(qr=!1,(Na!==null||Ea!==null)&&(nr(),Na&&(t=Na,e=Ea,Ea=Na=null,_u(t),e)))for(t=0;t<e.length;t++)_u(e[t])}}function fi(e,t){var n=e.stateNode;if(n===null)return null;var l=n[Qe]||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 rl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xr=!1;if(rl)try{var mi={};Object.defineProperty(mi,"passive",{get:function(){Xr=!0}}),window.addEventListener("test",mi,mi),window.removeEventListener("test",mi,mi)}catch{Xr=!1}var El=null,Vr=null,bs=null;function ku(){if(bs)return bs;var e,t=Vr,n=t.length,l,a="value"in El?El.value:El.textContent,i=a.length;for(e=0;e<n&&t[e]===a[e];e++);var d=n-e;for(l=1;l<=d&&t[n-l]===a[i-l];l++);return bs=a.slice(e,1<l?1-l:void 0)}function gs(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 ys(){return!0}function Du(){return!1}function nn(e){function t(n,l,a,i,d){this._reactName=n,this._targetInst=a,this.type=l,this.nativeEvent=i,this.target=d,this.currentTarget=null;for(var h in e)e.hasOwnProperty(h)&&(n=e[h],this[h]=n?n(i):i[h]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?ys:Du,this.isPropagationStopped=Du,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=ys)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ys)},persist:function(){},isPersistent:ys}),t}var Pl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vs=nn(Pl),hi=C({},Pl,{view:0,detail:0}),Xp=nn(hi),Zr,Fr,pi,xs=C({},hi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Jr,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!==pi&&(pi&&e.type==="mousemove"?(Zr=e.screenX-pi.screenX,Fr=e.screenY-pi.screenY):Fr=Zr=0,pi=e),Zr)},movementY:function(e){return"movementY"in e?e.movementY:Fr}}),Lu=nn(xs),Vp=C({},xs,{dataTransfer:0}),Zp=nn(Vp),Fp=C({},hi,{relatedTarget:0}),Qr=nn(Fp),Qp=C({},Pl,{animationName:0,elapsedTime:0,pseudoElement:0}),Jp=nn(Qp),Ip=C({},Pl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Wp=nn(Ip),Pp=C({},Pl,{data:0}),Ou=nn(Pp),$p={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},eb={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"},tb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nb(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=tb[e])?!!t[e]:!1}function Jr(){return nb}var lb=C({},hi,{key:function(e){if(e.key){var t=$p[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=gs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?eb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Jr,charCode:function(e){return e.type==="keypress"?gs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ab=nn(lb),ib=C({},xs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Uu=nn(ib),sb=C({},hi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Jr}),rb=nn(sb),ob=C({},Pl,{propertyName:0,elapsedTime:0,pseudoElement:0}),cb=nn(ob),ub=C({},xs,{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}),db=nn(ub),fb=C({},Pl,{newState:0,oldState:0}),mb=nn(fb),hb=[9,13,27,32],Ir=rl&&"CompositionEvent"in window,bi=null;rl&&"documentMode"in document&&(bi=document.documentMode);var pb=rl&&"TextEvent"in window&&!bi,Bu=rl&&(!Ir||bi&&8<bi&&11>=bi),Hu=" ",Yu=!1;function Ku(e,t){switch(e){case"keyup":return hb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ja=!1;function bb(e,t){switch(e){case"compositionend":return Gu(t);case"keypress":return t.which!==32?null:(Yu=!0,Hu);case"textInput":return e=t.data,e===Hu&&Yu?null:e;default:return null}}function gb(e,t){if(ja)return e==="compositionend"||!Ir&&Ku(e,t)?(e=ku(),bs=Vr=El=null,ja=!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 Bu&&t.locale!=="ko"?null:t.data;default:return null}}var yb={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 qu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!yb[e.type]:t==="textarea"}function Xu(e,t,n,l){Na?Ea?Ea.push(l):Ea=[l]:Na=l,t=cr(t,"onChange"),0<t.length&&(n=new vs("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var gi=null,yi=null;function vb(e){jm(e,0)}function Ss(e){var t=Zn(e);if(Nu(t))return e}function Vu(e,t){if(e==="change")return t}var Zu=!1;if(rl){var Wr;if(rl){var Pr="oninput"in document;if(!Pr){var Fu=document.createElement("div");Fu.setAttribute("oninput","return;"),Pr=typeof Fu.oninput=="function"}Wr=Pr}else Wr=!1;Zu=Wr&&(!document.documentMode||9<document.documentMode)}function Qu(){gi&&(gi.detachEvent("onpropertychange",Ju),yi=gi=null)}function Ju(e){if(e.propertyName==="value"&&Ss(yi)){var t=[];Xu(t,yi,e,Gr(e)),zu(vb,t)}}function xb(e,t,n){e==="focusin"?(Qu(),gi=t,yi=n,gi.attachEvent("onpropertychange",Ju)):e==="focusout"&&Qu()}function Sb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ss(yi)}function wb(e,t){if(e==="click")return Ss(t)}function Cb(e,t){if(e==="input"||e==="change")return Ss(t)}function Tb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var dn=typeof Object.is=="function"?Object.is:Tb;function vi(e,t){if(dn(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 a=n[l];if(!Jt.call(t,a)||!dn(e[a],t[a]))return!1}return!0}function Iu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Wu(e,t){var n=Iu(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=Iu(n)}}function Pu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Pu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $u(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=hs(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=hs(e.document)}return t}function $r(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 Nb=rl&&"documentMode"in document&&11>=document.documentMode,Aa=null,eo=null,xi=null,to=!1;function ed(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;to||Aa==null||Aa!==hs(l)||(l=Aa,"selectionStart"in l&&$r(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}),xi&&vi(xi,l)||(xi=l,l=cr(eo,"onSelect"),0<l.length&&(t=new vs("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=Aa)))}function $l(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ra={animationend:$l("Animation","AnimationEnd"),animationiteration:$l("Animation","AnimationIteration"),animationstart:$l("Animation","AnimationStart"),transitionrun:$l("Transition","TransitionRun"),transitionstart:$l("Transition","TransitionStart"),transitioncancel:$l("Transition","TransitionCancel"),transitionend:$l("Transition","TransitionEnd")},no={},td={};rl&&(td=document.createElement("div").style,"AnimationEvent"in window||(delete Ra.animationend.animation,delete Ra.animationiteration.animation,delete Ra.animationstart.animation),"TransitionEvent"in window||delete Ra.transitionend.transition);function ea(e){if(no[e])return no[e];if(!Ra[e])return e;var t=Ra[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in td)return no[e]=t[n];return e}var nd=ea("animationend"),ld=ea("animationiteration"),ad=ea("animationstart"),Eb=ea("transitionrun"),jb=ea("transitionstart"),Ab=ea("transitioncancel"),id=ea("transitionend"),sd=new Map,lo="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(" ");lo.push("scrollEnd");function Bn(e,t){sd.set(e,t),be(t,[e])}var ws=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)},Cn=[],Ma=0,ao=0;function Cs(){for(var e=Ma,t=ao=Ma=0;t<e;){var n=Cn[t];Cn[t++]=null;var l=Cn[t];Cn[t++]=null;var a=Cn[t];Cn[t++]=null;var i=Cn[t];if(Cn[t++]=null,l!==null&&a!==null){var d=l.pending;d===null?a.next=a:(a.next=d.next,d.next=a),l.pending=a}i!==0&&rd(n,a,i)}}function Ts(e,t,n,l){Cn[Ma++]=e,Cn[Ma++]=t,Cn[Ma++]=n,Cn[Ma++]=l,ao|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function io(e,t,n,l){return Ts(e,t,n,l),Ns(e)}function ta(e,t){return Ts(e,null,null,t),Ns(e)}function rd(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var a=!1,i=e.return;i!==null;)i.childLanes|=n,l=i.alternate,l!==null&&(l.childLanes|=n),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(a=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,a&&t!==null&&(a=31-qt(n),e=i.hiddenUpdates,l=e[a],l===null?e[a]=[t]:l.push(t),t.lane=n|536870912),i):null}function Ns(e){if(50<Gi)throw Gi=0,pc=null,Error(c(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var _a={};function Rb(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 fn(e,t,n,l){return new Rb(e,t,n,l)}function so(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ol(e,t){var n=e.alternate;return n===null?(n=fn(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 od(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 Es(e,t,n,l,a,i){var d=0;if(l=e,typeof e=="function")so(e)&&(d=1);else if(typeof e=="string")d=Dg(e,n,ve.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case te:return e=fn(31,n,t,a),e.elementType=te,e.lanes=i,e;case V:return na(n.children,a,i,t);case k:d=8,a|=24;break;case Z:return e=fn(12,n,t,a|2),e.elementType=Z,e.lanes=i,e;case ue:return e=fn(13,n,t,a),e.elementType=ue,e.lanes=i,e;case H:return e=fn(19,n,t,a),e.elementType=H,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case F:d=10;break e;case P:d=9;break e;case ce:d=11;break e;case z:d=14;break e;case A:d=16,l=null;break e}d=29,n=Error(c(130,e===null?"null":typeof e,"")),l=null}return t=fn(d,n,t,a),t.elementType=e,t.type=l,t.lanes=i,t}function na(e,t,n,l){return e=fn(7,e,l,t),e.lanes=n,e}function ro(e,t,n){return e=fn(6,e,null,t),e.lanes=n,e}function cd(e){var t=fn(18,null,null,0);return t.stateNode=e,t}function oo(e,t,n){return t=fn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ud=new WeakMap;function Tn(e,t){if(typeof e=="object"&&e!==null){var n=ud.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Lt(t)},ud.set(e,t),t)}return{value:e,source:t,stack:Lt(t)}}var za=[],ka=0,js=null,Si=0,Nn=[],En=0,jl=null,Jn=1,In="";function cl(e,t){za[ka++]=Si,za[ka++]=js,js=e,Si=t}function dd(e,t,n){Nn[En++]=Jn,Nn[En++]=In,Nn[En++]=jl,jl=e;var l=Jn;e=In;var a=32-qt(l)-1;l&=~(1<<a),n+=1;var i=32-qt(t)+a;if(30<i){var d=a-a%5;i=(l&(1<<d)-1).toString(32),l>>=d,a-=d,Jn=1<<32-qt(t)+a|n<<a|l,In=i+e}else Jn=1<<i|n<<a|l,In=e}function co(e){e.return!==null&&(cl(e,1),dd(e,1,0))}function uo(e){for(;e===js;)js=za[--ka],za[ka]=null,Si=za[--ka],za[ka]=null;for(;e===jl;)jl=Nn[--En],Nn[En]=null,In=Nn[--En],Nn[En]=null,Jn=Nn[--En],Nn[En]=null}function fd(e,t){Nn[En++]=Jn,Nn[En++]=In,Nn[En++]=jl,Jn=t.id,In=t.overflow,jl=e}var Xt=null,dt=null,Ze=!1,Al=null,jn=!1,fo=Error(c(519));function Rl(e){var t=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wi(Tn(t,e)),fo}function md(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[Pe]=e,t[Qe]=l,n){case"dialog":qe("cancel",t),qe("close",t);break;case"iframe":case"object":case"embed":qe("load",t);break;case"video":case"audio":for(n=0;n<Xi.length;n++)qe(Xi[n],t);break;case"source":qe("error",t);break;case"img":case"image":case"link":qe("error",t),qe("load",t);break;case"details":qe("toggle",t);break;case"input":qe("invalid",t),Eu(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":qe("invalid",t);break;case"textarea":qe("invalid",t),Au(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||_m(t.textContent,n)?(l.popover!=null&&(qe("beforetoggle",t),qe("toggle",t)),l.onScroll!=null&&qe("scroll",t),l.onScrollEnd!=null&&qe("scrollend",t),l.onClick!=null&&(t.onclick=sl),t=!0):t=!1,t||Rl(e,!0)}function hd(e){for(Xt=e.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:jn=!1;return;case 27:case 3:jn=!0;return;default:Xt=Xt.return}}function Da(e){if(e!==Xt)return!1;if(!Ze)return hd(e),Ze=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Mc(e.type,e.memoizedProps)),n=!n),n&&dt&&Rl(e),hd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));dt=Ym(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));dt=Ym(e)}else t===27?(t=dt,ql(e.type)?(e=Lc,Lc=null,dt=e):dt=t):dt=Xt?Rn(e.stateNode.nextSibling):null;return!0}function la(){dt=Xt=null,Ze=!1}function mo(){var e=Al;return e!==null&&(rn===null?rn=e:rn.push.apply(rn,e),Al=null),e}function wi(e){Al===null?Al=[e]:Al.push(e)}var ho=Ue(null),aa=null,ul=null;function Ml(e,t,n){X(ho,t._currentValue),t._currentValue=n}function dl(e){e._currentValue=ho.current,je(ho)}function po(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 bo(e,t,n,l){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var i=a.dependencies;if(i!==null){var d=a.child;i=i.firstContext;e:for(;i!==null;){var h=i;i=a;for(var y=0;y<t.length;y++)if(h.context===t[y]){i.lanes|=n,h=i.alternate,h!==null&&(h.lanes|=n),po(i.return,n,e),l||(d=null);break e}i=h.next}}else if(a.tag===18){if(d=a.return,d===null)throw Error(c(341));d.lanes|=n,i=d.alternate,i!==null&&(i.lanes|=n),po(d,n,e),d=null}else d=a.child;if(d!==null)d.return=a;else for(d=a;d!==null;){if(d===e){d=null;break}if(a=d.sibling,a!==null){a.return=d.return,d=a;break}d=d.return}a=d}}function La(e,t,n,l){e=null;for(var a=t,i=!1;a!==null;){if(!i){if((a.flags&524288)!==0)i=!0;else if((a.flags&262144)!==0)break}if(a.tag===10){var d=a.alternate;if(d===null)throw Error(c(387));if(d=d.memoizedProps,d!==null){var h=a.type;dn(a.pendingProps.value,d.value)||(e!==null?e.push(h):e=[h])}}else if(a===rt.current){if(d=a.alternate,d===null)throw Error(c(387));d.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e!==null?e.push(Ji):e=[Ji])}a=a.return}e!==null&&bo(t,e,n,l),t.flags|=262144}function As(e){for(e=e.firstContext;e!==null;){if(!dn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ia(e){aa=e,ul=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Vt(e){return pd(aa,e)}function Rs(e,t){return aa===null&&ia(e),pd(e,t)}function pd(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ul===null){if(e===null)throw Error(c(308));ul=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ul=ul.next=t;return n}var Mb=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()})}},_b=r.unstable_scheduleCallback,zb=r.unstable_NormalPriority,At={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function go(){return{controller:new Mb,data:new Map,refCount:0}}function Ci(e){e.refCount--,e.refCount===0&&_b(zb,function(){e.controller.abort()})}var Ti=null,yo=0,Oa=0,Ua=null;function kb(e,t){if(Ti===null){var n=Ti=[];yo=0,Oa=Sc(),Ua={status:"pending",value:void 0,then:function(l){n.push(l)}}}return yo++,t.then(bd,bd),t}function bd(){if(--yo===0&&Ti!==null){Ua!==null&&(Ua.status="fulfilled");var e=Ti;Ti=null,Oa=0,Ua=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Db(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var a=0;a<n.length;a++)(0,n[a])(t)},function(a){for(l.status="rejected",l.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),l}var gd=R.S;R.S=function(e,t){tm=$(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&kb(e,t),gd!==null&&gd(e,t)};var sa=Ue(null);function vo(){var e=sa.current;return e!==null?e:ct.pooledCache}function Ms(e,t){t===null?X(sa,sa.current):X(sa,t.pool)}function yd(){var e=vo();return e===null?null:{parent:At._currentValue,pool:e}}var Ba=Error(c(460)),xo=Error(c(474)),_s=Error(c(542)),zs={then:function(){}};function vd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function xd(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(sl,sl),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,wd(e),e;default:if(typeof t.status=="string")t.then(sl,sl);else{if(e=ct,e!==null&&100<e.shellSuspendCounter)throw Error(c(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var a=t;a.status="fulfilled",a.value=l}},function(l){if(t.status==="pending"){var a=t;a.status="rejected",a.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,wd(e),e}throw oa=t,Ba}}function ra(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(oa=n,Ba):n}}var oa=null;function Sd(){if(oa===null)throw Error(c(459));var e=oa;return oa=null,e}function wd(e){if(e===Ba||e===_s)throw Error(c(483))}var Ha=null,Ni=0;function ks(e){var t=Ni;return Ni+=1,Ha===null&&(Ha=[]),xd(Ha,e,t)}function Ei(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ds(e,t){throw t.$$typeof===Y?Error(c(525)):(e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Cd(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 a(T,w){return T=ol(T,w),T.index=0,T.sibling=null,T}function i(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 d(T){return e&&T.alternate===null&&(T.flags|=67108866),T}function h(T,w,N,K){return w===null||w.tag!==6?(w=ro(N,T.mode,K),w.return=T,w):(w=a(w,N),w.return=T,w)}function y(T,w,N,K){var ge=N.type;return ge===V?U(T,w,N.props.children,K,N.key):w!==null&&(w.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===A&&ra(ge)===w.type)?(w=a(w,N.props),Ei(w,N),w.return=T,w):(w=Es(N.type,N.key,N.props,null,T.mode,K),Ei(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=oo(N,T.mode,K),w.return=T,w):(w=a(w,N.children||[]),w.return=T,w)}function U(T,w,N,K,ge){return w===null||w.tag!==7?(w=na(N,T.mode,K,ge),w.return=T,w):(w=a(w,N),w.return=T,w)}function G(T,w,N){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return w=ro(""+w,T.mode,N),w.return=T,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case L:return N=Es(w.type,w.key,w.props,null,T.mode,N),Ei(N,w),N.return=T,N;case O:return w=oo(w,T.mode,N),w.return=T,w;case A:return w=ra(w),G(T,w,N)}if(Oe(w)||Te(w))return w=na(w,T.mode,N,null),w.return=T,w;if(typeof w.then=="function")return G(T,ks(w),N);if(w.$$typeof===F)return G(T,Rs(T,w),N);Ds(T,w)}return null}function j(T,w,N,K){var ge=w!==null?w.key:null;if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return ge!==null?null:h(T,w,""+N,K);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case L:return N.key===ge?y(T,w,N,K):null;case O:return N.key===ge?E(T,w,N,K):null;case A:return N=ra(N),j(T,w,N,K)}if(Oe(N)||Te(N))return ge!==null?null:U(T,w,N,K,null);if(typeof N.then=="function")return j(T,w,ks(N),K);if(N.$$typeof===F)return j(T,w,Rs(T,N),K);Ds(T,N)}return null}function M(T,w,N,K,ge){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return T=T.get(N)||null,h(w,T,""+K,ge);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case L:return T=T.get(K.key===null?N:K.key)||null,y(w,T,K,ge);case O:return T=T.get(K.key===null?N:K.key)||null,E(w,T,K,ge);case A:return K=ra(K),M(T,w,N,K,ge)}if(Oe(K)||Te(K))return T=T.get(N)||null,U(w,T,K,ge,null);if(typeof K.then=="function")return M(T,w,N,ks(K),ge);if(K.$$typeof===F)return M(T,w,N,Rs(w,K),ge);Ds(w,K)}return null}function oe(T,w,N,K){for(var ge=null,Je=null,de=w,De=w=0,Ve=null;de!==null&&De<N.length;De++){de.index>De?(Ve=de,de=null):Ve=de.sibling;var Ie=j(T,de,N[De],K);if(Ie===null){de===null&&(de=Ve);break}e&&de&&Ie.alternate===null&&t(T,de),w=i(Ie,w,De),Je===null?ge=Ie:Je.sibling=Ie,Je=Ie,de=Ve}if(De===N.length)return n(T,de),Ze&&cl(T,De),ge;if(de===null){for(;De<N.length;De++)de=G(T,N[De],K),de!==null&&(w=i(de,w,De),Je===null?ge=de:Je.sibling=de,Je=de);return Ze&&cl(T,De),ge}for(de=l(de);De<N.length;De++)Ve=M(de,T,De,N[De],K),Ve!==null&&(e&&Ve.alternate!==null&&de.delete(Ve.key===null?De:Ve.key),w=i(Ve,w,De),Je===null?ge=Ve:Je.sibling=Ve,Je=Ve);return e&&de.forEach(function(Ql){return t(T,Ql)}),Ze&&cl(T,De),ge}function Se(T,w,N,K){if(N==null)throw Error(c(151));for(var ge=null,Je=null,de=w,De=w=0,Ve=null,Ie=N.next();de!==null&&!Ie.done;De++,Ie=N.next()){de.index>De?(Ve=de,de=null):Ve=de.sibling;var Ql=j(T,de,Ie.value,K);if(Ql===null){de===null&&(de=Ve);break}e&&de&&Ql.alternate===null&&t(T,de),w=i(Ql,w,De),Je===null?ge=Ql:Je.sibling=Ql,Je=Ql,de=Ve}if(Ie.done)return n(T,de),Ze&&cl(T,De),ge;if(de===null){for(;!Ie.done;De++,Ie=N.next())Ie=G(T,Ie.value,K),Ie!==null&&(w=i(Ie,w,De),Je===null?ge=Ie:Je.sibling=Ie,Je=Ie);return Ze&&cl(T,De),ge}for(de=l(de);!Ie.done;De++,Ie=N.next())Ie=M(de,T,De,Ie.value,K),Ie!==null&&(e&&Ie.alternate!==null&&de.delete(Ie.key===null?De:Ie.key),w=i(Ie,w,De),Je===null?ge=Ie:Je.sibling=Ie,Je=Ie);return e&&de.forEach(function(Vg){return t(T,Vg)}),Ze&&cl(T,De),ge}function st(T,w,N,K){if(typeof N=="object"&&N!==null&&N.type===V&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case L:e:{for(var ge=N.key;w!==null;){if(w.key===ge){if(ge=N.type,ge===V){if(w.tag===7){n(T,w.sibling),K=a(w,N.props.children),K.return=T,T=K;break e}}else if(w.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===A&&ra(ge)===w.type){n(T,w.sibling),K=a(w,N.props),Ei(K,N),K.return=T,T=K;break e}n(T,w);break}else t(T,w);w=w.sibling}N.type===V?(K=na(N.props.children,T.mode,K,N.key),K.return=T,T=K):(K=Es(N.type,N.key,N.props,null,T.mode,K),Ei(K,N),K.return=T,T=K)}return d(T);case O:e:{for(ge=N.key;w!==null;){if(w.key===ge)if(w.tag===4&&w.stateNode.containerInfo===N.containerInfo&&w.stateNode.implementation===N.implementation){n(T,w.sibling),K=a(w,N.children||[]),K.return=T,T=K;break e}else{n(T,w);break}else t(T,w);w=w.sibling}K=oo(N,T.mode,K),K.return=T,T=K}return d(T);case A:return N=ra(N),st(T,w,N,K)}if(Oe(N))return oe(T,w,N,K);if(Te(N)){if(ge=Te(N),typeof ge!="function")throw Error(c(150));return N=ge.call(N),Se(T,w,N,K)}if(typeof N.then=="function")return st(T,w,ks(N),K);if(N.$$typeof===F)return st(T,w,Rs(T,N),K);Ds(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=a(w,N),K.return=T,T=K):(n(T,w),K=ro(N,T.mode,K),K.return=T,T=K),d(T)):n(T,w)}return function(T,w,N,K){try{Ni=0;var ge=st(T,w,N,K);return Ha=null,ge}catch(de){if(de===Ba||de===_s)throw de;var Je=fn(29,de,null,T.mode);return Je.lanes=K,Je.return=T,Je}finally{}}}var ca=Cd(!0),Td=Cd(!1),_l=!1;function So(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wo(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 zl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function kl(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(We&2)!==0){var a=l.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),l.pending=t,t=Ns(e),rd(e,null,n),t}return Ts(e,l,t,n),Ns(e)}function ji(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,_(e,n)}}function Co(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var a=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var d={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?a=i=d:i=i.next=d,n=n.next}while(n!==null);i===null?a=i=t:i=i.next=t}else a=i=t;n={baseState:l.baseState,firstBaseUpdate:a,lastBaseUpdate:i,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 To=!1;function Ai(){if(To){var e=Ua;if(e!==null)throw e}}function Ri(e,t,n,l){To=!1;var a=e.updateQueue;_l=!1;var i=a.firstBaseUpdate,d=a.lastBaseUpdate,h=a.shared.pending;if(h!==null){a.shared.pending=null;var y=h,E=y.next;y.next=null,d===null?i=E:d.next=E,d=y;var U=e.alternate;U!==null&&(U=U.updateQueue,h=U.lastBaseUpdate,h!==d&&(h===null?U.firstBaseUpdate=E:h.next=E,U.lastBaseUpdate=y))}if(i!==null){var G=a.baseState;d=0,U=E=y=null,h=i;do{var j=h.lane&-536870913,M=j!==h.lane;if(M?(Xe&j)===j:(l&j)===j){j!==0&&j===Oa&&(To=!0),U!==null&&(U=U.next={lane:0,tag:h.tag,payload:h.payload,callback:null,next:null});e:{var oe=e,Se=h;j=t;var st=n;switch(Se.tag){case 1:if(oe=Se.payload,typeof oe=="function"){G=oe.call(st,G,j);break e}G=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=Se.payload,j=typeof oe=="function"?oe.call(st,G,j):oe,j==null)break e;G=C({},G,j);break e;case 2:_l=!0}}j=h.callback,j!==null&&(e.flags|=64,M&&(e.flags|=8192),M=a.callbacks,M===null?a.callbacks=[j]:M.push(j))}else M={lane:j,tag:h.tag,payload:h.payload,callback:h.callback,next:null},U===null?(E=U=M,y=G):U=U.next=M,d|=j;if(h=h.next,h===null){if(h=a.shared.pending,h===null)break;M=h,h=M.next,M.next=null,a.lastBaseUpdate=M,a.shared.pending=null}}while(!0);U===null&&(y=G),a.baseState=y,a.firstBaseUpdate=E,a.lastBaseUpdate=U,i===null&&(a.shared.lanes=0),Bl|=d,e.lanes=d,e.memoizedState=G}}function Nd(e,t){if(typeof e!="function")throw Error(c(191,e));e.call(t)}function Ed(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Nd(n[e],t)}var Ya=Ue(null),Ls=Ue(0);function jd(e,t){e=xl,X(Ls,e),X(Ya,t),xl=e|t.baseLanes}function No(){X(Ls,xl),X(Ya,Ya.current)}function Eo(){xl=Ls.current,je(Ya),je(Ls)}var mn=Ue(null),An=null;function Dl(e){var t=e.alternate;X(Tt,Tt.current&1),X(mn,e),An===null&&(t===null||Ya.current!==null||t.memoizedState!==null)&&(An=e)}function jo(e){X(Tt,Tt.current),X(mn,e),An===null&&(An=e)}function Ad(e){e.tag===22?(X(Tt,Tt.current),X(mn,e),An===null&&(An=e)):Ll()}function Ll(){X(Tt,Tt.current),X(mn,mn.current)}function hn(e){je(mn),An===e&&(An=null),je(Tt)}var Tt=Ue(0);function Os(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||kc(n)||Dc(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 fl=0,ke=null,at=null,Rt=null,Us=!1,Ka=!1,ua=!1,Bs=0,Mi=0,Ga=null,Lb=0;function xt(){throw Error(c(321))}function Ao(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!dn(e[n],t[n]))return!1;return!0}function Ro(e,t,n,l,a,i){return fl=i,ke=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,R.H=e===null||e.memoizedState===null?ff:Xo,ua=!1,i=n(l,a),ua=!1,Ka&&(i=Md(t,n,l,a)),Rd(e),i}function Rd(e){R.H=ki;var t=at!==null&&at.next!==null;if(fl=0,Rt=at=ke=null,Us=!1,Mi=0,Ga=null,t)throw Error(c(300));e===null||Mt||(e=e.dependencies,e!==null&&As(e)&&(Mt=!0))}function Md(e,t,n,l){ke=e;var a=0;do{if(Ka&&(Ga=null),Mi=0,Ka=!1,25<=a)throw Error(c(301));if(a+=1,Rt=at=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}R.H=mf,i=t(n,l)}while(Ka);return i}function Ob(){var e=R.H,t=e.useState()[0];return t=typeof t.then=="function"?_i(t):t,e=e.useState()[0],(at!==null?at.memoizedState:null)!==e&&(ke.flags|=1024),t}function Mo(){var e=Bs!==0;return Bs=0,e}function _o(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function zo(e){if(Us){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Us=!1}fl=0,Rt=at=ke=null,Ka=!1,Mi=Bs=0,Ga=null}function tn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?ke.memoizedState=Rt=e:Rt=Rt.next=e,Rt}function Nt(){if(at===null){var e=ke.alternate;e=e!==null?e.memoizedState:null}else e=at.next;var t=Rt===null?ke.memoizedState:Rt.next;if(t!==null)Rt=t,at=e;else{if(e===null)throw ke.alternate===null?Error(c(467)):Error(c(310));at=e,e={memoizedState:at.memoizedState,baseState:at.baseState,baseQueue:at.baseQueue,queue:at.queue,next:null},Rt===null?ke.memoizedState=Rt=e:Rt=Rt.next=e}return Rt}function Hs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function _i(e){var t=Mi;return Mi+=1,Ga===null&&(Ga=[]),e=xd(Ga,e,t),t=ke,(Rt===null?t.memoizedState:Rt.next)===null&&(t=t.alternate,R.H=t===null||t.memoizedState===null?ff:Xo),e}function Ys(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return _i(e);if(e.$$typeof===F)return Vt(e)}throw Error(c(438,String(e)))}function ko(e){var t=null,n=ke.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=ke.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(a){return a.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Hs(),ke.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]=ze;return t.index++,n}function ml(e,t){return typeof t=="function"?t(e):t}function Ks(e){var t=Nt();return Do(t,at,e)}function Do(e,t,n){var l=e.queue;if(l===null)throw Error(c(311));l.lastRenderedReducer=n;var a=e.baseQueue,i=l.pending;if(i!==null){if(a!==null){var d=a.next;a.next=i.next,i.next=d}t.baseQueue=a=i,l.pending=null}if(i=e.baseState,a===null)e.memoizedState=i;else{t=a.next;var h=d=null,y=null,E=t,U=!1;do{var G=E.lane&-536870913;if(G!==E.lane?(Xe&G)===G:(fl&G)===G){var j=E.revertLane;if(j===0)y!==null&&(y=y.next={lane:0,revertLane:0,gesture:null,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null}),G===Oa&&(U=!0);else if((fl&j)===j){E=E.next,j===Oa&&(U=!0);continue}else G={lane:0,revertLane:E.revertLane,gesture:null,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null},y===null?(h=y=G,d=i):y=y.next=G,ke.lanes|=j,Bl|=j;G=E.action,ua&&n(i,G),i=E.hasEagerState?E.eagerState:n(i,G)}else j={lane:G,revertLane:E.revertLane,gesture:E.gesture,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null},y===null?(h=y=j,d=i):y=y.next=j,ke.lanes|=G,Bl|=G;E=E.next}while(E!==null&&E!==t);if(y===null?d=i:y.next=h,!dn(i,e.memoizedState)&&(Mt=!0,U&&(n=Ua,n!==null)))throw n;e.memoizedState=i,e.baseState=d,e.baseQueue=y,l.lastRenderedState=i}return a===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Lo(e){var t=Nt(),n=t.queue;if(n===null)throw Error(c(311));n.lastRenderedReducer=e;var l=n.dispatch,a=n.pending,i=t.memoizedState;if(a!==null){n.pending=null;var d=a=a.next;do i=e(i,d.action),d=d.next;while(d!==a);dn(i,t.memoizedState)||(Mt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,l]}function _d(e,t,n){var l=ke,a=Nt(),i=Ze;if(i){if(n===void 0)throw Error(c(407));n=n()}else n=t();var d=!dn((at||a).memoizedState,n);if(d&&(a.memoizedState=n,Mt=!0),a=a.queue,Bo(Dd.bind(null,l,a,e),[e]),a.getSnapshot!==t||d||Rt!==null&&Rt.memoizedState.tag&1){if(l.flags|=2048,qa(9,{destroy:void 0},kd.bind(null,l,a,n,t),null),ct===null)throw Error(c(349));i||(fl&127)!==0||zd(l,t,n)}return n}function zd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ke.updateQueue,t===null?(t=Hs(),ke.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function kd(e,t,n,l){t.value=n,t.getSnapshot=l,Ld(t)&&Od(e)}function Dd(e,t,n){return n(function(){Ld(t)&&Od(e)})}function Ld(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!dn(e,n)}catch{return!0}}function Od(e){var t=ta(e,2);t!==null&&on(t,e,2)}function Oo(e){var t=tn();if(typeof e=="function"){var n=e;if(e=n(),ua){yn(!0);try{n()}finally{yn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ml,lastRenderedState:e},t}function Ud(e,t,n,l){return e.baseState=n,Do(e,at,typeof l=="function"?l:ml)}function Ub(e,t,n,l,a){if(Xs(e))throw Error(c(485));if(e=t.action,e!==null){var i={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(d){i.listeners.push(d)}};R.T!==null?n(!0):i.isTransition=!1,l(i),n=t.pending,n===null?(i.next=t.pending=i,Bd(t,i)):(i.next=n.next,t.pending=n.next=i)}}function Bd(e,t){var n=t.action,l=t.payload,a=e.state;if(t.isTransition){var i=R.T,d={};R.T=d;try{var h=n(a,l),y=R.S;y!==null&&y(d,h),Hd(e,t,h)}catch(E){Uo(e,t,E)}finally{i!==null&&d.types!==null&&(i.types=d.types),R.T=i}}else try{i=n(a,l),Hd(e,t,i)}catch(E){Uo(e,t,E)}}function Hd(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){Yd(e,t,l)},function(l){return Uo(e,t,l)}):Yd(e,t,n)}function Yd(e,t,n){t.status="fulfilled",t.value=n,Kd(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Bd(e,n)))}function Uo(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,Kd(t),t=t.next;while(t!==l)}e.action=null}function Kd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Gd(e,t){return t}function qd(e,t){if(Ze){var n=ct.formState;if(n!==null){e:{var l=ke;if(Ze){if(dt){t:{for(var a=dt,i=jn;a.nodeType!==8;){if(!i){a=null;break t}if(a=Rn(a.nextSibling),a===null){a=null;break t}}i=a.data,a=i==="F!"||i==="F"?a:null}if(a){dt=Rn(a.nextSibling),l=a.data==="F!";break e}}Rl(l)}l=!1}l&&(t=n[0])}}return n=tn(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gd,lastRenderedState:t},n.queue=l,n=cf.bind(null,ke,l),l.dispatch=n,l=Oo(!1),i=qo.bind(null,ke,!1,l.queue),l=tn(),a={state:t,dispatch:null,action:e,pending:null},l.queue=a,n=Ub.bind(null,ke,a,i,n),a.dispatch=n,l.memoizedState=e,[t,n,!1]}function Xd(e){var t=Nt();return Vd(t,at,e)}function Vd(e,t,n){if(t=Do(e,t,Gd)[0],e=Ks(ml)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=_i(t)}catch(d){throw d===Ba?_s:d}else l=t;t=Nt();var a=t.queue,i=a.dispatch;return n!==t.memoizedState&&(ke.flags|=2048,qa(9,{destroy:void 0},Bb.bind(null,a,n),null)),[l,i,e]}function Bb(e,t){e.action=t}function Zd(e){var t=Nt(),n=at;if(n!==null)return Vd(t,n,e);Nt(),t=t.memoizedState,n=Nt();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function qa(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=ke.updateQueue,t===null&&(t=Hs(),ke.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 Fd(){return Nt().memoizedState}function Gs(e,t,n,l){var a=tn();ke.flags|=e,a.memoizedState=qa(1|t,{destroy:void 0},n,l===void 0?null:l)}function qs(e,t,n,l){var a=Nt();l=l===void 0?null:l;var i=a.memoizedState.inst;at!==null&&l!==null&&Ao(l,at.memoizedState.deps)?a.memoizedState=qa(t,i,n,l):(ke.flags|=e,a.memoizedState=qa(1|t,i,n,l))}function Qd(e,t){Gs(8390656,8,e,t)}function Bo(e,t){qs(2048,8,e,t)}function Hb(e){ke.flags|=4;var t=ke.updateQueue;if(t===null)t=Hs(),ke.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Jd(e){var t=Nt().memoizedState;return Hb({ref:t,nextImpl:e}),function(){if((We&2)!==0)throw Error(c(440));return t.impl.apply(void 0,arguments)}}function Id(e,t){return qs(4,2,e,t)}function Wd(e,t){return qs(4,4,e,t)}function Pd(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 $d(e,t,n){n=n!=null?n.concat([e]):null,qs(4,4,Pd.bind(null,t,e),n)}function Ho(){}function ef(e,t){var n=Nt();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&Ao(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function tf(e,t){var n=Nt();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&Ao(t,l[1]))return l[0];if(l=e(),ua){yn(!0);try{e()}finally{yn(!1)}}return n.memoizedState=[l,t],l}function Yo(e,t,n){return n===void 0||(fl&1073741824)!==0&&(Xe&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=lm(),ke.lanes|=e,Bl|=e,n)}function nf(e,t,n,l){return dn(n,t)?n:Ya.current!==null?(e=Yo(e,n,l),dn(e,t)||(Mt=!0),e):(fl&42)===0||(fl&1073741824)!==0&&(Xe&261930)===0?(Mt=!0,e.memoizedState=n):(e=lm(),ke.lanes|=e,Bl|=e,t)}function lf(e,t,n,l,a){var i=q.p;q.p=i!==0&&8>i?i:8;var d=R.T,h={};R.T=h,qo(e,!1,t,n);try{var y=a(),E=R.S;if(E!==null&&E(h,y),y!==null&&typeof y=="object"&&typeof y.then=="function"){var U=Db(y,l);zi(e,t,U,gn(e))}else zi(e,t,l,gn(e))}catch(G){zi(e,t,{then:function(){},status:"rejected",reason:G},gn())}finally{q.p=i,d!==null&&h.types!==null&&(d.types=h.types),R.T=d}}function Yb(){}function Ko(e,t,n,l){if(e.tag!==5)throw Error(c(476));var a=af(e).queue;lf(e,a,t,Q,n===null?Yb:function(){return sf(e),n(l)})}function af(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ml,lastRenderedState:Q},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ml,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function sf(e){var t=af(e);t.next===null&&(t=e.alternate.memoizedState),zi(e,t.next.queue,{},gn())}function Go(){return Vt(Ji)}function rf(){return Nt().memoizedState}function of(){return Nt().memoizedState}function Kb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=gn();e=zl(n);var l=kl(t,e,n);l!==null&&(on(l,t,n),ji(l,t,n)),t={cache:go()},e.payload=t;return}t=t.return}}function Gb(e,t,n){var l=gn();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Xs(e)?uf(t,n):(n=io(e,t,n,l),n!==null&&(on(n,e,l),df(n,t,l)))}function cf(e,t,n){var l=gn();zi(e,t,n,l)}function zi(e,t,n,l){var a={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Xs(e))uf(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var d=t.lastRenderedState,h=i(d,n);if(a.hasEagerState=!0,a.eagerState=h,dn(h,d))return Ts(e,t,a,0),ct===null&&Cs(),!1}catch{}finally{}if(n=io(e,t,a,l),n!==null)return on(n,e,l),df(n,t,l),!0}return!1}function qo(e,t,n,l){if(l={lane:2,revertLane:Sc(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Xs(e)){if(t)throw Error(c(479))}else t=io(e,n,l,2),t!==null&&on(t,e,2)}function Xs(e){var t=e.alternate;return e===ke||t!==null&&t===ke}function uf(e,t){Ka=Us=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function df(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,_(e,n)}}var ki={readContext:Vt,use:Ys,useCallback:xt,useContext:xt,useEffect:xt,useImperativeHandle:xt,useLayoutEffect:xt,useInsertionEffect:xt,useMemo:xt,useReducer:xt,useRef:xt,useState:xt,useDebugValue:xt,useDeferredValue:xt,useTransition:xt,useSyncExternalStore:xt,useId:xt,useHostTransitionStatus:xt,useFormState:xt,useActionState:xt,useOptimistic:xt,useMemoCache:xt,useCacheRefresh:xt};ki.useEffectEvent=xt;var ff={readContext:Vt,use:Ys,useCallback:function(e,t){return tn().memoizedState=[e,t===void 0?null:t],e},useContext:Vt,useEffect:Qd,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Gs(4194308,4,Pd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Gs(4194308,4,e,t)},useInsertionEffect:function(e,t){Gs(4,2,e,t)},useMemo:function(e,t){var n=tn();t=t===void 0?null:t;var l=e();if(ua){yn(!0);try{e()}finally{yn(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=tn();if(n!==void 0){var a=n(t);if(ua){yn(!0);try{n(t)}finally{yn(!1)}}}else a=t;return l.memoizedState=l.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},l.queue=e,e=e.dispatch=Gb.bind(null,ke,e),[l.memoizedState,e]},useRef:function(e){var t=tn();return e={current:e},t.memoizedState=e},useState:function(e){e=Oo(e);var t=e.queue,n=cf.bind(null,ke,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ho,useDeferredValue:function(e,t){var n=tn();return Yo(n,e,t)},useTransition:function(){var e=Oo(!1);return e=lf.bind(null,ke,e.queue,!0,!1),tn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=ke,a=tn();if(Ze){if(n===void 0)throw Error(c(407));n=n()}else{if(n=t(),ct===null)throw Error(c(349));(Xe&127)!==0||zd(l,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,Qd(Dd.bind(null,l,i,e),[e]),l.flags|=2048,qa(9,{destroy:void 0},kd.bind(null,l,i,n,t),null),n},useId:function(){var e=tn(),t=ct.identifierPrefix;if(Ze){var n=In,l=Jn;n=(l&~(1<<32-qt(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Bs++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Lb++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Go,useFormState:qd,useActionState:qd,useOptimistic:function(e){var t=tn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=qo.bind(null,ke,!0,n),n.dispatch=t,[e,t]},useMemoCache:ko,useCacheRefresh:function(){return tn().memoizedState=Kb.bind(null,ke)},useEffectEvent:function(e){var t=tn(),n={impl:e};return t.memoizedState=n,function(){if((We&2)!==0)throw Error(c(440));return n.impl.apply(void 0,arguments)}}},Xo={readContext:Vt,use:Ys,useCallback:ef,useContext:Vt,useEffect:Bo,useImperativeHandle:$d,useInsertionEffect:Id,useLayoutEffect:Wd,useMemo:tf,useReducer:Ks,useRef:Fd,useState:function(){return Ks(ml)},useDebugValue:Ho,useDeferredValue:function(e,t){var n=Nt();return nf(n,at.memoizedState,e,t)},useTransition:function(){var e=Ks(ml)[0],t=Nt().memoizedState;return[typeof e=="boolean"?e:_i(e),t]},useSyncExternalStore:_d,useId:rf,useHostTransitionStatus:Go,useFormState:Xd,useActionState:Xd,useOptimistic:function(e,t){var n=Nt();return Ud(n,at,e,t)},useMemoCache:ko,useCacheRefresh:of};Xo.useEffectEvent=Jd;var mf={readContext:Vt,use:Ys,useCallback:ef,useContext:Vt,useEffect:Bo,useImperativeHandle:$d,useInsertionEffect:Id,useLayoutEffect:Wd,useMemo:tf,useReducer:Lo,useRef:Fd,useState:function(){return Lo(ml)},useDebugValue:Ho,useDeferredValue:function(e,t){var n=Nt();return at===null?Yo(n,e,t):nf(n,at.memoizedState,e,t)},useTransition:function(){var e=Lo(ml)[0],t=Nt().memoizedState;return[typeof e=="boolean"?e:_i(e),t]},useSyncExternalStore:_d,useId:rf,useHostTransitionStatus:Go,useFormState:Zd,useActionState:Zd,useOptimistic:function(e,t){var n=Nt();return at!==null?Ud(n,at,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:ko,useCacheRefresh:of};mf.useEffectEvent=Jd;function Vo(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 Zo={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=gn(),a=zl(l);a.payload=t,n!=null&&(a.callback=n),t=kl(e,a,l),t!==null&&(on(t,e,l),ji(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=gn(),a=zl(l);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=kl(e,a,l),t!==null&&(on(t,e,l),ji(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=gn(),l=zl(n);l.tag=2,t!=null&&(l.callback=t),t=kl(e,l,n),t!==null&&(on(t,e,n),ji(t,e,n))}};function hf(e,t,n,l,a,i,d){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,i,d):t.prototype&&t.prototype.isPureReactComponent?!vi(n,l)||!vi(a,i):!0}function pf(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&&Zo.enqueueReplaceState(t,t.state,null)}function da(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 a in e)n[a]===void 0&&(n[a]=e[a])}return n}function bf(e){ws(e)}function gf(e){console.error(e)}function yf(e){ws(e)}function Vs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function vf(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function Fo(e,t,n){return n=zl(n),n.tag=3,n.payload={element:null},n.callback=function(){Vs(e,t)},n}function xf(e){return e=zl(e),e.tag=3,e}function Sf(e,t,n,l){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var i=l.value;e.payload=function(){return a(i)},e.callback=function(){vf(t,n,l)}}var d=n.stateNode;d!==null&&typeof d.componentDidCatch=="function"&&(e.callback=function(){vf(t,n,l),typeof a!="function"&&(Hl===null?Hl=new Set([this]):Hl.add(this));var h=l.stack;this.componentDidCatch(l.value,{componentStack:h!==null?h:""})})}function qb(e,t,n,l,a){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&La(t,n,a,!0),n=mn.current,n!==null){switch(n.tag){case 31:case 13:return An===null?lr():n.alternate===null&&St===0&&(St=3),n.flags&=-257,n.flags|=65536,n.lanes=a,l===zs?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),yc(e,l,a)),!1;case 22:return n.flags|=65536,l===zs?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)),yc(e,l,a)),!1}throw Error(c(435,n.tag))}return yc(e,l,a),lr(),!1}if(Ze)return t=mn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=a,l!==fo&&(e=Error(c(422),{cause:l}),wi(Tn(e,n)))):(l!==fo&&(t=Error(c(423),{cause:l}),wi(Tn(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,l=Tn(l,n),a=Fo(e.stateNode,l,a),Co(e,a),St!==4&&(St=2)),!1;var i=Error(c(520),{cause:l});if(i=Tn(i,n),Ki===null?Ki=[i]:Ki.push(i),St!==4&&(St=2),t===null)return!0;l=Tn(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Fo(n.stateNode,l,e),Co(n,e),!1;case 1:if(t=n.type,i=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(Hl===null||!Hl.has(i))))return n.flags|=65536,a&=-a,n.lanes|=a,a=xf(a),Sf(a,e,n,l),Co(n,a),!1}n=n.return}while(n!==null);return!1}var Qo=Error(c(461)),Mt=!1;function Zt(e,t,n,l){t.child=e===null?Td(t,null,n,l):ca(t,e.child,n,l)}function wf(e,t,n,l,a){n=n.render;var i=t.ref;if("ref"in l){var d={};for(var h in l)h!=="ref"&&(d[h]=l[h])}else d=l;return ia(t),l=Ro(e,t,n,d,i,a),h=Mo(),e!==null&&!Mt?(_o(e,t,a),hl(e,t,a)):(Ze&&h&&co(t),t.flags|=1,Zt(e,t,l,a),t.child)}function Cf(e,t,n,l,a){if(e===null){var i=n.type;return typeof i=="function"&&!so(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,Tf(e,t,i,l,a)):(e=Es(n.type,null,l,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!nc(e,a)){var d=i.memoizedProps;if(n=n.compare,n=n!==null?n:vi,n(d,l)&&e.ref===t.ref)return hl(e,t,a)}return t.flags|=1,e=ol(i,l),e.ref=t.ref,e.return=t,t.child=e}function Tf(e,t,n,l,a){if(e!==null){var i=e.memoizedProps;if(vi(i,l)&&e.ref===t.ref)if(Mt=!1,t.pendingProps=l=i,nc(e,a))(e.flags&131072)!==0&&(Mt=!0);else return t.lanes=e.lanes,hl(e,t,a)}return Jo(e,t,n,l,a)}function Nf(e,t,n,l){var a=l.children,i=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(i=i!==null?i.baseLanes|n:n,e!==null){for(l=t.child=e.child,a=0;l!==null;)a=a|l.lanes|l.childLanes,l=l.sibling;l=a&~i}else l=0,t.child=null;return Ef(e,t,i,n,l)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ms(t,i!==null?i.cachePool:null),i!==null?jd(t,i):No(),Ad(t);else return l=t.lanes=536870912,Ef(e,t,i!==null?i.baseLanes|n:n,n,l)}else i!==null?(Ms(t,i.cachePool),jd(t,i),Ll(),t.memoizedState=null):(e!==null&&Ms(t,null),No(),Ll());return Zt(e,t,a,n),t.child}function Di(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ef(e,t,n,l,a){var i=vo();return i=i===null?null:{parent:At._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&Ms(t,null),No(),Ad(t),e!==null&&La(e,t,l,!0),t.childLanes=a,null}function Zs(e,t){return t=Qs({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function jf(e,t,n){return ca(t,e.child,null,n),e=Zs(t,t.pendingProps),e.flags|=2,hn(t),t.memoizedState=null,e}function Xb(e,t,n){var l=t.pendingProps,a=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ze){if(l.mode==="hidden")return e=Zs(t,l),t.lanes=536870912,Di(null,e);if(jo(t),(e=dt)?(e=Hm(e,jn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:jl!==null?{id:Jn,overflow:In}:null,retryLane:536870912,hydrationErrors:null},n=cd(e),n.return=t,t.child=n,Xt=t,dt=null)):e=null,e===null)throw Rl(t);return t.lanes=536870912,null}return Zs(t,l)}var i=e.memoizedState;if(i!==null){var d=i.dehydrated;if(jo(t),a)if(t.flags&256)t.flags&=-257,t=jf(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(c(558));else if(Mt||La(e,t,n,!1),a=(n&e.childLanes)!==0,Mt||a){if(l=ct,l!==null&&(d=D(l,n),d!==0&&d!==i.retryLane))throw i.retryLane=d,ta(e,d),on(l,e,d),Qo;lr(),t=jf(e,t,n)}else e=i.treeContext,dt=Rn(d.nextSibling),Xt=t,Ze=!0,Al=null,jn=!1,e!==null&&fd(t,e),t=Zs(t,l),t.flags|=4096;return t}return e=ol(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Fs(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 Jo(e,t,n,l,a){return ia(t),n=Ro(e,t,n,l,void 0,a),l=Mo(),e!==null&&!Mt?(_o(e,t,a),hl(e,t,a)):(Ze&&l&&co(t),t.flags|=1,Zt(e,t,n,a),t.child)}function Af(e,t,n,l,a,i){return ia(t),t.updateQueue=null,n=Md(t,l,n,a),Rd(e),l=Mo(),e!==null&&!Mt?(_o(e,t,i),hl(e,t,i)):(Ze&&l&&co(t),t.flags|=1,Zt(e,t,n,i),t.child)}function Rf(e,t,n,l,a){if(ia(t),t.stateNode===null){var i=_a,d=n.contextType;typeof d=="object"&&d!==null&&(i=Vt(d)),i=new n(l,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Zo,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=l,i.state=t.memoizedState,i.refs={},So(t),d=n.contextType,i.context=typeof d=="object"&&d!==null?Vt(d):_a,i.state=t.memoizedState,d=n.getDerivedStateFromProps,typeof d=="function"&&(Vo(t,n,d,l),i.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(d=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),d!==i.state&&Zo.enqueueReplaceState(i,i.state,null),Ri(t,l,i,a),Ai(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){i=t.stateNode;var h=t.memoizedProps,y=da(n,h);i.props=y;var E=i.context,U=n.contextType;d=_a,typeof U=="object"&&U!==null&&(d=Vt(U));var G=n.getDerivedStateFromProps;U=typeof G=="function"||typeof i.getSnapshotBeforeUpdate=="function",h=t.pendingProps!==h,U||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(h||E!==d)&&pf(t,i,l,d),_l=!1;var j=t.memoizedState;i.state=j,Ri(t,l,i,a),Ai(),E=t.memoizedState,h||j!==E||_l?(typeof G=="function"&&(Vo(t,n,G,l),E=t.memoizedState),(y=_l||hf(t,n,y,l,j,E,d))?(U||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=E),i.props=l,i.state=E,i.context=d,l=y):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{i=t.stateNode,wo(e,t),d=t.memoizedProps,U=da(n,d),i.props=U,G=t.pendingProps,j=i.context,E=n.contextType,y=_a,typeof E=="object"&&E!==null&&(y=Vt(E)),h=n.getDerivedStateFromProps,(E=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(d!==G||j!==y)&&pf(t,i,l,y),_l=!1,j=t.memoizedState,i.state=j,Ri(t,l,i,a),Ai();var M=t.memoizedState;d!==G||j!==M||_l||e!==null&&e.dependencies!==null&&As(e.dependencies)?(typeof h=="function"&&(Vo(t,n,h,l),M=t.memoizedState),(U=_l||hf(t,n,U,l,j,M,y)||e!==null&&e.dependencies!==null&&As(e.dependencies))?(E||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(l,M,y),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(l,M,y)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||d===e.memoizedProps&&j===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&j===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=M),i.props=l,i.state=M,i.context=y,l=U):(typeof i.componentDidUpdate!="function"||d===e.memoizedProps&&j===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&j===e.memoizedState||(t.flags|=1024),l=!1)}return i=l,Fs(e,t),l=(t.flags&128)!==0,i||l?(i=t.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&l?(t.child=ca(t,e.child,null,a),t.child=ca(t,null,n,a)):Zt(e,t,n,a),t.memoizedState=i.state,e=t.child):e=hl(e,t,a),e}function Mf(e,t,n,l){return la(),t.flags|=256,Zt(e,t,n,l),t.child}var Io={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wo(e){return{baseLanes:e,cachePool:yd()}}function Po(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=bn),e}function _f(e,t,n){var l=t.pendingProps,a=!1,i=(t.flags&128)!==0,d;if((d=i)||(d=e!==null&&e.memoizedState===null?!1:(Tt.current&2)!==0),d&&(a=!0,t.flags&=-129),d=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ze){if(a?Dl(t):Ll(),(e=dt)?(e=Hm(e,jn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:jl!==null?{id:Jn,overflow:In}:null,retryLane:536870912,hydrationErrors:null},n=cd(e),n.return=t,t.child=n,Xt=t,dt=null)):e=null,e===null)throw Rl(t);return Dc(e)?t.lanes=32:t.lanes=536870912,null}var h=l.children;return l=l.fallback,a?(Ll(),a=t.mode,h=Qs({mode:"hidden",children:h},a),l=na(l,a,n,null),h.return=t,l.return=t,h.sibling=l,t.child=h,l=t.child,l.memoizedState=Wo(n),l.childLanes=Po(e,d,n),t.memoizedState=Io,Di(null,l)):(Dl(t),$o(t,h))}var y=e.memoizedState;if(y!==null&&(h=y.dehydrated,h!==null)){if(i)t.flags&256?(Dl(t),t.flags&=-257,t=ec(e,t,n)):t.memoizedState!==null?(Ll(),t.child=e.child,t.flags|=128,t=null):(Ll(),h=l.fallback,a=t.mode,l=Qs({mode:"visible",children:l.children},a),h=na(h,a,n,null),h.flags|=2,l.return=t,h.return=t,l.sibling=h,t.child=l,ca(t,e.child,null,n),l=t.child,l.memoizedState=Wo(n),l.childLanes=Po(e,d,n),t.memoizedState=Io,t=Di(null,l));else if(Dl(t),Dc(h)){if(d=h.nextSibling&&h.nextSibling.dataset,d)var E=d.dgst;d=E,l=Error(c(419)),l.stack="",l.digest=d,wi({value:l,source:null,stack:null}),t=ec(e,t,n)}else if(Mt||La(e,t,n,!1),d=(n&e.childLanes)!==0,Mt||d){if(d=ct,d!==null&&(l=D(d,n),l!==0&&l!==y.retryLane))throw y.retryLane=l,ta(e,l),on(d,e,l),Qo;kc(h)||lr(),t=ec(e,t,n)}else kc(h)?(t.flags|=192,t.child=e.child,t=null):(e=y.treeContext,dt=Rn(h.nextSibling),Xt=t,Ze=!0,Al=null,jn=!1,e!==null&&fd(t,e),t=$o(t,l.children),t.flags|=4096);return t}return a?(Ll(),h=l.fallback,a=t.mode,y=e.child,E=y.sibling,l=ol(y,{mode:"hidden",children:l.children}),l.subtreeFlags=y.subtreeFlags&65011712,E!==null?h=ol(E,h):(h=na(h,a,n,null),h.flags|=2),h.return=t,l.return=t,l.sibling=h,t.child=l,Di(null,l),l=t.child,h=e.child.memoizedState,h===null?h=Wo(n):(a=h.cachePool,a!==null?(y=At._currentValue,a=a.parent!==y?{parent:y,pool:y}:a):a=yd(),h={baseLanes:h.baseLanes|n,cachePool:a}),l.memoizedState=h,l.childLanes=Po(e,d,n),t.memoizedState=Io,Di(e.child,l)):(Dl(t),n=e.child,e=n.sibling,n=ol(n,{mode:"visible",children:l.children}),n.return=t,n.sibling=null,e!==null&&(d=t.deletions,d===null?(t.deletions=[e],t.flags|=16):d.push(e)),t.child=n,t.memoizedState=null,n)}function $o(e,t){return t=Qs({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Qs(e,t){return e=fn(22,e,null,t),e.lanes=0,e}function ec(e,t,n){return ca(t,e.child,null,n),e=$o(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function zf(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),po(e.return,t,n)}function tc(e,t,n,l,a,i){var d=e.memoizedState;d===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:a,treeForkCount:i}:(d.isBackwards=t,d.rendering=null,d.renderingStartTime=0,d.last=l,d.tail=n,d.tailMode=a,d.treeForkCount=i)}function kf(e,t,n){var l=t.pendingProps,a=l.revealOrder,i=l.tail;l=l.children;var d=Tt.current,h=(d&2)!==0;if(h?(d=d&1|2,t.flags|=128):d&=1,X(Tt,d),Zt(e,t,l,n),l=Ze?Si:0,!h&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&zf(e,n,t);else if(e.tag===19)zf(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(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&Os(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),tc(t,!1,a,n,i,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&Os(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}tc(t,!0,n,null,i,l);break;case"together":tc(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function hl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Bl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(La(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=ol(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ol(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function nc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&As(e)))}function Vb(e,t,n){switch(t.tag){case 3:Ke(t,t.stateNode.containerInfo),Ml(t,At,e.memoizedState.cache),la();break;case 27:case 5:Fe(t);break;case 4:Ke(t,t.stateNode.containerInfo);break;case 10:Ml(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,jo(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Dl(t),t.flags|=128,null):(n&t.child.childLanes)!==0?_f(e,t,n):(Dl(t),e=hl(e,t,n),e!==null?e.sibling:null);Dl(t);break;case 19:var a=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(La(e,t,n,!1),l=(n&t.childLanes)!==0),a){if(l)return kf(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),X(Tt,Tt.current),l)break;return null;case 22:return t.lanes=0,Nf(e,t,n,t.pendingProps);case 24:Ml(t,At,e.memoizedState.cache)}return hl(e,t,n)}function Df(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Mt=!0;else{if(!nc(e,n)&&(t.flags&128)===0)return Mt=!1,Vb(e,t,n);Mt=(e.flags&131072)!==0}else Mt=!1,Ze&&(t.flags&1048576)!==0&&dd(t,Si,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=ra(t.elementType),t.type=e,typeof e=="function")so(e)?(l=da(e,l),t.tag=1,t=Rf(null,t,e,l,n)):(t.tag=0,t=Jo(null,t,e,l,n));else{if(e!=null){var a=e.$$typeof;if(a===ce){t.tag=11,t=wf(null,t,e,l,n);break e}else if(a===z){t.tag=14,t=Cf(null,t,e,l,n);break e}}throw t=Me(e)||e,Error(c(306,t,""))}}return t;case 0:return Jo(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,a=da(l,t.pendingProps),Rf(e,t,l,a,n);case 3:e:{if(Ke(t,t.stateNode.containerInfo),e===null)throw Error(c(387));l=t.pendingProps;var i=t.memoizedState;a=i.element,wo(e,t),Ri(t,l,null,n);var d=t.memoizedState;if(l=d.cache,Ml(t,At,l),l!==i.cache&&bo(t,[At],n,!0),Ai(),l=d.element,i.isDehydrated)if(i={element:l,isDehydrated:!1,cache:d.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=Mf(e,t,l,n);break e}else if(l!==a){a=Tn(Error(c(424)),t),wi(a),t=Mf(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(dt=Rn(e.firstChild),Xt=t,Ze=!0,Al=null,jn=!0,n=Td(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(la(),l===a){t=hl(e,t,n);break e}Zt(e,t,l,n)}t=t.child}return t;case 26:return Fs(e,t),e===null?(n=Vm(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ze||(n=t.type,e=t.pendingProps,l=ur(ie.current).createElement(n),l[Pe]=t,l[Qe]=e,Ft(l,n,e),Ct(l),t.stateNode=l):t.memoizedState=Vm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Fe(t),e===null&&Ze&&(l=t.stateNode=Gm(t.type,t.pendingProps,ie.current),Xt=t,jn=!0,a=dt,ql(t.type)?(Lc=a,dt=Rn(l.firstChild)):dt=a),Zt(e,t,t.pendingProps.children,n),Fs(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ze&&((a=l=dt)&&(l=Sg(l,t.type,t.pendingProps,jn),l!==null?(t.stateNode=l,Xt=t,dt=Rn(l.firstChild),jn=!1,a=!0):a=!1),a||Rl(t)),Fe(t),a=t.type,i=t.pendingProps,d=e!==null?e.memoizedProps:null,l=i.children,Mc(a,i)?l=null:d!==null&&Mc(a,d)&&(t.flags|=32),t.memoizedState!==null&&(a=Ro(e,t,Ob,null,null,n),Ji._currentValue=a),Fs(e,t),Zt(e,t,l,n),t.child;case 6:return e===null&&Ze&&((e=n=dt)&&(n=wg(n,t.pendingProps,jn),n!==null?(t.stateNode=n,Xt=t,dt=null,e=!0):e=!1),e||Rl(t)),null;case 13:return _f(e,t,n);case 4:return Ke(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=ca(t,null,l,n):Zt(e,t,l,n),t.child;case 11:return wf(e,t,t.type,t.pendingProps,n);case 7:return Zt(e,t,t.pendingProps,n),t.child;case 8:return Zt(e,t,t.pendingProps.children,n),t.child;case 12:return Zt(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,Ml(t,t.type,l.value),Zt(e,t,l.children,n),t.child;case 9:return a=t.type._context,l=t.pendingProps.children,ia(t),a=Vt(a),l=l(a),t.flags|=1,Zt(e,t,l,n),t.child;case 14:return Cf(e,t,t.type,t.pendingProps,n);case 15:return Tf(e,t,t.type,t.pendingProps,n);case 19:return kf(e,t,n);case 31:return Xb(e,t,n);case 22:return Nf(e,t,n,t.pendingProps);case 24:return ia(t),l=Vt(At),e===null?(a=vo(),a===null&&(a=ct,i=go(),a.pooledCache=i,i.refCount++,i!==null&&(a.pooledCacheLanes|=n),a=i),t.memoizedState={parent:l,cache:a},So(t),Ml(t,At,a)):((e.lanes&n)!==0&&(wo(e,t),Ri(t,null,null,n),Ai()),a=e.memoizedState,i=t.memoizedState,a.parent!==l?(a={parent:l,cache:l},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ml(t,At,l)):(l=i.cache,Ml(t,At,l),l!==a.cache&&bo(t,[At],n,!0))),Zt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(c(156,t.tag))}function pl(e){e.flags|=4}function lc(e,t,n,l,a){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(a&335544128)===a)if(e.stateNode.complete)e.flags|=8192;else if(rm())e.flags|=8192;else throw oa=zs,xo}else e.flags&=-16777217}function Lf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Im(t))if(rm())e.flags|=8192;else throw oa=zs,xo}function Js(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ee():536870912,e.lanes|=t,Fa|=t)}function Li(e,t){if(!Ze)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 ft(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,l|=a.subtreeFlags&65011712,l|=a.flags&65011712,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,l|=a.subtreeFlags,l|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function Zb(e,t,n){var l=t.pendingProps;switch(uo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ft(t),null;case 1:return ft(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),dl(At),ye(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Da(t)?pl(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,mo())),ft(t),null;case 26:var a=t.type,i=t.memoizedState;return e===null?(pl(t),i!==null?(ft(t),Lf(t,i)):(ft(t),lc(t,a,null,l,n))):i?i!==e.memoizedState?(pl(t),ft(t),Lf(t,i)):(ft(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&pl(t),ft(t),lc(t,a,e,l,n)),null;case 27:if(ot(t),n=ie.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&pl(t);else{if(!l){if(t.stateNode===null)throw Error(c(166));return ft(t),null}e=ve.current,Da(t)?md(t):(e=Gm(a,l,n),t.stateNode=e,pl(t))}return ft(t),null;case 5:if(ot(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&pl(t);else{if(!l){if(t.stateNode===null)throw Error(c(166));return ft(t),null}if(i=ve.current,Da(t))md(t);else{var d=ur(ie.current);switch(i){case 1:i=d.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:i=d.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":i=d.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":i=d.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":i=d.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof l.is=="string"?d.createElement("select",{is:l.is}):d.createElement("select"),l.multiple?i.multiple=!0:l.size&&(i.size=l.size);break;default:i=typeof l.is=="string"?d.createElement(a,{is:l.is}):d.createElement(a)}}i[Pe]=t,i[Qe]=l;e:for(d=t.child;d!==null;){if(d.tag===5||d.tag===6)i.appendChild(d.stateNode);else if(d.tag!==4&&d.tag!==27&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}t.stateNode=i;e:switch(Ft(i,a,l),a){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&pl(t)}}return ft(t),lc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&pl(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(c(166));if(e=ie.current,Da(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,a=Xt,a!==null)switch(a.tag){case 27:case 5:l=a.memoizedProps}e[Pe]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||_m(e.nodeValue,n)),e||Rl(t,!0)}else e=ur(e).createTextNode(l),e[Pe]=t,t.stateNode=e}return ft(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=Da(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[Pe]=t}else la(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ft(t),e=!1}else n=mo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(hn(t),t):(hn(t),null);if((t.flags&128)!==0)throw Error(c(558))}return ft(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Da(t),l!==null&&l.dehydrated!==null){if(e===null){if(!a)throw Error(c(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(c(317));a[Pe]=t}else la(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ft(t),a=!1}else a=mo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(hn(t),t):(hn(t),null)}return hn(t),(t.flags&128)!==0?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,a=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(a=l.alternate.memoizedState.cachePool.pool),i=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(i=l.memoizedState.cachePool.pool),i!==a&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Js(t,t.updateQueue),ft(t),null);case 4:return ye(),e===null&&Nc(t.stateNode.containerInfo),ft(t),null;case 10:return dl(t.type),ft(t),null;case 19:if(je(Tt),l=t.memoizedState,l===null)return ft(t),null;if(a=(t.flags&128)!==0,i=l.rendering,i===null)if(a)Li(l,!1);else{if(St!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=Os(e),i!==null){for(t.flags|=128,Li(l,!1),e=i.updateQueue,t.updateQueue=e,Js(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)od(n,e),n=n.sibling;return X(Tt,Tt.current&1|2),Ze&&cl(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&$()>er&&(t.flags|=128,a=!0,Li(l,!1),t.lanes=4194304)}else{if(!a)if(e=Os(i),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Js(t,e),Li(l,!0),l.tail===null&&l.tailMode==="hidden"&&!i.alternate&&!Ze)return ft(t),null}else 2*$()-l.renderingStartTime>er&&n!==536870912&&(t.flags|=128,a=!0,Li(l,!1),t.lanes=4194304);l.isBackwards?(i.sibling=t.child,t.child=i):(e=l.last,e!==null?e.sibling=i:t.child=i,l.last=i)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=$(),e.sibling=null,n=Tt.current,X(Tt,a?n&1|2:n&1),Ze&&cl(t,l.treeForkCount),e):(ft(t),null);case 22:case 23:return hn(t),Eo(),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&&(ft(t),t.subtreeFlags&6&&(t.flags|=8192)):ft(t),n=t.updateQueue,n!==null&&Js(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==n&&(t.flags|=2048),e!==null&&je(sa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),dl(At),ft(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function Fb(e,t){switch(uo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return dl(At),ye(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ot(t),null;case 31:if(t.memoizedState!==null){if(hn(t),t.alternate===null)throw Error(c(340));la()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(hn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));la()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return je(Tt),null;case 4:return ye(),null;case 10:return dl(t.type),null;case 22:case 23:return hn(t),Eo(),e!==null&&je(sa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return dl(At),null;case 25:return null;default:return null}}function Of(e,t){switch(uo(t),t.tag){case 3:dl(At),ye();break;case 26:case 27:case 5:ot(t);break;case 4:ye();break;case 31:t.memoizedState!==null&&hn(t);break;case 13:hn(t);break;case 19:je(Tt);break;case 10:dl(t.type);break;case 22:case 23:hn(t),Eo(),e!==null&&je(sa);break;case 24:dl(At)}}function Oi(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var a=l.next;n=a;do{if((n.tag&e)===e){l=void 0;var i=n.create,d=n.inst;l=i(),d.destroy=l}n=n.next}while(n!==a)}}catch(h){lt(t,t.return,h)}}function Ol(e,t,n){try{var l=t.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var i=a.next;l=i;do{if((l.tag&e)===e){var d=l.inst,h=d.destroy;if(h!==void 0){d.destroy=void 0,a=t;var y=n,E=h;try{E()}catch(U){lt(a,y,U)}}}l=l.next}while(l!==i)}}catch(U){lt(t,t.return,U)}}function Uf(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ed(t,n)}catch(l){lt(e,e.return,l)}}}function Bf(e,t,n){n.props=da(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){lt(e,t,l)}}function Ui(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(a){lt(e,t,a)}}function Wn(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(a){lt(e,t,a)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){lt(e,t,a)}else n.current=null}function Hf(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(a){lt(e,e.return,a)}}function ac(e,t,n){try{var l=e.stateNode;pg(l,e.type,n,t),l[Qe]=t}catch(a){lt(e,e.return,a)}}function Yf(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ql(e.type)||e.tag===4}function ic(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yf(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&&ql(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 sc(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=sl));else if(l!==4&&(l===27&&ql(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(sc(e,t,n),e=e.sibling;e!==null;)sc(e,t,n),e=e.sibling}function Is(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&&ql(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Is(e,t,n),e=e.sibling;e!==null;)Is(e,t,n),e=e.sibling}function Kf(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Ft(t,l,n),t[Pe]=e,t[Qe]=n}catch(i){lt(e,e.return,i)}}var bl=!1,_t=!1,rc=!1,Gf=typeof WeakSet=="function"?WeakSet:Set,Ht=null;function Qb(e,t){if(e=e.containerInfo,Ac=gr,e=$u(e),$r(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 a=l.anchorOffset,i=l.focusNode;l=l.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var d=0,h=-1,y=-1,E=0,U=0,G=e,j=null;t:for(;;){for(var M;G!==n||a!==0&&G.nodeType!==3||(h=d+a),G!==i||l!==0&&G.nodeType!==3||(y=d+l),G.nodeType===3&&(d+=G.nodeValue.length),(M=G.firstChild)!==null;)j=G,G=M;for(;;){if(G===e)break t;if(j===n&&++E===a&&(h=d),j===i&&++U===l&&(y=d),(M=G.nextSibling)!==null)break;G=j,j=G.parentNode}G=M}n=h===-1||y===-1?null:{start:h,end:y}}else n=null}n=n||{start:0,end:0}}else n=null;for(Rc={focusedElem:e,selectionRange:n},gr=!1,Ht=t;Ht!==null;)if(t=Ht,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ht=e;else for(;Ht!==null;){switch(t=Ht,i=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++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&i!==null){e=void 0,n=t,a=i.memoizedProps,i=i.memoizedState,l=n.stateNode;try{var oe=da(n.type,a);e=l.getSnapshotBeforeUpdate(oe,i),l.__reactInternalSnapshotBeforeUpdate=e}catch(Se){lt(n,n.return,Se)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)zc(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":zc(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,Ht=e;break}Ht=t.return}}function qf(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:yl(e,n),l&4&&Oi(5,n);break;case 1:if(yl(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(d){lt(n,n.return,d)}else{var a=da(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(d){lt(n,n.return,d)}}l&64&&Uf(n),l&512&&Ui(n,n.return);break;case 3:if(yl(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{Ed(e,t)}catch(d){lt(n,n.return,d)}}break;case 27:t===null&&l&4&&Kf(n);case 26:case 5:yl(e,n),t===null&&l&4&&Hf(n),l&512&&Ui(n,n.return);break;case 12:yl(e,n);break;case 31:yl(e,n),l&4&&Zf(e,n);break;case 13:yl(e,n),l&4&&Ff(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=lg.bind(null,n),Cg(e,n))));break;case 22:if(l=n.memoizedState!==null||bl,!l){t=t!==null&&t.memoizedState!==null||_t,a=bl;var i=_t;bl=l,(_t=t)&&!i?vl(e,n,(n.subtreeFlags&8772)!==0):yl(e,n),bl=a,_t=i}break;case 30:break;default:yl(e,n)}}function Xf(e){var t=e.alternate;t!==null&&(e.alternate=null,Xf(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Sa(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 ht=null,ln=!1;function gl(e,t,n){for(n=n.child;n!==null;)Vf(e,t,n),n=n.sibling}function Vf(e,t,n){if(Gt&&typeof Gt.onCommitFiberUnmount=="function")try{Gt.onCommitFiberUnmount(nl,n)}catch{}switch(n.tag){case 26:_t||Wn(n,t),gl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:_t||Wn(n,t);var l=ht,a=ln;ql(n.type)&&(ht=n.stateNode,ln=!1),gl(e,t,n),Zi(n.stateNode),ht=l,ln=a;break;case 5:_t||Wn(n,t);case 6:if(l=ht,a=ln,ht=null,gl(e,t,n),ht=l,ln=a,ht!==null)if(ln)try{(ht.nodeType===9?ht.body:ht.nodeName==="HTML"?ht.ownerDocument.body:ht).removeChild(n.stateNode)}catch(i){lt(n,t,i)}else try{ht.removeChild(n.stateNode)}catch(i){lt(n,t,i)}break;case 18:ht!==null&&(ln?(e=ht,Um(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),ti(e)):Um(ht,n.stateNode));break;case 4:l=ht,a=ln,ht=n.stateNode.containerInfo,ln=!0,gl(e,t,n),ht=l,ln=a;break;case 0:case 11:case 14:case 15:Ol(2,n,t),_t||Ol(4,n,t),gl(e,t,n);break;case 1:_t||(Wn(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&Bf(n,t,l)),gl(e,t,n);break;case 21:gl(e,t,n);break;case 22:_t=(l=_t)||n.memoizedState!==null,gl(e,t,n),_t=l;break;default:gl(e,t,n)}}function Zf(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ti(e)}catch(n){lt(t,t.return,n)}}}function Ff(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ti(e)}catch(n){lt(t,t.return,n)}}function Jb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Gf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Gf),t;default:throw Error(c(435,e.tag))}}function Ws(e,t){var n=Jb(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var a=ag.bind(null,e,l);l.then(a,a)}})}function an(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var a=n[l],i=e,d=t,h=d;e:for(;h!==null;){switch(h.tag){case 27:if(ql(h.type)){ht=h.stateNode,ln=!1;break e}break;case 5:ht=h.stateNode,ln=!1;break e;case 3:case 4:ht=h.stateNode.containerInfo,ln=!0;break e}h=h.return}if(ht===null)throw Error(c(160));Vf(i,d,a),ht=null,ln=!1,i=a.alternate,i!==null&&(i.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Qf(t,e),t=t.sibling}var Hn=null;function Qf(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:an(t,e),sn(e),l&4&&(Ol(3,e,e.return),Oi(3,e),Ol(5,e,e.return));break;case 1:an(t,e),sn(e),l&512&&(_t||n===null||Wn(n,n.return)),l&64&&bl&&(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 a=Hn;if(an(t,e),sn(e),l&512&&(_t||n===null||Wn(n,n.return)),l&4){var i=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,a=a.ownerDocument||a;t:switch(l){case"title":i=a.getElementsByTagName("title")[0],(!i||i[en]||i[Pe]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=a.createElement(l),a.head.insertBefore(i,a.querySelector("head > title"))),Ft(i,l,n),i[Pe]=e,Ct(i),l=i;break e;case"link":var d=Qm("link","href",a).get(l+(n.href||""));if(d){for(var h=0;h<d.length;h++)if(i=d[h],i.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&i.getAttribute("rel")===(n.rel==null?null:n.rel)&&i.getAttribute("title")===(n.title==null?null:n.title)&&i.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){d.splice(h,1);break t}}i=a.createElement(l),Ft(i,l,n),a.head.appendChild(i);break;case"meta":if(d=Qm("meta","content",a).get(l+(n.content||""))){for(h=0;h<d.length;h++)if(i=d[h],i.getAttribute("content")===(n.content==null?null:""+n.content)&&i.getAttribute("name")===(n.name==null?null:n.name)&&i.getAttribute("property")===(n.property==null?null:n.property)&&i.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&i.getAttribute("charset")===(n.charSet==null?null:n.charSet)){d.splice(h,1);break t}}i=a.createElement(l),Ft(i,l,n),a.head.appendChild(i);break;default:throw Error(c(468,l))}i[Pe]=e,Ct(i),l=i}e.stateNode=l}else Jm(a,e.type,e.stateNode);else e.stateNode=Fm(a,l,e.memoizedProps);else i!==l?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,l===null?Jm(a,e.type,e.stateNode):Fm(a,l,e.memoizedProps)):l===null&&e.stateNode!==null&&ac(e,e.memoizedProps,n.memoizedProps)}break;case 27:an(t,e),sn(e),l&512&&(_t||n===null||Wn(n,n.return)),n!==null&&l&4&&ac(e,e.memoizedProps,n.memoizedProps);break;case 5:if(an(t,e),sn(e),l&512&&(_t||n===null||Wn(n,n.return)),e.flags&32){a=e.stateNode;try{Ta(a,"")}catch(oe){lt(e,e.return,oe)}}l&4&&e.stateNode!=null&&(a=e.memoizedProps,ac(e,a,n!==null?n.memoizedProps:a)),l&1024&&(rc=!0);break;case 6:if(an(t,e),sn(e),l&4){if(e.stateNode===null)throw Error(c(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(oe){lt(e,e.return,oe)}}break;case 3:if(mr=null,a=Hn,Hn=dr(t.containerInfo),an(t,e),Hn=a,sn(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{ti(t.containerInfo)}catch(oe){lt(e,e.return,oe)}rc&&(rc=!1,Jf(e));break;case 4:l=Hn,Hn=dr(e.stateNode.containerInfo),an(t,e),sn(e),Hn=l;break;case 12:an(t,e),sn(e);break;case 31:an(t,e),sn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ws(e,l)));break;case 13:an(t,e),sn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&($s=$()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ws(e,l)));break;case 22:a=e.memoizedState!==null;var y=n!==null&&n.memoizedState!==null,E=bl,U=_t;if(bl=E||a,_t=U||y,an(t,e),_t=U,bl=E,sn(e),l&8192)e:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||y||bl||_t||fa(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){y=n=t;try{if(i=y.stateNode,a)d=i.style,typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none";else{h=y.stateNode;var G=y.memoizedProps.style,j=G!=null&&G.hasOwnProperty("display")?G.display:null;h.style.display=j==null||typeof j=="boolean"?"":(""+j).trim()}}catch(oe){lt(y,y.return,oe)}}}else if(t.tag===6){if(n===null){y=t;try{y.stateNode.nodeValue=a?"":y.memoizedProps}catch(oe){lt(y,y.return,oe)}}}else if(t.tag===18){if(n===null){y=t;try{var M=y.stateNode;a?Bm(M,!0):Bm(y.stateNode,!1)}catch(oe){lt(y,y.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,Ws(e,n))));break;case 19:an(t,e),sn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ws(e,l)));break;case 30:break;case 21:break;default:an(t,e),sn(e)}}function sn(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(Yf(l)){n=l;break}l=l.return}if(n==null)throw Error(c(160));switch(n.tag){case 27:var a=n.stateNode,i=ic(e);Is(e,i,a);break;case 5:var d=n.stateNode;n.flags&32&&(Ta(d,""),n.flags&=-33);var h=ic(e);Is(e,h,d);break;case 3:case 4:var y=n.stateNode.containerInfo,E=ic(e);sc(e,E,y);break;default:throw Error(c(161))}}catch(U){lt(e,e.return,U)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Jf(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Jf(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function yl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)qf(e,t.alternate,t),t=t.sibling}function fa(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ol(4,t,t.return),fa(t);break;case 1:Wn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Bf(t,t.return,n),fa(t);break;case 27:Zi(t.stateNode);case 26:case 5:Wn(t,t.return),fa(t);break;case 22:t.memoizedState===null&&fa(t);break;case 30:fa(t);break;default:fa(t)}e=e.sibling}}function vl(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,a=e,i=t,d=i.flags;switch(i.tag){case 0:case 11:case 15:vl(a,i,n),Oi(4,i);break;case 1:if(vl(a,i,n),l=i,a=l.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(E){lt(l,l.return,E)}if(l=i,a=l.updateQueue,a!==null){var h=l.stateNode;try{var y=a.shared.hiddenCallbacks;if(y!==null)for(a.shared.hiddenCallbacks=null,a=0;a<y.length;a++)Nd(y[a],h)}catch(E){lt(l,l.return,E)}}n&&d&64&&Uf(i),Ui(i,i.return);break;case 27:Kf(i);case 26:case 5:vl(a,i,n),n&&l===null&&d&4&&Hf(i),Ui(i,i.return);break;case 12:vl(a,i,n);break;case 31:vl(a,i,n),n&&d&4&&Zf(a,i);break;case 13:vl(a,i,n),n&&d&4&&Ff(a,i);break;case 22:i.memoizedState===null&&vl(a,i,n),Ui(i,i.return);break;case 30:break;default:vl(a,i,n)}t=t.sibling}}function oc(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&&Ci(n))}function cc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ci(e))}function Yn(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)If(e,t,n,l),t=t.sibling}function If(e,t,n,l){var a=t.flags;switch(t.tag){case 0:case 11:case 15:Yn(e,t,n,l),a&2048&&Oi(9,t);break;case 1:Yn(e,t,n,l);break;case 3:Yn(e,t,n,l),a&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ci(e)));break;case 12:if(a&2048){Yn(e,t,n,l),e=t.stateNode;try{var i=t.memoizedProps,d=i.id,h=i.onPostCommit;typeof h=="function"&&h(d,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(y){lt(t,t.return,y)}}else Yn(e,t,n,l);break;case 31:Yn(e,t,n,l);break;case 13:Yn(e,t,n,l);break;case 23:break;case 22:i=t.stateNode,d=t.alternate,t.memoizedState!==null?i._visibility&2?Yn(e,t,n,l):Bi(e,t):i._visibility&2?Yn(e,t,n,l):(i._visibility|=2,Xa(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),a&2048&&oc(d,t);break;case 24:Yn(e,t,n,l),a&2048&&cc(t.alternate,t);break;default:Yn(e,t,n,l)}}function Xa(e,t,n,l,a){for(a=a&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,d=t,h=n,y=l,E=d.flags;switch(d.tag){case 0:case 11:case 15:Xa(i,d,h,y,a),Oi(8,d);break;case 23:break;case 22:var U=d.stateNode;d.memoizedState!==null?U._visibility&2?Xa(i,d,h,y,a):Bi(i,d):(U._visibility|=2,Xa(i,d,h,y,a)),a&&E&2048&&oc(d.alternate,d);break;case 24:Xa(i,d,h,y,a),a&&E&2048&&cc(d.alternate,d);break;default:Xa(i,d,h,y,a)}t=t.sibling}}function Bi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,a=l.flags;switch(l.tag){case 22:Bi(n,l),a&2048&&oc(l.alternate,l);break;case 24:Bi(n,l),a&2048&&cc(l.alternate,l);break;default:Bi(n,l)}t=t.sibling}}var Hi=8192;function Va(e,t,n){if(e.subtreeFlags&Hi)for(e=e.child;e!==null;)Wf(e,t,n),e=e.sibling}function Wf(e,t,n){switch(e.tag){case 26:Va(e,t,n),e.flags&Hi&&e.memoizedState!==null&&Lg(n,Hn,e.memoizedState,e.memoizedProps);break;case 5:Va(e,t,n);break;case 3:case 4:var l=Hn;Hn=dr(e.stateNode.containerInfo),Va(e,t,n),Hn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Hi,Hi=16777216,Va(e,t,n),Hi=l):Va(e,t,n));break;default:Va(e,t,n)}}function Pf(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 Yi(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];Ht=l,em(l,e)}Pf(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$f(e),e=e.sibling}function $f(e){switch(e.tag){case 0:case 11:case 15:Yi(e),e.flags&2048&&Ol(9,e,e.return);break;case 3:Yi(e);break;case 12:Yi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ps(e)):Yi(e);break;default:Yi(e)}}function Ps(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];Ht=l,em(l,e)}Pf(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ol(8,t,t.return),Ps(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ps(t));break;default:Ps(t)}e=e.sibling}}function em(e,t){for(;Ht!==null;){var n=Ht;switch(n.tag){case 0:case 11:case 15:Ol(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:Ci(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,Ht=l;else e:for(n=e;Ht!==null;){l=Ht;var a=l.sibling,i=l.return;if(Xf(l),l===n){Ht=null;break e}if(a!==null){a.return=i,Ht=a;break e}Ht=i}}}var Ib={getCacheForType:function(e){var t=Vt(At),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Vt(At).controller.signal}},Wb=typeof WeakMap=="function"?WeakMap:Map,We=0,ct=null,Ge=null,Xe=0,nt=0,pn=null,Ul=!1,Za=!1,uc=!1,xl=0,St=0,Bl=0,ma=0,dc=0,bn=0,Fa=0,Ki=null,rn=null,fc=!1,$s=0,tm=0,er=1/0,tr=null,Hl=null,kt=0,Yl=null,Qa=null,Sl=0,mc=0,hc=null,nm=null,Gi=0,pc=null;function gn(){return(We&2)!==0&&Xe!==0?Xe&-Xe:R.T!==null?Sc():pe()}function lm(){if(bn===0)if((Xe&536870912)===0||Ze){var e=Ln;Ln<<=1,(Ln&3932160)===0&&(Ln=262144),bn=e}else bn=536870912;return e=mn.current,e!==null&&(e.flags|=32),bn}function on(e,t,n){(e===ct&&(nt===2||nt===9)||e.cancelPendingCommit!==null)&&(Ja(e,0),Kl(e,Xe,bn,!1)),He(e,n),((We&2)===0||e!==ct)&&(e===ct&&((We&2)===0&&(ma|=n),St===4&&Kl(e,Xe,bn,!1)),Pn(e))}function am(e,t,n){if((We&6)!==0)throw Error(c(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Vn(e,t),a=l?eg(e,t):gc(e,t,!0),i=l;do{if(a===0){Za&&!l&&Kl(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!Pb(n)){a=gc(e,t,!1),i=!1;continue}if(a===2){if(i=t,e.errorRecoveryDisabledLanes&i)var d=0;else d=e.pendingLanes&-536870913,d=d!==0?d:d&536870912?536870912:0;if(d!==0){t=d;e:{var h=e;a=Ki;var y=h.current.memoizedState.isDehydrated;if(y&&(Ja(h,d).flags|=256),d=gc(h,d,!1),d!==2){if(uc&&!y){h.errorRecoveryDisabledLanes|=i,ma|=i,a=4;break e}i=rn,rn=a,i!==null&&(rn===null?rn=i:rn.push.apply(rn,i))}a=d}if(i=!1,a!==2)continue}}if(a===1){Ja(e,0),Kl(e,t,0,!0);break}e:{switch(l=e,i=a,i){case 0:case 1:throw Error(c(345));case 4:if((t&4194048)!==t)break;case 6:Kl(l,t,bn,!Ul);break e;case 2:rn=null;break;case 3:case 5:break;default:throw Error(c(329))}if((t&62914560)===t&&(a=$s+300-$(),10<a)){if(Kl(l,t,bn,!Ul),al(l,0,!0)!==0)break e;Sl=t,l.timeoutHandle=Lm(im.bind(null,l,n,rn,tr,fc,t,bn,ma,Fa,Ul,i,"Throttled",-0,0),a);break e}im(l,n,rn,tr,fc,t,bn,ma,Fa,Ul,i,null,-0,0)}}break}while(!0);Pn(e)}function im(e,t,n,l,a,i,d,h,y,E,U,G,j,M){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:sl},Wf(t,i,G);var oe=(i&62914560)===i?$s-$():(i&4194048)===i?tm-$():0;if(oe=Og(G,oe),oe!==null){Sl=i,e.cancelPendingCommit=oe(mm.bind(null,e,t,i,n,l,a,d,h,y,U,G,null,j,M)),Kl(e,i,d,!E);return}}mm(e,t,i,n,l,a,d,h,y)}function Pb(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 a=n[l],i=a.getSnapshot;a=a.value;try{if(!dn(i(),a))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 Kl(e,t,n,l){t&=~dc,t&=~ma,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var a=t;0<a;){var i=31-qt(a),d=1<<i;l[i]=-1,a&=~d}n!==0&&se(e,n,t)}function nr(){return(We&6)===0?(qi(0),!1):!0}function bc(){if(Ge!==null){if(nt===0)var e=Ge.return;else e=Ge,ul=aa=null,zo(e),Ha=null,Ni=0,e=Ge;for(;e!==null;)Of(e.alternate,e),e=e.return;Ge=null}}function Ja(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,yg(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Sl=0,bc(),ct=e,Ge=n=ol(e.current,null),Xe=t,nt=0,pn=null,Ul=!1,Za=Vn(e,t),uc=!1,Fa=bn=dc=ma=Bl=St=0,rn=Ki=null,fc=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var a=31-qt(l),i=1<<a;t|=e[a],l&=~i}return xl=t,Cs(),n}function sm(e,t){ke=null,R.H=ki,t===Ba||t===_s?(t=Sd(),nt=3):t===xo?(t=Sd(),nt=4):nt=t===Qo?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,pn=t,Ge===null&&(St=1,Vs(e,Tn(t,e.current)))}function rm(){var e=mn.current;return e===null?!0:(Xe&4194048)===Xe?An===null:(Xe&62914560)===Xe||(Xe&536870912)!==0?e===An:!1}function om(){var e=R.H;return R.H=ki,e===null?ki:e}function cm(){var e=R.A;return R.A=Ib,e}function lr(){St=4,Ul||(Xe&4194048)!==Xe&&mn.current!==null||(Za=!0),(Bl&134217727)===0&&(ma&134217727)===0||ct===null||Kl(ct,Xe,bn,!1)}function gc(e,t,n){var l=We;We|=2;var a=om(),i=cm();(ct!==e||Xe!==t)&&(tr=null,Ja(e,t)),t=!1;var d=St;e:do try{if(nt!==0&&Ge!==null){var h=Ge,y=pn;switch(nt){case 8:bc(),d=6;break e;case 3:case 2:case 9:case 6:mn.current===null&&(t=!0);var E=nt;if(nt=0,pn=null,Ia(e,h,y,E),n&&Za){d=0;break e}break;default:E=nt,nt=0,pn=null,Ia(e,h,y,E)}}$b(),d=St;break}catch(U){sm(e,U)}while(!0);return t&&e.shellSuspendCounter++,ul=aa=null,We=l,R.H=a,R.A=i,Ge===null&&(ct=null,Xe=0,Cs()),d}function $b(){for(;Ge!==null;)um(Ge)}function eg(e,t){var n=We;We|=2;var l=om(),a=cm();ct!==e||Xe!==t?(tr=null,er=$()+500,Ja(e,t)):Za=Vn(e,t);e:do try{if(nt!==0&&Ge!==null){t=Ge;var i=pn;t:switch(nt){case 1:nt=0,pn=null,Ia(e,t,i,1);break;case 2:case 9:if(vd(i)){nt=0,pn=null,dm(t);break}t=function(){nt!==2&&nt!==9||ct!==e||(nt=7),Pn(e)},i.then(t,t);break e;case 3:nt=7;break e;case 4:nt=5;break e;case 7:vd(i)?(nt=0,pn=null,dm(t)):(nt=0,pn=null,Ia(e,t,i,7));break;case 5:var d=null;switch(Ge.tag){case 26:d=Ge.memoizedState;case 5:case 27:var h=Ge;if(d?Im(d):h.stateNode.complete){nt=0,pn=null;var y=h.sibling;if(y!==null)Ge=y;else{var E=h.return;E!==null?(Ge=E,ar(E)):Ge=null}break t}}nt=0,pn=null,Ia(e,t,i,5);break;case 6:nt=0,pn=null,Ia(e,t,i,6);break;case 8:bc(),St=6;break e;default:throw Error(c(462))}}tg();break}catch(U){sm(e,U)}while(!0);return ul=aa=null,R.H=l,R.A=a,We=n,Ge!==null?0:(ct=null,Xe=0,Cs(),St)}function tg(){for(;Ge!==null&&!It();)um(Ge)}function um(e){var t=Df(e.alternate,e,xl);e.memoizedProps=e.pendingProps,t===null?ar(e):Ge=t}function dm(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Af(n,t,t.pendingProps,t.type,void 0,Xe);break;case 11:t=Af(n,t,t.pendingProps,t.type.render,t.ref,Xe);break;case 5:zo(t);default:Of(n,t),t=Ge=od(t,xl),t=Df(n,t,xl)}e.memoizedProps=e.pendingProps,t===null?ar(e):Ge=t}function Ia(e,t,n,l){ul=aa=null,zo(t),Ha=null,Ni=0;var a=t.return;try{if(qb(e,a,t,n,Xe)){St=1,Vs(e,Tn(n,e.current)),Ge=null;return}}catch(i){if(a!==null)throw Ge=a,i;St=1,Vs(e,Tn(n,e.current)),Ge=null;return}t.flags&32768?(Ze||l===1?e=!0:Za||(Xe&536870912)!==0?e=!1:(Ul=e=!0,(l===2||l===9||l===3||l===6)&&(l=mn.current,l!==null&&l.tag===13&&(l.flags|=16384))),fm(t,e)):ar(t)}function ar(e){var t=e;do{if((t.flags&32768)!==0){fm(t,Ul);return}e=t.return;var n=Zb(t.alternate,t,xl);if(n!==null){Ge=n;return}if(t=t.sibling,t!==null){Ge=t;return}Ge=t=e}while(t!==null);St===0&&(St=5)}function fm(e,t){do{var n=Fb(e.alternate,e);if(n!==null){n.flags&=32767,Ge=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ge=e;return}Ge=e=n}while(e!==null);St=6,Ge=null}function mm(e,t,n,l,a,i,d,h,y){e.cancelPendingCommit=null;do ir();while(kt!==0);if((We&6)!==0)throw Error(c(327));if(t!==null){if(t===e.current)throw Error(c(177));if(i=t.lanes|t.childLanes,i|=ao,bt(e,n,i,d,h,y),e===ct&&(Ge=ct=null,Xe=0),Qa=t,Yl=e,Sl=n,mc=i,hc=a,nm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,ig(Wt,function(){return ym(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=R.T,R.T=null,a=q.p,q.p=2,d=We,We|=4;try{Qb(e,t,n)}finally{We=d,q.p=a,R.T=l}}kt=1,hm(),pm(),bm()}}function hm(){if(kt===1){kt=0;var e=Yl,t=Qa,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=R.T,R.T=null;var l=q.p;q.p=2;var a=We;We|=4;try{Qf(t,e);var i=Rc,d=$u(e.containerInfo),h=i.focusedElem,y=i.selectionRange;if(d!==h&&h&&h.ownerDocument&&Pu(h.ownerDocument.documentElement,h)){if(y!==null&&$r(h)){var E=y.start,U=y.end;if(U===void 0&&(U=E),"selectionStart"in h)h.selectionStart=E,h.selectionEnd=Math.min(U,h.value.length);else{var G=h.ownerDocument||document,j=G&&G.defaultView||window;if(j.getSelection){var M=j.getSelection(),oe=h.textContent.length,Se=Math.min(y.start,oe),st=y.end===void 0?Se:Math.min(y.end,oe);!M.extend&&Se>st&&(d=st,st=Se,Se=d);var T=Wu(h,Se),w=Wu(h,st);if(T&&w&&(M.rangeCount!==1||M.anchorNode!==T.node||M.anchorOffset!==T.offset||M.focusNode!==w.node||M.focusOffset!==w.offset)){var N=G.createRange();N.setStart(T.node,T.offset),M.removeAllRanges(),Se>st?(M.addRange(N),M.extend(w.node,w.offset)):(N.setEnd(w.node,w.offset),M.addRange(N))}}}}for(G=[],M=h;M=M.parentNode;)M.nodeType===1&&G.push({element:M,left:M.scrollLeft,top:M.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<G.length;h++){var K=G[h];K.element.scrollLeft=K.left,K.element.scrollTop=K.top}}gr=!!Ac,Rc=Ac=null}finally{We=a,q.p=l,R.T=n}}e.current=t,kt=2}}function pm(){if(kt===2){kt=0;var e=Yl,t=Qa,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=R.T,R.T=null;var l=q.p;q.p=2;var a=We;We|=4;try{qf(e,t.alternate,t)}finally{We=a,q.p=l,R.T=n}}kt=3}}function bm(){if(kt===4||kt===3){kt=0,Kt();var e=Yl,t=Qa,n=Sl,l=nm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?kt=5:(kt=0,Qa=Yl=null,gm(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(Hl=null),ne(n),t=t.stateNode,Gt&&typeof Gt.onCommitFiberRoot=="function")try{Gt.onCommitFiberRoot(nl,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=R.T,a=q.p,q.p=2,R.T=null;try{for(var i=e.onRecoverableError,d=0;d<l.length;d++){var h=l[d];i(h.value,{componentStack:h.stack})}}finally{R.T=t,q.p=a}}(Sl&3)!==0&&ir(),Pn(e),a=e.pendingLanes,(n&261930)!==0&&(a&42)!==0?e===pc?Gi++:(Gi=0,pc=e):Gi=0,qi(0)}}function gm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ci(t)))}function ir(){return hm(),pm(),bm(),ym()}function ym(){if(kt!==5)return!1;var e=Yl,t=mc;mc=0;var n=ne(Sl),l=R.T,a=q.p;try{q.p=32>n?32:n,R.T=null,n=hc,hc=null;var i=Yl,d=Sl;if(kt=0,Qa=Yl=null,Sl=0,(We&6)!==0)throw Error(c(331));var h=We;if(We|=4,$f(i.current),If(i,i.current,d,n),We=h,qi(0,!1),Gt&&typeof Gt.onPostCommitFiberRoot=="function")try{Gt.onPostCommitFiberRoot(nl,i)}catch{}return!0}finally{q.p=a,R.T=l,gm(e,t)}}function vm(e,t,n){t=Tn(n,t),t=Fo(e.stateNode,t,2),e=kl(e,t,2),e!==null&&(He(e,2),Pn(e))}function lt(e,t,n){if(e.tag===3)vm(e,e,n);else for(;t!==null;){if(t.tag===3){vm(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Hl===null||!Hl.has(l))){e=Tn(n,e),n=xf(2),l=kl(t,n,2),l!==null&&(Sf(n,l,t,e),He(l,2),Pn(l));break}}t=t.return}}function yc(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new Wb;var a=new Set;l.set(t,a)}else a=l.get(t),a===void 0&&(a=new Set,l.set(t,a));a.has(n)||(uc=!0,a.add(n),e=ng.bind(null,e,t,n),t.then(e,e))}function ng(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ct===e&&(Xe&n)===n&&(St===4||St===3&&(Xe&62914560)===Xe&&300>$()-$s?(We&2)===0&&Ja(e,0):dc|=n,Fa===Xe&&(Fa=0)),Pn(e)}function xm(e,t){t===0&&(t=ee()),e=ta(e,t),e!==null&&(He(e,t),Pn(e))}function lg(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),xm(e,n)}function ag(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,a=e.memoizedState;a!==null&&(n=a.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),xm(e,n)}function ig(e,t){return Ot(e,t)}var sr=null,Wa=null,vc=!1,rr=!1,xc=!1,Gl=0;function Pn(e){e!==Wa&&e.next===null&&(Wa===null?sr=Wa=e:Wa=Wa.next=e),rr=!0,vc||(vc=!0,rg())}function qi(e,t){if(!xc&&rr){xc=!0;do for(var n=!1,l=sr;l!==null;){if(e!==0){var a=l.pendingLanes;if(a===0)var i=0;else{var d=l.suspendedLanes,h=l.pingedLanes;i=(1<<31-qt(42|e)+1)-1,i&=a&~(d&~h),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,Tm(l,i))}else i=Xe,i=al(l,l===ct?i:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(i&3)===0||Vn(l,i)||(n=!0,Tm(l,i));l=l.next}while(n);xc=!1}}function sg(){Sm()}function Sm(){rr=vc=!1;var e=0;Gl!==0&&gg()&&(e=Gl);for(var t=$(),n=null,l=sr;l!==null;){var a=l.next,i=wm(l,t);i===0?(l.next=null,n===null?sr=a:n.next=a,a===null&&(Wa=n)):(n=l,(e!==0||(i&3)!==0)&&(rr=!0)),l=a}kt!==0&&kt!==5||qi(e),Gl!==0&&(Gl=0)}function wm(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,a=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var d=31-qt(i),h=1<<d,y=a[d];y===-1?((h&n)===0||(h&l)!==0)&&(a[d]=W(h,t)):y<=t&&(e.expiredLanes|=h),i&=~h}if(t=ct,n=Xe,n=al(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(nt===2||nt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&cn(l),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Vn(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&cn(l),ne(n)){case 2:case 8:n=ut;break;case 32:n=Wt;break;case 268435456:n=Ut;break;default:n=Wt}return l=Cm.bind(null,e),n=Ot(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&cn(l),e.callbackPriority=2,e.callbackNode=null,2}function Cm(e,t){if(kt!==0&&kt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ir()&&e.callbackNode!==n)return null;var l=Xe;return l=al(e,e===ct?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(am(e,l,t),wm(e,$()),e.callbackNode!=null&&e.callbackNode===n?Cm.bind(null,e):null)}function Tm(e,t){if(ir())return null;am(e,t,!0)}function rg(){vg(function(){(We&6)!==0?Ot(he,sg):Sm()})}function Sc(){if(Gl===0){var e=Oa;e===0&&(e=ll,ll<<=1,(ll&261888)===0&&(ll=256)),Gl=e}return Gl}function Nm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ps(""+e)}function Em(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 og(e,t,n,l,a){if(t==="submit"&&n&&n.stateNode===a){var i=Nm((a[Qe]||null).action),d=l.submitter;d&&(t=(t=d[Qe]||null)?Nm(t.formAction):d.getAttribute("formAction"),t!==null&&(i=t,d=null));var h=new vs("action","action",null,l,a);e.push({event:h,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Gl!==0){var y=d?Em(a,d):new FormData(a);Ko(n,{pending:!0,data:y,method:a.method,action:i},null,y)}}else typeof i=="function"&&(h.preventDefault(),y=d?Em(a,d):new FormData(a),Ko(n,{pending:!0,data:y,method:a.method,action:i},i,y))},currentTarget:a}]})}}for(var wc=0;wc<lo.length;wc++){var Cc=lo[wc],cg=Cc.toLowerCase(),ug=Cc[0].toUpperCase()+Cc.slice(1);Bn(cg,"on"+ug)}Bn(nd,"onAnimationEnd"),Bn(ld,"onAnimationIteration"),Bn(ad,"onAnimationStart"),Bn("dblclick","onDoubleClick"),Bn("focusin","onFocus"),Bn("focusout","onBlur"),Bn(Eb,"onTransitionRun"),Bn(jb,"onTransitionStart"),Bn(Ab,"onTransitionCancel"),Bn(id,"onTransitionEnd"),tt("onMouseEnter",["mouseout","mouseover"]),tt("onMouseLeave",["mouseout","mouseover"]),tt("onPointerEnter",["pointerout","pointerover"]),tt("onPointerLeave",["pointerout","pointerover"]),be("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),be("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),be("onBeforeInput",["compositionend","keypress","textInput","paste"]),be("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xi="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(" "),dg=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xi));function jm(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],a=l.event;l=l.listeners;e:{var i=void 0;if(t)for(var d=l.length-1;0<=d;d--){var h=l[d],y=h.instance,E=h.currentTarget;if(h=h.listener,y!==i&&a.isPropagationStopped())break e;i=h,a.currentTarget=E;try{i(a)}catch(U){ws(U)}a.currentTarget=null,i=y}else for(d=0;d<l.length;d++){if(h=l[d],y=h.instance,E=h.currentTarget,h=h.listener,y!==i&&a.isPropagationStopped())break e;i=h,a.currentTarget=E;try{i(a)}catch(U){ws(U)}a.currentTarget=null,i=y}}}}function qe(e,t){var n=t[vt];n===void 0&&(n=t[vt]=new Set);var l=e+"__bubble";n.has(l)||(Am(t,e,2,!1),n.add(l))}function Tc(e,t,n){var l=0;t&&(l|=4),Am(n,e,l,t)}var or="_reactListening"+Math.random().toString(36).slice(2);function Nc(e){if(!e[or]){e[or]=!0,di.forEach(function(n){n!=="selectionchange"&&(dg.has(n)||Tc(n,!1,e),Tc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[or]||(t[or]=!0,Tc("selectionchange",!1,t))}}function Am(e,t,n,l){switch(lh(t)){case 2:var a=Hg;break;case 8:a=Yg;break;default:a=Yc}n=a.bind(null,t,n,e),a=void 0,!Xr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),l?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Ec(e,t,n,l,a){var i=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var d=l.tag;if(d===3||d===4){var h=l.stateNode.containerInfo;if(h===a)break;if(d===4)for(d=l.return;d!==null;){var y=d.tag;if((y===3||y===4)&&d.stateNode.containerInfo===a)return;d=d.return}for(;h!==null;){if(d=il(h),d===null)return;if(y=d.tag,y===5||y===6||y===26||y===27){l=i=d;continue e}h=h.parentNode}}l=l.return}zu(function(){var E=i,U=Gr(n),G=[];e:{var j=sd.get(e);if(j!==void 0){var M=vs,oe=e;switch(e){case"keypress":if(gs(n)===0)break e;case"keydown":case"keyup":M=ab;break;case"focusin":oe="focus",M=Qr;break;case"focusout":oe="blur",M=Qr;break;case"beforeblur":case"afterblur":M=Qr;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":M=Lu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":M=Zp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":M=rb;break;case nd:case ld:case ad:M=Jp;break;case id:M=cb;break;case"scroll":case"scrollend":M=Xp;break;case"wheel":M=db;break;case"copy":case"cut":case"paste":M=Wp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":M=Uu;break;case"toggle":case"beforetoggle":M=mb}var Se=(t&4)!==0,st=!Se&&(e==="scroll"||e==="scrollend"),T=Se?j!==null?j+"Capture":null:j;Se=[];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=fi(w,T),K!=null&&Se.push(Vi(w,K,N))),st)break;w=w.return}0<Se.length&&(j=new M(j,oe,null,n,U),G.push({event:j,listeners:Se}))}}if((t&7)===0){e:{if(j=e==="mouseover"||e==="pointerover",M=e==="mouseout"||e==="pointerout",j&&n!==Kr&&(oe=n.relatedTarget||n.fromElement)&&(il(oe)||oe[un]))break e;if((M||j)&&(j=U.window===U?U:(j=U.ownerDocument)?j.defaultView||j.parentWindow:window,M?(oe=n.relatedTarget||n.toElement,M=E,oe=oe?il(oe):null,oe!==null&&(st=m(oe),Se=oe.tag,oe!==st||Se!==5&&Se!==27&&Se!==6)&&(oe=null)):(M=null,oe=E),M!==oe)){if(Se=Lu,K="onMouseLeave",T="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(Se=Uu,K="onPointerLeave",T="onPointerEnter",w="pointer"),st=M==null?j:Zn(M),N=oe==null?j:Zn(oe),j=new Se(K,w+"leave",M,n,U),j.target=st,j.relatedTarget=N,K=null,il(U)===E&&(Se=new Se(T,w+"enter",oe,n,U),Se.target=N,Se.relatedTarget=st,K=Se),st=K,M&&oe)t:{for(Se=fg,T=M,w=oe,N=0,K=T;K;K=Se(K))N++;K=0;for(var ge=w;ge;ge=Se(ge))K++;for(;0<N-K;)T=Se(T),N--;for(;0<K-N;)w=Se(w),K--;for(;N--;){if(T===w||w!==null&&T===w.alternate){Se=T;break t}T=Se(T),w=Se(w)}Se=null}else Se=null;M!==null&&Rm(G,j,M,Se,!1),oe!==null&&st!==null&&Rm(G,st,oe,Se,!0)}}e:{if(j=E?Zn(E):window,M=j.nodeName&&j.nodeName.toLowerCase(),M==="select"||M==="input"&&j.type==="file")var Je=Vu;else if(qu(j))if(Zu)Je=Cb;else{Je=Sb;var de=xb}else M=j.nodeName,!M||M.toLowerCase()!=="input"||j.type!=="checkbox"&&j.type!=="radio"?E&&Yr(E.elementType)&&(Je=Vu):Je=wb;if(Je&&(Je=Je(e,E))){Xu(G,Je,n,U);break e}de&&de(e,j,E),e==="focusout"&&E&&j.type==="number"&&E.memoizedProps.value!=null&&Hr(j,"number",j.value)}switch(de=E?Zn(E):window,e){case"focusin":(qu(de)||de.contentEditable==="true")&&(Aa=de,eo=E,xi=null);break;case"focusout":xi=eo=Aa=null;break;case"mousedown":to=!0;break;case"contextmenu":case"mouseup":case"dragend":to=!1,ed(G,n,U);break;case"selectionchange":if(Nb)break;case"keydown":case"keyup":ed(G,n,U)}var De;if(Ir)e:{switch(e){case"compositionstart":var Ve="onCompositionStart";break e;case"compositionend":Ve="onCompositionEnd";break e;case"compositionupdate":Ve="onCompositionUpdate";break e}Ve=void 0}else ja?Ku(e,n)&&(Ve="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ve="onCompositionStart");Ve&&(Bu&&n.locale!=="ko"&&(ja||Ve!=="onCompositionStart"?Ve==="onCompositionEnd"&&ja&&(De=ku()):(El=U,Vr="value"in El?El.value:El.textContent,ja=!0)),de=cr(E,Ve),0<de.length&&(Ve=new Ou(Ve,e,null,n,U),G.push({event:Ve,listeners:de}),De?Ve.data=De:(De=Gu(n),De!==null&&(Ve.data=De)))),(De=pb?bb(e,n):gb(e,n))&&(Ve=cr(E,"onBeforeInput"),0<Ve.length&&(de=new Ou("onBeforeInput","beforeinput",null,n,U),G.push({event:de,listeners:Ve}),de.data=De)),og(G,e,E,n,U)}jm(G,t)})}function Vi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function cr(e,t){for(var n=t+"Capture",l=[];e!==null;){var a=e,i=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||i===null||(a=fi(e,n),a!=null&&l.unshift(Vi(e,a,i)),a=fi(e,t),a!=null&&l.push(Vi(e,a,i))),e.tag===3)return l;e=e.return}return[]}function fg(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Rm(e,t,n,l,a){for(var i=t._reactName,d=[];n!==null&&n!==l;){var h=n,y=h.alternate,E=h.stateNode;if(h=h.tag,y!==null&&y===l)break;h!==5&&h!==26&&h!==27||E===null||(y=E,a?(E=fi(n,i),E!=null&&d.unshift(Vi(n,E,y))):a||(E=fi(n,i),E!=null&&d.push(Vi(n,E,y)))),n=n.return}d.length!==0&&e.push({event:t,listeners:d})}var mg=/\r\n?/g,hg=/\u0000|\uFFFD/g;function Mm(e){return(typeof e=="string"?e:""+e).replace(mg,`
33
- `).replace(hg,"")}function _m(e,t){return t=Mm(t),Mm(e)===t}function it(e,t,n,l,a,i){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||Ta(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&Ta(e,""+l);break;case"className":gt(e,"class",l);break;case"tabIndex":gt(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":gt(e,n,l);break;case"style":Mu(e,l,i);break;case"data":if(t!=="object"){gt(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=ps(""+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 i=="function"&&(n==="formAction"?(t!=="input"&&it(e,t,"name",a.name,a,null),it(e,t,"formEncType",a.formEncType,a,null),it(e,t,"formMethod",a.formMethod,a,null),it(e,t,"formTarget",a.formTarget,a,null)):(it(e,t,"encType",a.encType,a,null),it(e,t,"method",a.method,a,null),it(e,t,"target",a.target,a,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=ps(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=sl);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("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(a.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=ps(""+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":qe("beforetoggle",e),qe("toggle",e),Bt(e,"popover",l);break;case"xlinkActuate":Et(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Et(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Et(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Et(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Et(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Et(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Et(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Et(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Et(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Bt(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=Gp.get(n)||n,Bt(e,n,l))}}function jc(e,t,n,l,a,i){switch(n){case"style":Mu(e,l,i);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(c(61));if(n=l.__html,n!=null){if(a.children!=null)throw Error(c(60));e.innerHTML=n}}break;case"children":typeof l=="string"?Ta(e,l):(typeof l=="number"||typeof l=="bigint")&&Ta(e,""+l);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=sl);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!le.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),t=n.slice(2,a?n.length-7:void 0),i=e[Qe]||null,i=i!=null?i[n]:null,typeof i=="function"&&e.removeEventListener(t,i,a),typeof l=="function")){typeof i!="function"&&i!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,a);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):Bt(e,n,l)}}}function Ft(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var l=!1,a=!1,i;for(i in n)if(n.hasOwnProperty(i)){var d=n[i];if(d!=null)switch(i){case"src":l=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:it(e,t,i,d,n,null)}}a&&it(e,t,"srcSet",n.srcSet,n,null),l&&it(e,t,"src",n.src,n,null);return;case"input":qe("invalid",e);var h=i=d=a=null,y=null,E=null;for(l in n)if(n.hasOwnProperty(l)){var U=n[l];if(U!=null)switch(l){case"name":a=U;break;case"type":d=U;break;case"checked":y=U;break;case"defaultChecked":E=U;break;case"value":i=U;break;case"defaultValue":h=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(c(137,t));break;default:it(e,t,l,U,n,null)}}Eu(e,i,h,y,E,d,a,!1);return;case"select":qe("invalid",e),l=d=i=null;for(a in n)if(n.hasOwnProperty(a)&&(h=n[a],h!=null))switch(a){case"value":i=h;break;case"defaultValue":d=h;break;case"multiple":l=h;default:it(e,t,a,h,n,null)}t=i,n=d,e.multiple=!!l,t!=null?Ca(e,!!l,t,!1):n!=null&&Ca(e,!!l,n,!0);return;case"textarea":qe("invalid",e),i=a=l=null;for(d in n)if(n.hasOwnProperty(d)&&(h=n[d],h!=null))switch(d){case"value":l=h;break;case"defaultValue":a=h;break;case"children":i=h;break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(c(91));break;default:it(e,t,d,h,n,null)}Au(e,l,a,i);return;case"option":for(y in n)if(n.hasOwnProperty(y)&&(l=n[y],l!=null))switch(y){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:it(e,t,y,l,n,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(l=0;l<Xi.length;l++)qe(Xi[l],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("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:it(e,t,E,l,n,null)}return;default:if(Yr(t)){for(U in n)n.hasOwnProperty(U)&&(l=n[U],l!==void 0&&jc(e,t,U,l,n,void 0));return}}for(h in n)n.hasOwnProperty(h)&&(l=n[h],l!=null&&it(e,t,h,l,n,null))}function pg(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 a=null,i=null,d=null,h=null,y=null,E=null,U=null;for(M in n){var G=n[M];if(n.hasOwnProperty(M)&&G!=null)switch(M){case"checked":break;case"value":break;case"defaultValue":y=G;default:l.hasOwnProperty(M)||it(e,t,M,null,l,G)}}for(var j in l){var M=l[j];if(G=n[j],l.hasOwnProperty(j)&&(M!=null||G!=null))switch(j){case"type":i=M;break;case"name":a=M;break;case"checked":E=M;break;case"defaultChecked":U=M;break;case"value":d=M;break;case"defaultValue":h=M;break;case"children":case"dangerouslySetInnerHTML":if(M!=null)throw Error(c(137,t));break;default:M!==G&&it(e,t,j,M,l,G)}}Br(e,d,h,y,E,U,i,a);return;case"select":M=d=h=j=null;for(i in n)if(y=n[i],n.hasOwnProperty(i)&&y!=null)switch(i){case"value":break;case"multiple":M=y;default:l.hasOwnProperty(i)||it(e,t,i,null,l,y)}for(a in l)if(i=l[a],y=n[a],l.hasOwnProperty(a)&&(i!=null||y!=null))switch(a){case"value":j=i;break;case"defaultValue":h=i;break;case"multiple":d=i;default:i!==y&&it(e,t,a,i,l,y)}t=h,n=d,l=M,j!=null?Ca(e,!!n,j,!1):!!l!=!!n&&(t!=null?Ca(e,!!n,t,!0):Ca(e,!!n,n?[]:"",!1));return;case"textarea":M=j=null;for(h in n)if(a=n[h],n.hasOwnProperty(h)&&a!=null&&!l.hasOwnProperty(h))switch(h){case"value":break;case"children":break;default:it(e,t,h,null,l,a)}for(d in l)if(a=l[d],i=n[d],l.hasOwnProperty(d)&&(a!=null||i!=null))switch(d){case"value":j=a;break;case"defaultValue":M=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(c(91));break;default:a!==i&&it(e,t,d,a,l,i)}ju(e,j,M);return;case"option":for(var oe in n)if(j=n[oe],n.hasOwnProperty(oe)&&j!=null&&!l.hasOwnProperty(oe))switch(oe){case"selected":e.selected=!1;break;default:it(e,t,oe,null,l,j)}for(y in l)if(j=l[y],M=n[y],l.hasOwnProperty(y)&&j!==M&&(j!=null||M!=null))switch(y){case"selected":e.selected=j&&typeof j!="function"&&typeof j!="symbol";break;default:it(e,t,y,j,l,M)}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 Se in n)j=n[Se],n.hasOwnProperty(Se)&&j!=null&&!l.hasOwnProperty(Se)&&it(e,t,Se,null,l,j);for(E in l)if(j=l[E],M=n[E],l.hasOwnProperty(E)&&j!==M&&(j!=null||M!=null))switch(E){case"children":case"dangerouslySetInnerHTML":if(j!=null)throw Error(c(137,t));break;default:it(e,t,E,j,l,M)}return;default:if(Yr(t)){for(var st in n)j=n[st],n.hasOwnProperty(st)&&j!==void 0&&!l.hasOwnProperty(st)&&jc(e,t,st,void 0,l,j);for(U in l)j=l[U],M=n[U],!l.hasOwnProperty(U)||j===M||j===void 0&&M===void 0||jc(e,t,U,j,l,M);return}}for(var T in n)j=n[T],n.hasOwnProperty(T)&&j!=null&&!l.hasOwnProperty(T)&&it(e,t,T,null,l,j);for(G in l)j=l[G],M=n[G],!l.hasOwnProperty(G)||j===M||j==null&&M==null||it(e,t,G,j,l,M)}function zm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function bg(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var a=n[l],i=a.transferSize,d=a.initiatorType,h=a.duration;if(i&&h&&zm(d)){for(d=0,h=a.responseEnd,l+=1;l<n.length;l++){var y=n[l],E=y.startTime;if(E>h)break;var U=y.transferSize,G=y.initiatorType;U&&zm(G)&&(y=y.responseEnd,d+=U*(y<h?1:(h-E)/(y-E)))}if(--l,t+=8*(i+d)/(a.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 Ac=null,Rc=null;function ur(e){return e.nodeType===9?e:e.ownerDocument}function km(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 Dm(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 Mc(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 _c=null;function gg(){var e=window.event;return e&&e.type==="popstate"?e===_c?!1:(_c=e,!0):(_c=null,!1)}var Lm=typeof setTimeout=="function"?setTimeout:void 0,yg=typeof clearTimeout=="function"?clearTimeout:void 0,Om=typeof Promise=="function"?Promise:void 0,vg=typeof queueMicrotask=="function"?queueMicrotask:typeof Om<"u"?function(e){return Om.resolve(null).then(e).catch(xg)}:Lm;function xg(e){setTimeout(function(){throw e})}function ql(e){return e==="head"}function Um(e,t){var n=t,l=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(a),ti(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")Zi(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Zi(n);for(var i=n.firstChild;i;){var d=i.nextSibling,h=i.nodeName;i[en]||h==="SCRIPT"||h==="STYLE"||h==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=d}}else n==="body"&&Zi(e.ownerDocument.body);n=a}while(n);ti(t)}function Bm(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 zc(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":zc(n),Sa(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Sg(e,t,n,l){for(;e.nodeType===1;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[en])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==a.rel||e.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||e.getAttribute("title")!==(a.title==null?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(a.src==null?null:a.src)||e.getAttribute("type")!==(a.type==null?null:a.type)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=a.name==null?null:""+a.name;if(a.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=Rn(e.nextSibling),e===null)break}return null}function wg(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Rn(e.nextSibling),e===null))return null;return e}function Hm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Rn(e.nextSibling),e===null))return null;return e}function kc(e){return e.data==="$?"||e.data==="$~"}function Dc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Cg(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 Rn(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 Lc=null;function Ym(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Rn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Km(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 Gm(e,t,n){switch(t=ur(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 Zi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Sa(e)}var Mn=new Map,qm=new Set;function dr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var wl=q.d;q.d={f:Tg,r:Ng,D:Eg,C:jg,L:Ag,m:Rg,X:_g,S:Mg,M:zg};function Tg(){var e=wl.f(),t=nr();return e||t}function Ng(e){var t=On(e);t!==null&&t.tag===5&&t.type==="form"?sf(t):wl.r(e)}var Pa=typeof document>"u"?null:document;function Xm(e,t,n){var l=Pa;if(l&&typeof t=="string"&&t){var a=wn(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),qm.has(a)||(qm.add(a),e={rel:e,crossOrigin:n,href:t},l.querySelector(a)===null&&(t=l.createElement("link"),Ft(t,"link",e),Ct(t),l.head.appendChild(t)))}}function Eg(e){wl.D(e),Xm("dns-prefetch",e,null)}function jg(e,t){wl.C(e,t),Xm("preconnect",e,t)}function Ag(e,t,n){wl.L(e,t,n);var l=Pa;if(l&&e&&t){var a='link[rel="preload"][as="'+wn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+wn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+wn(n.imageSizes)+'"]')):a+='[href="'+wn(e)+'"]';var i=a;switch(t){case"style":i=$a(e);break;case"script":i=ei(e)}Mn.has(i)||(e=C({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Mn.set(i,e),l.querySelector(a)!==null||t==="style"&&l.querySelector(Fi(i))||t==="script"&&l.querySelector(Qi(i))||(t=l.createElement("link"),Ft(t,"link",e),Ct(t),l.head.appendChild(t)))}}function Rg(e,t){wl.m(e,t);var n=Pa;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+wn(l)+'"][href="'+wn(e)+'"]',i=a;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=ei(e)}if(!Mn.has(i)&&(e=C({rel:"modulepreload",href:e},t),Mn.set(i,e),n.querySelector(a)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Qi(i)))return}l=n.createElement("link"),Ft(l,"link",e),Ct(l),n.head.appendChild(l)}}}function Mg(e,t,n){wl.S(e,t,n);var l=Pa;if(l&&e){var a=Un(l).hoistableStyles,i=$a(e);t=t||"default";var d=a.get(i);if(!d){var h={loading:0,preload:null};if(d=l.querySelector(Fi(i)))h.loading=5;else{e=C({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Mn.get(i))&&Oc(e,n);var y=d=l.createElement("link");Ct(y),Ft(y,"link",e),y._p=new Promise(function(E,U){y.onload=E,y.onerror=U}),y.addEventListener("load",function(){h.loading|=1}),y.addEventListener("error",function(){h.loading|=2}),h.loading|=4,fr(d,t,l)}d={type:"stylesheet",instance:d,count:1,state:h},a.set(i,d)}}}function _g(e,t){wl.X(e,t);var n=Pa;if(n&&e){var l=Un(n).hoistableScripts,a=ei(e),i=l.get(a);i||(i=n.querySelector(Qi(a)),i||(e=C({src:e,async:!0},t),(t=Mn.get(a))&&Uc(e,t),i=n.createElement("script"),Ct(i),Ft(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},l.set(a,i))}}function zg(e,t){wl.M(e,t);var n=Pa;if(n&&e){var l=Un(n).hoistableScripts,a=ei(e),i=l.get(a);i||(i=n.querySelector(Qi(a)),i||(e=C({src:e,async:!0,type:"module"},t),(t=Mn.get(a))&&Uc(e,t),i=n.createElement("script"),Ct(i),Ft(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},l.set(a,i))}}function Vm(e,t,n,l){var a=(a=ie.current)?dr(a):null;if(!a)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=$a(n.href),n=Un(a).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=$a(n.href);var i=Un(a).hoistableStyles,d=i.get(e);if(d||(a=a.ownerDocument||a,d={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,d),(i=a.querySelector(Fi(e)))&&!i._p&&(d.instance=i,d.state.loading=5),Mn.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},Mn.set(e,n),i||kg(a,e,n,d.state))),t&&l===null)throw Error(c(528,""));return d}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=ei(n),n=Un(a).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 $a(e){return'href="'+wn(e)+'"'}function Fi(e){return'link[rel="stylesheet"]['+e+"]"}function Zm(e){return C({},e,{"data-precedence":e.precedence,precedence:null})}function kg(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}),Ft(t,"link",n),Ct(t),e.head.appendChild(t))}function ei(e){return'[src="'+wn(e)+'"]'}function Qi(e){return"script[async]"+e}function Fm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+wn(n.href)+'"]');if(l)return t.instance=l,Ct(l),l;var a=C({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Ct(l),Ft(l,"style",a),fr(l,n.precedence,e),t.instance=l;case"stylesheet":a=$a(n.href);var i=e.querySelector(Fi(a));if(i)return t.state.loading|=4,t.instance=i,Ct(i),i;l=Zm(n),(a=Mn.get(a))&&Oc(l,a),i=(e.ownerDocument||e).createElement("link"),Ct(i);var d=i;return d._p=new Promise(function(h,y){d.onload=h,d.onerror=y}),Ft(i,"link",l),t.state.loading|=4,fr(i,n.precedence,e),t.instance=i;case"script":return i=ei(n.src),(a=e.querySelector(Qi(i)))?(t.instance=a,Ct(a),a):(l=n,(a=Mn.get(i))&&(l=C({},n),Uc(l,a)),e=e.ownerDocument||e,a=e.createElement("script"),Ct(a),Ft(a,"link",l),e.head.appendChild(a),t.instance=a);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,fr(l,n.precedence,e));return t.instance}function fr(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=l.length?l[l.length-1]:null,i=a,d=0;d<l.length;d++){var h=l[d];if(h.dataset.precedence===t)i=h;else if(i!==a)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Oc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Uc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var mr=null;function Qm(e,t,n){if(mr===null){var l=new Map,a=mr=new Map;a.set(n,l)}else a=mr,l=a.get(n),l||(l=new Map,a.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var i=n[a];if(!(i[en]||i[Pe]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var d=i.getAttribute(t)||"";d=e+d;var h=l.get(d);h?h.push(i):l.set(d,[i])}}return l}function Jm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Dg(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 Im(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Lg(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 a=$a(l.href),i=t.querySelector(Fi(a));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=hr.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,Ct(i);return}i=t.ownerDocument||t,l=Zm(l),(a=Mn.get(a))&&Oc(l,a),i=i.createElement("link"),Ct(i);var d=i;d._p=new Promise(function(h,y){d.onload=h,d.onerror=y}),Ft(i,"link",l),n.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=hr.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Bc=0;function Og(e,t){return e.stylesheets&&e.count===0&&br(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&br(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&Bc===0&&(Bc=62500*bg());var a=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&br(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>Bc?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(a)}}:null}function hr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)br(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var pr=null;function br(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,pr=new Map,t.forEach(Ug,e),pr=null,hr.call(e))}function Ug(e,t){if(!(t.state.loading&4)){var n=pr.get(e);if(n)var l=n.get(null);else{n=new Map,pr.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<a.length;i++){var d=a[i];(d.nodeName==="LINK"||d.getAttribute("media")!=="not all")&&(n.set(d.dataset.precedence,d),l=d)}l&&n.set(null,l)}a=t.instance,d=a.getAttribute("data-precedence"),i=n.get(d)||l,i===l&&n.set(null,a),n.set(d,a),this.count++,l=hr.bind(this),a.addEventListener("load",l),a.addEventListener("error",l),i?i.parentNode.insertBefore(a,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(a,e.firstChild)),t.state.loading|=4}}var Ji={$$typeof:F,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function Bg(e,t,n,l,a,i,d,h,y){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=Ae(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ae(0),this.hiddenUpdates=Ae(null),this.identifierPrefix=l,this.onUncaughtError=a,this.onCaughtError=i,this.onRecoverableError=d,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=y,this.incompleteTransitions=new Map}function Wm(e,t,n,l,a,i,d,h,y,E,U,G){return e=new Bg(e,t,n,d,y,E,U,G,h),t=1,i===!0&&(t|=24),i=fn(3,null,null,t),e.current=i,i.stateNode=e,t=go(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:l,isDehydrated:n,cache:t},So(i),e}function Pm(e){return e?(e=_a,e):_a}function $m(e,t,n,l,a,i){a=Pm(a),l.context===null?l.context=a:l.pendingContext=a,l=zl(t),l.payload={element:n},i=i===void 0?null:i,i!==null&&(l.callback=i),n=kl(e,l,t),n!==null&&(on(n,e,t),ji(n,e,t))}function eh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Hc(e,t){eh(e,t),(e=e.alternate)&&eh(e,t)}function th(e){if(e.tag===13||e.tag===31){var t=ta(e,67108864);t!==null&&on(t,e,67108864),Hc(e,67108864)}}function nh(e){if(e.tag===13||e.tag===31){var t=gn();t=I(t);var n=ta(e,t);n!==null&&on(n,e,t),Hc(e,t)}}var gr=!0;function Hg(e,t,n,l){var a=R.T;R.T=null;var i=q.p;try{q.p=2,Yc(e,t,n,l)}finally{q.p=i,R.T=a}}function Yg(e,t,n,l){var a=R.T;R.T=null;var i=q.p;try{q.p=8,Yc(e,t,n,l)}finally{q.p=i,R.T=a}}function Yc(e,t,n,l){if(gr){var a=Kc(l);if(a===null)Ec(e,t,l,yr,n),ah(e,l);else if(Gg(a,e,t,n,l))l.stopPropagation();else if(ah(e,l),t&4&&-1<Kg.indexOf(e)){for(;a!==null;){var i=On(a);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var d=$t(i.pendingLanes);if(d!==0){var h=i;for(h.pendingLanes|=2,h.entangledLanes|=2;d;){var y=1<<31-qt(d);h.entanglements[1]|=y,d&=~y}Pn(i),(We&6)===0&&(er=$()+500,qi(0))}}break;case 31:case 13:h=ta(i,2),h!==null&&on(h,i,2),nr(),Hc(i,2)}if(i=Kc(l),i===null&&Ec(e,t,l,yr,n),i===a)break;a=i}a!==null&&l.stopPropagation()}else Ec(e,t,l,null,n)}}function Kc(e){return e=Gr(e),Gc(e)}var yr=null;function Gc(e){if(yr=null,e=il(e),e!==null){var t=m(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=b(t),e!==null)return e;e=null}else if(n===31){if(e=p(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 yr=e,null}function lh(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(Ce()){case he:return 2;case ut:return 8;case Wt:case Pt:return 32;case Ut:return 268435456;default:return 32}default:return 32}}var qc=!1,Xl=null,Vl=null,Zl=null,Ii=new Map,Wi=new Map,Fl=[],Kg="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 ah(e,t){switch(e){case"focusin":case"focusout":Xl=null;break;case"dragenter":case"dragleave":Vl=null;break;case"mouseover":case"mouseout":Zl=null;break;case"pointerover":case"pointerout":Ii.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wi.delete(t.pointerId)}}function Pi(e,t,n,l,a,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:i,targetContainers:[a]},t!==null&&(t=On(t),t!==null&&th(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function Gg(e,t,n,l,a){switch(t){case"focusin":return Xl=Pi(Xl,e,t,n,l,a),!0;case"dragenter":return Vl=Pi(Vl,e,t,n,l,a),!0;case"mouseover":return Zl=Pi(Zl,e,t,n,l,a),!0;case"pointerover":var i=a.pointerId;return Ii.set(i,Pi(Ii.get(i)||null,e,t,n,l,a)),!0;case"gotpointercapture":return i=a.pointerId,Wi.set(i,Pi(Wi.get(i)||null,e,t,n,l,a)),!0}return!1}function ih(e){var t=il(e.target);if(t!==null){var n=m(t);if(n!==null){if(t=n.tag,t===13){if(t=b(n),t!==null){e.blockedOn=t,Re(e.priority,function(){nh(n)});return}}else if(t===31){if(t=p(n),t!==null){e.blockedOn=t,Re(e.priority,function(){nh(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 vr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Kc(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);Kr=l,n.target.dispatchEvent(l),Kr=null}else return t=On(n),t!==null&&th(t),e.blockedOn=n,!1;t.shift()}return!0}function sh(e,t,n){vr(e)&&n.delete(t)}function qg(){qc=!1,Xl!==null&&vr(Xl)&&(Xl=null),Vl!==null&&vr(Vl)&&(Vl=null),Zl!==null&&vr(Zl)&&(Zl=null),Ii.forEach(sh),Wi.forEach(sh)}function xr(e,t){e.blockedOn===t&&(e.blockedOn=null,qc||(qc=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,qg)))}var Sr=null;function rh(e){Sr!==e&&(Sr=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){Sr===e&&(Sr=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],a=e[t+2];if(typeof l!="function"){if(Gc(l||n)===null)continue;break}var i=On(n);i!==null&&(e.splice(t,3),t-=3,Ko(i,{pending:!0,data:a,method:n.method,action:l},l,a))}}))}function ti(e){function t(y){return xr(y,e)}Xl!==null&&xr(Xl,e),Vl!==null&&xr(Vl,e),Zl!==null&&xr(Zl,e),Ii.forEach(t),Wi.forEach(t);for(var n=0;n<Fl.length;n++){var l=Fl[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Fl.length&&(n=Fl[0],n.blockedOn===null);)ih(n),n.blockedOn===null&&Fl.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var a=n[l],i=n[l+1],d=a[Qe]||null;if(typeof i=="function")d||rh(n);else if(d){var h=null;if(i&&i.hasAttribute("formAction")){if(a=i,d=i[Qe]||null)h=d.formAction;else if(Gc(a)!==null)continue}else h=d.action;typeof h=="function"?n[l+1]=h:(n.splice(l,3),l-=3),rh(n)}}}function oh(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(d){return a=d})},focusReset:"manual",scroll:"manual"})}function t(){a!==null&&(a(),a=null),l||setTimeout(n,20)}function n(){if(!l&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,a=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),a!==null&&(a(),a=null)}}}function Xc(e){this._internalRoot=e}wr.prototype.render=Xc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));var n=t.current,l=gn();$m(n,l,e,t,null,null)},wr.prototype.unmount=Xc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;$m(e.current,2,null,e,null,null),nr(),t[un]=null}};function wr(e){this._internalRoot=e}wr.prototype.unstable_scheduleHydration=function(e){if(e){var t=pe();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Fl.length&&t!==0&&t<Fl[n].priority;n++);Fl.splice(n,0,e),n===0&&ih(e)}};var ch=s.version;if(ch!=="19.2.8")throw Error(c(527,ch,"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 Xg={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Cr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Cr.isDisabled&&Cr.supportsFiber)try{nl=Cr.inject(Xg),Gt=Cr}catch{}}return es.createRoot=function(e,t){if(!f(e))throw Error(c(299));var n=!1,l="",a=bf,i=gf,d=yf;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(a=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(d=t.onRecoverableError)),t=Wm(e,1,!1,null,null,n,l,null,a,i,d,oh),e[un]=t.current,Nc(e),new Xc(t)},es.hydrateRoot=function(e,t,n){if(!f(e))throw Error(c(299));var l=!1,a="",i=bf,d=gf,h=yf,y=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(i=n.onUncaughtError),n.onCaughtError!==void 0&&(d=n.onCaughtError),n.onRecoverableError!==void 0&&(h=n.onRecoverableError),n.formState!==void 0&&(y=n.formState)),t=Wm(e,1,!0,t,n??null,l,a,y,i,d,h,oh),t.context=Pm(null),n=t.current,l=gn(),l=I(l),a=zl(l),a.callback=null,kl(n,a,l),n=l,t.current.lanes=n,He(t,n),Pn(t),e[un]=t.current,Nc(e),new wr(t)},es.version="19.2.8",es}var ph;function ly(){if(ph)return Zc.exports;ph=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(s){console.error(s)}}return r(),Zc.exports=ny(),Zc.exports}var ay=ly();const iy=Jh(ay),we={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~"},sy=new TextEncoder;function Wh(r){return sy.encode(r)}function ry(r){if(!r||r.length===0)return"";const o=r.toUpperCase().charCodeAt(0);return o>=65&&o<=90?String.fromCharCode(o-64):r==="@"||r===" "?"\0":r==="["?"\x1B":r==="\\"?"":r==="]"?"":r==="^"?"":r==="_"?"":r==="?"?"":r}function oy(r){return`\x1B${r}`}function cy(r,s){let o=r;return s.shift&&r.length===1&&!s.ctrl&&(o=r.toUpperCase()),s.ctrl&&(o=ry(o)),s.alt&&(o=oy(o)),o}class uy{constructor(s){$e(this,"ws",null);$e(this,"config");$e(this,"state","disconnected");$e(this,"currentRole","viewer");$e(this,"controllerId");$e(this,"hostId");$e(this,"assignedClientId");$e(this,"reconnectAttempts",0);$e(this,"reconnectTimer",null);$e(this,"pingTimer",null);$e(this,"pingTimestamp",null);$e(this,"isManuallyClosed",!1);$e(this,"authFailureDetail",null);$e(this,"authFailureCode",null);$e(this,"temporaryFailureCode",null);$e(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});$e(this,"terminalCols",80);$e(this,"terminalRows",24);this.config={...s}}updateConfig(s){this.config={...this.config,...s}}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(s,o){return this.listeners[s].add(o),()=>{this.listeners[s].delete(o)}}emit(s,...o){this.listeners[s].forEach(f=>{try{f(...o)}catch(m){console.error(`Error in event listener for ${s}:`,m)}})}setState(s,o,c){this.state!==s&&(this.state=s,this.emit("stateChange",s,o,c))}connect(s){if(s&&(this.terminalCols=s.cols,this.terminalRows=s.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 o=this.resolveWsUrl(this.config.wsUrl),c=new WebSocket(o);this.ws=c,c.binaryType="arraybuffer",c.onopen=()=>{this.isStaleSocket(c)||this.handleOpen()},c.onmessage=f=>{this.isStaleSocket(c)||this.handleMessage(f)},c.onerror=f=>{this.isStaleSocket(c)||this.handleError(f)},c.onclose=f=>{this.isStaleSocket(c)||this.handleClose(f)}}catch(o){this.setState("error",o instanceof Error?o.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(s){return this.ws!==s}teardownSocket(s=1e3,o="Client closed the connection"){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(s,o)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(s){this.updateConfig(s),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(s){if(typeof s.data=="string")try{const o=JSON.parse(s.data);this.processJsonMessage(o)}catch(o){console.warn("Received unparseable text frame from server:",o)}else if(s.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(s.data));else if(typeof Blob<"u"&&s.data instanceof Blob)try{const o=await s.data.arrayBuffer();this.emit("binaryData",new Uint8Array(o))}catch(o){console.error("Failed to convert Blob to ArrayBuffer:",o)}}processJsonMessage(s){switch(s.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=s.role,this.controllerId=s.controllerId,this.hostId=s.hostId,this.assignedClientId=s.clientId,this.emit("ready",s),this.emit("roleChange",s.role,s.controllerId,s.hostId,s.clientId),typeof s.clientCount=="number"&&this.emit("peerCount",s.clientCount);break}case"paired":{this.emit("paired",{token:s.token,deviceId:s.deviceId,hostId:s.hostId,expiresAt:s.expiresAt});break}case"control_state":{this.currentRole=s.role,this.controllerId=s.controllerId,this.emit("controlState",s.role,s.controllerId),this.emit("roleChange",s.role,s.controllerId,this.hostId,this.assignedClientId),typeof s.clientCount=="number"&&this.emit("peerCount",s.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",s.code||"host_reconnecting"),this.emit("hostReconnecting",s.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",s.cols,s.rows,s.terminalPalette,s.hostname);break}case"control_revoked":{this.currentRole="viewer",this.emit("controlRevoked",s.reason),this.emit("roleChange","viewer",this.controllerId,this.hostId,this.assignedClientId);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",s);break}case"exit":{this.emit("exit",s.code,s.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",s.message);break}case"status":{this.emit("status",s);break}case"error":{s.code==="host_offline"||s.code==="host_reconnecting"||s.code==="host_reconnect_timeout"||s.code==="rate_limited"?(this.temporaryFailureCode=String(s.code),this.setState("reconnecting",s.message,String(s.code))):(s.code==="auth_required"||s.code==="unauthorized"||s.code==="device_revoked"||s.code==="invalid_handshake"||s.code==="too_many_hosts"||s.code===401||s.code===403)&&(this.authFailureDetail=s.message,this.authFailureCode=String(s.code),this.setState("error",s.message,this.authFailureCode)),this.emit("error",{code:s.code,message:s.message});break}case"pong":{if(this.pingTimestamp){const o=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(o))}break}case"paste_file_ready":{this.emit("pasteFileReady",s.path);break}}}handleError(s){console.error("WebSocket error:",s),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(s){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(s.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",s.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(s.code===1008){this.setState("error",s.reason||"The relay rejected the connection",String(s.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${s.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${s.reason||s.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 s=this.config.reconnectIntervalMs||2e3,c=Math.min(3e4,Math.floor(s*Math.pow(1.5,this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},c)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const s=this.config.pingIntervalMs||1e4;this.pingTimer=setInterval(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN&&this.sendPing()},s)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=null)}sendHello(){const s={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(s.token=this.config.token),this.config.pairCode&&(s.pairCode=this.config.pairCode),this.sendJson(s)}claimControl(s=!1){const o={type:"claim_control",...s?{force:!0}:{}};this.sendJson(o)}releaseControl(){const s={type:"release_control"};this.sendJson(s)}sendResize(s,o){this.terminalCols=s,this.terminalRows=o;const c={type:"resize",cols:s,rows:o};this.sendJson(c)}sendPing(){this.pingTimestamp=performance.now();const s={type:"ping"};this.sendJson(s)}sendPasteFile(s,o){this.sendJson({type:"paste_file",mime:s,dataBase64:o})}sendJson(s){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(s))}sendBinary(s){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(s)}sendText(s){const o=Wh(s);this.sendBinary(o)}resolveWsUrl(s){if(/^wss?:\/\//i.test(s))return s;if(/^https?:\/\//i.test(s)){const o=new URL(s);return o.protocol=o.protocol==="https:"?"wss:":"ws:",(!o.pathname||o.pathname==="/")&&(o.pathname="/ws/client"),o.toString()}if(typeof window<"u"&&window.location){const c=window.location.protocol==="https:"?"wss:":"ws:",f=window.location.host,m=s.startsWith("/")?s:`/${s}`;return`${c}//${f}${m}`}return"ws://127.0.0.1:8787/ws/client"}}const Ph=27,$h=91,dy=60,bh=59,ep=77,tp=48,fy=57,my=64,hy=-30,Jc=32,gh=255;function np(r){return Number.isInteger(r)&&(r&hy)===my}function py(r){return r>=tp&&r<=fy}function Ic(r,s){let o=s,c=0;for(;o<r.length&&py(r[o]);){if(c=c*10+(r[o]-tp),c>65535)return null;o+=1}return o===s?null:{value:c,next:o}}function by(r,s){if(r[s]!==Ph||r[s+1]!==$h||r[s+2]!==dy)return-1;const o=Ic(r,s+3);if(!o||!np(o.value)||r[o.next]!==bh)return-1;const c=Ic(r,o.next+1);if(!c||r[c.next]!==bh)return-1;const f=Ic(r,c.next+1);return!f||r[f.next]!==ep?-1:f.next+1}function gy(r,s){if(r[s]!==Ph||r[s+1]!==$h||r[s+2]!==ep||s+6>r.length)return-1;const o=r[s+3]-Jc,c=r[s+4],f=r[s+5];return!np(o)||c<Jc||c>gh||f<Jc||f>gh?-1:s+6}function au(r){if(!r)return!1;const s=r instanceof Uint8Array?r:new Uint8Array(r);if(s.length===0)return!1;let o=0;for(;o<s.length;){const c=by(s,o);if(c>o){o=c;continue}const f=gy(s,o);if(f>o){o=f;continue}return!1}return!0}const yy=10,vy=24,Dr=15,fu=13,mu=640;function xy(){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 ai()<mu}function ai(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function Wc(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function Mr(r,s=Dr){const o=typeof r=="number"?r:Number(r);return!Number.isFinite(o)||o<=0?s:Math.min(vy,Math.max(yy,Math.round(o)))}function yh(r,s=ai()){if(s<mu){const c=Mr(r,fu);return Math.min(15,Math.max(12,c))}return Mr(r,Dr)}const lp=[{id:"esc",label:"ESC",code:we.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:we.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:we.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:we.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:we.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:we.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:we.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],Sy=[{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:we.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:we.TAB,type:"key",enabled:!0,title:"Tab"},{id:"enter",label:"Enter",code:we.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:we.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:we.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:we.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:we.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:we.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:we.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:we.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:we.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:we.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:we.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:we.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:we.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:we.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:we.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:we.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:we.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:we.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:we.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:we.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:we.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:we.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:we.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:we.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:we.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:we.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:we.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:we.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:we.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:we.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:we.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:we.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 ds(){return JSON.parse(JSON.stringify(lp))}const vh=["esc","tab","ctrl","alt","left","up","down","right","enter","drawer_chords","drawer_symbols","drawer_fn"];function wy(r){return r.length!==vh.length?!1:r.every((s,o)=>s.id===vh[o]&&s.enabled!==!1)}function Cy(r){if(!Array.isArray(r)||r.length===0)return ds();const s=r.filter(o=>typeof o=="object"&&o!==null&&typeof o.id=="string"&&typeof o.label=="string"&&typeof o.code=="string");return wy(s)?ds():s}function iu(r,s){if(s){const o=`keyTitles.${r.id}`,c=s(o);if(c&&c!==o)return c}return r.title||r.label}const su='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',Ty='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',xh="JetBrains Mono, Menlo, Monaco, Consolas, monospace",ii="herdr_remote_settings_v1",us="herdr_remote_session_view_v1",ap=64,fs=4096,ru={local:{},session:{}};function _r(r,s){if(typeof window>"u")return ru[r][s]||null;try{return(r==="local"?window.localStorage:window.sessionStorage).getItem(s)}catch{return ru[r][s]||null}}function pa(r,s,o){if(ru[r][s]=o,!(typeof window>"u"))try{(r==="local"?window.localStorage:window.sessionStorage).setItem(s,o)}catch(c){console.warn(`Failed to write to ${r}Storage:`,c)}}function Ny(){return`client-${Math.random().toString(36).substring(2,8)}`}function hu(){const r=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${r}`}function Ey(r,s){return(typeof r=="string"?r.trim().slice(0,ap):"")||s}function zr(r,s){if(!r||typeof r!="object"||Array.isArray(r))return null;const o=r,c=typeof o.wsUrl=="string"?o.wsUrl.trim().slice(0,2048):"",f=typeof o.token=="string"?o.token.slice(0,fs):"",m=typeof o.pairCode=="string"?o.pairCode.trim().toUpperCase().slice(0,32):"";if(!c||!c.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(c)||!f&&!m)return null;const b=Date.now(),p=typeof o.id=="string"&&o.id.length>0?o.id.slice(0,128):hu(),g=typeof o.hostname=="string"&&o.hostname.trim()?o.hostname.trim().slice(0,ap):`Herdr ${s+1}`;return{id:p,displayName:Ey(o.displayName,g),wsUrl:c,token:f,...m?{pairCode:m}:{},...typeof o.hostId=="string"&&o.hostId.trim()?{hostId:o.hostId.trim().slice(0,128)}:{},...typeof o.hostname=="string"&&o.hostname.trim()?{hostname:o.hostname.trim().slice(0,128)}:{},...typeof o.deviceId=="string"&&o.deviceId.trim()?{deviceId:o.deviceId.trim().slice(0,128)}:{},autoReconnect:o.autoReconnect!==!1,createdAt:Number.isFinite(o.createdAt)?Number(o.createdAt):b,lastUsedAt:Number.isFinite(o.lastUsedAt)?Number(o.lastUsedAt):b}}function Sh(r,s=0){const o=zr({...r,id:r.id||hu()},s);if(!o)throw new Error("a connection profile requires a relay URL and token or pairing code");return o}function wh(r){let s=r.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const o=new URL(r.wsUrl,window.location.origin);o.protocol=o.protocol==="wss:"?"https:":"http:",o.pathname=o.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",o.search="",o.hash="",s=o.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${s}::${r.hostId||""}`}function ip(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function sp(){const r=typeof window<"u"&&window.innerWidth<640;return{wsUrl:"/ws/client",token:"",pairCode:"",clientId:Ny(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:r?fu:Dr,fontFamily:su,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,language:ip(),virtualKeys:ds(),adminToken:"",adminTokens:{}}}const jy=["wsUrl","token","pairCode","clientId","autoReconnect","language"],Ay=["wsUrl","token","pairCode","autoReconnect"],pu=["fontSize","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","virtualKeys","adminToken","adminTokens"],Ry=pu.filter(r=>r!=="adminToken"&&r!=="adminTokens"),Ch=["theme","colorMode"];function ou(r){const s=r;if(!Ch.some(f=>s[f]!==void 0))return{data:r,changed:!1};const c={...s};for(const f of Ch)delete c[f];return{data:c,changed:!0}}function rp(r){if(!r||typeof r!="object"||Array.isArray(r))return{};const s={};for(const[o,c]of Object.entries(r).slice(0,32))typeof c!="string"||c.length===0||(s[o.slice(0,512)]=c.slice(0,fs));return s}function op(r){var m;const s=[];if((Array.isArray(r.profiles)?r.profiles.slice(0,64):[]).forEach((b,p)=>{const g=zr(b,p);g&&!s.some(S=>S.id===g.id)&&s.push(g)}),s.length===0&&(typeof r.token=="string"&&r.token||typeof r.pairCode=="string"&&r.pairCode)){const b=zr({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof r.wsUrl=="string"&&r.wsUrl.trim()?r.wsUrl:"/ws/client",token:r.token||"",pairCode:r.pairCode||"",autoReconnect:r.autoReconnect!==!1},0);b&&s.push(b)}const c=typeof r.activeProfileId=="string"?r.activeProfileId:"",f=s.some(b=>b.id===c)?c:((m=s[0])==null?void 0:m.id)||"";return{profiles:s,activeProfileId:f}}function cp(){const r=sp();if(typeof window>"u")return r;let s={};const o=_r("local",ii);if(o)try{s=JSON.parse(o)}catch(z){console.warn("Failed to parse localStorage settings:",z)}const c=ou(s);c.changed&&(s=c.data,pa("local",ii,JSON.stringify(s)));let f=null;const m=_r("session",us);if(m)try{f=JSON.parse(m)}catch(z){console.warn("Failed to parse sessionStorage settings:",z)}if(!f){const z={};for(const A of pu)s[A]!==void 0&&(z[A]=s[A]);f=z,pa("session",us,JSON.stringify(f))}let b=f.fontFamily??s.fontFamily??r.fontFamily;(!b||b===xh||b===Ty)&&(b=su);const p=window.innerWidth<640?fu:Dr,g=f.fontSize??s.fontSize??r.fontSize,S=Mr(g,p),v=f.virtualKeys??s.virtualKeys??r.virtualKeys,C=Cy(v),Y=s.language??r.language,L=Y==="zh"||Y==="en"?Y:ip(),O=op(s),V=O.profiles.find(z=>z.id===O.activeProfileId),k=ou(f);k.changed&&(f=k.data,pa("session",us,JSON.stringify(f)));const Z=f.toolbarVisible??s.toolbarVisible??r.toolbarVisible,P=f.toolbarPosition??s.toolbarPosition??r.toolbarPosition,F=f.vibrateOnKeyPress??s.vibrateOnKeyPress??r.vibrateOnKeyPress,ce=typeof f.adminToken=="string"?f.adminToken.slice(0,fs):typeof s.adminToken=="string"?s.adminToken.slice(0,fs):r.adminToken,ue=rp(f.adminTokens),H={...r,...s,...f,wsUrl:(V==null?void 0:V.wsUrl)||(typeof s.wsUrl=="string"?s.wsUrl:r.wsUrl),token:(V==null?void 0:V.token)||"",pairCode:(V==null?void 0:V.pairCode)||"",autoReconnect:(V==null?void 0:V.autoReconnect)??r.autoReconnect,profiles:O.profiles,activeProfileId:O.activeProfileId,clientId:typeof s.clientId=="string"&&s.clientId.trim()?s.clientId.trim().slice(0,128):r.clientId,fontFamily:b,fontSize:S,toolbarVisible:Z,toolbarPosition:P,vibrateOnKeyPress:F,virtualKeys:C,language:L,adminToken:ce,adminTokens:ue};return s.fontFamily===xh&&(s.fontFamily=su,pa("local",ii,JSON.stringify(s))),H}function Jl(r){var Y;const o={...cp(),...r};o.adminTokens=rp(o.adminTokens),typeof o.adminToken=="string"&&(o.adminToken=o.adminToken.slice(0,fs)),r.fontSize!==void 0&&(o.fontSize=Mr(r.fontSize));const c=op(o);let f=c.profiles,m=c.activeProfileId;if(Ay.some(L=>r[L]!==void 0)){const L=f.findIndex(k=>k.id===m),O=L>=0?{...f[L]}:{id:hu(),displayName:`Herdr ${f.length+1}`,wsUrl:o.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};O.wsUrl=o.wsUrl,O.token=o.token,O.pairCode=o.pairCode||void 0,O.autoReconnect=o.autoReconnect,O.lastUsedAt=Date.now();const V=zr(O,Math.max(L,0));V?L>=0?f[L]=V:(f.push(V),m=V.id):L>=0&&(f=f.filter(k=>k.id!==m),m=((Y=f[0])==null?void 0:Y.id)||"")}f.length>0&&!f.some(L=>L.id===m)&&(m=f[0].id);const p=f.find(L=>L.id===m);o.profiles=f,o.activeProfileId=m,o.wsUrl=(p==null?void 0:p.wsUrl)||o.wsUrl||"/ws/client",o.token=(p==null?void 0:p.token)||"",o.pairCode=(p==null?void 0:p.pairCode)||"",o.autoReconnect=(p==null?void 0:p.autoReconnect)??o.autoReconnect;const g=_r("local",ii);let S={};if(g)try{S=JSON.parse(g)}catch{}S=ou(S).data;for(const L of jy)o[L]!==void 0&&(S[L]=o[L]);S.profiles=f,S.activeProfileId=m,pa("local",ii,JSON.stringify(S));const v=_r("session",us);let C={};if(v)try{C=JSON.parse(v)}catch{}for(const L of pu)o[L]!==void 0&&(C[L]=o[L]);pa("session",us,JSON.stringify(C));for(const L of Ry)o[L]!==void 0&&(S[L]=o[L]);return pa("local",ii,JSON.stringify(S)),o}const My={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.",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"}},_y={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:"终端配色与光标样式透传自宿主环境。",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:"移除图片"}},Pc={en:My,zh:_y};function bu(r,s,o){const c=Pc[r]||Pc.en,f=s.split(".");let m=c;for(const b of f)if(m&&typeof m=="object"&&b in m)m=m[b];else{let p=Pc.en;for(const g of f)if(p&&typeof p=="object"&&g in p)p=p[g];else return s;m=p;break}if(typeof m!="string")return s;if(o){let b=m;for(const[p,g]of Object.entries(o))b=b.replaceAll(`{${p}}`,String(g));return b}return m}const Th="#11111b",cu=[{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 Nh(r){if(!r||typeof r!="string")return cu[0].font;const s=r.trim();if(s.includes("Symbols Nerd Font"))return s;if(/^['"]?monospace['"]?$/i.test(s))return'"Symbols Nerd Font Mono", monospace';const o=/,\s*['"]?monospace['"]?\s*$/i;return o.test(s)?s.replace(o,', "Symbols Nerd Font Mono", monospace'):`${s}, "Symbols Nerd Font Mono", monospace`}function zy(r){if(!r)return null;const s={};return r.background&&(s.background=r.background,s.cursorAccent=r.background),r.foreground&&(s.foreground=r.foreground),r.cursor&&(s.cursor=r.cursor),r.ansi&&Object.assign(s,r.ansi),Object.keys(s).length===0?null:s}function up(){if(typeof document>"u")return;const r=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",r==null||r.setAttribute("content",Th),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=Th}const dp=1568,ky=3*1024*1024,Dy=[.85,.7,.55,.4],Kn={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function Ly(r,s,o=dp){if(r<=0||s<=0)return{width:Math.max(1,r),height:Math.max(1,s)};const c=Math.max(r,s);if(c<=o)return{width:r,height:s};const f=o/c;return{width:Math.max(1,Math.round(r*f)),height:Math.max(1,Math.round(s*f))}}function Oy(r){if(typeof r!="string"||r.length===0)return 0;const s=r.length;let o=0;r.endsWith("==")?o=2:r.endsWith("=")&&(o=1);const c=Math.floor(s*3/4)-o;return Number.isFinite(c)&&c>0?c:0}function Uy(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}async function By(r){if(typeof createImageBitmap=="function")try{const s=await createImageBitmap(r,{imageOrientation:"from-image"});return{source:s,width:s.width,height:s.height,cleanup:()=>{typeof s.close=="function"&&s.close()}}}catch{try{const s=await createImageBitmap(r);return{source:s,width:s.width,height:s.height,cleanup:()=>{typeof s.close=="function"&&s.close()}}}catch{}}return new Promise((s,o)=>{if(typeof Image>"u")return o(new Error("Image decoding not supported in this environment"));const c=new Image,f=URL.createObjectURL(r);c.onload=()=>{s({source:c,width:c.naturalWidth||c.width,height:c.naturalHeight||c.height,cleanup:()=>{try{URL.revokeObjectURL(f)}catch{}}})},c.onerror=()=>{try{URL.revokeObjectURL(f)}catch{}o(new Error("Failed to decode image source"))},c.src=f})}async function fp(r,s=dp,o=ky){var f;if(!r||r.size===0||r.type&&!r.type.startsWith("image/"))return null;let c;try{c=await By(r)}catch(m){return console.warn("Failed to decode image for paste:",m),null}try{const{width:m,height:b}=Ly(c.width,c.height,s),p=document.createElement("canvas");p.width=m,p.height=b;const g=p.getContext("2d");if(!g)return null;g.drawImage(c.source,0,0,m,b);let S="image/webp";try{p.toDataURL("image/webp",.85).startsWith("data:image/webp")||(S="image/jpeg")}catch{S="image/jpeg"}for(const v of Dy){let C;try{C=p.toDataURL(S,v)}catch{continue}if(!C||!C.startsWith("data:"))continue;const Y=C.indexOf(","),L=Y!==-1?C.slice(Y+1):"",O=Oy(L);if(O<=o)return{mime:S,dataBase64:L,dataUrl:C,byteLength:O,width:m,height:b}}return null}finally{(f=c.cleanup)==null||f.call(c)}}const Hy=4e3,Yy=3,Ky=4096,Gy=8*1024*1024,mp=x.createContext(null);function ni(r){return{wsUrl:r.wsUrl,token:r.token||void 0,pairCode:r.pairCode||void 0,clientId:r.clientId,autoReconnect:r.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}const qy=({children:r})=>{const[s,o]=x.useState(cp),[c,f]=x.useState("disconnected"),[m,b]=x.useState(),[p,g]=x.useState(),[S,v]=x.useState("viewer"),[C,Y]=x.useState(),[L,O]=x.useState(),[V,k]=x.useState(),[Z,P]=x.useState(null),[F,ce]=x.useState(),[ue,H]=x.useState(null),[z,A]=x.useState(1),[te,ze]=x.useState(0),[Ee,Te]=x.useState(null),[Ne,Me]=x.useState(null),[Oe,R]=x.useState({cols:80,rows:24}),[q,Q]=x.useState([]);x.useEffect(()=>{up()},[]);const me=x.useRef(s);me.current=s;const B=x.useRef(null),Ue=x.useRef(!1),je=x.useRef(Oe);je.current=Oe;const X=x.useRef(new Set),[ve,fe]=x.useState(Kn),ie=x.useRef(null),rt=x.useRef(0),Ke=x.useRef(null),ye=x.useCallback((_,D)=>bu(s.language,_,D),[s.language]),Fe=x.useRef(ye);Fe.current=ye;const ot=x.useRef(null),et=x.useRef([]),mt=x.useRef(0),pt=x.useCallback(_=>{for(et.current.push(_),mt.current+=_.byteLength;et.current.length>Ky||mt.current>Gy;){const D=et.current.shift();if(!D)break;mt.current-=D.byteLength}},[]),zt=x.useCallback(_=>{const D=ot.current;if(D)try{D(_);return}catch(I){console.debug("Terminal output sink threw, buffering chunk instead:",I)}pt(_)},[pt]),Yt=x.useRef(zt);Yt.current=zt;const tl=x.useCallback(_=>{ot.current=_;const D=et.current;et.current=[],mt.current=0;for(let I=0;I<D.length;I++)try{_(D[I])}catch(ne){console.debug("Terminal sink threw while flushing, re-buffering the tail:",ne);for(let pe=I;pe<D.length;pe++)pt(D[pe]);break}return()=>{ot.current===_&&(ot.current=null)}},[pt]),Lt=x.useCallback(()=>et.current.length,[]),Jt=x.useCallback(()=>{et.current=[],mt.current=0},[]),Ot=x.useCallback((_=!0)=>{v("viewer"),Y(void 0),O(void 0),k(void 0),P(null),ce(void 0),H(null),A(1),Te(null),Jt(),_&&ze(D=>D+1)},[Jt]),cn=x.useRef([]),It=x.useRef(new Map),Kt=x.useCallback(_=>{cn.current=_,Q(_)},[]),$=x.useCallback(_=>{const D=It.current.get(_);D&&(clearTimeout(D),It.current.delete(_)),Kt(cn.current.filter(I=>I.id!==_))},[Kt]),Ce=x.useRef($);Ce.current=$;const he=x.useCallback((_,D)=>{const I=Date.now(),ne=cn.current,pe=ne.find(Qe=>Qe.type===_&&Qe.message===D),Re=pe?pe.id:`${I}-${Math.random().toString(36).substring(2,6)}`;let _e;if(pe)_e=ne.map(Qe=>Qe.id===Re?{...Qe,count:Qe.count+1,timestamp:I}:Qe);else for(_e=[...ne,{id:Re,type:_,message:D,timestamp:I,count:1}];_e.length>Yy;){const[Qe,...un]=_e,vt=It.current.get(Qe.id);vt&&(clearTimeout(vt),It.current.delete(Qe.id)),_e=un}Kt(_e);const Pe=It.current.get(Re);Pe&&clearTimeout(Pe),It.current.set(Re,setTimeout(()=>Ce.current(Re),Hy))},[Kt]),ut=x.useCallback(_=>{Ce.current(_)},[]),Wt=x.useRef(!0);x.useEffect(()=>{S==="controller"&&(Wt.current=!0)},[S]);const Pt=x.useCallback(()=>{Wt.current&&(Wt.current=!1,he("warning",Fe.current("toasts.viewerModeWarning")))},[he]);x.useEffect(()=>{const _=It.current;return()=>{for(const D of _.values())clearTimeout(D);_.clear()}},[]);const Ut=x.useCallback(_=>{const D=Jl(_);me.current=D,o(D)},[]),qn=x.useCallback(_=>{Ut({language:_})},[Ut]),wt=x.useCallback(_=>{me.current=_,o(_)},[]),nl=x.useCallback(_=>{var pe;const D=me.current,I=Sh({..._,wsUrl:_.wsUrl||"/ws/client",token:_.token||"",displayName:_.displayName||`Herdr ${D.profiles.length+1}`,autoReconnect:_.autoReconnect!==!1},D.profiles.length),ne=Jl({profiles:[...D.profiles,I],activeProfileId:I.id,wsUrl:I.wsUrl,token:I.token,pairCode:I.pairCode||"",autoReconnect:I.autoReconnect});wt(ne),Ot(),(pe=B.current)==null||pe.reconnectWith(ni(ne))},[wt,Ot]),Gt=x.useCallback(_=>{var pe;const D=me.current,I=D.profiles.find(Re=>Re.id===_);if(!I||I.id===D.activeProfileId)return;const ne=Jl({activeProfileId:I.id,wsUrl:I.wsUrl,token:I.token,pairCode:I.pairCode||"",autoReconnect:I.autoReconnect,profiles:D.profiles.map(Re=>Re.id===I.id?{...Re,lastUsedAt:Date.now()}:Re)});wt(ne),Ot(),(pe=B.current)==null||pe.reconnectWith(ni(ne))},[wt,Ot]),yn=x.useCallback((_,D)=>{const I=me.current;if(!I.profiles.find(_e=>_e.id===_))return;const pe=D.trim().slice(0,64);if(!pe)return;const Re=Jl({profiles:I.profiles.map(_e=>_e.id===_?{..._e,displayName:pe}:_e)});wt(Re)},[wt]),qt=x.useCallback(_=>{var Re;const D=me.current;if(!D.profiles.some(_e=>_e.id===_))return;const I=D.profiles.filter(_e=>_e.id!==_),ne=I.find(_e=>_e.id===D.activeProfileId)||I[0],pe=Jl(ne?{profiles:I,activeProfileId:ne.id,wsUrl:ne.wsUrl,token:ne.token,pairCode:ne.pairCode||"",autoReconnect:ne.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:"/ws/client",token:"",pairCode:""});wt(pe),_===D.activeProfileId&&(Ot(),(Re=B.current)==null||Re.reconnectWith(ni(pe)))},[wt,Ot]),ci=x.useCallback(_=>{const D=me.current,I=D.profiles.find(vn=>vn.id===D.activeProfileId),ne=_.hostId?wh({wsUrl:D.wsUrl,hostId:_.hostId}):null,pe=ne?D.profiles.findIndex(vn=>wh(vn)===ne):-1,Re=pe>=0?pe:Math.max(0,D.profiles.findIndex(vn=>vn.id===D.activeProfileId)),Pe={...D.profiles[Re]||I||Sh({wsUrl:D.wsUrl||"/ws/client",token:"",pairCode:D.pairCode||"PENDING",displayName:`Herdr ${D.profiles.length+1}`},D.profiles.length),token:_.token,pairCode:void 0,..._.hostId?{hostId:_.hostId}:{},..._.deviceId?{deviceId:_.deviceId}:{},lastUsedAt:Date.now()};let Qe=[...D.profiles];Re>=0&&Re<Qe.length?Qe[Re]=Pe:Qe.push(Pe);const un=I==null?void 0:I.id;Qe=Qe.filter((vn,ui)=>ui===Re||vn.id===Pe.id?!0:!(pe>=0&&un&&vn.id===un));const vt=Jl({profiles:Qe,activeProfileId:Pe.id,wsUrl:Pe.wsUrl,token:Pe.token,pairCode:"",autoReconnect:Pe.autoReconnect});return wt(vt),vt},[wt]),va=x.useCallback(_=>{const D=me.current,I=D.profiles.find(_e=>_e.id===D.activeProfileId);if(!I||!_.hostId&&!_.hostname)return;const ne=/^Herdr \d+$/.test(I.displayName),pe={...I,..._.hostId?{hostId:_.hostId}:{},..._.hostname?{hostname:_.hostname}:{},..._.hostname&&ne?{displayName:_.hostname}:{}},Re=Jl({profiles:D.profiles.map(_e=>_e.id===I.id?pe:_e)});wt(Re)},[wt]);if(!B.current){const _=new uy(ni(s));B.current=_,_.on("stateChange",(D,I,ne)=>{f(D),g(ne);const pe=ne?`serverErrors.${ne}`:null,Re=pe?Fe.current(pe):null,_e=Re&&Re!==pe?Re:I;b(_e),D==="connected"?he("success",Fe.current("toasts.connected")):D==="error"&&he("error",_e||Fe.current("toasts.connectionError"))}),_.on("ready",D=>{Ue.current&&(Jt(),ze(I=>I+1)),Ue.current=!0,v(D.role),Y(D.controllerId),O(D.hostId),k(D.hostname),va(D),D.clientId&&ce(D.clientId),P(D.terminalPalette||null)}),_.on("hostReconnecting",D=>{g(D||"host_reconnecting"),b(Fe.current(`serverErrors.${D||"host_reconnecting"}`)),v("viewer"),Y(void 0),k(void 0),P(null),H(null),A(1),Te(null),Jt()}),_.on("sessionRestarted",(D,I,ne,pe)=>{Jt(),k(pe),va({hostId:_.getHostId(),hostname:pe}),P(ne||null),ze(Re=>Re+1)}),_.on("roleChange",(D,I,ne,pe)=>{v(D),Y(I),ne&&O(ne),pe&&ce(pe)}),_.on("controlGranted",()=>{v("controller"),he("success",Fe.current("toasts.controlGranted"))}),_.on("controlDenied",D=>{he("warning",D||Fe.current("toasts.controlDenied"))}),_.on("controlRevoked",D=>{v("viewer"),he("warning",D||Fe.current("toasts.controlRevoked"))}),_.on("paired",D=>{const I=ci(D);he("success",Fe.current("toasts.pairedSuccess")),Me(Date.now()),_.reconnectWith(ni(I))}),_.on("exit",(D,I)=>{he("info",`${Fe.current("toasts.sessionEnded")}${I?`: ${I}`:""}${D!==void 0?` (${D})`:""}`)}),_.on("status",D=>{Te(D)}),_.on("error",D=>{ie.current!==null&&(Ke.current&&(clearTimeout(Ke.current),Ke.current=null),ie.current=null,fe(Kn));const ne=`serverErrors.${String(D.code)}`,pe=Fe.current(ne),Re=pe&&pe!==ne?pe:D.message||`[${D.code}]`;he("error",Re)}),_.on("pasteFileReady",D=>{const I=ie.current;I!==null&&(Ke.current&&(clearTimeout(Ke.current),Ke.current=null),fe({active:!0,phase:"completed",ratio:1,percent:100,statusText:Fe.current("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{ie.current===I&&(ie.current=null,fe(Kn))},1200));for(const ne of X.current)try{ne(D)}catch(pe){console.error("Error in pasteFileReady listener:",pe)}}),_.on("rttUpdate",D=>{H(D)}),_.on("peerCount",D=>{A(Math.max(1,D))}),_.on("sessionReady",()=>{f("connected")}),_.on("binaryData",D=>{Yt.current(D)})}const xa=B.current,ll=s.profiles.find(_=>_.id===s.activeProfileId);x.useEffect(()=>{var _;(_=B.current)==null||_.updateConfig(ni(s))},[s]);const Ln=x.useCallback(_=>{B.current&&(_&&B.current.updateConfig(_),B.current.connect(je.current))},[]),Xn=x.useCallback(()=>{B.current&&B.current.disconnect()},[]),$t=x.useCallback((_=!1)=>{B.current&&B.current.claimControl(_)},[]),al=x.useCallback(()=>{var _;(_=B.current)==null||_.releaseControl()},[]),Vn=x.useCallback(_=>{if(S!=="controller"){Pt();return}B.current&&B.current.sendText(_)},[S,Pt]),W=x.useCallback(_=>{S!=="controller"&&!au(_)||B.current&&B.current.sendBinary(_)},[S]),ee=x.useCallback((_,D)=>{je.current={cols:_,rows:D},R({cols:_,rows:D}),B.current&&B.current.sendResize(_,D)},[]),Ae=x.useCallback((_,D)=>S!=="controller"?(Pt(),!1):B.current?(B.current.sendPasteFile(_,D),!0):!1,[S,Pt]),He=x.useCallback(_=>(X.current.add(_),()=>{X.current.delete(_)}),[]),bt=x.useCallback(()=>{Ke.current&&(clearTimeout(Ke.current),Ke.current=null),ie.current=null,fe(Kn)},[]);x.useEffect(()=>{c!=="connected"&&ie.current!==null&&(Ke.current&&(clearTimeout(Ke.current),Ke.current=null),ie.current=null,fe(Kn))},[c]),x.useEffect(()=>()=>{Ke.current&&clearTimeout(Ke.current)},[]);const se=x.useCallback(async _=>{if(S!=="controller")return Pt(),!1;if(!B.current||c!=="connected")return he("error",ye("serverErrors.host_offline")),!1;if(ie.current!==null)return!1;const D=++rt.current;ie.current=D,Ke.current&&(clearTimeout(Ke.current),Ke.current=null);const I="dataBase64"in _&&typeof _.dataBase64=="string";try{let ne;if(I)ne=_;else{const Re=_;if(fe({active:!0,phase:"reading",ratio:.1,percent:10,statusText:ye("virtualKeyboard.uploadProgressReading")}),!Re||Re.size===0)return he("error",ye("clipboard.fileEmpty")),ie.current=null,fe(Kn),!1;if(Re.type&&!Re.type.startsWith("image/"))return he("error",ye("clipboard.unsupportedType")),ie.current=null,fe(Kn),!1;fe({active:!0,phase:"processing",ratio:.35,percent:35,statusText:ye("virtualKeyboard.uploadProgressProcessing")});const _e=await fp(Re);if(ie.current!==D)return!1;if(!_e)return he("error",ye("clipboard.imageTooLarge")),ie.current=null,fe(Kn),!1;ne=_e,fe({active:!0,phase:"processing",ratio:.6,percent:60,statusText:ye("virtualKeyboard.uploadProgressProcessing")})}fe({active:!0,phase:"sending",ratio:.75,percent:75,statusText:ye("virtualKeyboard.uploadProgressSending")});const pe=Ae(ne.mime,ne.dataBase64);return ie.current!==D?!1:pe?(fe({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:ye("virtualKeyboard.uploadProgressWaitingHost")}),Ke.current=setTimeout(()=>{ie.current===D&&(ie.current=null,he("error",ye("serverErrors.paste_file_write_failed")),fe(Kn))},3e4),!0):(ie.current=null,fe(Kn),!1)}catch(ne){return console.error("Failed to process/upload image:",ne),ie.current===D&&(ie.current=null,he("error",ye("clipboard.imageTooLarge")),fe(Kn)),!1}},[S,c,Pt,he,ye,Ae]);return u.jsx(mp.Provider,{value:{connectionState:c,stateDetail:m,stateCode:p,role:S,controllerId:C,hostId:L,hostname:V,assignedClientId:F,profiles:s.profiles,activeProfileId:s.activeProfileId,activeProfile:ll,isController:S==="controller",sharedWindowCount:z,terminalResetVersion:te,rttMs:ue,statusPayload:Ee,lastPairedAt:Ne,settings:s,hostPalette:Z,terminalDimensions:Oe,toasts:q,adapter:xa,language:s.language,t:ye,setLanguage:qn,connect:Ln,disconnect:Xn,switchProfile:Gt,addProfileAndConnect:nl,renameProfile:yn,removeProfile:qt,claimControl:$t,releaseControl:al,sendKey:Vn,sendBinary:W,sendResize:ee,updateSettings:Ut,addToast:he,removeToast:ut,warnViewerMode:Pt,subscribeToOutput:tl,getPendingOutputChunkCount:Lt,sendPasteFile:Ae,subscribeToPasteFileReady:He,uploadProgress:ve,uploadImage:se,resetUploadProgress:bt},children:r})};function yt(){const r=x.useContext(mp);if(!r)throw new Error("useTerminal must be used within a TerminalProvider");return r}function hp(r){var s,o,c="";if(typeof r=="string"||typeof r=="number")c+=r;else if(typeof r=="object")if(Array.isArray(r)){var f=r.length;for(s=0;s<f;s++)r[s]&&(o=hp(r[s]))&&(c&&(c+=" "),c+=o)}else for(o in r)r[o]&&(c&&(c+=" "),c+=o);return c}function Xy(){for(var r,s,o=0,c="",f=arguments.length;o<f;o++)(r=arguments[o])&&(s=hp(r))&&(c&&(c+=" "),c+=s);return c}const Vy=(r,s)=>{const o=new Array(r.length+s.length);for(let c=0;c<r.length;c++)o[c]=r[c];for(let c=0;c<s.length;c++)o[r.length+c]=s[c];return o},Zy=(r,s)=>({classGroupId:r,validator:s}),pp=(r=new Map,s=null,o)=>({nextPart:r,validators:s,classGroupId:o}),kr="-",Eh=[],Fy="arbitrary..",Qy=r=>{const s=Iy(r),{conflictingClassGroups:o,conflictingClassGroupModifiers:c}=r;return{getClassGroupId:b=>{if(b.startsWith("[")&&b.endsWith("]"))return Jy(b);const p=b.split(kr),g=p[0]===""&&p.length>1?1:0;return bp(p,g,s)},getConflictingClassGroupIds:(b,p)=>{if(p){const g=c[b],S=o[b];return g?S?Vy(S,g):g:S||Eh}return o[b]||Eh}}},bp=(r,s,o)=>{if(r.length-s===0)return o.classGroupId;const f=r[s],m=o.nextPart.get(f);if(m){const S=bp(r,s+1,m);if(S)return S}const b=o.validators;if(b===null)return;const p=s===0?r.join(kr):r.slice(s).join(kr),g=b.length;for(let S=0;S<g;S++){const v=b[S];if(v.validator(p))return v.classGroupId}},Jy=r=>r.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const s=r.slice(1,-1),o=s.indexOf(":"),c=s.slice(0,o);return c?Fy+c:void 0})(),Iy=r=>{const{theme:s,classGroups:o}=r;return Wy(o,s)},Wy=(r,s)=>{const o=pp();for(const c in r){const f=r[c];gu(f,o,c,s)}return o},gu=(r,s,o,c)=>{const f=r.length;for(let m=0;m<f;m++){const b=r[m];Py(b,s,o,c)}},Py=(r,s,o,c)=>{if(typeof r=="string"){$y(r,s,o);return}if(typeof r=="function"){ev(r,s,o,c);return}tv(r,s,o,c)},$y=(r,s,o)=>{const c=r===""?s:gp(s,r);c.classGroupId=o},ev=(r,s,o,c)=>{if(nv(r)){gu(r(c),s,o,c);return}s.validators===null&&(s.validators=[]),s.validators.push(Zy(o,r))},tv=(r,s,o,c)=>{const f=Object.entries(r),m=f.length;for(let b=0;b<m;b++){const[p,g]=f[b];gu(g,gp(s,p),o,c)}},gp=(r,s)=>{let o=r;const c=s.split(kr),f=c.length;for(let m=0;m<f;m++){const b=c[m];let p=o.nextPart.get(b);p||(p=pp(),o.nextPart.set(b,p)),o=p}return o},nv=r=>"isThemeGetter"in r&&r.isThemeGetter===!0,lv=r=>{if(r<1)return{get:()=>{},set:()=>{}};let s=0,o=Object.create(null),c=Object.create(null);const f=(m,b)=>{o[m]=b,s++,s>r&&(s=0,c=o,o=Object.create(null))};return{get(m){let b=o[m];if(b!==void 0)return b;if((b=c[m])!==void 0)return f(m,b),b},set(m,b){m in o?o[m]=b:f(m,b)}}},uu="!",jh=":",av=[],Ah=(r,s,o,c,f)=>({modifiers:r,hasImportantModifier:s,baseClassName:o,maybePostfixModifierPosition:c,isExternal:f}),iv=r=>{const{prefix:s,experimentalParseClassName:o}=r;let c=f=>{const m=[];let b=0,p=0,g=0,S;const v=f.length;for(let V=0;V<v;V++){const k=f[V];if(b===0&&p===0){if(k===jh){m.push(f.slice(g,V)),g=V+1;continue}if(k==="/"){S=V;continue}}k==="["?b++:k==="]"?b--:k==="("?p++:k===")"&&p--}const C=m.length===0?f:f.slice(g);let Y=C,L=!1;C.endsWith(uu)?(Y=C.slice(0,-1),L=!0):C.startsWith(uu)&&(Y=C.slice(1),L=!0);const O=S&&S>g?S-g:void 0;return Ah(m,L,Y,O)};if(s){const f=s+jh,m=c;c=b=>b.startsWith(f)?m(b.slice(f.length)):Ah(av,!1,b,void 0,!0)}if(o){const f=c;c=m=>o({className:m,parseClassName:f})}return c},sv=r=>{const s=new Map;return r.orderSensitiveModifiers.forEach((o,c)=>{s.set(o,1e6+c)}),o=>{const c=[];let f=[];for(let m=0;m<o.length;m++){const b=o[m],p=b[0]==="[",g=s.has(b);p||g?(f.length>0&&(f.sort(),c.push(...f),f=[]),c.push(b)):f.push(b)}return f.length>0&&(f.sort(),c.push(...f)),c}},rv=r=>({cache:lv(r.cacheSize),parseClassName:iv(r),sortModifiers:sv(r),postfixLookupClassGroupIds:ov(r),...Qy(r)}),ov=r=>{const s=Object.create(null),o=r.postfixLookupClassGroups;if(o)for(let c=0;c<o.length;c++)s[o[c]]=!0;return s},cv=/\s+/,uv=(r,s)=>{const{parseClassName:o,getClassGroupId:c,getConflictingClassGroupIds:f,sortModifiers:m,postfixLookupClassGroupIds:b}=s,p=[],g=r.trim().split(cv);let S="";for(let v=g.length-1;v>=0;v-=1){const C=g[v],{isExternal:Y,modifiers:L,hasImportantModifier:O,baseClassName:V,maybePostfixModifierPosition:k}=o(C);if(Y){S=C+(S.length>0?" "+S:S);continue}let Z=!!k,P;if(Z){const z=V.substring(0,k);P=c(z);const A=P&&b[P]?c(V):void 0;A&&A!==P&&(P=A,Z=!1)}else P=c(V);if(!P){if(!Z){S=C+(S.length>0?" "+S:S);continue}if(P=c(V),!P){S=C+(S.length>0?" "+S:S);continue}Z=!1}const F=L.length===0?"":L.length===1?L[0]:m(L).join(":"),ce=O?F+uu:F,ue=ce+P;if(p.indexOf(ue)>-1)continue;p.push(ue);const H=f(P,Z);for(let z=0;z<H.length;++z){const A=H[z];p.push(ce+A)}S=C+(S.length>0?" "+S:S)}return S},dv=(...r)=>{let s=0,o,c,f="";for(;s<r.length;)(o=r[s++])&&(c=yp(o))&&(f&&(f+=" "),f+=c);return f},yp=r=>{if(typeof r=="string")return r;let s,o="";for(let c=0;c<r.length;c++)r[c]&&(s=yp(r[c]))&&(o&&(o+=" "),o+=s);return o},fv=(r,...s)=>{let o,c,f,m;const b=g=>{const S=s.reduce((v,C)=>C(v),r());return o=rv(S),c=o.cache.get,f=o.cache.set,m=p,p(g)},p=g=>{const S=c(g);if(S)return S;const v=uv(g,o);return f(g,v),v};return m=b,(...g)=>m(dv(...g))},mv=[],Dt=r=>{const s=o=>o[r]||mv;return s.isThemeGetter=!0,s},vp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,xp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,hv=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,pv=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bv=/\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$/,gv=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,yv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,vv=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Il=r=>hv.test(r),Be=r=>!!r&&!Number.isNaN(Number(r)),$n=r=>!!r&&Number.isInteger(Number(r)),$c=r=>r.endsWith("%")&&Be(r.slice(0,-1)),Cl=r=>pv.test(r),Sp=()=>!0,xv=r=>bv.test(r)&&!gv.test(r),yu=()=>!1,Sv=r=>yv.test(r),wv=r=>vv.test(r),Cv=r=>!ae(r)&&!re(r),Tv=r=>r.startsWith("@container")&&(r[10]==="/"&&r[11]!==void 0||r[11]==="s"&&r[16]!==void 0&&r.startsWith("-size/",10)||r[11]==="n"&&r[18]!==void 0&&r.startsWith("-normal/",10)),Nv=r=>Wl(r,Tp,yu),ae=r=>vp.test(r),ha=r=>Wl(r,Np,xv),Rh=r=>Wl(r,kv,Be),Ev=r=>Wl(r,jp,Sp),jv=r=>Wl(r,Ep,yu),Mh=r=>Wl(r,wp,yu),Av=r=>Wl(r,Cp,wv),Tr=r=>Wl(r,Ap,Sv),re=r=>xp.test(r),ts=r=>ya(r,Np),Rv=r=>ya(r,Ep),_h=r=>ya(r,wp),Mv=r=>ya(r,Tp),_v=r=>ya(r,Cp),Nr=r=>ya(r,Ap,!0),zv=r=>ya(r,jp,!0),Wl=(r,s,o)=>{const c=vp.exec(r);return c?c[1]?s(c[1]):o(c[2]):!1},ya=(r,s,o=!1)=>{const c=xp.exec(r);return c?c[1]?s(c[1]):o:!1},wp=r=>r==="position"||r==="percentage",Cp=r=>r==="image"||r==="url",Tp=r=>r==="length"||r==="size"||r==="bg-size",Np=r=>r==="length",kv=r=>r==="number",Ep=r=>r==="family-name",jp=r=>r==="number"||r==="weight",Ap=r=>r==="shadow",Dv=()=>{const r=Dt("color"),s=Dt("font"),o=Dt("text"),c=Dt("font-weight"),f=Dt("tracking"),m=Dt("leading"),b=Dt("breakpoint"),p=Dt("container"),g=Dt("spacing"),S=Dt("radius"),v=Dt("shadow"),C=Dt("inset-shadow"),Y=Dt("text-shadow"),L=Dt("drop-shadow"),O=Dt("blur"),V=Dt("perspective"),k=Dt("aspect"),Z=Dt("ease"),P=Dt("animate"),F=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ce=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],ue=()=>[...ce(),re,ae],H=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],A=()=>[re,ae,g],te=()=>[Il,"full","auto",...A()],ze=()=>[$n,"none","subgrid",re,ae],Ee=()=>["auto",{span:["full",$n,re,ae]},$n,re,ae],Te=()=>[$n,"auto",re,ae],Ne=()=>["auto","min","max","fr",re,ae],Me=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Oe=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...A()],q=()=>[Il,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],Q=()=>[Il,"screen","full","dvw","lvw","svw","min","max","fit",...A()],me=()=>[Il,"screen","full","lh","dvh","lvh","svh","min","max","fit",...A()],B=()=>[r,re,ae],Ue=()=>[...ce(),_h,Mh,{position:[re,ae]}],je=()=>["no-repeat",{repeat:["","x","y","space","round"]}],X=()=>["auto","cover","contain",Mv,Nv,{size:[re,ae]}],ve=()=>[$c,ts,ha],fe=()=>["","none","full",S,re,ae],ie=()=>["",Be,ts,ha],rt=()=>["solid","dashed","dotted","double"],Ke=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ye=()=>[Be,$c,_h,Mh],Fe=()=>["","none",O,re,ae],ot=()=>["none",Be,re,ae],et=()=>["none",Be,re,ae],mt=()=>[Be,re,ae],pt=()=>[Il,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Cl],breakpoint:[Cl],color:[Sp],container:[Cl],"drop-shadow":[Cl],ease:["in","out","in-out"],font:[Cv],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Cl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Cl],shadow:[Cl],spacing:["px",Be],text:[Cl],"text-shadow":[Cl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Il,ae,re,k]}],container:["container"],"container-type":[{"@container":["","normal","size",re,ae]}],"container-named":[Tv],columns:[{columns:[Be,ae,re,p]}],"break-after":[{"break-after":F()}],"break-before":[{"break-before":F()}],"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:ue()}],overflow:[{overflow:H()}],"overflow-x":[{"overflow-x":H()}],"overflow-y":[{"overflow-y":H()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],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:[$n,"auto",re,ae]}],basis:[{basis:[Il,"full","auto",p,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Be,Il,"auto","initial","none",ae]}],grow:[{grow:["",Be,re,ae]}],shrink:[{shrink:["",Be,re,ae]}],order:[{order:[$n,"first","last","none",re,ae]}],"grid-cols":[{"grid-cols":ze()}],"col-start-end":[{col:Ee()}],"col-start":[{"col-start":Te()}],"col-end":[{"col-end":Te()}],"grid-rows":[{"grid-rows":ze()}],"row-start-end":[{row:Ee()}],"row-start":[{"row-start":Te()}],"row-end":[{"row-end":Te()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ne()}],"auto-rows":[{"auto-rows":Ne()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...Me(),"normal"]}],"justify-items":[{"justify-items":[...Oe(),"normal"]}],"justify-self":[{"justify-self":["auto",...Oe()]}],"align-content":[{content:["normal",...Me()]}],"align-items":[{items:[...Oe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Oe(),{baseline:["","last"]}]}],"place-content":[{"place-content":Me()}],"place-items":[{"place-items":[...Oe(),"baseline"]}],"place-self":[{"place-self":["auto",...Oe()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pbs:[{pbs:A()}],pbe:[{pbe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mbs:[{mbs:R()}],mbe:[{mbe:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...Q()]}],"min-inline-size":[{"min-inline":["auto",...Q()]}],"max-inline-size":[{"max-inline":["none",...Q()]}],"block-size":[{block:["auto",...me()]}],"min-block-size":[{"min-block":["auto",...me()]}],"max-block-size":[{"max-block":["none",...me()]}],w:[{w:[p,"screen",...q()]}],"min-w":[{"min-w":[p,"screen","none",...q()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[b]},...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",o,ts,ha]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[c,zv,Ev]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",$c,ae]}],"font-family":[{font:[Rv,jv,s]}],"font-features":[{"font-features":[ae]}],"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:[f,re,ae]}],"line-clamp":[{"line-clamp":[Be,"none",re,Rh]}],leading:[{leading:[m,...A()]}],"list-image":[{"list-image":["none",re,ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",re,ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...rt(),"wavy"]}],"text-decoration-thickness":[{decoration:[Be,"from-font","auto",re,ha]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[Be,"auto",re,ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"tab-size":[{tab:[$n,re,ae]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",re,ae]}],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",re,ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Ue()}],"bg-repeat":[{bg:je()}],"bg-size":[{bg:X()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$n,re,ae],radial:["",re,ae],conic:[$n,re,ae]},_v,Av]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:ve()}],"gradient-via-pos":[{via:ve()}],"gradient-to-pos":[{to:ve()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:fe()}],"rounded-s":[{"rounded-s":fe()}],"rounded-e":[{"rounded-e":fe()}],"rounded-t":[{"rounded-t":fe()}],"rounded-r":[{"rounded-r":fe()}],"rounded-b":[{"rounded-b":fe()}],"rounded-l":[{"rounded-l":fe()}],"rounded-ss":[{"rounded-ss":fe()}],"rounded-se":[{"rounded-se":fe()}],"rounded-ee":[{"rounded-ee":fe()}],"rounded-es":[{"rounded-es":fe()}],"rounded-tl":[{"rounded-tl":fe()}],"rounded-tr":[{"rounded-tr":fe()}],"rounded-br":[{"rounded-br":fe()}],"rounded-bl":[{"rounded-bl":fe()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-bs":[{"border-bs":ie()}],"border-w-be":[{"border-be":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...rt(),"hidden","none"]}],"divide-style":[{divide:[...rt(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-bs":[{"border-bs":B()}],"border-color-be":[{"border-be":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...rt(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Be,re,ae]}],"outline-w":[{outline:["",Be,ts,ha]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",v,Nr,Tr]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",C,Nr,Tr]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[Be,ha]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",Y,Nr,Tr]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[Be,re,ae]}],"mix-blend":[{"mix-blend":[...Ke(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ke()}],"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":[Be]}],"mask-image-linear-from-pos":[{"mask-linear-from":ye()}],"mask-image-linear-to-pos":[{"mask-linear-to":ye()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":ye()}],"mask-image-t-to-pos":[{"mask-t-to":ye()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":ye()}],"mask-image-r-to-pos":[{"mask-r-to":ye()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":ye()}],"mask-image-b-to-pos":[{"mask-b-to":ye()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":ye()}],"mask-image-l-to-pos":[{"mask-l-to":ye()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":ye()}],"mask-image-x-to-pos":[{"mask-x-to":ye()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":ye()}],"mask-image-y-to-pos":[{"mask-y-to":ye()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[re,ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":ye()}],"mask-image-radial-to-pos":[{"mask-radial-to":ye()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"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":ce()}],"mask-image-conic-pos":[{"mask-conic":[Be]}],"mask-image-conic-from-pos":[{"mask-conic-from":ye()}],"mask-image-conic-to-pos":[{"mask-conic-to":ye()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Ue()}],"mask-repeat":[{mask:je()}],"mask-size":[{mask:X()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",re,ae]}],filter:[{filter:["","none",re,ae]}],blur:[{blur:Fe()}],brightness:[{brightness:[Be,re,ae]}],contrast:[{contrast:[Be,re,ae]}],"drop-shadow":[{"drop-shadow":["","none",L,Nr,Tr]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",Be,re,ae]}],"hue-rotate":[{"hue-rotate":[Be,re,ae]}],invert:[{invert:["",Be,re,ae]}],saturate:[{saturate:[Be,re,ae]}],sepia:[{sepia:["",Be,re,ae]}],"backdrop-filter":[{"backdrop-filter":["","none",re,ae]}],"backdrop-blur":[{"backdrop-blur":Fe()}],"backdrop-brightness":[{"backdrop-brightness":[Be,re,ae]}],"backdrop-contrast":[{"backdrop-contrast":[Be,re,ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Be,re,ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Be,re,ae]}],"backdrop-invert":[{"backdrop-invert":["",Be,re,ae]}],"backdrop-opacity":[{"backdrop-opacity":[Be,re,ae]}],"backdrop-saturate":[{"backdrop-saturate":[Be,re,ae]}],"backdrop-sepia":[{"backdrop-sepia":["",Be,re,ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",re,ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Be,"initial",re,ae]}],ease:[{ease:["linear","initial",Z,re,ae]}],delay:[{delay:[Be,re,ae]}],animate:[{animate:["none",P,re,ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[V,re,ae]}],"perspective-origin":[{"perspective-origin":ue()}],rotate:[{rotate:ot()}],"rotate-x":[{"rotate-x":ot()}],"rotate-y":[{"rotate-y":ot()}],"rotate-z":[{"rotate-z":ot()}],scale:[{scale:et()}],"scale-x":[{"scale-x":et()}],"scale-y":[{"scale-y":et()}],"scale-z":[{"scale-z":et()}],"scale-3d":["scale-3d"],skew:[{skew:mt()}],"skew-x":[{"skew-x":mt()}],"skew-y":[{"skew-y":mt()}],transform:[{transform:[re,ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:ue()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:pt()}],"translate-x":[{"translate-x":pt()}],"translate-y":[{"translate-y":pt()}],"translate-z":[{"translate-z":pt()}],"translate-none":["translate-none"],zoom:[{zoom:[$n,re,ae]}],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"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",re,ae]}],"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":B()}],"scrollbar-track-color":[{"scrollbar-track":B()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mbs":[{"scroll-mbs":A()}],"scroll-mbe":[{"scroll-mbe":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pbs":[{"scroll-pbs":A()}],"scroll-pbe":[{"scroll-pbe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",re,ae]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[Be,ts,ha,Rh]}],stroke:[{stroke:["none",...B()]}],"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"]}},Lv=fv(Dv);function J(...r){return Lv(Xy(r))}var Ov=Ih();const Ye={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},_n={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"}},ms={ok:_n.ok.text,warn:_n.warn.text,bad:_n.bad.text,idle:_n.idle.text,accent:_n.accent.text,alt:_n.alt.text,info:_n.info.text},Dn=({level:r,className:s})=>u.jsx("span",{"aria-hidden":"true",className:J("select-none leading-none",ms[r],s),children:r==="idle"?Ye.off:Ye.on}),Rp=({className:r})=>u.jsx("span",{"aria-hidden":"true",className:J("select-none text-tui-faint",r),children:Ye.dot}),Qt=({title:r,aside:s,tone:o="accent",className:c,bodyClassName:f,children:m,...b})=>u.jsxs("fieldset",{className:J("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",r?"px-3 pb-3 pt-1":"p-3",c),...b,children:[r?u.jsx("legend",{className:J("flex items-center gap-2 text-tui font-bold",ms[o]),children:u.jsx("span",{children:r})}):null,s?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:s}):null,u.jsx("div",{className:J("min-w-0",f),children:m})]}),Gn=({label:r,labelWidth:s=16,className:o,children:c})=>u.jsxs("div",{className:J("flex items-baseline gap-2 text-tui",o),children:[u.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${s}ch`},title:typeof r=="string"?r:void 0,children:r}),u.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:c})]}),si=({className:r,label:s})=>s?u.jsxs("div",{className:J("flex items-center gap-2",r),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:s}),u.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):u.jsx("div",{className:J("h-px w-full bg-tui-border-dim",r),"aria-hidden":"true"}),Uv={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"},Le=({variant:r="default",brackets:s=!0,glyph:o,block:c=!1,className:f,children:m,type:b="button",...p})=>u.jsxs("button",{type:b,className:J("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",Uv[r],c&&"w-full",f),...p,children:[s?u.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,o?u.jsx("span",{"aria-hidden":"true",className:"leading-none",children:o}):null,u.jsx("span",{className:"truncate",children:m}),s?u.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),Lr=({tone:r="accent",dot:s=!1,className:o,children:c})=>u.jsxs("span",{className:J("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",ms[r],o),children:[s?u.jsx(Dn,{level:r}):null,c]}),vu=({tabs:r,activeId:s,onSelect:o,ariaLabel:c,className:f,labelClassName:m})=>u.jsx("nav",{className:J("flex items-center gap-2",f),"aria-label":c,children:r.map((b,p)=>{const g=b.id===s;return u.jsxs(el.Fragment,{children:[p>0?u.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:Ye.tabDivider}):null,u.jsxs("button",{type:"button",onClick:()=>o(b.id),"aria-current":g?"page":void 0,"aria-label":b.ariaLabel??b.label,title:b.title,className:J("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",g?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[b.index!==void 0?u.jsx("span",{"aria-hidden":"true",className:J("text-tui-faint",g&&"text-tui-accent"),children:b.index}):null,u.jsx("span",{"aria-hidden":"true",className:J("ml-1",m),children:b.label})]})]},b.id)})}),Mp=({hints:r,className:s})=>u.jsx("div",{className:J("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",s),children:r.map((o,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:o.keys}),u.jsx("span",{children:o.action})]},`${o.keys}-${c}`))}),zn=({htmlFor:r,hint:s,className:o,children:c})=>u.jsxs("label",{htmlFor:r,className:J("block text-tui-sm font-bold text-tui-muted",o),children:[c,s?u.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:s}):null]}),kn=el.forwardRef(({className:r,...s},o)=>u.jsx("input",{ref:o,className:J("tui-input w-full px-2 py-1 text-tui",r),...s}));kn.displayName="Input";const xu=el.forwardRef(({className:r,children:s,...o},c)=>u.jsx("select",{ref:c,className:J("tui-input w-full px-2 py-1 text-tui",r),...o,children:s}));xu.displayName="Select";const du=({checked:r,onChange:s,disabled:o=!1,label:c,description:f,className:m,id:b})=>u.jsxs("label",{className:J("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",o&&"cursor-not-allowed opacity-60",m),children:[u.jsx("input",{id:b,type:"checkbox",className:"sr-only",checked:r,disabled:o,onChange:p=>s(p.target.checked)}),u.jsx("span",{"aria-hidden":"true",className:J("mt-px shrink-0 font-bold leading-tight",r?"text-tui-ok":"text-tui-faint",!o&&"group-hover:text-tui-accent"),children:r?"[x]":"[ ]"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:J("block",r?"text-tui-text":"text-tui-muted"),children:c}),f?u.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:f}):null]})]}),zh=({checked:r,onChange:s,name:o,disabled:c=!1,label:f,description:m,className:b})=>u.jsxs("label",{className:J("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",c&&"cursor-not-allowed opacity-60",b),children:[u.jsx("input",{type:"radio",name:o,className:"sr-only",checked:r,disabled:c,onChange:s}),u.jsx("span",{"aria-hidden":"true",className:J("mt-px shrink-0 font-bold leading-tight",r?"text-tui-accent":"text-tui-faint",!c&&"group-hover:text-tui-accent"),children:r?"(•)":"( )"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:J("block",r?"text-tui-text":"text-tui-muted"),children:f}),m?u.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:m}):null]})]}),Bv=({value:r,width:s=20,tone:o="accent",className:c})=>{const f=Number.isFinite(r)?Math.min(1,Math.max(0,r)):0,m=Math.round(f*s);return u.jsxs("span",{className:J("inline-flex select-none whitespace-pre font-mono leading-none",c),role:"presentation",children:[u.jsx("span",{className:ms[o],children:Ye.meterFull.repeat(m)}),u.jsx("span",{className:"text-tui-border",children:Ye.meterEmpty.repeat(Math.max(0,s-m))})]})},Hv={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"},Yv=({ratio:r,label:s,tone:o="accent",className:c,...f})=>{const m=Number.isFinite(r)?Math.min(1,Math.max(0,r)):0;return u.jsxs("div",{className:J("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",c),role:"progressbar","aria-valuenow":Math.round(m*100),"aria-valuemin":0,"aria-valuemax":100,...f,children:[u.jsx("div",{className:J("absolute inset-y-0 left-0",Hv[o]),style:{width:`${m*100}%`},"aria-hidden":"true"}),s!==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:s}):null]})};function Su({columns:r,items:s,rowKey:o,empty:c,className:f}){return s.length===0?u.jsx("div",{className:J("px-1 py-4 text-center text-tui text-tui-faint",f),children:c}):u.jsx("div",{className:J("w-full overflow-x-auto",f),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:r.map(m=>u.jsx("th",{scope:"col",style:m.width?{width:`${m.width}ch`}:void 0,className:J("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",m.align==="right"?"text-right":"text-left",m.className),children:m.header},m.key))})}),u.jsx("tbody",{children:s.map((m,b)=>u.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:r.map(p=>u.jsx("td",{className:J("px-2 py-1 align-top text-tui-text",p.align==="right"?"text-right":"text-left",p.className),children:p.render(m,b)},p.key))},o(m,b)))})]})})}const wu=({isOpen:r,onClose:s,title:o,subtitle:c,closeLabel:f,footer:m,hints:b,size:p="md",className:g,children:S})=>{if(!r)return null;const v=p==="sm"?"max-w-md":p==="lg"?"max-w-3xl":"max-w-xl",C=`tui-modal-${o.replace(/\s+/g,"-").toLowerCase()}`,Y=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:L=>{L.target===L.currentTarget&&s()},children:u.jsxs("div",{className:J("flex w-full flex-col border border-tui-border bg-tui-base",v,g),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:o}),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(Le,{variant:"ghost",onClick:s,"aria-label":f,title:f,children:"esc"})]}),u.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:S}),m||b?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:[b?u.jsx(Mp,{hints:b}):u.jsx("span",{}),m?u.jsx("div",{className:"flex items-center gap-2",children:m}):null]}):null]})});return typeof document>"u"?Y:Ov.createPortal(Y,document.body)},Rr=({tone:r="accent",className:s,children:o,action:c})=>{const f=r==="ok"?Ye.check:r==="bad"?Ye.cross:r==="warn"?Ye.warn:"›",m=_n[r].edgeL;return u.jsxs("div",{className:J("flex items-start gap-2 border border-tui-border-dim border-l-2 bg-tui-mantle px-2 py-1.5 text-tui",m,s),children:[u.jsx("span",{"aria-hidden":"true",className:J("shrink-0 font-bold",ms[r]),children:f}),u.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:o}),c?u.jsx("div",{className:"shrink-0",children:c}):null]})},Kv=({active:r=!1,className:s,children:o})=>u.jsx("span",{className:J("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",r?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",s),children:o}),kh=({items:r,className:s})=>{const o=r.filter(Boolean);return u.jsx("span",{className:J("flex min-w-0 items-center gap-1.5",s),children:o.map((c,f)=>u.jsxs(el.Fragment,{children:[f>0?u.jsx(Rp,{className:"shrink-0"}):null,c]},f))})},_p=({left:r,right:s,className:o})=>u.jsxs("footer",{className:J("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",o),children:[u.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:r}),u.jsx("div",{className:"flex shrink-0 items-center gap-3",children:s})]}),Gv=({name:r,tagline:s,aside:o,tabs:c,activeTabId:f,onSelectTab:m,tabsAriaLabel:b,hints:p,footerAside:g,bodyClassName:S,className:v,children:C})=>u.jsxs("div",{className:J("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:r}),s?u.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:s}):null]}),o?u.jsx("span",{className:"flex shrink-0 items-center gap-2",children:o}):null]}),c&&c.length>0&&f!==void 0&&m?u.jsx("div",{className:"scrollbar-none shrink-0 overflow-x-auto border-b border-tui-border bg-tui-mantle px-2",children:u.jsx(vu,{tabs:c,activeId:f,onSelect:m,ariaLabel:b,className:"gap-3"})}):null,u.jsx("div",{className:J("min-h-0 flex-1 overflow-y-auto p-2",S),children:C}),p||g?u.jsx(_p,{left:p?u.jsx(Mp,{hints:p}):null,right:g}):null]}),Dh=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],ri=({className:r,label:s})=>{const[o,c]=el.useState(0);return el.useEffect(()=>{const f=setInterval(()=>c(m=>(m+1)%Dh.length),90);return()=>clearInterval(f)},[]),u.jsxs("span",{className:J("inline-flex items-center gap-1.5",r),role:"status",children:[u.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:Dh[o]}),s?u.jsx("span",{children:s}):null]})},Er="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",jr="text-tui-muted hover:border-tui-border hover:text-tui-accent",qv="border-tui-accent bg-tui-accent text-tui-crust",Xv=({currentView:r,onNavigate:s,showAdminEntry:o=!0,onOpenPairing:c,onOpenSettings:f,onToggleVirtualKeyboard:m,isVirtualKeyboardOpen:b})=>{const{addToast:p,language:g,setLanguage:S,t:v}=yt(),C=()=>{const L=g==="zh"?"en":"zh";S(L),p("info",bu(L,"toasts.switchedLanguage",{lang:L==="zh"?"简体中文":"English"}))},Y=[{id:"terminal",label:v("header.terminalTab"),index:1,ariaLabel:v("header.terminalTab")},...o||r==="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(vu,{tabs:Y,activeId:r,onSelect:L=>s(L),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:J(Er,jr),title:v("header.languageToggleTitle"),"aria-label":v("header.languageToggleTitle"),children:v("header.languageShort")}),r==="terminal"&&u.jsx("button",{type:"button",onClick:m,className:J(Er,b?qv:jr),title:v("header.virtualKeyboardTitle"),"aria-label":v("header.virtualKeyboardTitle"),children:v("header.actionKeyboard")}),u.jsx("button",{type:"button",onClick:c,className:J(Er,jr),title:v("header.pairingTitle"),"aria-label":v("header.pairingTitle"),children:v("header.actionPairing")}),u.jsx("button",{type:"button",onClick:f,className:J(Er,jr),title:v("header.settingsTitle"),"aria-label":v("header.settingsTitle"),children:v("header.actionSettings")})]})]})})},Ar=({tone:r,glyph:s,message:o,assertive:c=!1,action:f})=>u.jsxs("aside",{className:J("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",_n[r].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:J("shrink-0",_n[r].text),children:s}),u.jsx("span",{className:"truncate text-tui-text",children:o})]}),f]}),Vv=()=>{const{connectionState:r,stateDetail:s,connect:o,settings:c,t:f}=yt();return r==="connected"||!c.token&&!c.pairCode&&r==="disconnected"?null:r==="connecting"?u.jsx(Ar,{tone:"accent",glyph:u.jsx(ri,{}),message:f("statusBanner.connecting")}):r==="reconnecting"?u.jsx(Ar,{tone:"warn",glyph:u.jsx(ri,{}),assertive:!0,message:s||f("statusBanner.reconnectingDefault"),action:u.jsx(Le,{variant:"warn",onClick:()=>o(),className:"shrink-0",children:f("statusBanner.reconnectNow")})}):r==="error"?u.jsx(Ar,{tone:"bad",glyph:Ye.cross,assertive:!0,message:s||f("statusBanner.errorDefault"),action:u.jsx(Le,{variant:"danger",onClick:()=>o(),className:"shrink-0",children:f("common.retry")})}):r==="disconnected"?u.jsx(Ar,{tone:"idle",glyph:Ye.off,message:f("statusBanner.disconnected"),action:u.jsx(Le,{variant:"primary",onClick:()=>o(),className:"shrink-0",children:f("common.connect")})}):null};var Zv=Qg(),Fv=Jg();const Qv=20,Jv=6,Iv=500,Wv=300,oi=13,zp=.602,kp=1.3;function Tl(r,s){return Number.isFinite(r)&&r>0?r:s}function Lh(r,s,o){return Math.min(o,Math.max(s,r))}function Oh(r){const{width:s,height:o,cellWidth:c,cellHeight:f,minCols:m=Qv,minRows:b=Jv,maxCols:p=Iv,maxRows:g=Wv}=r,S=Tl(c,oi*zp),v=Tl(f,oi*kp);return{cols:Lh(Math.floor(Tl(s,0)/S),m,p),rows:Lh(Math.floor(Tl(o,0)/v),b,g)}}function ba(r,s=oi){var c,f,m;if(r)try{const b=r._core,p=(m=(f=(c=b==null?void 0:b._renderService)==null?void 0:c.dimensions)==null?void 0:f.css)==null?void 0:m.cell;if(p&&p.width&&p.width>0&&p.height&&p.height>0)return{cellWidth:p.width,cellHeight:p.height,measured:!0}}catch{}const o=Tl(s,oi);return{cellWidth:Math.round(o*zp*100)/100,cellHeight:Math.round(o*kp*100)/100,measured:!1}}function Pv(r){var c;const s=(c=r==null?void 0:r.querySelector)==null?void 0:c.call(r,".xterm-viewport");if(!s)return 0;const o=(s.offsetWidth||0)-(s.clientWidth||0);return Number.isFinite(o)&&o>0?o:0}function eu(r,s,o){if(!r)return{width:s,height:o};let c=0,f=0;if(typeof r.getBoundingClientRect=="function"){const m=r.getBoundingClientRect();c=(m==null?void 0:m.width)||0,f=(m==null?void 0:m.height)||0}return{width:Tl(c,Tl(r.clientWidth,s)),height:Tl(f,Tl(r.clientHeight,o))}}function Dp(r,s,o,c){const f=Number.isFinite(c)&&c>.01?c:1;return{clientX:o.left+(r-o.left)/f,clientY:o.top+(s-o.top)/f}}function ns(r){var s,o;if(!r)return!1;try{const c=r.modes;if(c&&typeof c.mouseTrackingMode=="string"&&c.mouseTrackingMode!=="none")return!0;const f=r._core;if((s=f==null?void 0:f._coreMouseService)!=null&&s.areMouseEventsActive||(o=f==null?void 0:f.coreMouseService)!=null&&o.areMouseEventsActive||f!=null&&f.mouseMode&&f.mouseMode!=="none")return!0}catch{}return!1}function $v(r,s){const o=s.button??0,c=s.buttons??(r==="mouseup"?0:1);return new MouseEvent(r,{bubbles:!0,cancelable:!0,clientX:s.clientX,clientY:s.clientY,screenX:s.clientX,screenY:s.clientY,button:o,buttons:c})}function Uh(r,s,o){const c=$v(s,o);return r.dispatchEvent(c)}class ex{constructor(s){$e(this,"options");$e(this,"state","idle");$e(this,"startX",0);$e(this,"startY",0);$e(this,"lastX",0);$e(this,"lastY",0);$e(this,"activeTarget",null);$e(this,"longPressTimer",null);$e(this,"capturedPointerId",null);$e(this,"captureElement",null);$e(this,"scrollRemainderY",0);this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...s}}getState(){return this.state}setGestureState(s){var o,c;this.state!==s&&(this.state=s,(c=(o=this.options).onGestureStateChange)==null||c.call(o,s))}getActiveBuffer(s){var o;try{return((o=s.buffer)==null?void 0:o.active)||null}catch{return null}}getViewportY(s){var c;const o=(c=this.getActiveBuffer(s))==null?void 0:c.viewportY;return typeof o=="number"&&Number.isFinite(o)?o:null}blurTerminal(s){var o;try{(o=s.blur)==null||o.call(s)}catch{}}getLogicalCoordinates(s,o){const c=this.options.getScale?this.options.getScale():1,f=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(c!==1&&f&&typeof f.getBoundingClientRect=="function"){const m=f.getBoundingClientRect();return Dp(s,o,m,c)}return{clientX:s,clientY:o}}getViewportElement(s){var f;const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(o==null?void 0:o.querySelector(".xterm-viewport"))||((f=s.element)==null?void 0:f.querySelector(".xterm-viewport"))||null}isInputLineHit(s,o){var P;const c=(P=o.buffer)==null?void 0:P.active,f=this.options.getSurfaceElement?this.options.getSurfaceElement():null,m=(f==null?void 0:f.querySelector(".xterm-screen"))||o.element||f,b=ba(o);if(!m||typeof m.getBoundingClientRect!="function"||b.cellHeight<=0)return!1;const p=m.getBoundingClientRect(),g=this.getLogicalCoordinates(s.clientX,s.clientY),S=p.width>0&&p.height>0;if(![c==null?void 0:c.cursorY,c==null?void 0:c.viewportY,c==null?void 0:c.baseY].every(F=>typeof F=="number"&&Number.isFinite(F)))return!1;const C=c==null?void 0:c.cursorY,Y=c==null?void 0:c.viewportY,O=(c==null?void 0:c.baseY)+C-Y,V=p.top+O*b.cellHeight,k=V+b.cellHeight,Z=Number(o.rows);return O>=0&&(!Number.isFinite(Z)||O<Z)&&g.clientY>=V-2&&g.clientY<=k+2&&(!S||g.clientX>=p.left&&g.clientX<=p.right)}resolveDispatchTarget(s,o){var p;const c=this.options.getSurfaceElement?this.options.getSurfaceElement():null,f=(c==null?void 0:c.querySelector(".xterm-screen"))||o.querySelector(".xterm-screen")||null,m=((p=f==null?void 0:f.closest)==null?void 0:p.call(f,".xterm"))||null;let b=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(b=document.elementFromPoint(s.clientX,s.clientY)),b&&m&&(b===m||m.contains(b))?b:f||c||o}getMouseReport(s,o){const c=this.options.getSurfaceElement?this.options.getSurfaceElement():null,f=(c==null?void 0:c.querySelector(".xterm-screen"))||o.element;if(!f||typeof f.getBoundingClientRect!="function")return null;const m=f.getBoundingClientRect(),b=this.getLogicalCoordinates(s.clientX,s.clientY),p=ba(o);if(p.cellWidth<=0||p.cellHeight<=0)return null;const g=Math.max(1,m.width||o.cols*p.cellWidth),S=Math.max(1,m.height||o.rows*p.cellHeight),v=Math.max(0,Math.min(g-1,b.clientX-m.left)),C=Math.max(0,Math.min(S-1,b.clientY-m.top)),Y=Math.max(0,Math.min(o.cols-1,Math.floor(v/p.cellWidth))),L=Math.max(0,Math.min(o.rows-1,Math.floor(C/p.cellHeight)));return{col:Y,row:L,x:Math.floor(v),y:Math.floor(C),button:0,action:0}}getCoreMouseService(s){var c,f;const o=s;return o.coreMouseService||((c=o._core)==null?void 0:c.coreMouseService)||((f=o._core)==null?void 0:f._coreMouseService)||null}getCoreService(s){var c;const o=s;return o.coreService||((c=o._core)==null?void 0:c.coreService)||null}getWheelDispatchTarget(s){const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(o==null?void 0:o.querySelector(".xterm"))||s.element||null}dispatchWheel(s,o,c,f){const m=this.getWheelDispatchTarget(c);if(!m||typeof WheelEvent>"u"||o===0)return!1;const b=this.getLogicalCoordinates(s.clientX,s.clientY),p=o<0?-1:1;let g=0;for(let S=0;S<Math.abs(o);S+=1)try{const v=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:b.clientX,clientY:b.clientY,deltaX:0,deltaY:p,deltaMode:1,ctrlKey:!!(f!=null&&f.ctrlKey),altKey:!!(f!=null&&f.altKey),shiftKey:!!(f!=null&&f.shiftKey)});m.dispatchEvent(v),g+=1}catch{return g>0}return g>0}emitWheel(s,o,c,f){if(o===0)return!1;if(this.dispatchWheel(s,o,c,f))return!0;const m=this.getCoreMouseService(c);if(!(m!=null&&m.triggerMouseEvent))return!1;let b=0;for(let p=0;p<Math.abs(o);p+=1){const g=this.getMouseReport(s,c);g&&(g.button=4,g.action=o<0?0:1,g.ctrl=!!(f!=null&&f.ctrlKey),g.alt=!!(f!=null&&f.altKey),g.shift=!!(f!=null&&f.shiftKey),m.triggerMouseEvent(g)&&(b+=1))}return b>0}scrollAlternateBuffer(s,o,c,f){var b;if(o===0)return"none";const m=ns(c);if(!m&&!this.options.getIsController())return"none";if(this.emitWheel(s,o,c,f))return m?"application-mouse":"application-keys";if(!m){const p=this.getCoreService(c);if(!(p!=null&&p.triggerDataEvent))return"none";const S=`\x1B${!!((b=p.decPrivateModes)!=null&&b.applicationCursorKeys)?"O":"["}${o<0?"A":"B"}`;return p.triggerDataEvent(S.repeat(Math.abs(o)),!0),"application-keys"}return"none"}emitMouse(s,o,c){const f=this.options.getTerminal();if(!f)return;const m=this.getCoreMouseService(f);if(m!=null&&m.triggerMouseEvent){const p=this.getMouseReport(o,f);p&&(p.action=s==="mousedown"?1:s==="mouseup"?0:32,p.ctrl=!!(c!=null&&c.ctrlKey),p.alt=!!(c!=null&&c.altKey),p.shift=!!(c!=null&&c.shiftKey),m.triggerMouseEvent(p));return}if(this.options.allowSyntheticMouseFallback===!1||!this.activeTarget)return;const b=this.getLogicalCoordinates(o.clientX,o.clientY);Uh(this.activeTarget,s,{clientX:b.clientX,clientY:b.clientY,button:0,buttons:s==="mouseup"?0:1})}beginGesture(s,o){this.startX=s.clientX,this.startY=s.clientY,this.lastX=s.clientX,this.lastY=s.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.resolveDispatchTarget(s,o),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var c,f;this.state==="pending"&&(this.setGestureState("longpress"),(f=(c=this.options).onLongPress)==null||f.call(c,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(s,o){var S,v,C,Y;if(this.state==="longpress"){(v=(S=this.options).onSelectionExtend)==null||v.call(S,{clientX:s.clientX,clientY:s.clientY}),o!=null&&o.cancelable&&((C=o.preventDefault)==null||C.call(o));return}if(this.state==="idle")return;const c=s.clientX-this.startX,f=s.clientY-this.startY,m=Math.hypot(c,f);if(this.state==="scrolling"){this.scrollGesture(s,o);return}const b=this.options.getTerminal(),p=this.options.getIsController(),g=ns(b);if(!(m<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(f)>=Math.abs(c)||!g||!p){this.setGestureState("scrolling"),b&&this.blurTerminal(b),this.lastX=s.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(s,o);return}if(g&&p){this.state==="pending"&&(this.setGestureState("dragging"),this.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},o)),this.state==="dragging"&&(this.lastX=s.clientX,this.lastY=s.clientY,this.emitMouse("mousemove",s,o),o!=null&&o.cancelable&&((Y=o.preventDefault)==null||Y.call(o)));return}this.lastX=s.clientX,this.lastY=s.clientY}}scrollGesture(s,o){var O,V,k;const c=this.options.getTerminal();if(!c)return;const f=s.clientY-this.lastY;this.lastX=s.clientX,this.lastY=s.clientY;const m=ba(c),b=m.measured?m.cellHeight:this.options.scrollLineHeightPx||m.cellHeight||18;this.scrollRemainderY+=f;const p=Math.trunc(this.scrollRemainderY/b),g=-p;let S=!1,v="none";const C=this.getActiveBuffer(c),Y=ns(c);if(g!==0){if((C==null?void 0:C.type)==="alternate")v=this.scrollAlternateBuffer(s,g,c,o),S=v!=="none";else{const Z=this.getViewportY(c);c.scrollLines(g);const P=this.getViewportY(c);v="buffer",S=Z===null||P===null||Z!==P}this.scrollRemainderY-=p*b}const L=this.getViewportElement(c);(V=(O=this.options).onGestureScroll)==null||V.call(O,{deltaY:f,lines:g,viewportY:this.getViewportY(c),scrollTop:(L==null?void 0:L.scrollTop)??null,scrollHeight:(L==null?void 0:L.scrollHeight)??null,clientHeight:(L==null?void 0:L.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:Y,scrollMode:v}),o!=null&&o.cancelable&&((k=o.preventDefault)==null||k.call(o))}endGesture(s,o){var b,p,g;this.clearLongPressTimer();const c=this.options.getTerminal(),f=this.options.getIsController(),m=ns(c);if(this.state==="pending"){if(m&&f){const v={clientX:this.startX,clientY:this.startY};this.emitMouse("mousedown",v,o),this.emitMouse("mouseup",v,o)}const S={clientX:this.startX,clientY:this.startY};f&&c&&this.isInputLineHit(S,c)&&((p=(b=this.options).onFocus)==null||p.call(b))}else if(this.state==="dragging"&&m&&f){const S=s??{clientX:this.lastX,clientY:this.lastY};this.emitMouse("mouseup",S,o),o!=null&&o.cancelable&&((g=o.preventDefault)==null||g.call(o))}this.reset()}handlePointerDown(s,o){if(s.pointerType==="mouse")return!1;if(!s.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(s.cancelable&&s.preventDefault(),this.beginGesture(s,o),s.pointerType!=="touch")try{typeof o.setPointerCapture=="function"&&(o.setPointerCapture(s.pointerId),this.capturedPointerId=s.pointerId,this.captureElement=o)}catch{}return!0}handlePointerMove(s){s.pointerType==="mouse"||this.state==="idle"||this.moveGesture(s,s)}handlePointerUp(s){s.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(s,s))}handlePointerCancel(s){s&&s.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(s,o){if(s.touches.length!==1){this.reset();return}s.cancelable&&s.preventDefault(),this.beginGesture(s.touches[0],o)}handleTouchMove(s){s.touches.length===1&&this.moveGesture(s.touches[0],s)}handleTouchEnd(s){s.cancelable&&s.preventDefault(),this.endGesture(null,s)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const s=this.options.getTerminal(),o=this.options.getIsController(),c=ns(s);if(this.state==="dragging"&&c&&o&&this.activeTarget){const f=this.getLogicalCoordinates(this.lastX,this.lastY);Uh(this.activeTarget,"mouseup",{clientX:f.clientX,clientY:f.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const s=this.captureElement,o=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!s||o===null))try{typeof s.releasePointerCapture=="function"&&(typeof s.hasPointerCapture!="function"||s.hasPointerCapture(o))&&s.releasePointerCapture(o)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}var Bh=Ig(),tx=Wg();function nx(r,s){if(s.coarsePointer)return{kind:"dom",dispose:()=>{}};try{const o=new tx.WebglAddon;let c=null;return o.onContextLoss(()=>{var f;try{o.dispose()}catch{}try{c=new Bh.CanvasAddon,r.loadAddon(c)}catch(m){console.debug("Canvas fallback failed after WebGL context loss:",m)}(f=s.onRendererSwapped)==null||f.call(s)}),r.loadAddon(o),{kind:"webgl",dispose:()=>{for(const f of[c,o])try{f==null||f.dispose()}catch{}}}}catch(o){console.debug("WebGL renderer unavailable, falling back to canvas:",o)}try{const o=new Bh.CanvasAddon;return r.loadAddon(o),{kind:"canvas",dispose:()=>{try{o.dispose()}catch{}}}}catch(o){console.debug("Canvas renderer unavailable, using the DOM renderer:",o)}return{kind:"dom",dispose:()=>{}}}function Hh(r,s){const o=typeof window<"u"?window:void 0,c=o&&typeof o.devicePixelRatio=="number"&&o.devicePixelRatio>0?o.devicePixelRatio:1,f=o&&o.visualViewport&&typeof o.visualViewport.scale=="number"&&o.visualViewport.scale>0?o.visualViewport.scale:1,m=Math.max(0,r.width),b=Math.max(0,r.height),p=Math.round(m*c*100)/100,g=Math.round(b*c*100)/100;return{dpr:c,scale:f,cssWidth:m,cssHeight:b,physicalWidth:p,physicalHeight:g}}function lx(r){const{lastSnapshot:s,currentSnapshot:o,physicalTolerancePx:c=6}=r;if(!s)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const f=Math.abs(o.scale-s.scale)>.01,m=Math.abs(o.scale-1)>.01;if(f||m)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(o.dpr-s.dpr)>.01){const S=Math.abs(o.physicalWidth-s.physicalWidth),v=Math.abs(o.physicalHeight-s.physicalHeight);if(S<=c&&v<=c)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const p=Math.abs(o.cssWidth-s.cssWidth),g=Math.abs(o.cssHeight-s.cssHeight);return p<1&&g<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const ax=" ()[]{}'\"\\`";function Yh(r,s,o,c=1){var k,Z;if(!s||!((k=s.buffer)!=null&&k.active)||s.cols<=0||s.rows<=0)return null;const f=o||((Z=s.element)==null?void 0:Z.querySelector(".xterm-screen"))||s.element;if(!f||typeof f.getBoundingClientRect!="function")return null;const m=f.getBoundingClientRect(),b=Dp(r.clientX,r.clientY,m,c),p=ba(s);if(p.cellWidth<=0||p.cellHeight<=0)return null;const g=Math.max(1,m.width||s.cols*p.cellWidth),S=Math.max(1,m.height||s.rows*p.cellHeight),v=Math.max(0,Math.min(g-1,b.clientX-m.left)),C=Math.max(0,Math.min(S-1,b.clientY-m.top)),Y=Math.max(0,Math.min(s.cols-1,Math.floor(v/p.cellWidth))),L=Math.max(0,Math.min(s.rows-1,Math.floor(C/p.cellHeight))),V=(s.buffer.active.viewportY??0)+L;return{col:Y,bufferRow:V}}function ix(r,s){if(!r||r.length===0||r==="\0")return!0;for(const o of r)if(o==="\0"||/\s/.test(o)||s.includes(o))return!0;return!1}function sx(r,s,o){var Y,L;if(!r||!((Y=r.buffer)!=null&&Y.active)||s<0||s>=r.cols)return null;const c=r.buffer.active.getLine(o);if(!c)return null;const f=((L=r.options)==null?void 0:L.wordSeparator)??ax,m=new Array(r.cols).fill(null),b=Math.min(r.cols,c.length);let p=0;for(;p<b;){const O=c.getCell(p);if(!O){m[p]={startCol:p,endCol:p+1,isSeparator:!0},p++;continue}const V=O.getWidth();if(V===0){m[p]||(m[p]={startCol:p,endCol:p+1,isSeparator:!0}),p++;continue}const k=O.getChars(),Z=ix(k,f),P=Math.min(r.cols,p+V),F={startCol:p,endCol:P,isSeparator:Z};for(let ce=p;ce<P;ce++)m[ce]=F;p+=Math.max(1,V)}for(let O=b;O<r.cols;O++)m[O]||(m[O]={startCol:O,endCol:O+1,isSeparator:!0});const g=m[s];if(!g||g.isSeparator)return null;let S=g.startCol;for(;S>0;){const O=m[S-1];if(O&&!O.isSeparator)S=O.startCol;else break}let v=g.endCol;for(;v<r.cols;){const O=m[v];if(O&&!O.isSeparator)v=O.endCol;else break}const C=v-S;return C<=0?null:{startCol:S,length:C}}function rx(r){var m;if(!r||!((m=r.buffer)!=null&&m.active))return"";const s=r.buffer.active,o=s.viewportY??0,c=r.rows,f=[];for(let b=0;b<c;b++){const p=s.getLine(o+b);f.push(p?p.translateToString(!0):"")}for(;f.length>0&&f[f.length-1]==="";)f.pop();return f.join(`
34
- `)}const Kh=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),ox=.6,cx=new Set(["─","━","═","┄","┅","┈","┉","-"]),ux=.8;function tu(r,s){if(!r)return!1;let o=0;const c=Math.min(s,r.length);for(let f=0;f<c;f++){const m=r.getCell(f);if(m){const b=m.getChars();b&&cx.has(b)&&o++}}return o>=Math.max(5,Math.min(s*.25,10))}function nu(r,s,o){var L;if(!r||!((L=r.buffer)!=null&&L.active)||r.cols<=0)return{startCol:0,endCol:0};const c=r.buffer.active,f=r.cols,m=Math.max(0,Math.min(f-1,s)),b=c.viewportY??0,p=r.rows>0?r.rows:1,g=new Int32Array(f);let S=0;for(let O=0;O<p;O++){const V=c.getLine(b+O);if(S++,!V)continue;const k=Math.min(f,V.length);for(let Z=0;Z<k;Z++){const P=V.getCell(Z);if(P){const F=P.getChars();F&&Kh.has(F)&&g[Z]++}}}if(S===0)return{startCol:0,endCol:f-1};const v=S*ox,C=O=>g[O]>=v;let Y=!1;for(let O=0;O<f;O++)if(C(O)){Y=!0;break}if(Y){if(C(m))return{startCol:m,endCol:m};let O=-1;for(let k=m-1;k>=0;k--)if(C(k)){O=k;break}let V=f;for(let k=m+1;k<f;k++)if(C(k)){V=k;break}return{startCol:O+1,endCol:V-1}}if(o!==void 0){const O=Math.max(b,Math.min(b+p-1,o)),V=c.getLine(O);if(!tu(V,f)){let k=b;for(let F=O-1;F>=b;F--)if(tu(c.getLine(F),f)){k=F+1;break}let Z=b+p-1;for(let F=O+1;F<=b+p-1;F++)if(tu(c.getLine(F),f)){Z=F-1;break}const P=Z-k+1;if(P>=2){const F=new Int32Array(f);for(let z=k;z<=Z;z++){const A=c.getLine(z);if(!A)continue;const te=Math.min(f,A.length);for(let ze=0;ze<te;ze++){const Ee=A.getCell(ze);if(Ee){const Te=Ee.getChars();Te&&Kh.has(Te)&&F[ze]++}}}const ce=P*ux,ue=z=>F[z]>=ce;let H=!1;for(let z=0;z<f;z++)if(ue(z)){H=!0;break}if(H){if(ue(m))return{startCol:m,endCol:m};let z=-1;for(let te=m-1;te>=0;te--)if(ue(te)){z=te;break}let A=f;for(let te=m+1;te<f;te++)if(ue(te)){A=te;break}return{startCol:z+1,endCol:A-1}}}}}return{startCol:0,endCol:f-1}}function Gh(r,s){const o=Math.min(r.startCol,r.endCol),c=Math.max(r.startCol,r.endCol),f=Math.min(r.startRow,r.endRow),m=Math.max(r.startRow,r.endRow);return{startCol:Math.max(s.startCol,Math.min(s.endCol,o)),endCol:Math.max(s.startCol,Math.min(s.endCol,c)),startRow:f,endRow:m}}function lu(r,s){var S;if(!r||!((S=r.buffer)!=null&&S.active)||r.cols<=0)return"";const o=r.buffer.active,c=r.cols,f=Math.min(s.startRow,s.endRow),m=Math.max(s.startRow,s.endRow),b=Math.max(0,Math.min(s.startCol,s.endCol)),p=Math.min(c-1,Math.max(s.startCol,s.endCol));if(b>p||f>m)return"";const g=[];for(let v=f;v<=m;v++){const C=o.getLine(v);if(!C){g.push("");continue}const Y=C.translateToString(!0,b,p+1);g.push(Y.trimEnd())}return g.join(`
35
- `)}async function ga(r){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(r),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let s=null,o=null,c=null;try{if(s=document.createElement("textarea"),s.style.userSelect="text",s.style.webkitUserSelect="text",s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.width="1px",s.style.height="1px",s.style.padding="0",s.style.border="none",s.style.outline="none",s.style.boxShadow="none",s.style.background="transparent",s.style.opacity="0",s.style.fontSize="16px",s.setAttribute("readonly",""),s.setAttribute("aria-hidden","true"),s.value=r,typeof window<"u"&&typeof window.getSelection=="function"&&(c=window.getSelection(),c&&c.rangeCount>0&&(o=c.getRangeAt(0))),document.body.appendChild(s),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const b=document.createRange();b.selectNodeContents(s),c&&(c.removeAllRanges(),c.addRange(b)),s.setSelectionRange(0,r.length)}else s.focus({preventScroll:!0}),s.select();if(document.execCommand("copy"))return"exec"}catch{}finally{s&&s.parentNode&&s.parentNode.removeChild(s),c&&(c.removeAllRanges(),o&&c.addRange(o))}}return"failed"}async function dx(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const s=await navigator.clipboard.readText();return!s||s.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:s}}catch(s){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(s==null?void 0:s.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function fx(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const s=await navigator.clipboard.read();if(!s||s.length===0)return{ok:!1,reason:"empty"};for(const o of s){const c=o.types.find(f=>f.startsWith("image/"));if(c){const f=await o.getType(c);if(f&&f.size>0)return{ok:!0,blob:f}}}return{ok:!1,reason:"empty"}}catch(s){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const o=s==null?void 0:s.name;return o==="SecurityError"?{ok:!1,reason:"insecure"}:o==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function Lp(r){const s=r.clipboardData;if(!s)return null;if(s.files&&s.files.length>0)for(let o=0;o<s.files.length;o++){const c=s.files[o];if(c&&c.type.startsWith("image/"))return c}if(s.items&&s.items.length>0)for(let o=0;o<s.items.length;o++){const c=s.items[o];if(c&&c.type.startsWith("image/")){const f=c.getAsFile();if(f)return f}}return null}function mx(r){if(!r||r.length===0)return null;for(let s=0;s<r.length;s++){const o=r[s];if(o&&(o.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(o.name)))return o}return null}const ls="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",as="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",hx=({anchorPoint:r,hasSelection:s,isController:o,vibrateOnKeyPress:c=!1,onCopySelection:f,onCopyLine:m,onCopyScreen:b,onPaste:p,onClose:g})=>{const{t:S}=yt(),v=x.useRef(null),[C,Y]=x.useState(null);x.useEffect(()=>{if(c&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[c]),x.useLayoutEffect(()=>{const k=v.current;if(!k||!k.parentElement)return;const Z=k.parentElement.getBoundingClientRect(),P=k.getBoundingClientRect(),F=P.width||208,ce=P.height||220,ue=Z.width,H=Z.height;let z=r.x-F/2;z=Math.max(8,Math.min(Math.max(8,ue-F-8),z));let A=r.y-ce-8;A<8&&(A=r.y+8),A=Math.max(8,Math.min(Math.max(8,H-ce-8),A)),Y({x:z,y:A})},[r.x,r.y,s,o]);const L=Math.max(8,r.x-104),O=Math.max(8,r.y-200),V={position:"absolute",left:`${C?C.x:L}px`,top:`${C?C.y:O}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:V,onMouseDown:k=>k.stopPropagation(),onTouchStart:k=>k.stopPropagation(),onPointerDown:k=>k.stopPropagation(),children:u.jsxs(Qt,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[s&&u.jsxs("button",{type:"button",role:"menuitem",className:J(ls,as),onClick:()=>{f(),g()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.copySelection")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:J(ls,as),onClick:()=>{m(),g()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.copyLine")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:J(ls,as),onClick:()=>{b(),g()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.copyScreen")})]}),o&&u.jsxs("button",{type:"button",role:"menuitem",className:J(ls,as),onClick:()=>{p(),g()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.paste")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:J(ls,as),onClick:g,children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.cancel")})]})]})})},px=({isOpen:r,onClose:s,onSend:o,onSendImage:c})=>{const{t:f,addToast:m}=yt(),[b,p]=x.useState(""),[g,S]=x.useState(null),[v,C]=x.useState(!1),Y=x.useRef(null),L=x.useRef(null),O=x.useRef(null);x.useEffect(()=>{r&&(p(""),S(null),C(!1),Y.current&&(Y.current.value=""),L.current&&(L.current.value=""))},[r]);const V=async H=>{if(H.size===0){m("error",f("clipboard.fileEmpty"));return}C(!0);try{const z=await fp(H);z?(S(z),p("")):m("error",f("clipboard.imageTooLarge"))}catch(z){console.error("Failed to process image:",z),m("error",f("clipboard.imageTooLarge"))}finally{C(!1)}},k=async H=>{const z=Lp(H);z&&(H.preventDefault(),await V(z))},Z=async H=>{const z=mx(H.target.files);H.target.value="",z&&await V(z)},P=H=>{const z=H.target.value;p(z),z&&g&&S(null)},F=()=>{S(null),Y.current&&(Y.current.value=""),L.current&&(L.current.value="")},ce=()=>{g?(c==null||c(g),s()):b.trim()&&(o(b),s())},ue=!!(b.trim()||g);return u.jsx(wu,{isOpen:r,onClose:s,title:f("clipboard.pasteTitle"),closeLabel:f("clipboard.cancel"),size:"sm",footer:u.jsxs("div",{className:"flex items-center justify-end gap-2",children:[u.jsx(Le,{variant:"ghost",onClick:s,children:f("clipboard.cancel")}),u.jsx(Le,{variant:"primary",onClick:ce,disabled:!ue||v,children:f("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:f("clipboard.pasteHint")}),u.jsx("textarea",{ref:O,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:f("clipboard.pasteHint"),value:b,onChange:P,onPaste:k,disabled:!!g||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:f("clipboard.imageSectionTitle")})})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx("input",{ref:Y,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:L,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:Z}),g?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:g.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:f("clipboard.imageCompressedSize",{size:Uy(g.byteLength)})}),u.jsx(Le,{variant:"ghost",onClick:F,"aria-label":f("clipboard.removeImage"),children:f("clipboard.cancel")})]})]}):u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx(Le,{variant:"default",onClick:()=>{var H;return(H=Y.current)==null?void 0:H.click()},disabled:v||!!b.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":f("clipboard.chooseImage"),children:f("clipboard.chooseImage")}),u.jsx(Le,{variant:"default",onClick:()=>{var H;return(H=L.current)==null?void 0:H.click()},disabled:v||!!b.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":f("clipboard.takePhoto"),children:f("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:f("clipboard.imageCompressing")})})]})]})})},bx=250,gx=({onTerminalFocus:r,isActive:s=!0})=>{const o=x.useRef(null),c=x.useRef(null),f=x.useRef(null),m=x.useRef(null),b=x.useRef(1),p=x.useRef({cols:0,rows:0}),g=x.useRef(null),S=x.useRef(null),v=x.useRef(null),C=x.useRef(null),Y=x.useRef({width:0,height:0}),L=x.useRef(null),O=xy(),V=O||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,k=typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1",[Z,P]=x.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}),{isController:F,connectionState:ce,settings:ue,hostPalette:H,terminalResetVersion:z,sendResize:A,sendBinary:te,addToast:ze,warnViewerMode:Ee,connect:Te,subscribeToOutput:Ne,subscribeToPasteFileReady:Me,uploadImage:Oe,t:R}=yt(),q=el.useMemo(()=>zy(H),[H]),Q=x.useRef(q);Q.current=q;const me=x.useRef(F);me.current=F;const B=x.useRef(te);B.current=te;const Ue=x.useRef(ze);Ue.current=ze;const je=x.useRef(Ee);je.current=Ee;const X=x.useRef(A);X.current=A;const ve=x.useRef(Oe);ve.current=Oe;const fe=x.useRef(s);fe.current=s;const ie=x.useRef(R);ie.current=R;const rt=x.useRef(null),[Ke,ye]=x.useState(null),Fe=x.useRef(null);Fe.current=Ke;const[ot,et]=x.useState(null),mt=x.useRef(null);mt.current=ot;const[pt,zt]=x.useState(""),Yt=x.useRef("");Yt.current=pt;const[tl,Lt]=x.useState(!1),Jt=x.useRef(!1);Jt.current=tl;const Ot=x.useRef(!1),[cn,It]=x.useState(0),Kt=x.useRef(null),$=x.useRef(null),Ce=x.useRef(null),he=x.useRef(null),[ut,Wt]=x.useState(!1),Pt=x.useCallback(W=>{var bt;const ee=m.current;if(!ee)return;const Ae=((bt=f.current)==null?void 0:bt.querySelector(".xterm-screen"))||f.current,He=Yh(W,ee,Ae,b.current);if(He){Ce.current=He;const se=nu(ee,He.col,He.bufferRow);he.current=se;const _=sx(ee,He.col,He.bufferRow);if(_){const D={startCol:_.startCol,endCol:_.startCol+_.length-1,startRow:He.bufferRow,endRow:He.bufferRow},I=Gh(D,se),ne=lu(ee,I);et(I),zt(ne),Lt(!0)}else et(null),zt(""),Lt(!1),Ce.current=null,he.current=null}else et(null),zt(""),Lt(!1),Ce.current=null,he.current=null;Kt.current=W,$.current=null},[]),Ut=x.useCallback(W=>{var ne;const ee=m.current,Ae=Ce.current;if(!ee||!Ae)return;$.current=W;const He=((ne=f.current)==null?void 0:ne.querySelector(".xterm-screen"))||f.current,bt=Yh(W,ee,He,b.current);if(!bt)return;const se=he.current??nu(ee,Ae.col,Ae.bufferRow),_={startCol:Math.min(Ae.col,bt.col),endCol:Math.max(Ae.col,bt.col),startRow:Math.min(Ae.bufferRow,bt.bufferRow),endRow:Math.max(Ae.bufferRow,bt.bufferRow)},D=Gh(_,se),I=lu(ee,D);et(D),zt(I),Lt(!0)},[]),qn=x.useRef(Pt);qn.current=Pt;const wt=x.useRef(Ut);wt.current=Ut;const nl=x.useCallback(async()=>{const W=Yt.current;if(!W)return;await ga(W)==="failed"?Ue.current("error",ie.current("clipboard.copyFailed")):Ue.current("success",ie.current("clipboard.copied"))},[]),Gt=x.useCallback(async()=>{var D,I,ne,pe;const W=m.current;if(!W)return;const ee=(D=W.buffer)==null?void 0:D.active;if(!ee)return;const Ae=((I=mt.current)==null?void 0:I.startRow)??((ne=Ce.current)==null?void 0:ne.bufferRow)??ee.viewportY,He=he.current??nu(W,((pe=Ce.current)==null?void 0:pe.col)??0,Ae),bt={startCol:He.startCol,endCol:He.endCol,startRow:Ae,endRow:Ae},se=lu(W,bt);await ga(se)==="failed"?Ue.current("error",ie.current("clipboard.copyFailed")):Ue.current("success",ie.current("clipboard.copied"))},[]),yn=x.useCallback(async()=>{const W=m.current;if(!W)return;const ee=rx(W);await ga(ee)==="failed"?Ue.current("error",ie.current("clipboard.copyFailed")):Ue.current("success",ie.current("clipboard.copied"))},[]),qt=x.useCallback(async()=>{const W=m.current;if(W){if(!me.current){je.current();return}try{const ee=await fx();if(ee.ok){await ve.current(ee.blob);return}}catch{}try{const ee=await dx();if(ee.ok){W.paste(ee.text),Ue.current("success",ie.current("clipboard.pasted"));return}else if(ee.reason==="empty"){Ue.current("info",ie.current("clipboard.pasteUnavailable"));return}}catch{}Wt(!0)}},[]),ci=x.useCallback(W=>{const ee=m.current;if(ee){if(!me.current){je.current();return}ee.paste(W),Ue.current("success",ie.current("clipboard.pasted"))}},[]),va=x.useCallback(W=>{if(m.current){if(!me.current){je.current();return}ve.current(W)}},[]);x.useEffect(()=>Me(ee=>{const Ae=m.current;Ae&&(Ae.paste(ee),Ue.current("success",ie.current("clipboard.pasted")))}),[Me]);const xa=x.useCallback((W,ee)=>{!Number.isFinite(W)||!Number.isFinite(ee)||W<=0||ee<=0||W===p.current.cols&&ee===p.current.rows||(g.current={cols:W,rows:ee},!S.current&&(S.current=setTimeout(()=>{S.current=null;const Ae=g.current;g.current=null,Ae&&(Ae.cols===p.current.cols&&Ae.rows===p.current.rows||(p.current=Ae,X.current(Ae.cols,Ae.rows)))},bx)))},[]),ll=x.useCallback((W=!1)=>{const ee=m.current,Ae=o.current,He=f.current,bt=c.current;if(!ee||!Ae||!He||!bt)return;const se=eu(Ae,ai(),Wc());if(se.width<=0||se.height<=0)return;bt.style.width="100%",bt.style.height="100%",He.style.width="100%",He.style.height="100%",He.style.transform="none",He.style.transformOrigin="top left",b.current=1;const _=Hh(se),D=lx({lastSnapshot:L.current,currentSnapshot:_});if(D.isVisualZoom&&!W){L.current=_;try{ee.refresh(0,Math.max(0,ee.rows-1))}catch{}return}if(D.shouldIgnore&&!W)return;L.current=_;const I=ba(ee,oi),ne=Oh({width:se.width-Pv(He),height:se.height,cellWidth:I.cellWidth,cellHeight:I.cellHeight}),pe=Math.abs(se.width-Y.current.width)>1||Math.abs(se.height-Y.current.height)>1;if(ee.cols!==ne.cols||ee.rows!==ne.rows)try{ee.resize(ne.cols,ne.rows)}catch(_e){console.debug("Error resizing terminal grid:",_e)}const Re=ne.cols!==p.current.cols||ne.rows!==p.current.rows;fe.current&&(pe||W||Re)&&(Y.current={width:se.width,height:se.height},xa(ne.cols,ne.rows));try{ee.refresh(0,Math.max(0,ee.rows-1))}catch{}},[xa]),Ln=x.useRef(ll);Ln.current=ll;const Xn=x.useCallback(()=>{if(v.current===null){if(typeof requestAnimationFrame!="function"){Ln.current();return}v.current=requestAnimationFrame(()=>{v.current=null,Ln.current()})}},[]),$t=x.useCallback((W=30)=>{C.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(C.current),C.current=null);let ee=0;const Ae=()=>{C.current=null,ee++;const He=ee>=W;Ln.current(!0),!He&&ee<2&&typeof requestAnimationFrame=="function"&&(C.current=requestAnimationFrame(Ae))};typeof requestAnimationFrame=="function"?C.current=requestAnimationFrame(Ae):Ae()},[]);x.useEffect(()=>{var Ct,di;if(!o.current||!f.current)return;const W=o.current,ee=eu(W,ai(),Wc()),Ae=ba(null,oi),He=Oh({width:ee.width,height:ee.height,cellWidth:Ae.cellWidth,cellHeight:Ae.cellHeight});X.current(He.cols,He.rows),Y.current={width:ee.width,height:ee.height},L.current=Hh(ee);const bt=yh(ue.fontSize,ee.width),se=new Zv.Terminal({fontSize:bt,fontFamily:Nh(ue.fontFamily),lineHeight:1.15,...Q.current?{theme:{...Q.current}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:He.cols,rows:He.rows,screenReaderMode:!1});try{const le=new Fv.Unicode11Addon;se.loadAddon(le),se.unicode.activeVersion="11"}catch(le){console.debug("Unicode11 addon unavailable, using default width table:",le)}se.open(f.current),m.current=se,O&&se.textarea&&(se.textarea.readOnly=!1,se.textarea.tabIndex=0,se.textarea.inputMode="text");let _=()=>{};if(k&&se.textarea){const le=()=>{P(be=>({...be,focused:document.activeElement===se.textarea}))};se.textarea.addEventListener("focus",le),se.textarea.addEventListener("blur",le),_=()=>{var be,tt;(be=se.textarea)==null||be.removeEventListener("focus",le),(tt=se.textarea)==null||tt.removeEventListener("blur",le)},le()}const D=async le=>{const be=Lp(le);if(be){if(le.preventDefault(),le.stopPropagation(),!me.current){je.current();return}await ve.current(be)}};(Ct=se.textarea)==null||Ct.addEventListener("paste",D),W.addEventListener("paste",D);const I=nx(se,{coarsePointer:O,onRendererSwapped:()=>{try{se.refresh(0,Math.max(0,se.rows-1))}catch{}}});W&&(W.dataset.renderer=I.kind);const ne=ie.current("terminal.bannerTitle"),pe=ie.current("terminal.bannerSubtitle");if(se.writeln(" ___ ___ .___ "),se.writeln(` / | \\ ____ _______| _/______ \x1B[1m${ne}\x1B[0m`),se.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${pe}\x1B[0m`),se.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),se.writeln(" \\___|_ / \\___ >|__| /___/____ >"),se.writeln(" \\/ \\/ \\/ "),se.writeln(""),!O)try{se.focus()}catch{}typeof document<"u"&&"fonts"in document&&typeof((di=document.fonts)==null?void 0:di.load)=="function"&&document.fonts.load('13px "Symbols Nerd Font Mono"').then(()=>{if(m.current){try{m.current.refresh(0,Math.max(0,m.current.rows-1))}catch{}$t(5)}}).catch(()=>{});const Re=se.onData(le=>{const be=Wh(le);if(!me.current&&!au(be)){je.current();return}B.current(be)}),_e=se.onBinary(le=>{const be=new Uint8Array(le.length);for(let tt=0;tt<le.length;tt++)be[tt]=le.charCodeAt(tt)&255;!me.current&&!au(be)||B.current(be)}),Pe=typeof se.onWriteParsed=="function"?se.onWriteParsed(()=>{Ot.current=!0}):{dispose:()=>{}},Qe=typeof se.onRender=="function"?se.onRender(le=>{const be=se.buffer.active.viewportY??0;It(be);const tt=mt.current;if(tt&&Jt.current){const xn=tt.startRow-be,Sn=tt.endRow-be;Ot.current&&le.start<=Sn&&le.end>=xn&&(Lt(!1),Ot.current=!1)}else Ot.current=!1}):{dispose:()=>{}},un=typeof se.onScroll=="function"?se.onScroll(()=>{const le=se.buffer.active.viewportY??0;It(le)}):{dispose:()=>{}},vt=new ex({getTerminal:()=>m.current,getIsController:()=>me.current,getScale:()=>b.current,getSurfaceElement:()=>f.current,allowSyntheticMouseFallback:!1,onFocus:()=>{try{se.focus()}catch{}k&&P(le=>({...le,focused:document.activeElement===se.textarea})),r==null||r()},onGestureStateChange:le=>{k&&P(be=>({...be,state:le}))},onGestureScroll:({deltaY:le,lines:be,viewportY:tt,scrollTop:xn,scrollHeight:Sn,clientHeight:Fn,moved:xe,bufferType:Bt,baseY:gt,cursorY:Et,hasScrollback:jt,mouseTracking:Qn,scrollMode:Ur})=>{k&&P(wa=>({...wa,deltaY:le,lines:be,viewportY:tt,scrollTop:xn,scrollHeight:Sn,clientHeight:Fn,moved:xe,focused:document.activeElement===se.textarea,bufferType:Bt,baseY:gt,cursorY:Et,hasScrollback:jt,mouseTracking:Qn,scrollMode:Ur,scrollCalls:wa.scrollCalls+(be!==0?1:0),lastScrollLines:be}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:O?(le=>{var be;return(be=qn.current)==null?void 0:be.call(qn,le)}):void 0,onSelectionExtend:O?(le=>{var be;return(be=wt.current)==null?void 0:be.call(wt,le)}):void 0}),vn=typeof window<"u"&&"PointerEvent"in window,ui=typeof TouchEvent<"u",Nl=[],en=(le,be=!1)=>{const tt=le.target;return tt instanceof Node&&W.contains(tt)||be&&vt.getState()!=="idle"};if(vn){const le={passive:!1,capture:!0},be=xe=>{k&&P(Bt=>({...Bt,pointerEvents:Bt.pointerEvents+1,lastInputEvent:xe}))},tt=xe=>{if(!en(xe))return;if(be("pointerdown"),Fe.current){ye(null),Fe.current=null,et(null),mt.current=null,zt(""),Yt.current="",Lt(!1),Kt.current=null,$.current=null,xe.cancelable&&xe.preventDefault(),xe.stopPropagation();return}vt.handlePointerDown(xe,W)&&xe.stopPropagation()},xn=xe=>{en(xe,!0)&&(be("pointermove"),vt.handlePointerMove(xe),xe.pointerType!=="mouse"&&xe.stopPropagation())},Sn=xe=>{if(!en(xe,!0))return;if(be("pointerup"),vt.getState()==="longpress"&&rt.current){const gt=$.current??Kt.current;if(gt){const Et=rt.current.getBoundingClientRect(),jt=gt.clientX-Et.left,Qn=gt.clientY-Et.top;ye({x:jt,y:Qn}),Fe.current={x:jt,y:Qn}}}vt.handlePointerUp(xe),xe.pointerType!=="mouse"&&xe.stopPropagation()},Fn=xe=>{en(xe,!0)&&(be("pointercancel"),ye(null),Fe.current=null,et(null),mt.current=null,zt(""),Yt.current="",Lt(!1),Kt.current=null,$.current=null,vt.handlePointerCancel(xe),xe.pointerType!=="mouse"&&xe.stopPropagation())};if(document.addEventListener("pointerdown",tt,le),document.addEventListener("pointermove",xn,le),document.addEventListener("pointerup",Sn,le),document.addEventListener("pointercancel",Fn,le),Nl.push(()=>{document.removeEventListener("pointerdown",tt,le),document.removeEventListener("pointermove",xn,le),document.removeEventListener("pointerup",Sn,le),document.removeEventListener("pointercancel",Fn,le)}),ui){const xe=gt=>{en(gt,!0)&&(k&&P(Et=>({...Et,touchEvents:Et.touchEvents+1})),gt.cancelable&&gt.preventDefault(),gt.stopPropagation())},Bt=["touchstart","touchmove","touchend","touchcancel"];for(const gt of Bt)document.addEventListener(gt,xe,le);Nl.push(()=>{for(const gt of Bt)document.removeEventListener(gt,xe,le)})}}else{const le={passive:!1,capture:!0},be=xe=>{k&&P(Bt=>({...Bt,touchEvents:Bt.touchEvents+1,lastInputEvent:xe}))},tt=xe=>{if(en(xe)){if(be("touchstart"),Fe.current){ye(null),Fe.current=null,et(null),mt.current=null,zt(""),Yt.current="",Lt(!1),Kt.current=null,$.current=null,xe.cancelable&&xe.preventDefault(),xe.stopPropagation();return}xe.touches.length===1&&xe.stopPropagation(),vt.handleTouchStart(xe,W)}},xn=xe=>{en(xe,!0)&&(be("touchmove"),xe.touches.length===1&&xe.stopPropagation(),vt.handleTouchMove(xe))},Sn=xe=>{if(!en(xe,!0))return;if(be("touchend"),vt.getState()==="longpress"&&rt.current){const gt=$.current??Kt.current;if(gt){const Et=rt.current.getBoundingClientRect(),jt=gt.clientX-Et.left,Qn=gt.clientY-Et.top;ye({x:jt,y:Qn}),Fe.current={x:jt,y:Qn}}}xe.stopPropagation(),vt.handleTouchEnd(xe)},Fn=xe=>{en(xe,!0)&&(be("touchcancel"),ye(null),Fe.current=null,et(null),mt.current=null,zt(""),Yt.current="",Lt(!1),Kt.current=null,$.current=null,xe.stopPropagation(),vt.handleTouchCancel())};document.addEventListener("touchstart",tt,le),document.addEventListener("touchmove",xn,le),document.addEventListener("touchend",Sn,le),document.addEventListener("touchcancel",Fn,le),Nl.push(()=>{document.removeEventListener("touchstart",tt,le),document.removeEventListener("touchmove",xn,le),document.removeEventListener("touchend",Sn,le),document.removeEventListener("touchcancel",Fn,le)})}const Sa=le=>{le.preventDefault()};W.addEventListener("contextmenu",Sa),Nl.push(()=>{W.removeEventListener("contextmenu",Sa)});const il=new ResizeObserver(()=>{Xn()});il.observe(W);const On=()=>{Xn()},Zn=()=>{var le,be;if(document.visibilityState==="visible"){$t(10);try{(be=m.current)==null||be.refresh(0,Math.max(0,(((le=m.current)==null?void 0:le.rows)||1)-1))}catch{}}};window.addEventListener("resize",On),window.addEventListener("orientationchange",On),document.addEventListener("visibilitychange",Zn),window.addEventListener("pageshow",Zn);const Un=()=>{Xn()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",Un),window.visualViewport.addEventListener("scroll",Un)),()=>{var le;Re.dispose(),_e.dispose(),Qe.dispose(),un.dispose(),Pe.dispose(),vt.handlePointerCancel();for(const be of Nl)be();il.disconnect(),window.removeEventListener("resize",On),window.removeEventListener("orientationchange",On),document.removeEventListener("visibilitychange",Zn),window.removeEventListener("pageshow",Zn),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",Un),window.visualViewport.removeEventListener("scroll",Un)),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),_(),(le=se.textarea)==null||le.removeEventListener("paste",D),W.removeEventListener("paste",D),I.dispose(),se.dispose(),m.current=null}},[]),x.useEffect(()=>{const W=m.current;if(!W)return;const ee=eu(o.current,ai(),Wc());W.options.fontSize=yh(ue.fontSize,ee.width),W.options.fontFamily=Nh(ue.fontFamily);try{W.refresh(0,Math.max(0,W.rows-1))}catch{}$t(10)},[ue.fontSize,ue.fontFamily]);const al=x.useRef(z);x.useEffect(()=>{var ee;if(al.current===z)return;al.current=z;const W=m.current;if(W)try{(ee=W.reset)==null||ee.call(W),W.clear(),W.refresh(0,Math.max(0,W.rows-1))}catch{}},[z]),x.useEffect(()=>{const W=m.current;if(!(!W||!q)){W.options.theme={...q};try{W.refresh(0,Math.max(0,W.rows-1))}catch{}}},[q]),x.useEffect(()=>Ne(ee=>{const Ae=m.current;if(!Ae)throw new Error("terminal not ready");Ae.write(ee)}),[Ne]),x.useEffect(()=>{if(!s)return;$t(10);const W=m.current;if(W){try{W.refresh(0,Math.max(0,W.rows-1))}catch{}if(!O)try{W.focus()}catch{}}},[s,O,$t]),x.useEffect(()=>{ce==="disconnected"&&Te()},[]);const Vn=W=>{W.preventDefault()};return u.jsxs("main",{ref:rt,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:Vn,"aria-label":R("terminal.windowAriaLabel"),children:[u.jsx("div",{id:"terminal-container",ref:o,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:V?"none":"auto"},tabIndex:0,onContextMenu:Vn,"aria-label":R("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:f,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),k&&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}`]}),O&&ot&&tl&&(()=>{var Re;const W=m.current;if(!W||!rt.current)return null;const ee=ba(W);if(ee.cellWidth<=0||ee.cellHeight<=0)return null;const Ae=((Re=f.current)==null?void 0:Re.querySelector(".xterm-screen"))||f.current;if(!Ae)return null;const He=Ae.getBoundingClientRect(),bt=rt.current.getBoundingClientRect(),se=ot.startRow-cn;if(ot.endRow-cn<0||se>=W.rows)return null;const D=He.top-bt.top+se*ee.cellHeight,I=He.left-bt.left+ot.startCol*ee.cellWidth,ne=(ot.endCol-ot.startCol+1)*ee.cellWidth,pe=(ot.endRow-ot.startRow+1)*ee.cellHeight;return u.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${D}px`,left:`${I}px`,width:`${ne}px`,height:`${pe}px`}})})(),O&&Ke&&u.jsx(hx,{anchorPoint:Ke,hasSelection:!!pt,isController:F,vibrateOnKeyPress:ue.vibrateOnKeyPress,onCopySelection:nl,onCopyLine:Gt,onCopyScreen:yn,onPaste:qt,onClose:()=>{ye(null),Fe.current=null,et(null),mt.current=null,zt(""),Yt.current="",Lt(!1)}}),O&&u.jsx(px,{isOpen:ut,onClose:()=>Wt(!1),onSend:ci,onSendImage:va})]})},yx=({onPairedSuccess:r})=>{const{settings:s,updateSettings:o,connect:c,connectionState:f,stateDetail:m,addToast:b,t:p}=yt(),[g,S]=x.useState(""),[v,C]=x.useState(null),[Y,L]=x.useState(!1),[O,V]=x.useState(s.wsUrl||"/ws/client"),[k,Z]=x.useState(s.token||""),[P,F]=x.useState(s.clientId||""),ce="node bin/service.js pair",ue="node bin/config-tui.js",H="herdr plugin pane open --plugin herdr.remote.web --entrypoint config --placement zoomed --focus",z=Ee=>{ga(Ee).then(Te=>{if(Te==="failed"){b("error",p("clipboard.copyFailed"));return}C(Ee),b("success",p("toasts.commandCopied")),setTimeout(()=>C(null),2e3)})},A=Ee=>{Ee.preventDefault();const Te=g.trim().toUpperCase();if(!Te&&!k.trim()){b("warning",p("toasts.connectionError"));return}const Ne={pairCode:Te,wsUrl:O.trim()||"/ws/client",clientId:P.trim()||s.clientId};k.trim()&&(Ne.token=k.trim()),o(Ne),c({pairCode:Te||void 0,token:k.trim()||void 0,wsUrl:O.trim()||"/ws/client",clientId:P.trim()||s.clientId}),r&&r()},te=f==="connecting"||f==="reconnecting",ze=({n:Ee})=>u.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",Ee,"]"]});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:p("onboarding.title")}),u.jsx("span",{className:"text-tui uppercase text-tui-warn",children:p("onboarding.firstTimeSetup")})]}),u.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:p("onboarding.description")})]}),f==="error"&&u.jsxs(Rr,{tone:"warn",action:u.jsx(Le,{variant:"warn",onClick:()=>c(),children:p("common.retry")}),children:[u.jsx("span",{className:"block font-bold",children:p("onboarding.authRequired")}),u.jsx("span",{className:"block text-tui-muted",children:m||p("onboarding.authRequiredDesc")})]}),u.jsxs("form",{onSubmit:A,className:"grid gap-3",children:[u.jsx(Qt,{title:p("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(ze,{n:1}),u.jsx("span",{className:"leading-snug",children:p("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:ce}),u.jsx(Le,{onClick:()=>z(ce),glyph:v===ce?Ye.check:"⧉",className:J("shrink-0",v===ce&&"border-tui-ok text-tui-ok"),children:p(v===ce?"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:p("onboarding.step1CopyPlugin")}),u.jsx("button",{type:"button",onClick:()=>z(H),className:"tui-focusable shrink-0 text-tui-accent underline-offset-2 hover:underline",children:p(v===H?"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:p("onboarding.step1TuiNote")}),u.jsx("code",{onClick:()=>z(ue),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:p("common.clickToCopy"),children:ue})]})]})]})}),u.jsx(Qt,{title:p("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(ze,{n:2}),u.jsx(kn,{type:"text",value:g,onChange:Ee=>S(Ee.target.value.toUpperCase()),placeholder:p("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":p("onboarding.step2Title"),className:"font-bold uppercase"})]}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("onboarding.step2Note")})]})}),u.jsx(Le,{variant:"primary",type:"submit",block:!0,disabled:te,className:"py-1.5",children:te?u.jsx(ri,{label:p("onboarding.connectingAndPairing")}):p("onboarding.connectAndPair")}),u.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[u.jsxs("button",{type:"button",onClick:()=>L(!Y),"aria-expanded":Y,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:Y?Ye.chevronDown:Ye.chevronRight}),u.jsx("span",{className:"uppercase",children:p("onboarding.advancedTitle")})]}),Y&&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(zn,{htmlFor:"onboarding-token",children:p("onboarding.manualTokenLabel")}),u.jsx(kn,{id:"onboarding-token",type:"password",value:k,onChange:Ee=>Z(Ee.target.value),placeholder:p("onboarding.manualTokenPlaceholder")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(zn,{htmlFor:"onboarding-ws",children:p("onboarding.wsEndpointLabel")}),u.jsx(kn,{id:"onboarding-ws",type:"text",value:O,onChange:Ee=>V(Ee.target.value),placeholder:p("onboarding.wsEndpointPlaceholder")})]}),u.jsx(si,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(zn,{htmlFor:"onboarding-client-id",children:p("onboarding.clientIdLabel")}),u.jsx(kn,{id:"onboarding-client-id",type:"text",value:P,onChange:Ee=>F(Ee.target.value)})]})]})]})]})]})})},li="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",is="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",vx="border-tui-accent bg-tui-accent text-tui-crust font-bold",xx="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",Sx=({compact:r=!1})=>{const{sendKey:s,settings:o,updateSettings:c,isController:f,warnViewerMode:m,t:b,uploadProgress:p,uploadImage:g}=yt(),S="h-9 min-w-[2.25rem] px-2",v="h-9 w-9",C="h-9 px-2",Y="min-h-[44px] min-w-[44px] px-2.5 gap-1 touch-manipulation",L=x.useRef(null),O=x.useRef(null),V=x.useCallback(()=>{if(o.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[o.vibrateOnKeyPress]),k=x.useCallback(()=>{var X;if(V(),!f){m();return}p.active||(X=L.current)==null||X.click()},[V,f,m,p.active]),Z=x.useCallback(X=>{const ve=X.target.files,fe=ve&&ve[0];X.target.value="",fe&&g(fe)},[g]),P=()=>u.jsxs(u.Fragment,{children:[u.jsx("input",{ref:L,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"key-toolbar-file-input",onChange:Z}),u.jsx("input",{ref:O,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:Z})]}),F=(X=!1)=>p.active?u.jsx("div",{"data-testid":X?"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(Yv,{ratio:p.ratio,label:p.statusText,tone:p.phase==="completed"?"ok":p.phase==="error"?"bad":"accent","aria-label":p.statusText})}):null,ce=(X=!1)=>{const ve=p.active;return u.jsxs("button",{type:"button","data-testid":X?"image-upload-btn-collapsed":"image-upload-btn",onClick:k,disabled:ve,className:J(li,X?"min-h-[44px] min-w-[44px] px-2 text-tui-xs gap-1 touch-manipulation":Y,ve?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":is),title:ve?p.statusText:b("virtualKeyboard.uploadImageTitle"),"aria-label":b("virtualKeyboard.uploadImage"),children:[u.jsx("span",{"aria-hidden":"true",children:"🖼️"}),u.jsx("span",{className:J("font-medium",X?"text-tui-xs":"text-tui-sm"),children:ve?`${p.percent}%`:b("virtualKeyboard.image")})]})},[ue,H]=x.useState(!1),[z,A]=x.useState(!1),[te,ze]=x.useState(!1),[Ee,Te]=x.useState(!1),[Ne,Me]=x.useState(!1),[Oe,R]=x.useState(!1),q=x.useCallback((X,ve=!1)=>{if(V(),!f){m();return}let fe=X;ve&&(ue||z||te)&&(fe=cy(X,{ctrl:ue,alt:z,shift:te})),s(fe),ue&&H(!1),z&&A(!1),te&&ze(!1)},[f,ue,z,te,s,m,V,b]);if(!o.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:[P(),F(!0),u.jsxs("div",{className:"flex items-center justify-center gap-2 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:b("virtualKeyboard.expandToolbar"),"aria-label":b("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[u.jsx("span",{"aria-hidden":"true",children:"▴"}),u.jsx("span",{"aria-hidden":"true",children:b("common.keyBar")})]}),ce(!0)]})]});const Q=o.virtualKeys&&o.virtualKeys.length>0?o.virtualKeys.filter(X=>X.enabled):lp,me=X=>X.id==="left"?u.jsx("span",{"aria-hidden":"true",children:"←"}):X.id==="up"?u.jsx("span",{"aria-hidden":"true",children:"↑"}):X.id==="down"?u.jsx("span",{"aria-hidden":"true",children:"↓"}):X.id==="right"?u.jsx("span",{"aria-hidden":"true",children:"→"}):X.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:b("virtualKeyboard.keyEnter")})]}):X.id==="drawer_chords"?u.jsx("span",{children:"^C"}):X.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:Ee?"▾":"▴"})]}):u.jsx("span",{children:X.label}),B=X=>{if(V(),X.type==="modifier"){X.modifierType==="ctrl"?H(!ue):X.modifierType==="alt"?A(!z):X.modifierType==="shift"?ze(!te):X.modifierType==="meta"&&q(we.ESC);return}if(X.type==="drawer"){X.drawerType==="fn"?(Te(!Ee),Me(!1),R(!1)):X.drawerType==="chords"?(R(!Oe),Te(!1),Me(!1)):X.drawerType==="symbols"&&(Me(!Ne),Te(!1),R(!1));return}q(X.code,X.isPlainChar||X.type==="symbol")},Ue=X=>{if(X.type==="modifier"){if(X.modifierType==="ctrl")return ue;if(X.modifierType==="alt")return z;if(X.modifierType==="shift")return te}if(X.type==="drawer"){if(X.drawerType==="fn")return Ee;if(X.drawerType==="chords")return Oe;if(X.drawerType==="symbols")return Ne}return!1},je=(X,ve,fe,ie,rt="default")=>u.jsxs("button",{type:"button",onClick:()=>q(X),className:J(li,"h-8 gap-1.5 px-2",rt==="bad"?"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust":rt==="warn"?"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust":is),title:fe,children:[u.jsx("span",{className:"font-bold",children:ve}),u.jsx("span",{className:"text-tui-sm opacity-70",children:ie})]});return u.jsxs("div",{"data-testid":"key-toolbar",className:J("z-20 flex shrink-0 select-none flex-col border-t border-tui-border bg-tui-mantle",r?"pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]":"pb-[max(env(safe-area-inset-bottom,0px),0.25rem)]"),role:"toolbar","aria-label":b("virtualKeyboard.touchKeyboardShortcuts"),children:[P(),F(!1),Ee&&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(X=>{const ve=`F${X}`;return u.jsxs("button",{type:"button",onClick:()=>q(we[ve]),className:J(li,is,"h-8"),children:["F",X]},ve)})}),Oe&&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:[je(we.CTRL_C,"^C",b("virtualKeyboard.ctrlCTitle"),b("virtualKeyboard.badgeSigint"),"bad"),je(we.CTRL_D,"^D",b("virtualKeyboard.ctrlDTitle"),b("virtualKeyboard.badgeEof")),je(we.CTRL_Z,"^Z",b("virtualKeyboard.ctrlZTitle"),b("virtualKeyboard.badgeTstp"),"warn"),je(we.CTRL_L,"^L",b("virtualKeyboard.ctrlLTitle"),b("virtualKeyboard.badgeClear")),je(we.CTRL_R,"^R",b("virtualKeyboard.ctrlRTitle"),b("virtualKeyboard.badgeSearch")),je(we.CTRL_A,"^A",b("virtualKeyboard.ctrlATitle"),b("virtualKeyboard.badgeStart")),je(we.CTRL_E,"^E",b("virtualKeyboard.ctrlETitle"),b("virtualKeyboard.badgeEnd")),je(we.CTRL_K,"^K",b("virtualKeyboard.ctrlKTitle"),b("virtualKeyboard.badgeKill"))]}),Ne&&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(X=>u.jsx("button",{type:"button",onClick:()=>q(X,!0),className:J(li,is,"h-8 w-8 font-bold"),children:X},X))}),u.jsxs("div",{"data-testid":"key-toolbar-row",className:J("flex flex-wrap items-center justify-center gap-1",r?"px-1.5 py-1":"px-2 py-1.5"),children:[u.jsx("button",{type:"button",onClick:()=>c({toolbarVisible:!1}),className:J(li,v,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:b("virtualKeyboard.collapseToolbar"),"aria-label":b("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:u.jsx("span",{"aria-hidden":"true",children:"▾"})}),Q.map(X=>{const ve=Ue(X),fe=X.id==="enter",ie=["left","up","down","right"].includes(X.id),rt=X.type==="drawer",Ke=iu(X,b),ye=u.jsx("button",{type:"button",onClick:()=>B(X),className:J(li,ie?v:rt?C:S,fe?xx:ve?vx:is),title:Ke,"aria-label":Ke,"aria-pressed":ve,children:me(X)},X.id);return fe?u.jsxs(el.Fragment,{children:[ce(!1),ye]},"enter-with-image"):ye}),!Q.some(X=>X.id==="enter")&&ce(!1)]})]})},wx=["ls -la","clear","git status","pwd","top","exit","cat"],Cx=({isOpen:r,onClose:s})=>{const{sendKey:o,isController:c,warnViewerMode:f,t:m}=yt(),[b,p]=x.useState("");if(!r)return null;const g=v=>{if(v&&v.preventDefault(),!c){f();return}b.length>0?(o(b+"\r"),p("")):o("\r")},S=v=>{if(!c){f();return}o(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":m("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:m("virtualKeyboard.helperTitle")}),u.jsx(Le,{variant:"ghost",onClick:s,"aria-label":m("virtualKeyboard.closeHelper"),children:"esc"})]}),u.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:wx.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:g,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:m("virtualKeyboard.placeholder")}),u.jsx(kn,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:b,onChange:v=>p(v.target.value),placeholder:m("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),b.length>0&&u.jsx("button",{type:"button",onClick:()=>p(""),className:"tui-focusable absolute right-1 top-1/2 -translate-y-1/2 px-1 text-tui-faint hover:text-tui-bad","aria-label":m("virtualKeyboard.clearInput"),children:u.jsx("span",{"aria-hidden":"true",children:Ye.cross})})]}),u.jsx(Le,{variant:"primary",type:"submit",title:m("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:u.jsx("span",{className:"hidden sm:inline",children:m("virtualKeyboard.sendButton")})})]})]})};function Or(r,s){const o=(c,f)=>s?s(c):f;switch(r){case"connected":return{label:o("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:o("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:o("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:o("connection.reconnectNow","Reconnect now")};case"error":return{label:o("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:o("connection.retry","Retry")};default:return{label:o("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:o("connection.connect","Connect")}}}const Tx={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},Nx=({isOpen:r,onClose:s,isAddMode:o=!1})=>{const{settings:c,updateSettings:f,connect:m,disconnect:b,connectionState:p,hostId:g,addToast:S,t:v,activeProfile:C,activeProfileId:Y,addProfileAndConnect:L,renameProfile:O}=yt(),[V,k]=x.useState(c.wsUrl),[Z,P]=x.useState(c.token),[F,ce]=x.useState(c.pairCode),[ue,H]=x.useState(c.clientId),[z,A]=x.useState((C==null?void 0:C.displayName)||""),[te,ze]=x.useState(c.autoReconnect),[Ee,Te]=x.useState(!1);if(x.useEffect(()=>{r&&(k(c.wsUrl),P(o?"":c.token),ce(o?"":c.pairCode),H(c.clientId),A(o?"":(C==null?void 0:C.displayName)||""),ze(c.autoReconnect))},[r,o,c,C]),!r)return null;const Ne=q=>{q.preventDefault();const Q={wsUrl:V.trim()||"/ws/client",token:Z.trim(),pairCode:F.trim().toUpperCase(),clientId:ue.trim()||c.clientId,autoReconnect:te};if(!Q.token&&!Q.pairCode){S("warning",v("pairing.credentialsRequired"));return}o?L({...Q,displayName:z.trim()||void 0}):(f(Q),Y&&z.trim()&&O(Y,z),b(),m({wsUrl:Q.wsUrl,token:Q.token||void 0,pairCode:Q.pairCode||void 0,clientId:Q.clientId,autoReconnect:te})),s()},Me=()=>{const q=`client-${Math.random().toString(36).substring(2,8)}`;H(q)},Oe=()=>{const q=new URL(window.location.href);q.search="",F.trim()&&q.searchParams.set("pairCode",F.trim().toUpperCase()),ga(q.toString()).then(Q=>{if(Q==="failed"){S("error",v("clipboard.copyFailed"));return}Te(!0),S("success",v("toasts.pairingLinkCopied")),setTimeout(()=>Te(!1),2e3)})},R=Tx[p]??"idle";return u.jsxs(wu,{isOpen:r,onClose:s,title:v(o?"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:[p==="connected"&&u.jsx(Le,{variant:"danger",onClick:()=>{b(),s()},children:v("common.disconnect")}),u.jsx(Le,{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(Dn,{level:R}),u.jsx("span",{className:"text-tui-muted",children:v("common.status")}),u.jsx("span",{className:J(R==="ok"?"text-tui-ok":R==="bad"?"text-tui-bad":R==="warn"?"text-tui-warn":"text-tui-faint"),children:Or(p,v).label})]}),g&&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:g})]})]}),u.jsxs("form",{id:"pairing-form",onSubmit:Ne,className:"space-y-3",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(zn,{htmlFor:"pairing-name",children:v("pairing.displayNameLabel")}),u.jsx(kn,{id:"pairing-name",type:"text",value:z,onChange:q=>A(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(zn,{htmlFor:"pairing-code",hint:v("pairing.pairCodeNote"),children:v("pairing.pairCodeLabel")}),u.jsx(kn,{id:"pairing-code",type:"text",value:F,onChange:q=>ce(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(zn,{htmlFor:"pairing-token",hint:v("pairing.tokenNote"),children:v("pairing.tokenLabel")}),u.jsx(kn,{id:"pairing-token",type:"password",value:Z,onChange:q=>P(q.target.value),placeholder:v("pairing.tokenPlaceholder")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(zn,{htmlFor:"pairing-ws",children:v("pairing.wsUrlLabel")}),u.jsx(kn,{id:"pairing-ws",type:"text",value:V,onChange:q=>k(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(zn,{htmlFor:"pairing-client-id",children:v("pairing.clientIdLabel")}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(kn,{id:"pairing-client-id",type:"text",value:ue,onChange:q=>H(q.target.value),className:"flex-1"}),u.jsx(Le,{onClick:Me,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(du,{checked:te,onChange:ze,label:v("pairing.autoReconnectLabel"),description:v("pairing.autoReconnectDesc")})}),u.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:u.jsx(Le,{onClick:Oe,block:!0,glyph:Ee?Ye.check:"⧉",className:J(Ee&&"border-tui-ok text-tui-ok"),children:v("pairing.copyDirectLink")})})]})]})},Ex=({isOpen:r,onClose:s})=>{const{settings:o,updateSettings:c,addToast:f,language:m,setLanguage:b,t:p}=yt(),[g,S]=x.useState("appearance"),[v,C]=x.useState(!1);if(!r)return null;const Y=cu.find(H=>H.font===o.fontFamily),L=o.virtualKeys&&o.virtualKeys.length>0?o.virtualKeys:ds(),O=()=>{const H=sp();c({fontSize:H.fontSize,fontFamily:H.fontFamily,toolbarVisible:H.toolbarVisible,vibrateOnKeyPress:H.vibrateOnKeyPress,language:H.language,virtualKeys:H.virtualKeys}),f("info",p("settings.resetDefaultsToast"))},V=H=>{const z=L.map(A=>A.id===H?{...A,enabled:!A.enabled}:A);c({virtualKeys:z})},k=(H,z)=>{const A=z==="up"?H-1:H+1;if(A<0||A>=L.length)return;const te=[...L],ze=te[H];te[H]=te[A],te[A]=ze,c({virtualKeys:te})},Z=H=>{if(L.some(A=>A.id===H.id)){const A=L.map(te=>te.id===H.id?{...te,enabled:!0}:te);c({virtualKeys:A})}else{const A=[...L,{...H,enabled:!0}];c({virtualKeys:A})}C(!1)},P=H=>{const z=L.filter(A=>A.id!==H);c({virtualKeys:z})},F=()=>{c({virtualKeys:ds()}),f("info",p("toasts.keyLayoutReset"))},ce=10,ue=24;return u.jsxs(wu,{isOpen:r,onClose:s,title:p("settings.title"),subtitle:p("settings.subtitle"),closeLabel:p("common.closeDialog"),size:"lg",hints:[{keys:"esc",action:p("common.close")}],footer:u.jsxs(u.Fragment,{children:[u.jsx(Le,{variant:"ghost",onClick:O,children:p("settings.resetDefaults")}),u.jsx(Le,{variant:"primary",onClick:s,children:p("common.done")})]}),children:[u.jsx(vu,{tabs:[{id:"appearance",label:p("settings.tabAppearance"),index:1},{id:"virtualKeys",label:p("settings.tabVirtualKeys"),index:2}],activeId:g,onSelect:H=>S(H),className:"mb-3 border-b border-tui-border-dim pb-1"}),g==="appearance"&&u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(zn,{children:p("settings.languageLabel")}),u.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2",children:[u.jsx(zh,{name:"ui-language",checked:m==="zh",onChange:()=>b("zh"),label:"简体中文"}),u.jsx(zh,{name:"ui-language",checked:m==="en",onChange:()=>b("en"),label:"English"})]})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(zn,{htmlFor:"terminal-font-select",children:p("settings.fontFamilyLabel")}),u.jsxs(xu,{id:"terminal-font-select",value:o.fontFamily,onChange:H=>c({fontFamily:H.target.value}),"aria-label":p("settings.fontFamilyLabel"),children:[!Y&&u.jsx("option",{value:o.fontFamily,children:o.fontFamily}),cu.map(H=>u.jsx("option",{value:H.font,children:p(`fontPresets.${H.id}`)||H.name},H.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:o.fontFamily,fontSize:`${o.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(zn,{htmlFor:"terminal-font-size",children:p("settings.fontSizeLabel",{size:o.fontSize})}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Bv,{value:(o.fontSize-ce)/(ue-ce),width:24,className:"hidden shrink-0 sm:inline-flex"}),u.jsx("input",{id:"terminal-font-size",type:"range",min:ce,max:ue,step:1,value:o.fontSize,onChange:H=>c({fontSize:Number(H.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:p("settings.fontSizeCompact")}),u.jsx("span",{children:p("settings.fontSizeDefault")}),u.jsx("span",{children:p("settings.fontSizeLarge")})]}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("settings.mobileFontNote")}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("settings.windowZoomSharedNote")})]}),u.jsx(si,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(du,{checked:o.toolbarVisible,onChange:H=>c({toolbarVisible:H}),label:p("settings.touchKeyToolbar"),description:p("settings.touchKeyToolbarDesc")}),u.jsx(du,{checked:o.vibrateOnKeyPress,onChange:H=>c({vibrateOnKeyPress:H}),label:p("settings.touchHaptics"),description:p("settings.touchHapticsDesc")})]}),u.jsx(si,{}),u.jsxs("p",{className:"text-tui-sm leading-snug text-tui-faint",children:[u.jsx("span",{"aria-hidden":"true",className:"mr-1",children:Ye.arrowRight}),p("settings.colorPassthroughNote")]})]}),g==="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:p("virtualKeyboard.customizeTitle")}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("virtualKeyboard.customizeDesc")})]}),u.jsx(Le,{variant:"ghost",onClick:F,className:"shrink-0",children:p("virtualKeyboard.resetLayout")})]}),u.jsx("div",{className:"max-h-72 overflow-y-auto border border-tui-border bg-tui-mantle",children:L.map((H,z)=>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:H.enabled,onChange:()=>V(H.id),className:"sr-only",id:`toggle-${H.id}`}),u.jsx("label",{htmlFor:`toggle-${H.id}`,className:J("shrink-0 cursor-pointer select-none font-bold",H.enabled?"text-tui-ok":"text-tui-faint"),"aria-hidden":"true",children:H.enabled?"[x]":"[ ]"}),u.jsx(Kv,{className:J(!H.enabled&&"opacity-50"),children:H.label}),u.jsx("span",{className:"truncate text-tui-sm text-tui-muted",children:iu(H,p)})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.jsx(Le,{variant:"ghost",brackets:!1,disabled:z===0,onClick:()=>k(z,"up"),title:p("virtualKeyboard.moveUp"),"aria-label":p("virtualKeyboard.moveUp"),className:"px-1",children:"↑"}),u.jsx(Le,{variant:"ghost",brackets:!1,disabled:z===L.length-1,onClick:()=>k(z,"down"),title:p("virtualKeyboard.moveDown"),"aria-label":p("virtualKeyboard.moveDown"),className:"px-1",children:"↓"}),u.jsx(Le,{variant:"ghost",brackets:!1,onClick:()=>P(H.id),title:p("virtualKeyboard.deleteKeyTitle"),"aria-label":p("virtualKeyboard.deleteKeyTitle"),className:"px-1 text-tui-bad hover:text-tui-bad",children:Ye.cross})]})]},H.id))}),u.jsx(Le,{block:!0,glyph:"+",onClick:()=>C(!v),className:"border-dashed",children:p("virtualKeyboard.addKey")}),v&&u.jsxs("div",{className:"space-y-2 border border-tui-border bg-tui-mantle p-2",children:[u.jsx(si,{label:p("virtualKeyboard.availableKeys")}),u.jsx("div",{className:"flex max-h-48 flex-wrap gap-1 overflow-y-auto",children:Sy.map(H=>{const z=L.some(A=>A.id===H.id);return u.jsxs("button",{type:"button",onClick:()=>Z(H),title:iu(H,p),className:J("tui-focusable flex select-none items-center gap-1 border px-1.5 py-0.5 text-tui-sm transition-colors",z?"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:H.label}),u.jsx("span",{"aria-hidden":"true",className:z?"text-tui-ok":"text-tui-accent",children:z?Ye.check:"+"})]},H.id)})})]})]})]})},jx={success:"ok",warning:"warn",error:"bad",info:"accent"},Ax={success:Ye.check,warning:Ye.warn,error:Ye.cross,info:"›"},Rx=()=>{const{toasts:r,removeToast:s,t:o}=yt();return r.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:r.map(c=>{const f=jx[c.type];return u.jsxs("div",{className:J("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",_n[f].edgeL),role:"alert",children:[u.jsx("span",{"aria-hidden":"true",className:J("shrink-0 font-bold",_n[f].text),children:Ax[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:()=>s(c.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":o("common.dismissNotification"),children:u.jsx("span",{"aria-hidden":"true",children:Ye.cross})})]},c.id)})})},Cu=({onAddProfile:r,mobile:s=!1,statusBar:o=!1})=>{const{profiles:c,activeProfileId:f,activeProfile:m,connectionState:b,switchProfile:p,renameProfile:g,removeProfile:S,t:v}=yt(),[C,Y]=x.useState(!1),[L,O]=x.useState(null),[V,k]=x.useState(""),Z=x.useRef(null);x.useEffect(()=>{if(!C)return;const z=A=>{Z.current&&!Z.current.contains(A.target)&&Y(!1)};return document.addEventListener("pointerdown",z),()=>document.removeEventListener("pointerdown",z)},[C]);const P=(z,A)=>{O(z),k(A)},F=z=>{const A=V.trim();A&&g(z,A),O(null)},ce=z=>{typeof window<"u"&&!window.confirm(v("profiles.removeConfirm"))||(S(z),O(null))},ue=(m==null?void 0:m.displayName)||v("profiles.addHost"),H=b==="connected"?"ok":b==="connecting"||b==="reconnecting"?"warn":b==="error"?"bad":"idle";return u.jsxs("div",{ref:Z,className:J("relative min-w-0",s&&"w-full",o&&"flex-1"),children:[u.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":C,"aria-label":v("profiles.switcherLabel"),onClick:()=>Y(z=>!z),className:J("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",o?"min-h-11 w-full max-w-none px-2":s?"min-h-11 w-full px-2":"min-h-[24px] max-w-[18rem] px-1"),children:[u.jsx(Dn,{level:H}),u.jsx("span",{className:J("truncate text-tui-text",o&&"min-w-0 flex-1"),children:ue}),u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:C?Ye.chevronDown:Ye.chevronRight})]}),C&&u.jsxs("div",{role:"menu","aria-label":v("profiles.switcherLabel"),className:J("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",o?"w-80 max-w-[calc(100vw-1rem)]":s?"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(z=>{const A=z.id===f,te=z.id===L;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":A?"true":void 0,onClick:()=>{p(z.id),Y(!1)},className:J("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",A?"text-tui-accent":"text-tui-text"),children:[u.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:A?Ye.cursor:""}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate font-bold",children:z.displayName}),u.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:z.hostname||z.hostId,children:z.hostname||z.hostId||z.wsUrl})]}),A&&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:()=>P(z.id,z.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:Ye.ellipsis})]}),te&&u.jsxs("div",{className:"flex items-center gap-1 px-2 pb-2",children:[u.jsx("input",{autoFocus:!0,value:V,maxLength:64,onChange:ze=>k(ze.target.value),onKeyDown:ze=>{ze.key==="Enter"&&F(z.id),ze.key==="Escape"&&O(null)},"aria-label":v("profiles.rename"),className:"tui-input min-w-0 flex-1 px-2 py-1 text-tui"}),u.jsx(Le,{onClick:()=>F(z.id),variant:"primary",className:"min-h-11",children:v("common.save")}),u.jsx(Le,{onClick:()=>ce(z.id),variant:"danger",className:"min-h-11",children:v("profiles.remove")})]})]},z.id)}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Y(!1),r()},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")})]})]})]})},Mx=({onAddProfile:r=()=>{}})=>{const{connectionState:s,role:o,hostId:c,assignedClientId:f,sharedWindowCount:m,settings:b,rttMs:p,t:g}=yt(),S=Or(s,g),v=s==="connected";return u.jsx(_p,{left:u.jsxs(u.Fragment,{children:[u.jsx(Cu,{onAddProfile:r}),u.jsx(kh,{items:[u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Dn,{level:S.level}),u.jsx("span",{className:"text-tui-text",children:S.label})]},"status"),v?u.jsx(Lr,{tone:o==="controller"?"ok":"warn",children:g(o==="controller"?"role.sharedControl":"common.viewer")},"role"):null,v&&m>1?u.jsx("span",{className:"text-tui-muted",children:g("role.sharedWindows",{count:m})},"windows"):null,c?u.jsxs("span",{children:[u.jsxs("span",{className:"text-tui-faint",children:[g("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:g("header.clientIdLabel")})," ",u.jsx("span",{className:"text-tui-text",children:f||b.clientId})]},"client")]})]}),right:u.jsx(kh,{items:[p!==null?u.jsxs("span",{className:"text-tui-muted",children:[g("header.latencyTitle"),": ",u.jsxs("span",{className:"text-tui-text",children:[p,"ms"]})]},"rtt"):null,u.jsx("span",{className:"hidden text-tui-faint sm:inline",children:g("header.tagline")},"mode")]})})},_x=[[/\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"]],zx=[[/\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 qh(r,s){for(const[o,c]of r)if(o.test(s))return c;return null}function Tu(r){const s=typeof r=="string"?r.trim():"";if(!s)return{label:"",raw:""};const o=qh(_x,s),c=qh(zx,s);return o&&c?{label:`${o} · ${c}`,raw:s}:o?{label:o,raw:s}:c?{label:c,raw:s}:{label:s.length>32?`${s.slice(0,32)}…`:s,raw:s}}function Xh(r){if(r===0)return"0 B";const s=1024,o=["B","KB","MB","GB"],c=Math.floor(Math.log(r)/Math.log(s));return`${(r/Math.pow(s,c)).toFixed(1)} ${o[c]}`}const kx=({clients:r})=>{const{t:s}=yt(),o=[{key:"id",header:s("admin.colClientId"),render:c=>u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Dn,{level:"ok"}),u.jsx("span",{className:"font-bold text-tui-text",children:c.id})]})},{key:"role",header:s("admin.colRole"),width:12,render:c=>{const f=c.role==="controller";return u.jsx(Lr,{tone:f?"ok":"warn",children:s(f?"common.controller":"common.viewer")})}},{key:"device",header:s("admin.colDevice"),render:c=>{const f=Tu(c.userAgent);return f.label?u.jsx("span",{className:"text-tui-muted",title:f.raw,children:f.label}):u.jsx("span",{className:"text-tui-faint",children:s("admin.unknownDevice")})}},{key:"ip",header:s("admin.colIp"),render:c=>u.jsx("span",{className:"text-tui-muted",children:c.ip||"127.0.0.1"})},{key:"connectedAt",header:s("admin.colConnectedAt"),render:c=>u.jsx("span",{className:"text-tui-muted",children:c.connectedAt?new Date(c.connectedAt).toLocaleTimeString():s("admin.startedRecently")})},{key:"traffic",header:s("admin.colTraffic"),align:"right",render:c=>u.jsxs("span",{className:"whitespace-nowrap",children:[u.jsx("span",{className:"text-tui-accent",children:Xh(c.bytesReceived||0)}),u.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),u.jsx("span",{className:"text-tui-ok",children:Xh(c.bytesSent||0)})]})}];return u.jsx(Qt,{title:s("admin.connectedClientsTitle",{count:r.length}),bodyClassName:"-mx-1",children:u.jsx(Su,{columns:o,items:r,rowKey:c=>c.id,empty:s("admin.noClients")})})},Vh={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function Dx(r=[],s=[]){const o=new Map;for(const m of s){if(!(m!=null&&m.hostId))continue;const b=o.get(m.hostId);b?b.push(m):o.set(m.hostId,[m])}const c=r.map(m=>{const b=o.get(m.id)||[];return{id:m.id,hostname:m.hostname||m.id,status:m.status||"online",connectedDeviceCount:m.connectedDeviceCount??0,pairedDeviceCount:m.pairedDeviceCount??b.length,devices:b,fromRosterOnly:!1}}),f=new Set(c.map(m=>m.id));for(const[m,b]of o)f.has(m)||c.push({id:m,hostname:m,status:"offline",connectedDeviceCount:0,pairedDeviceCount:b.length,devices:b,fromRosterOnly:!0});return c.sort((m,b)=>m.fromRosterOnly!==b.fromRosterOnly?m.fromRosterOnly?1:-1:m.hostname.localeCompare(b.hostname))}const Lx=({hosts:r,devices:s})=>{const{t:o}=yt(),c=Dx(r,s),f={online:o("admin.hostStatusOnline"),busy:o("admin.hostStatusBusy"),reconnecting:o("admin.hostStatusReconnecting"),offline:o("admin.hostStatusOffline")};return u.jsx(Qt,{title:o("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:o("admin.noHosts")}):c.map(m=>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(Dn,{level:Vh[m.status]}),u.jsx("span",{className:"truncate font-bold text-tui-text",children:m.hostname}),m.hostname!==m.id?u.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:m.id}):null]}),u.jsxs("span",{className:"flex shrink-0 items-center gap-3 text-tui-sm",children:[u.jsx(Lr,{tone:Vh[m.status],children:f[m.status]}),u.jsx("span",{className:"text-tui-accent",children:o("admin.hostConnectedDevices",{count:m.connectedDeviceCount})}),u.jsx("span",{className:"text-tui-muted",children:o("admin.hostPairedDevices",{count:m.pairedDeviceCount})})]})]}),m.devices.length>0?u.jsx("ul",{className:"divide-y divide-tui-border-dim",children:m.devices.map(b=>{const p=Tu(b.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:p.raw,children:p.label||o("admin.unknownDevice")}),u.jsx("code",{className:"truncate text-tui-sm text-tui-muted",children:b.deviceId}),u.jsx("span",{className:"ml-auto shrink-0 text-tui-sm text-tui-faint",children:b.lastIp||"—"})]},b.deviceId)})}):u.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:m.pairedDeviceCount>0?o("admin.hostRosterOperatorOnly"):o("admin.noDevices")})]},m.id))})},Ox=({ptys:r})=>{const{t:s}=yt(),o=[{key:"id",header:s("admin.colPtyId"),render:c=>u.jsx("span",{className:"font-bold text-tui-accent",children:c.id})},{key:"pid",header:s("admin.colPid"),width:9,render:c=>u.jsx("span",{className:"text-tui-muted",children:c.pid})},{key:"command",header:s("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:s("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:s("admin.colCwd"),className:"max-w-xs truncate",render:c=>u.jsx("span",{className:"text-tui-muted",children:c.cwd||"~"})},{key:"viewers",header:s("admin.colViewers"),align:"right",width:9,render:c=>u.jsx("span",{className:"font-bold text-tui-ok",children:c.activeClients})}];return u.jsx(Qt,{title:s("admin.activePtysTitle",{count:r.length}),bodyClassName:"-mx-1",children:u.jsx(Su,{columns:o,items:r,rowKey:c=>c.id,empty:s("admin.noPtys")})})};function Ux(r){if(!r)return"—";const s=new Date(r);return Number.isNaN(s.getTime())?"—":s.toLocaleString()}const Bx=({devices:r,onRevoke:s})=>{const{t:o}=yt(),[c,f]=x.useState(null),[m,b]=x.useState(null),p=async S=>{if(c!==S){f(S);return}b(S);try{await s(S)}finally{b(null),f(null)}},g=[{key:"device",header:o("admin.colDevice"),render:S=>{const v=Tu(S.userAgent);return u.jsx("span",{className:"text-tui-text",title:v.raw,children:v.label||o("admin.unknownDevice")})}},{key:"deviceId",header:o("admin.colDeviceId"),render:S=>u.jsx("span",{className:"text-tui-muted",children:S.deviceId})},{key:"ip",header:o("admin.colIp"),render:S=>u.jsx("span",{className:"text-tui-muted",children:S.lastIp||"—"})},{key:"lastSeen",header:o("admin.colLastSeen"),render:S=>u.jsx("span",{className:"whitespace-nowrap text-tui-muted",children:Ux(S.lastSeenAt)})},{key:"actions",header:o("admin.colActions"),align:"right",render:S=>{const v=c===S.deviceId,C=m===S.deviceId;return u.jsx(Le,{variant:"danger",disabled:C,onClick:()=>void p(S.deviceId),onBlur:()=>f(Y=>Y===S.deviceId?null:Y),"aria-label":o("admin.revokeDevice"),className:v?"bg-tui-bad text-tui-crust":void 0,children:C?u.jsx(ri,{}):o(v?"admin.revokeConfirm":"admin.revokeDevice")})}}];return u.jsx(Qt,{title:o("admin.pairedDevicesTitle",{count:r.length}),bodyClassName:"-mx-1",children:u.jsx(Su,{columns:g,items:r,rowKey:S=>S.deviceId,empty:o("admin.noDevices")})})};function Op(r){if(typeof window>"u"||!r||r.startsWith("/"))return"";try{const s=new URL(r.replace(/^ws/,"http")),o=s.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return s.origin===window.location.origin&&!o?"":`${s.origin}${o}`}catch{return""}}function ss(r,s){const o=Op(r);return o?`${o}${s.startsWith("/")?s:`/${s}`}`:s}const Hx=({onBackToTerminal:r,onOpenPairing:s})=>{var Fe,ot,et,mt,pt,zt,Yt,tl,Lt,Jt,Ot,cn,It,Kt;const{settings:o,updateSettings:c,addToast:f,t:m}=yt(),b=Op(o.wsUrl)||(typeof window<"u"?window.location.origin:"local"),p=((Fe=o.adminTokens)==null?void 0:Fe[b])||(b===(typeof window<"u"?window.location.origin:"local")?o.adminToken:"")||"",[g,S]=x.useState(null),[v,C]=x.useState(null),[Y,L]=x.useState(!1),[O,V]=x.useState(!0),[k,Z]=x.useState(null),[P,F]=x.useState(!1),[ce,ue]=x.useState(3e3),[H,z]=x.useState(null),[A,te]=x.useState("overview"),[ze,Ee]=x.useState(!1),[Te,Ne]=x.useState(p),[Me,Oe]=x.useState(!!p),R="node bin/service.js pair";x.useEffect(()=>{Ne(p),Oe(!!p),S(null),C(null),L(!1)},[b]);const q=()=>{ga(R).then($=>{if($==="failed"){f("error",m("clipboard.copyFailed"));return}Ee(!0),f("success",m("toasts.commandCopied")),setTimeout(()=>Ee(!1),2e3)})};x.useEffect(()=>{let $=!0;V(!0);async function Ce(){try{const he=await fetch(ss(o.wsUrl,"/api/info"),{headers:{Accept:"application/json"}});if(he.ok){const ut=await he.json();$&&(C(ut),L(!0));return}}catch{}if($){const he=!!(o.wsUrl&&!o.wsUrl.startsWith("/")&&!o.wsUrl.includes("localhost")&&!o.wsUrl.includes("127.0.0.1")&&typeof window<"u"&&!o.wsUrl.startsWith(window.location.origin.replace("http","ws")));C({ok:!0,version:"0.1.0",protocol:1,relayMode:he?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}),L(!0)}}return Ce(),()=>{$=!1}},[o.wsUrl,b]);const Q=(v==null?void 0:v.relayMode)==="remote",me=()=>{if(v!=null&&v.adminPath)return v.publicUrl?`${v.publicUrl.replace(/\/$/,"")}${v.adminPath}`:ss(o.wsUrl,v.adminPath);if(g!=null&&g.remoteAdminUrl)return g.remoteAdminUrl;if(o.wsUrl)try{return ss(o.wsUrl,"/admin")}catch{}return"/admin"},B=x.useCallback(async()=>{if(Y){if(Q){if(!Me&&!Te){S(null),V(!1),Z(null),F(!1);return}try{V(!0);const $=ss(o.wsUrl,(v==null?void 0:v.adminStatusPath)||"/api/admin/status"),he=await fetch($,{headers:{Accept:"application/json","X-Relay-Admin-Token":Te}});if(he.status===401||he.status===403){F(!0),Z(m("admin.relayAdminAuthError")),S(null);return}if(!he.ok)throw new Error(`HTTP ${he.status}: ${he.statusText}`);const ut=await he.json();S(ut),Z(null),F(!1),z(new Date)}catch($){console.warn("GET /api/admin/status request failed:",$),F(!1),Z($ instanceof Error?$.message:"Failed to fetch remote admin status"),S(null)}finally{V(!1)}return}try{V(!0);const $={Accept:"application/json"};o.token&&($.Authorization=`Bearer ${o.token}`);const Ce=await fetch("/api/status",{headers:$});if(Ce.status===401||Ce.status===403){F(!0),Z(`Authentication failed (HTTP ${Ce.status}): Access denied. Please configure an authorized token or pair with the host.`),S(null);return}if(!Ce.ok)throw new Error(`HTTP ${Ce.status}: ${Ce.statusText}`);const he=await Ce.json();S(he),Z(null),F(!1),z(new Date)}catch($){console.warn("GET /api/status request failed:",$),F(!1),Z($ instanceof Error?$.message:"Failed to fetch status"),S(null)}finally{V(!1)}}},[Y,Q,Me,Te,v,o.token,o.wsUrl,b,m]),Ue=x.useCallback(async $=>{try{if(!(await fetch(ss(o.wsUrl,`/api/admin/devices/${encodeURIComponent($)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":Te}})).ok){Z(m("admin.revokeFailed"));return}await B()}catch{Z(m("admin.revokeFailed"))}},[Te,B,o.wsUrl,m]);x.useEffect(()=>{if(!Y)return;B();let $=null;const Ce=()=>{ce>0&&!$&&($=setInterval(()=>{document.visibilityState==="visible"&&B()},ce))},he=()=>{$&&(clearInterval($),$=null)},ut=()=>{document.visibilityState==="visible"?(B(),Ce()):he()};return Ce(),document.addEventListener("visibilitychange",ut),()=>{he(),document.removeEventListener("visibilitychange",ut)}},[Y,B,ce]);const je=$=>{$.preventDefault();const Ce=Te.trim();c({adminToken:Ce,adminTokens:{...o.adminTokens||{},[b]:Ce}}),Oe(!!Ce)},X=$=>{const Ce=Math.max(0,Math.floor($)),he=Math.floor(Ce/86400),ut=Math.floor(Ce%86400/3600),Wt=Math.floor(Ce%3600/60),Pt=Ce%60,Ut=(qn,wt)=>`${qn}${m(`admin.unit${wt}`)}`;return he>0?[Ut(he,"Day"),Ut(ut,"Hour"),Ut(Wt,"Minute")].join(" "):ut>0?[Ut(ut,"Hour"),Ut(Wt,"Minute"),Ut(Pt,"Second")].join(" "):[Ut(Wt,"Minute"),Ut(Pt,"Second")].join(" ")},ve=$=>{if(!$||$===0)return"0 B";const Ce=1024,he=["B","KB","MB","GB"],ut=Math.floor(Math.log($)/Math.log(Ce));return`${($/Math.pow(Ce,ut)).toFixed(1)} ${he[ut]}`},fe=()=>{const $=me();window.open($,"_blank","noopener,noreferrer")},ie=g?g.activeUserCount??((ot=g.clients)==null?void 0:ot.length)??0:0,rt=g?[{id:"overview",label:m("admin.tabOverview"),index:1},{id:"clients",label:m("admin.tabClients",{count:((et=g.clients)==null?void 0:et.length)||0}),index:2},{id:"ptys",label:m("admin.tabPtys",{count:((mt=g.ptys)==null?void 0:mt.length)||0}),index:3},...g.devices?[{id:"devices",label:m("admin.tabDevices",{count:g.devices.length}),index:4}]:[]]:[],Ke=rt.map($=>$.id);x.useEffect(()=>{const $=Ce=>{if(Ce.ctrlKey||Ce.altKey||Ce.metaKey)return;const he=Ce.target;if(he instanceof HTMLInputElement||he instanceof HTMLTextAreaElement||he instanceof HTMLSelectElement||he!=null&&he.isContentEditable||document.querySelector('[role="dialog"]'))return;if(Ce.key==="Escape"&&r){Ce.preventDefault(),r();return}if(Ce.key.toLowerCase()==="r"){Ce.preventDefault(),B();return}const ut=Number.parseInt(Ce.key,10)-1;Number.isInteger(ut)&&ut>=0&&ut<Ke.length&&(Ce.preventDefault(),te(Ke[ut]))};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[B,Ke.join("|")]);const ye=u.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r&&u.jsx(Le,{variant:"ghost",onClick:r,title:m("admin.returnToTerminal"),"aria-label":m("admin.returnToTerminal"),glyph:Ye.arrowLeft,brackets:!1,className:"shrink-0",children:u.jsx("span",{className:"sr-only",children:m("admin.returnToTerminal")})}),u.jsxs("span",{className:"hidden text-tui-sm text-tui-accent sm:inline",children:["v",(v==null?void 0:v.version)||(g==null?void 0:g.version)||"0.1.0"]}),u.jsx(Lr,{tone:Q?"alt":"ok",children:m(Q?"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:m("admin.autoRefresh")}),u.jsxs(xu,{value:ce,onChange:$=>ue(Number($.target.value)),"aria-label":m("admin.autoRefresh"),className:"w-auto",children:[u.jsx("option",{value:0,children:m("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(Le,{variant:"primary",onClick:B,disabled:O,title:m("admin.refreshNow"),children:O?u.jsx(ri,{}):m("admin.refreshNow")})]});return u.jsxs(Gv,{name:m("admin.title"),tagline:m("admin.subtitle"),aside:ye,tabs:rt,activeTabId:A,onSelectTab:$=>te($),tabsAriaLabel:m("header.mainNavigationAria"),hints:[{keys:"1–4",action:m("admin.hintTabs")},{keys:"r",action:m("admin.hintRefresh")},...r?[{keys:"esc",action:m("admin.hintBack")}]:[]],footerAside:H?u.jsx("span",{className:"text-tui-faint",children:m("admin.updatedAt",{time:H.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!Y&&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(ri,{label:m("admin.loadingStatus")})}),Y&&Q&&!Me&&u.jsxs(Qt,{title:m("admin.remoteRelayTitle"),aside:m("admin.remoteRelayBadge"),bodyClassName:"space-y-2",children:[u.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:m("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(Gn,{label:m("admin.remoteRelayEndpoint"),labelWidth:18,children:u.jsx("code",{className:"break-all text-tui-accent",children:o.wsUrl})}),u.jsx(Gn,{label:m("admin.remoteRelayAdminUrl"),labelWidth:18,children:u.jsx("code",{className:"break-all text-tui-ok",children:me()})})]}),u.jsx(si,{}),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:m("admin.remoteRelayHelp")}),u.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[u.jsx(Le,{onClick:()=>Oe(!0),children:m("admin.relayAdminLoginBtn")}),u.jsx(Le,{variant:"primary",onClick:fe,glyph:Ye.arrowRight,children:m("admin.openRemoteAdminBtn")})]})]})]}),Y&&Q&&Me&&!g&&u.jsxs(Qt,{title:m("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[u.jsx(Rr,{tone:(v==null?void 0:v.adminConfigured)===!1?"warn":"bad",children:(v==null?void 0:v.adminConfigured)===!1?m("admin.relayAdminNotConfigured"):m("admin.relayAdminAuthError")}),u.jsxs("form",{onSubmit:je,className:"space-y-2",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(zn,{htmlFor:"relay-admin-token",children:m("admin.relayAdminTokenLabel")}),u.jsx(kn,{id:"relay-admin-token",type:"password",value:Te,onChange:$=>Ne($.target.value),placeholder:m("admin.relayAdminTokenPlaceholder")})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Le,{variant:"primary",type:"submit",children:m("admin.relayAdminLoginBtn")}),u.jsx(Le,{variant:"ghost",onClick:()=>Oe(!1),children:m("common.cancel")})]})]})]}),Y&&!Q&&P&&u.jsxs(Qt,{title:m("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[u.jsx(Rr,{tone:"bad",children:m("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:m("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:R}),u.jsx(Le,{onClick:q,glyph:ze?Ye.check:"⧉",className:J("shrink-0",ze&&"border-tui-ok text-tui-ok"),children:m(ze?"admin.copiedJson":"common.copy")})]}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:m("admin.pairingStepsHelp")})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[s&&u.jsx(Le,{variant:"primary",onClick:s,children:m("admin.enterPairCodeBtn")}),u.jsx(Le,{onClick:B,children:m("admin.retryFetchBtn")})]})]}),Y&&k&&!P&&!(!Q&&P)&&u.jsx(Rr,{tone:"warn",action:u.jsx(Le,{variant:"warn",onClick:B,children:m("common.retry")}),children:m("admin.errorConnecting",{error:k})}),g&&u.jsxs(u.Fragment,{children:[A==="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(Qt,{title:m("admin.accessPanel"),aside:X(g.uptimeSeconds||0),bodyClassName:"space-y-0.5",children:[u.jsx(Gn,{label:m("admin.connectedHosts"),labelWidth:14,children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Dn,{level:(pt=g.hosts)!=null&&pt.length?"ok":"idle"}),u.jsx("span",{className:"font-bold",children:((zt=g.hosts)==null?void 0:zt.length)||0})]})}),u.jsx(Gn,{label:m("admin.activeUsers"),labelWidth:14,children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Dn,{level:ie?"ok":"idle"}),u.jsx("span",{className:"font-bold",children:ie}),u.jsx("span",{className:"text-tui-faint",children:m("admin.acrossWindows",{count:((Yt=g.clients)==null?void 0:Yt.length)||0})})]})}),u.jsxs(Gn,{label:m("admin.activePtys"),labelWidth:14,children:[u.jsx("span",{className:"font-bold",children:((tl=g.ptys)==null?void 0:tl.length)||0}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:m("admin.terminalShells")})]}),u.jsx(Gn,{label:m("admin.uptime"),labelWidth:14,children:u.jsx("span",{className:"text-tui-muted",children:g.startTime?m("admin.startedAt",{time:new Date(g.startTime).toLocaleTimeString()}):m("admin.startedRecently")})})]}),u.jsxs(Qt,{title:m("admin.throughput"),aside:m("admin.perSecond",{value:ve(((Lt=g.throughput)==null?void 0:Lt.bytesOutPerSec)||0)}),bodyClassName:"space-y-0.5",children:[u.jsxs(Gn,{label:m("admin.bytesInTotal"),labelWidth:13,children:[u.jsx("span",{className:"font-bold text-tui-accent",children:ve(((Jt=g.throughput)==null?void 0:Jt.bytesIn)||0)}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:m("admin.perSecond",{value:ve(((Ot=g.throughput)==null?void 0:Ot.bytesInPerSec)||0)})})]}),u.jsxs(Gn,{label:m("admin.bytesOutTotal"),labelWidth:13,children:[u.jsx("span",{className:"font-bold text-tui-ok",children:ve(((cn=g.throughput)==null?void 0:cn.bytesOut)||0)}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:m("admin.perSecond",{value:ve(((It=g.throughput)==null?void 0:It.bytesOutPerSec)||0)})})]}),u.jsx(si,{}),u.jsx(Gn,{label:m("admin.frameRate"),labelWidth:13,children:u.jsx("span",{className:"font-bold",children:m("admin.framesPerSecond",{count:(((Kt=g.throughput)==null?void 0:Kt.framesOutPerSec)||0).toFixed(0)})})})]})]}),u.jsx(Lx,{hosts:g.hosts||[],devices:g.devices})]}),A==="clients"&&u.jsx(kx,{clients:g.clients||[]}),A==="ptys"&&u.jsx(Ox,{ptys:g.ptys||[]}),A==="devices"&&u.jsx(Bx,{devices:g.devices||[],onRevoke:Ue})]})]})},Yx=({compact:r=!1})=>{const{role:s,connectionState:o,sharedWindowCount:c,assignedClientId:f,t:m}=yt();if(!(o==="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":m("terminal.offlineStatusAria"),children:[u.jsx(Dn,{level:"idle"}),u.jsx("span",{children:m("common.offline")})]});const p=s==="controller",g=c>1,S=u.jsxs("div",{className:J("inline-flex min-w-0 select-none items-center gap-1.5 text-tui uppercase",p?"text-tui-ok":"text-tui-warn"),role:"status","aria-label":m(p?"role.controllerMode":"role.viewerMode"),children:[u.jsx(Dn,{level:p?"ok":"warn"}),u.jsx("span",{className:"truncate",children:m(p?"role.sharedControl":"role.viewerReadOnly")}),g?u.jsx("span",{className:"shrink-0 normal-case text-tui-muted",children:m("role.sharedWindows",{count:c})}):null]});return r?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:m("role.sharedControlDesc")}),f?u.jsx(Gn,{label:m("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:u.jsx("span",{className:"truncate text-tui-muted",children:f})}):null]})},rs="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",os="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",Kx="border-tui-accent bg-tui-selection text-tui-accent",cs=({active:r=!1})=>u.jsx("span",{"aria-hidden":"true",className:J("shrink-0",r?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:Ye.cursor}),Gx=({onClose:r,onNavigateAdmin:s,showAdminEntry:o=!0,onOpenPairing:c,onOpenSettings:f,onAddProfile:m=()=>{}})=>{const{connectionState:b,stateDetail:p,rttMs:g,hostId:S,settings:v,updateSettings:C,connect:Y,addToast:L,language:O,setLanguage:V,t:k}=yt(),[Z,P]=el.useState(!1),F=Or(b,k),ce=z=>()=>{var te;const A=document.activeElement;(te=A==null?void 0:A.blur)==null||te.call(A),z()},ue=()=>{ga(v.clientId).then(z=>{if(z==="failed"){L("error",k("clipboard.copyFailed"));return}P(!0),L("info",k("toasts.clientIdCopied",{id:v.clientId})),setTimeout(()=>P(!1),2e3)})},H=()=>{const z=O==="zh"?"en":"zh";V(z),L("info",bu(z,"toasts.switchedLanguage",{lang:z==="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:k("mobile.sessionControls")}),u.jsx(Le,{variant:"ghost",onClick:r,"aria-label":k("mobile.closeSessionControls"),children:"esc"})]}),u.jsx(Qt,{title:k("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:u.jsx(Cu,{mobile:!0,onAddProfile:m})}),u.jsxs(Qt,{title:k("common.status"),tone:F.level==="ok"?"ok":F.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2","aria-label":k("mobile.connectionStatusAria"),children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[u.jsx(Dn,{level:F.level}),u.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:F.label}),b==="connected"&&g!==null&&u.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[g,"ms"]})]}),F.actionLabel&&u.jsx(Le,{variant:"primary",onClick:()=>Y(),className:"shrink-0",children:F.actionLabel})]}),F.needsAttention&&p&&u.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:p}),S&&u.jsx(Gn,{label:k("common.host"),labelWidth:9,children:S}),u.jsxs("button",{type:"button",onClick:ue,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:k("header.copyClientIdTitle"),children:[u.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:k("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:J("shrink-0",Z?"text-tui-ok":"text-tui-faint"),children:Z?Ye.check:"⧉"})]})]}),u.jsx(Qt,{title:k("mobile.inputControl"),tone:"accent","aria-label":k("mobile.terminalControlAria"),children:u.jsx(Yx,{})}),u.jsxs(Qt,{title:k("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[u.jsxs("button",{type:"button",onClick:H,className:J(rs,os),"aria-label":k("header.languageToggleTitle"),children:[u.jsx(cs,{}),u.jsx("span",{className:"truncate",children:O==="zh"?"English":"中文"})]}),u.jsxs("button",{type:"button",onClick:ce(f),className:J(rs,os),"aria-label":k("mobile.settingsAria"),children:[u.jsx(cs,{}),u.jsx("span",{className:"truncate",children:k("common.settings")})]}),u.jsxs("button",{type:"button",onClick:ce(c),className:J(rs,os),"aria-label":k("mobile.pairingAria"),children:[u.jsx(cs,{}),u.jsx("span",{className:"truncate",children:k("common.pairing")})]}),o&&u.jsxs("button",{type:"button",onClick:ce(s),className:J(rs,os),"aria-label":k("mobile.adminAria"),children:[u.jsx(cs,{}),u.jsx("span",{className:"truncate",children:k("common.admin")})]}),u.jsxs("button",{type:"button",onClick:()=>C({toolbarVisible:!v.toolbarVisible}),className:J(rs,v.toolbarVisible?Kx:os),"aria-label":k("mobile.keybarAria"),"aria-pressed":v.toolbarVisible,children:[u.jsx(cs,{active:v.toolbarVisible}),u.jsx("span",{className:"truncate",children:k("common.keyBar")}),u.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:v.toolbarVisible?"[x]":"[ ]"})]})]})]})},qx=({onAddProfile:r})=>{const{rttMs:s,t:o}=yt();return u.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":o("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(Cu,{statusBar:!0,onAddProfile:r}),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:o("header.latencyTitle"),children:[u.jsx("span",{className:"text-tui-faint",children:"RTT"}),u.jsx("span",{className:J(s===null?"text-tui-faint":"text-tui-text"),children:s===null?"—":`${s}ms`})]})]})},Xx=({onNavigateAdmin:r,showAdminEntry:s=!0,onOpenPairing:o,onOpenSettings:c,onAddProfile:f=()=>{}})=>{const{connectionState:m,isController:b,t:p}=yt(),[g,S]=x.useState(!1),v=x.useRef(null),C=x.useCallback(()=>S(!1),[]);x.useEffect(()=>{if(!g)return;const L=O=>{if(!(O.ctrlKey||O.altKey||O.metaKey)&&O.key==="Escape"){const V=O.target;V&&typeof V.closest=="function"&&!!V.closest("#terminal-container")||(O.stopPropagation(),O.preventDefault(),C())}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[g,C]),x.useEffect(()=>{var L;g&&((L=v.current)==null||L.focus({preventScroll:!0}))},[g]);const Y=Or(m,p);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":p("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(Rp,{className:"shrink-0"}),u.jsx(Dn,{level:Y.level}),u.jsx("span",{className:"truncate uppercase",children:Y.label})]}),u.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>S(!0),"aria-label":p("mobile.sessionControls"),"aria-expanded":g,"aria-haspopup":"dialog",className:J("tui-focusable pointer-events-auto flex h-9 shrink-0 select-none items-center gap-1.5 border px-2 text-tui uppercase transition-colors",Y.needsAttention?"border-tui-warn text-tui-warn":b?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!b&&!Y.needsAttention&&u.jsx("span",{className:"max-w-[8rem] truncate",children:p("common.viewer")}),u.jsx("span",{"aria-hidden":"true",className:"text-tui",children:Ye.chevronDown}),u.jsx("span",{"aria-hidden":"true",children:p("mobile.menu")})]})]}),g&&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":p("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(Gx,{onClose:C,showAdminEntry:s,onNavigateAdmin:()=>{C(),r()},onOpenPairing:()=>{C(),o()},onOpenSettings:()=>{C(),c()},onAddProfile:()=>{C(),f()}})})]}),u.jsx(qx,{onAddProfile:f})]})},Up="--app-height",Bp="--keyboard-inset",Vx=80;function Zx(){if(typeof window>"u")return{height:768,keyboardInset:0};const r=window.innerHeight||768,s=window.visualViewport;if(s&&typeof s.height=="number"&&s.height>0){const o=r-s.height-(s.offsetTop||0),c=o>=Vx?Math.round(o):0;return{height:Math.round(s.height),keyboardInset:c}}return{height:r,keyboardInset:0}}function Zh(r,s=Zx()){return r.style.setProperty(Up,`${s.height}px`),r.style.setProperty(Bp,`${s.keyboardInset}px`),s}function Fx(r=typeof document<"u"?document.documentElement:null){if(!r||typeof window>"u")return()=>{};let s=null;const o=()=>{s=null,Zh(r)},c=()=>{if(s===null){if(typeof requestAnimationFrame!="function"){o();return}s=requestAnimationFrame(o)}};Zh(r);const f=window.visualViewport;return f==null||f.addEventListener("resize",c),f==null||f.addEventListener("scroll",c),window.addEventListener("resize",c),window.addEventListener("orientationchange",c),()=>{s!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(s),s=null),f==null||f.removeEventListener("resize",c),f==null||f.removeEventListener("scroll",c),window.removeEventListener("resize",c),window.removeEventListener("orientationchange",c),r.style.removeProperty(Up),r.style.removeProperty(Bp)}}const Qx=900;function Fh(){if(typeof window>"u")return!1;const r=ai();return r<mu?!0:r<=Qx}function Jx(){const[r,s]=x.useState(Fh);return x.useEffect(()=>{var f,m;const o=()=>{const b=Fh();s(p=>p===b?p:b)};o();let c=null;try{c=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{c=null}return(f=c==null?void 0:c.addEventListener)==null||f.call(c,"change",o),window.addEventListener("resize",o),window.addEventListener("orientationchange",o),(m=window.visualViewport)==null||m.addEventListener("resize",o),()=>{var b,p;(b=c==null?void 0:c.removeEventListener)==null||b.call(c,"change",o),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),(p=window.visualViewport)==null||p.removeEventListener("resize",o)}},[]),r}function Ix(r){const s=r.target;if(!s)return!1;if(s.id==="terminal-container"||s.id==="terminal-frame"||s.id==="terminal-surface"||s.classList.contains("xterm-helper-textarea")||s.classList.contains("xterm")||s.closest("#terminal-container")||s.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const o=document.activeElement;if(o.id==="terminal-container"||o.classList.contains("xterm-helper-textarea")||o.closest("#terminal-container")||o.closest(".xterm"))return!0}return!1}function Wx(r,s={}){if(typeof window>"u")return()=>{};const o=c=>{var f;c.ctrlKey||c.altKey||c.metaKey||c.key==="Escape"&&(s.isModalOpen||s.isSheetOpen)&&(Ix(c)||(c.preventDefault(),c.stopPropagation(),(f=r.onCloseModals)==null||f.call(r)))};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o)}}function Px(){const[r,s]=x.useState("terminal"),[o,c]=x.useState(!1),[f,m]=x.useState(!1),[b,p]=x.useState(!1),[g,S]=x.useState(!1),{updateSettings:v,settings:C,connectionState:Y,stateDetail:L,stateCode:O,lastPairedAt:V}=yt(),k=Jx();x.useEffect(()=>Fx(),[]);const[Z,P]=x.useState(!0);x.useEffect(()=>{let Ne=!1;return fetch("/api/info",{headers:{Accept:"application/json"}}).then(Me=>Me.ok?Me.json():null).then(Me=>{Ne||!Me||P(!Me.isRemoteRelay)}).catch(()=>{}),()=>{Ne=!0}},[]),x.useEffect(()=>{up()},[]),x.useEffect(()=>{const Ne=o||b||g;if(Ne)return Wx({onCloseModals:()=>{c(!1),p(!1),S(!1)}},{isModalOpen:Ne})},[o,b,g]),x.useEffect(()=>{const Ne=()=>{const Me=window.location.pathname,Oe=window.location.hash;s(Me==="/admin"||Oe==="#admin"?"admin":"terminal")};Ne(),window.addEventListener("popstate",Ne),window.addEventListener("hashchange",Ne);try{const Me=new URL(window.location.href),Oe=Me.searchParams.get("token"),R=Me.searchParams.get("pairCode"),q=Me.searchParams.get("ws")||Me.searchParams.get("wsUrl"),Q={};Oe&&(Q.token=Oe),R&&(Q.pairCode=R.toUpperCase()),q&&(Q.wsUrl=q),Object.keys(Q).length>0&&v(Q);let me=!1;if(Me.searchParams.has("token")&&(Me.searchParams.delete("token"),me=!0),Me.searchParams.has("pairCode")&&(Me.searchParams.delete("pairCode"),me=!0),me){const B=Me.searchParams.toString(),Ue=Me.pathname+(B?`?${B}`:"")+Me.hash;window.history.replaceState({},"",Ue)}}catch(Me){console.warn("Failed to parse URL query params:",Me)}return()=>{window.removeEventListener("popstate",Ne),window.removeEventListener("hashchange",Ne)}},[]);const F=(Ne=!1)=>{m(Ne),c(!0)},ce=()=>{c(!1),m(!1)},ue=Ne=>{s(Ne),Ne==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},H=!C.token&&!C.pairCode&&Y!=="connected",z=Y==="error"&&(["auth_required","unauthorized","device_revoked"].includes(O||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(L||"")),A=H||z,[te,ze]=x.useState(!A);x.useEffect(()=>{A||ze(!0)},[A]),x.useEffect(()=>{V&&(c(!1),ze(!0),s("terminal"))},[V]);const Ee=r==="terminal"&&!A,Te=Ne=>({visibility:Ne?"visible":"hidden",opacity:Ne?1:0,pointerEvents:Ne?"auto":"none",zIndex:Ne?1:0});return u.jsxs("div",{"data-testid":"app-shell",style:k?{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:Ne=>{Ne.preventDefault(),Ne.stopPropagation()},children:[!k&&u.jsx(Xv,{currentView:r,onNavigate:ue,showAdminEntry:Z,onOpenPairing:()=>F(!1),onOpenSettings:()=>p(!0),onToggleVirtualKeyboard:()=>S(!g),isVirtualKeyboardOpen:g}),!k&&!A&&u.jsx(Vv,{}),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 ${k?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:Te(Ee),"aria-hidden":!Ee,children:[u.jsx(gx,{isActive:Ee}),!k&&u.jsx(Cx,{isOpen:g,onClose:()=>S(!1)}),u.jsx(Sx,{compact:k})]}),r==="terminal"&&A&&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(yx,{onPairedSuccess:()=>{}})}),r==="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(Hx,{onBackToTerminal:()=>ue("terminal"),onOpenPairing:()=>F(!1)})}),k&&Ee&&u.jsx(Xx,{onNavigateAdmin:()=>ue("admin"),showAdminEntry:Z,onOpenPairing:()=>F(!1),onOpenSettings:()=>p(!0),onAddProfile:()=>F(!0)})]}),!k&&r!=="admin"&&u.jsx(Mx,{onAddProfile:()=>F(!0)}),u.jsx(Nx,{isOpen:o,isAddMode:f,onClose:ce}),u.jsx(Ex,{isOpen:b,onClose:()=>p(!1)}),u.jsx(Rx,{})]})}function $x(){return u.jsx(qy,{children:u.jsx(Px,{})})}const Hp=document.getElementById("root");if(!Hp)throw new Error("Root element not found");iy.createRoot(Hp).render(u.jsx(el.StrictMode,{children:u.jsx($x,{})}));