herdr-remote-relay 0.3.16 → 0.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var ax=Object.defineProperty;var sx=(l,i,a)=>i in l?ax(l,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[i]=a;var W=(l,i,a)=>sx(l,typeof i!="symbol"?i+"":i,a);import{r as ib,g as lb,a as ab}from"./vendor-react-CYSfZuHu.js";import{r as ox,a as rx}from"./vendor-xterm-BhCxil_4.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const u of r)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function a(r){const u={};return r.integrity&&(u.integrity=r.integrity),r.referrerPolicy&&(u.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?u.credentials="include":r.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(r){if(r.ep)return;r.ep=!0;const u=a(r);fetch(r.href,u)}})();var Nu={exports:{}},Wa={};/**
1
+ var sx=Object.defineProperty;var ox=(l,i,a)=>i in l?sx(l,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[i]=a;var W=(l,i,a)=>ox(l,typeof i!="symbol"?i+"":i,a);import{r as ib,g as lb,a as ab}from"./vendor-react-CYSfZuHu.js";import{r as rx,a as cx}from"./vendor-xterm-BhCxil_4.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const u of r)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function a(r){const u={};return r.integrity&&(u.integrity=r.integrity),r.referrerPolicy&&(u.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?u.credentials="include":r.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(r){if(r.ep)return;r.ep=!0;const u=a(r);fetch(r.href,u)}})();var Nu={exports:{}},Wa={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@ var ax=Object.defineProperty;var sx=(l,i,a)=>i in l?ax(l,i,{enumerable:!0,config
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Bp;function cx(){if(Bp)return Wa;Bp=1;var l=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function a(o,r,u){var h=null;if(u!==void 0&&(h=""+u),r.key!==void 0&&(h=""+r.key),"key"in r){u={};for(var p in r)p!=="key"&&(u[p]=r[p])}else u=r;return r=u.ref,{$$typeof:l,type:o,key:h,ref:r!==void 0?r:null,props:u}}return Wa.Fragment=i,Wa.jsx=a,Wa.jsxs=a,Wa}var Up;function ux(){return Up||(Up=1,Nu.exports=cx()),Nu.exports}var f=ux(),C=ib();const qn=lb(C);var ku={exports:{}},Ja={},Lu={exports:{}},Ru={};/**
9
+ */var Kp;function ux(){if(Kp)return Wa;Kp=1;var l=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function a(o,r,u){var h=null;if(u!==void 0&&(h=""+u),r.key!==void 0&&(h=""+r.key),"key"in r){u={};for(var p in r)p!=="key"&&(u[p]=r[p])}else u=r;return r=u.ref,{$$typeof:l,type:o,key:h,ref:r!==void 0?r:null,props:u}}return Wa.Fragment=i,Wa.jsx=a,Wa.jsxs=a,Wa}var Ip;function dx(){return Ip||(Ip=1,Nu.exports=ux()),Nu.exports}var f=dx(),C=ib();const Vn=lb(C);var ku={exports:{}},Ja={},Lu={exports:{}},Ru={};/**
10
10
  * @license React
11
11
  * scheduler.production.js
12
12
  *
@@ -14,7 +14,7 @@ var ax=Object.defineProperty;var sx=(l,i,a)=>i in l?ax(l,i,{enumerable:!0,config
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Kp;function dx(){return Kp||(Kp=1,(function(l){function i(E,G){var P=E.length;E.push(G);e:for(;0<P;){var le=P-1>>>1,Q=E[le];if(0<r(Q,G))E[le]=G,E[P]=Q,P=le;else break e}}function a(E){return E.length===0?null:E[0]}function o(E){if(E.length===0)return null;var G=E[0],P=E.pop();if(P!==G){E[0]=P;e:for(var le=0,Q=E.length,xe=Q>>>1;le<xe;){var ye=2*(le+1)-1,ve=E[ye],me=ye+1,de=E[me];if(0>r(ve,P))me<Q&&0>r(de,ve)?(E[le]=de,E[me]=P,le=me):(E[le]=ve,E[ye]=P,le=ye);else if(me<Q&&0>r(de,P))E[le]=de,E[me]=P,le=me;else break e}}return G}function r(E,G){var P=E.sortIndex-G.sortIndex;return P!==0?P:E.id-G.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;l.unstable_now=function(){return u.now()}}else{var h=Date,p=h.now();l.unstable_now=function(){return h.now()-p}}var m=[],g=[],b=1,v=null,w=3,x=!1,T=!1,M=!1,A=!1,R=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function $(E){for(var G=a(g);G!==null;){if(G.callback===null)o(g);else if(G.startTime<=E)o(g),G.sortIndex=G.expirationTime,i(m,G);else break;G=a(g)}}function _(E){if(M=!1,$(E),!T)if(a(m)!==null)T=!0,z||(z=!0,X());else{var G=a(g);G!==null&&U(_,G.startTime-E)}}var z=!1,L=-1,D=5,K=-1;function J(){return A?!0:!(l.unstable_now()-K<D)}function V(){if(A=!1,z){var E=l.unstable_now();K=E;var G=!0;try{e:{T=!1,M&&(M=!1,k(L),L=-1),x=!0;var P=w;try{t:{for($(E),v=a(m);v!==null&&!(v.expirationTime>E&&J());){var le=v.callback;if(typeof le=="function"){v.callback=null,w=v.priorityLevel;var Q=le(v.expirationTime<=E);if(E=l.unstable_now(),typeof Q=="function"){v.callback=Q,$(E),G=!0;break t}v===a(m)&&o(m),$(E)}else o(m);v=a(m)}if(v!==null)G=!0;else{var xe=a(g);xe!==null&&U(_,xe.startTime-E),G=!1}}break e}finally{v=null,w=P,x=!1}G=void 0}}finally{G?X():z=!1}}}var X;if(typeof O=="function")X=function(){O(V)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,ue=ie.port2;ie.port1.onmessage=V,X=function(){ue.postMessage(null)}}else X=function(){R(V,0)};function U(E,G){L=R(function(){E(l.unstable_now())},G)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(E){E.callback=null},l.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<E?Math.floor(1e3/E):5},l.unstable_getCurrentPriorityLevel=function(){return w},l.unstable_next=function(E){switch(w){case 1:case 2:case 3:var G=3;break;default:G=w}var P=w;w=G;try{return E()}finally{w=P}},l.unstable_requestPaint=function(){A=!0},l.unstable_runWithPriority=function(E,G){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var P=w;w=E;try{return G()}finally{w=P}},l.unstable_scheduleCallback=function(E,G,P){var le=l.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?le+P:le):P=le,E){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=P+Q,E={id:b++,callback:G,priorityLevel:E,startTime:P,expirationTime:Q,sortIndex:-1},P>le?(E.sortIndex=P,i(g,E),a(m)===null&&E===a(g)&&(M?(k(L),L=-1):M=!0,U(_,P-le))):(E.sortIndex=Q,i(m,E),T||x||(T=!0,z||(z=!0,X()))),E},l.unstable_shouldYield=J,l.unstable_wrapCallback=function(E){var G=w;return function(){var P=w;w=G;try{return E.apply(this,arguments)}finally{w=P}}}})(Ru)),Ru}var Ip;function fx(){return Ip||(Ip=1,Lu.exports=dx()),Lu.exports}/**
17
+ */var Fp;function fx(){return Fp||(Fp=1,(function(l){function i(E,G){var P=E.length;E.push(G);e:for(;0<P;){var le=P-1>>>1,Q=E[le];if(0<r(Q,G))E[le]=G,E[P]=Q,P=le;else break e}}function a(E){return E.length===0?null:E[0]}function o(E){if(E.length===0)return null;var G=E[0],P=E.pop();if(P!==G){E[0]=P;e:for(var le=0,Q=E.length,xe=Q>>>1;le<xe;){var ye=2*(le+1)-1,ve=E[ye],me=ye+1,de=E[me];if(0>r(ve,P))me<Q&&0>r(de,ve)?(E[le]=de,E[me]=P,le=me):(E[le]=ve,E[ye]=P,le=ye);else if(me<Q&&0>r(de,P))E[le]=de,E[me]=P,le=me;else break e}}return G}function r(E,G){var P=E.sortIndex-G.sortIndex;return P!==0?P:E.id-G.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;l.unstable_now=function(){return u.now()}}else{var h=Date,p=h.now();l.unstable_now=function(){return h.now()-p}}var m=[],g=[],b=1,v=null,w=3,x=!1,T=!1,M=!1,A=!1,R=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function $(E){for(var G=a(g);G!==null;){if(G.callback===null)o(g);else if(G.startTime<=E)o(g),G.sortIndex=G.expirationTime,i(m,G);else break;G=a(g)}}function _(E){if(M=!1,$(E),!T)if(a(m)!==null)T=!0,z||(z=!0,X());else{var G=a(g);G!==null&&U(_,G.startTime-E)}}var z=!1,L=-1,D=5,K=-1;function J(){return A?!0:!(l.unstable_now()-K<D)}function V(){if(A=!1,z){var E=l.unstable_now();K=E;var G=!0;try{e:{T=!1,M&&(M=!1,k(L),L=-1),x=!0;var P=w;try{t:{for($(E),v=a(m);v!==null&&!(v.expirationTime>E&&J());){var le=v.callback;if(typeof le=="function"){v.callback=null,w=v.priorityLevel;var Q=le(v.expirationTime<=E);if(E=l.unstable_now(),typeof Q=="function"){v.callback=Q,$(E),G=!0;break t}v===a(m)&&o(m),$(E)}else o(m);v=a(m)}if(v!==null)G=!0;else{var xe=a(g);xe!==null&&U(_,xe.startTime-E),G=!1}}break e}finally{v=null,w=P,x=!1}G=void 0}}finally{G?X():z=!1}}}var X;if(typeof O=="function")X=function(){O(V)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,ue=ie.port2;ie.port1.onmessage=V,X=function(){ue.postMessage(null)}}else X=function(){R(V,0)};function U(E,G){L=R(function(){E(l.unstable_now())},G)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(E){E.callback=null},l.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<E?Math.floor(1e3/E):5},l.unstable_getCurrentPriorityLevel=function(){return w},l.unstable_next=function(E){switch(w){case 1:case 2:case 3:var G=3;break;default:G=w}var P=w;w=G;try{return E()}finally{w=P}},l.unstable_requestPaint=function(){A=!0},l.unstable_runWithPriority=function(E,G){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var P=w;w=E;try{return G()}finally{w=P}},l.unstable_scheduleCallback=function(E,G,P){var le=l.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?le+P:le):P=le,E){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=P+Q,E={id:b++,callback:G,priorityLevel:E,startTime:P,expirationTime:Q,sortIndex:-1},P>le?(E.sortIndex=P,i(g,E),a(m)===null&&E===a(g)&&(M?(k(L),L=-1):M=!0,U(_,P-le))):(E.sortIndex=Q,i(m,E),T||x||(T=!0,z||(z=!0,X()))),E},l.unstable_shouldYield=J,l.unstable_wrapCallback=function(E){var G=w;return function(){var P=w;w=G;try{return E.apply(this,arguments)}finally{w=P}}}})(Ru)),Ru}var Gp;function hx(){return Gp||(Gp=1,Lu.exports=fx()),Lu.exports}/**
18
18
  * @license React
19
19
  * react-dom-client.production.js
20
20
  *
@@ -22,19 +22,19 @@ var ax=Object.defineProperty;var sx=(l,i,a)=>i in l?ax(l,i,{enumerable:!0,config
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var Fp;function hx(){if(Fp)return Ja;Fp=1;var l=fx(),i=ib(),a=ab();function o(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 r(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(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 h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(u(e)!==e)throw Error(o(188))}function g(e){var t=e.alternate;if(!t){if(t=u(e),t===null)throw Error(o(188));return t!==e?null:e}for(var n=e,s=t;;){var c=n.return;if(c===null)break;var d=c.alternate;if(d===null){if(s=c.return,s!==null){n=s;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===n)return m(c),e;if(d===s)return m(c),t;d=d.sibling}throw Error(o(188))}if(n.return!==s.return)n=c,s=d;else{for(var y=!1,S=c.child;S;){if(S===n){y=!0,n=c,s=d;break}if(S===s){y=!0,s=c,n=d;break}S=S.sibling}if(!y){for(S=d.child;S;){if(S===n){y=!0,n=d,s=c;break}if(S===s){y=!0,s=d,n=c;break}S=S.sibling}if(!y)throw Error(o(189))}}if(n.alternate!==s)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,w=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),O=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),J=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function X(e){return e===null||typeof e!="object"?null:(e=V&&e[V]||e["@@iterator"],typeof e=="function"?e:null)}var ie=Symbol.for("react.client.reference");function ue(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case R:return"Profiler";case A:return"StrictMode";case _:return"Suspense";case z:return"SuspenseList";case K:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case O:return e.displayName||"Context";case k:return(e._context.displayName||"Context")+".Consumer";case $:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case L:return t=e.displayName||null,t!==null?t:ue(e.type)||"Memo";case D:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var U=Array.isArray,E=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},le=[],Q=-1;function xe(e){return{current:e}}function ye(e){0>Q||(e.current=le[Q],le[Q]=null,Q--)}function ve(e,t){Q++,le[Q]=e.current,e.current=t}var me=xe(null),de=xe(null),we=xe(null),se=xe(null);function Se(e,t){switch(ve(we,t),ve(de,e),ve(me,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?op(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=op(t),e=rp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ye(me),ve(me,e)}function ae(){ye(me),ye(de),ye(we)}function pe(e){e.memoizedState!==null&&ve(se,e);var t=me.current,n=rp(t,e.type);t!==n&&(ve(de,e),ve(me,n))}function Ee(e){de.current===e&&(ye(me),ye(de)),se.current===e&&(ye(se),Pa._currentValue=P)}var Be,re;function Ae(e){if(Be===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Be=t&&t[1]||"",re=-1<n.stack.indexOf(`
25
+ */var Yp;function mx(){if(Yp)return Ja;Yp=1;var l=hx(),i=ib(),a=ab();function o(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 r(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(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 h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(u(e)!==e)throw Error(o(188))}function g(e){var t=e.alternate;if(!t){if(t=u(e),t===null)throw Error(o(188));return t!==e?null:e}for(var n=e,s=t;;){var c=n.return;if(c===null)break;var d=c.alternate;if(d===null){if(s=c.return,s!==null){n=s;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===n)return m(c),e;if(d===s)return m(c),t;d=d.sibling}throw Error(o(188))}if(n.return!==s.return)n=c,s=d;else{for(var y=!1,S=c.child;S;){if(S===n){y=!0,n=c,s=d;break}if(S===s){y=!0,s=c,n=d;break}S=S.sibling}if(!y){for(S=d.child;S;){if(S===n){y=!0,n=d,s=c;break}if(S===s){y=!0,s=d,n=c;break}S=S.sibling}if(!y)throw Error(o(189))}}if(n.alternate!==s)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,w=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),O=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),J=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function X(e){return e===null||typeof e!="object"?null:(e=V&&e[V]||e["@@iterator"],typeof e=="function"?e:null)}var ie=Symbol.for("react.client.reference");function ue(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case R:return"Profiler";case A:return"StrictMode";case _:return"Suspense";case z:return"SuspenseList";case K:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case O:return e.displayName||"Context";case k:return(e._context.displayName||"Context")+".Consumer";case $:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case L:return t=e.displayName||null,t!==null?t:ue(e.type)||"Memo";case D:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var U=Array.isArray,E=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},le=[],Q=-1;function xe(e){return{current:e}}function ye(e){0>Q||(e.current=le[Q],le[Q]=null,Q--)}function ve(e,t){Q++,le[Q]=e.current,e.current=t}var me=xe(null),de=xe(null),we=xe(null),se=xe(null);function Se(e,t){switch(ve(we,t),ve(de,e),ve(me,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?cp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=cp(t),e=up(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ye(me),ve(me,e)}function ae(){ye(me),ye(de),ye(we)}function pe(e){e.memoizedState!==null&&ve(se,e);var t=me.current,n=up(t,e.type);t!==n&&(ve(de,e),ve(me,n))}function Ee(e){de.current===e&&(ye(me),ye(de)),se.current===e&&(ye(se),Pa._currentValue=P)}var Be,re;function Ae(e){if(Be===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Be=t&&t[1]||"",re=-1<n.stack.indexOf(`
26
26
  at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
27
27
  `+Be+e+re}var Pe=!1;function wt(e,t){if(!e||Pe)return"";Pe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(q){var Y=q}Reflect.construct(e,[],te)}else{try{te.call()}catch(q){Y=q}e.call(te.prototype)}}else{try{throw Error()}catch(q){Y=q}(te=e())&&typeof te.catch=="function"&&te.catch(function(){})}}catch(q){if(q&&Y&&typeof q.stack=="string")return[q.stack,Y.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=s.DetermineComponentFrameRoot(),y=d[0],S=d[1];if(y&&S){var N=y.split(`
28
28
  `),F=S.split(`
29
29
  `);for(c=s=0;s<N.length&&!N[s].includes("DetermineComponentFrameRoot");)s++;for(;c<F.length&&!F[c].includes("DetermineComponentFrameRoot");)c++;if(s===N.length||c===F.length)for(s=N.length-1,c=F.length-1;1<=s&&0<=c&&N[s]!==F[c];)c--;for(;1<=s&&0<=c;s--,c--)if(N[s]!==F[c]){if(s!==1||c!==1)do if(s--,c--,0>c||N[s]!==F[c]){var Z=`
30
- `+N[s].replace(" at new "," at ");return e.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",e.displayName)),Z}while(1<=s&&0<=c);break}}}finally{Pe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Ae(n):""}function Nt(e,t){switch(e.tag){case 26:case 27:case 5:return Ae(e.type);case 16:return Ae("Lazy");case 13:return e.child!==t&&t!==null?Ae("Suspense Fallback"):Ae("Suspense");case 19:return Ae("SuspenseList");case 0:case 15:return wt(e.type,!1);case 11:return wt(e.type.render,!1);case 1:return wt(e.type,!0);case 31:return Ae("Activity");default:return""}}function Vn(e){try{var t="",n=null;do t+=Nt(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
30
+ `+N[s].replace(" at new "," at ");return e.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",e.displayName)),Z}while(1<=s&&0<=c);break}}}finally{Pe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Ae(n):""}function Nt(e,t){switch(e.tag){case 26:case 27:case 5:return Ae(e.type);case 16:return Ae("Lazy");case 13:return e.child!==t&&t!==null?Ae("Suspense Fallback"):Ae("Suspense");case 19:return Ae("SuspenseList");case 0:case 15:return wt(e.type,!1);case 11:return wt(e.type.render,!1);case 1:return wt(e.type,!0);case 31:return Ae("Activity");default:return""}}function Pn(e){try{var t="",n=null;do t+=Nt(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
31
31
  Error generating stack: `+s.message+`
32
- `+s.stack}}var Pn=Object.prototype.hasOwnProperty,kt=l.unstable_scheduleCallback,Sn=l.unstable_cancelCallback,ps=l.unstable_shouldYield,gs=l.unstable_requestPaint,St=l.unstable_now,bs=l.unstable_getCurrentPriorityLevel,la=l.unstable_ImmediatePriority,aa=l.unstable_UserBlockingPriority,ki=l.unstable_NormalPriority,ys=l.unstable_LowPriority,sa=l.unstable_IdlePriority,vs=l.log,xs=l.unstable_setDisableYieldValue,Li=null,Mt=null;function cn(e){if(typeof vs=="function"&&xs(e),Mt&&typeof Mt.setStrictMode=="function")try{Mt.setStrictMode(Li,e)}catch{}}var Ct=Math.clz32?Math.clz32:qt,ge=Math.log,We=Math.LN2;function qt(e){return e>>>=0,e===0?32:31-(ge(e)/We|0)|0}var Vt=256,Ri=262144,ws=4194304;function _i(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 Ss(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var c=0,d=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var S=s&134217727;return S!==0?(s=S&~d,s!==0?c=_i(s):(y&=S,y!==0?c=_i(y):n||(n=S&~e,n!==0&&(c=_i(n))))):(S=s&~d,S!==0?c=_i(S):y!==0?c=_i(y):n||(n=s&~e,n!==0&&(c=_i(n)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,n=t&-t,d>=n||d===32&&(n&4194048)!==0)?t:c}function oa(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function qy(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 Id(){var e=ws;return ws<<=1,(ws&62914560)===0&&(ws=4194304),e}function gr(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ra(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Vy(e,t,n,s,c,d){var y=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 S=e.entanglements,N=e.expirationTimes,F=e.hiddenUpdates;for(n=y&~n;0<n;){var Z=31-Ct(n),te=1<<Z;S[Z]=0,N[Z]=-1;var Y=F[Z];if(Y!==null)for(F[Z]=null,Z=0;Z<Y.length;Z++){var q=Y[Z];q!==null&&(q.lane&=-536870913)}n&=~te}s!==0&&Fd(e,s,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(y&~t))}function Fd(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Ct(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function Gd(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Ct(n),c=1<<s;c&t|e[s]&t&&(e[s]|=t),n&=~c}}function Yd(e,t){var n=t&-t;return n=(n&42)!==0?1:br(n),(n&(e.suspendedLanes|t))!==0?0:n}function br(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 yr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function $d(){var e=G.p;return e!==0?e:(e=window.event,e===void 0?32:Rp(e.type))}function qd(e,t){var n=G.p;try{return G.p=e,t()}finally{G.p=n}}var Xn=Math.random().toString(36).slice(2),gt="__reactFiber$"+Xn,Lt="__reactProps$"+Xn,al="__reactContainer$"+Xn,vr="__reactEvents$"+Xn,Py="__reactListeners$"+Xn,Xy="__reactHandles$"+Xn,Vd="__reactResources$"+Xn,ca="__reactMarker$"+Xn;function xr(e){delete e[gt],delete e[Lt],delete e[vr],delete e[Py],delete e[Xy]}function sl(e){var t=e[gt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[al]||n[gt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=pp(e);e!==null;){if(n=e[gt])return n;e=pp(e)}return t}e=n,n=e.parentNode}return null}function ol(e){if(e=e[gt]||e[al]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ua(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function rl(e){var t=e[Vd];return t||(t=e[Vd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ht(e){e[ca]=!0}var Pd=new Set,Xd={};function ji(e,t){cl(e,t),cl(e+"Capture",t)}function cl(e,t){for(Xd[e]=t,e=0;e<t.length;e++)Pd.add(t[e])}var Qy=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]*$"),Qd={},Zd={};function Zy(e){return Pn.call(Zd,e)?!0:Pn.call(Qd,e)?!1:Qy.test(e)?Zd[e]=!0:(Qd[e]=!0,!1)}function Cs(e,t,n){if(Zy(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Ts(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 Cn(e,t,n,s){if(s===null)e.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+s)}}function Pt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Wy(e,t,n){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,d=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(y){n=""+y,d.call(this,y)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(y){n=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function wr(e){if(!e._valueTracker){var t=Wd(e)?"checked":"value";e._valueTracker=Wy(e,t,""+e[t])}}function Jd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=Wd(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Ms(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 Jy=/[\n"\\]/g;function Xt(e){return e.replace(Jy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Sr(e,t,n,s,c,d,y,S){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Pt(t)):e.value!==""+Pt(t)&&(e.value=""+Pt(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?Cr(e,y,Pt(t)):n!=null?Cr(e,y,Pt(n)):s!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.name=""+Pt(S):e.removeAttribute("name")}function ef(e,t,n,s,c,d,y,S){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||n!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){wr(e);return}n=n!=null?""+Pt(n):"",t=t!=null?""+Pt(t):n,S||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=S?e.checked:!!s,e.defaultChecked=!!s,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),wr(e)}function Cr(e,t,n){t==="number"&&Ms(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function ul(e,t,n,s){if(e=e.options,t){t={};for(var c=0;c<n.length;c++)t["$"+n[c]]=!0;for(n=0;n<e.length;n++)c=t.hasOwnProperty("$"+e[n].value),e[n].selected!==c&&(e[n].selected=c),c&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Pt(n),t=null,c=0;c<e.length;c++){if(e[c].value===n){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function tf(e,t,n){if(t!=null&&(t=""+Pt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Pt(n):""}function nf(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(o(92));if(U(s)){if(1<s.length)throw Error(o(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=Pt(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),wr(e)}function dl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var e0=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 lf(e,t,n){var s=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,n):typeof n!="number"||n===0||e0.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function af(e,t,n){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,n!=null){for(var s in n)!n.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var c in t)s=t[c],t.hasOwnProperty(c)&&n[c]!==s&&lf(e,c,s)}else for(var d in t)t.hasOwnProperty(d)&&lf(e,d,t[d])}function Tr(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 t0=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"]]),n0=/^[\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 As(e){return n0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Tn(){}var Mr=null;function Ar(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var fl=null,hl=null;function sf(e){var t=ol(e);if(t&&(e=t.stateNode)){var n=e[Lt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Sr(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="'+Xt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var c=s[Lt]||null;if(!c)throw Error(o(90));Sr(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<n.length;t++)s=n[t],s.form===e.form&&Jd(s)}break e;case"textarea":tf(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&ul(e,!!n.multiple,t,!1)}}}var Er=!1;function of(e,t,n){if(Er)return e(t,n);Er=!0;try{var s=e(t);return s}finally{if(Er=!1,(fl!==null||hl!==null)&&(mo(),fl&&(t=fl,e=hl,hl=fl=null,sf(t),e)))for(t=0;t<e.length;t++)sf(e[t])}}function da(e,t){var n=e.stateNode;if(n===null)return null;var s=n[Lt]||null;if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(o(231,t,typeof n));return n}var Mn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Nr=!1;if(Mn)try{var fa={};Object.defineProperty(fa,"passive",{get:function(){Nr=!0}}),window.addEventListener("test",fa,fa),window.removeEventListener("test",fa,fa)}catch{Nr=!1}var Qn=null,kr=null,Es=null;function rf(){if(Es)return Es;var e,t=kr,n=t.length,s,c="value"in Qn?Qn.value:Qn.textContent,d=c.length;for(e=0;e<n&&t[e]===c[e];e++);var y=n-e;for(s=1;s<=y&&t[n-s]===c[d-s];s++);return Es=c.slice(e,1<s?1-s:void 0)}function Ns(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 ks(){return!0}function cf(){return!1}function Rt(e){function t(n,s,c,d,y){this._reactName=n,this._targetInst=c,this.type=s,this.nativeEvent=d,this.target=y,this.currentTarget=null;for(var S in e)e.hasOwnProperty(S)&&(n=e[S],this[S]=n?n(d):d[S]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?ks:cf,this.isPropagationStopped=cf,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ks)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ks)},persist:function(){},isPersistent:ks}),t}var Oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ls=Rt(Oi),ha=v({},Oi,{view:0,detail:0}),i0=Rt(ha),Lr,Rr,ma,Rs=v({},ha,{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!==ma&&(ma&&e.type==="mousemove"?(Lr=e.screenX-ma.screenX,Rr=e.screenY-ma.screenY):Rr=Lr=0,ma=e),Lr)},movementY:function(e){return"movementY"in e?e.movementY:Rr}}),uf=Rt(Rs),l0=v({},Rs,{dataTransfer:0}),a0=Rt(l0),s0=v({},ha,{relatedTarget:0}),_r=Rt(s0),o0=v({},Oi,{animationName:0,elapsedTime:0,pseudoElement:0}),r0=Rt(o0),c0=v({},Oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),u0=Rt(c0),d0=v({},Oi,{data:0}),df=Rt(d0),f0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},h0={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"},m0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function p0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=m0[e])?!!t[e]:!1}function jr(){return p0}var g0=v({},ha,{key:function(e){if(e.key){var t=f0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ns(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?h0[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"?Ns(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ns(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),b0=Rt(g0),y0=v({},Rs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ff=Rt(y0),v0=v({},ha,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jr}),x0=Rt(v0),w0=v({},Oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),S0=Rt(w0),C0=v({},Rs,{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}),T0=Rt(C0),M0=v({},Oi,{newState:0,oldState:0}),A0=Rt(M0),E0=[9,13,27,32],Or=Mn&&"CompositionEvent"in window,pa=null;Mn&&"documentMode"in document&&(pa=document.documentMode);var N0=Mn&&"TextEvent"in window&&!pa,hf=Mn&&(!Or||pa&&8<pa&&11>=pa),mf=" ",pf=!1;function gf(e,t){switch(e){case"keyup":return E0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ml=!1;function k0(e,t){switch(e){case"compositionend":return bf(t);case"keypress":return t.which!==32?null:(pf=!0,mf);case"textInput":return e=t.data,e===mf&&pf?null:e;default:return null}}function L0(e,t){if(ml)return e==="compositionend"||!Or&&gf(e,t)?(e=rf(),Es=kr=Qn=null,ml=!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 hf&&t.locale!=="ko"?null:t.data;default:return null}}var R0={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 yf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!R0[e.type]:t==="textarea"}function vf(e,t,n,s){fl?hl?hl.push(s):hl=[s]:fl=s,t=wo(t,"onChange"),0<t.length&&(n=new Ls("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var ga=null,ba=null;function _0(e){tp(e,0)}function _s(e){var t=ua(e);if(Jd(t))return e}function xf(e,t){if(e==="change")return t}var wf=!1;if(Mn){var Dr;if(Mn){var zr="oninput"in document;if(!zr){var Sf=document.createElement("div");Sf.setAttribute("oninput","return;"),zr=typeof Sf.oninput=="function"}Dr=zr}else Dr=!1;wf=Dr&&(!document.documentMode||9<document.documentMode)}function Cf(){ga&&(ga.detachEvent("onpropertychange",Tf),ba=ga=null)}function Tf(e){if(e.propertyName==="value"&&_s(ba)){var t=[];vf(t,ba,e,Ar(e)),of(_0,t)}}function j0(e,t,n){e==="focusin"?(Cf(),ga=t,ba=n,ga.attachEvent("onpropertychange",Tf)):e==="focusout"&&Cf()}function O0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return _s(ba)}function D0(e,t){if(e==="click")return _s(t)}function z0(e,t){if(e==="input"||e==="change")return _s(t)}function H0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ut=typeof Object.is=="function"?Object.is:H0;function ya(e,t){if(Ut(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var c=n[s];if(!Pn.call(t,c)||!Ut(e[c],t[c]))return!1}return!0}function Mf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Af(e,t){var n=Mf(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Mf(n)}}function Ef(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ef(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ms(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=Ms(e.document)}return t}function Hr(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 B0=Mn&&"documentMode"in document&&11>=document.documentMode,pl=null,Br=null,va=null,Ur=!1;function kf(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ur||pl==null||pl!==Ms(s)||(s=pl,"selectionStart"in s&&Hr(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),va&&ya(va,s)||(va=s,s=wo(Br,"onSelect"),0<s.length&&(t=new Ls("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=pl)))}function Di(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var gl={animationend:Di("Animation","AnimationEnd"),animationiteration:Di("Animation","AnimationIteration"),animationstart:Di("Animation","AnimationStart"),transitionrun:Di("Transition","TransitionRun"),transitionstart:Di("Transition","TransitionStart"),transitioncancel:Di("Transition","TransitionCancel"),transitionend:Di("Transition","TransitionEnd")},Kr={},Lf={};Mn&&(Lf=document.createElement("div").style,"AnimationEvent"in window||(delete gl.animationend.animation,delete gl.animationiteration.animation,delete gl.animationstart.animation),"TransitionEvent"in window||delete gl.transitionend.transition);function zi(e){if(Kr[e])return Kr[e];if(!gl[e])return e;var t=gl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Lf)return Kr[e]=t[n];return e}var Rf=zi("animationend"),_f=zi("animationiteration"),jf=zi("animationstart"),U0=zi("transitionrun"),K0=zi("transitionstart"),I0=zi("transitioncancel"),Of=zi("transitionend"),Df=new Map,Ir="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(" ");Ir.push("scrollEnd");function un(e,t){Df.set(e,t),ji(t,[e])}var js=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Qt=[],bl=0,Fr=0;function Os(){for(var e=bl,t=Fr=bl=0;t<e;){var n=Qt[t];Qt[t++]=null;var s=Qt[t];Qt[t++]=null;var c=Qt[t];Qt[t++]=null;var d=Qt[t];if(Qt[t++]=null,s!==null&&c!==null){var y=s.pending;y===null?c.next=c:(c.next=y.next,y.next=c),s.pending=c}d!==0&&zf(n,c,d)}}function Ds(e,t,n,s){Qt[bl++]=e,Qt[bl++]=t,Qt[bl++]=n,Qt[bl++]=s,Fr|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Gr(e,t,n,s){return Ds(e,t,n,s),zs(e)}function Hi(e,t){return Ds(e,null,null,t),zs(e)}function zf(e,t,n){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n);for(var c=!1,d=e.return;d!==null;)d.childLanes|=n,s=d.alternate,s!==null&&(s.childLanes|=n),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-Ct(n),e=d.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=n|536870912),d):null}function zs(e){if(50<Ia)throw Ia=0,Wc=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var yl={};function F0(e,t,n,s){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=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kt(e,t,n,s){return new F0(e,t,n,s)}function Yr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function An(e,t){var n=e.alternate;return n===null?(n=Kt(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 Hf(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 Hs(e,t,n,s,c,d){var y=0;if(s=e,typeof e=="function")Yr(e)&&(y=1);else if(typeof e=="string")y=Vv(e,n,me.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case K:return e=Kt(31,n,t,c),e.elementType=K,e.lanes=d,e;case M:return Bi(n.children,c,d,t);case A:y=8,c|=24;break;case R:return e=Kt(12,n,t,c|2),e.elementType=R,e.lanes=d,e;case _:return e=Kt(13,n,t,c),e.elementType=_,e.lanes=d,e;case z:return e=Kt(19,n,t,c),e.elementType=z,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O:y=10;break e;case k:y=9;break e;case $:y=11;break e;case L:y=14;break e;case D:y=16,s=null;break e}y=29,n=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=Kt(y,n,t,c),t.elementType=e,t.type=s,t.lanes=d,t}function Bi(e,t,n,s){return e=Kt(7,e,s,t),e.lanes=n,e}function $r(e,t,n){return e=Kt(6,e,null,t),e.lanes=n,e}function Bf(e){var t=Kt(18,null,null,0);return t.stateNode=e,t}function qr(e,t,n){return t=Kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Uf=new WeakMap;function Zt(e,t){if(typeof e=="object"&&e!==null){var n=Uf.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Vn(t)},Uf.set(e,t),t)}return{value:e,source:t,stack:Vn(t)}}var vl=[],xl=0,Bs=null,xa=0,Wt=[],Jt=0,Zn=null,mn=1,pn="";function En(e,t){vl[xl++]=xa,vl[xl++]=Bs,Bs=e,xa=t}function Kf(e,t,n){Wt[Jt++]=mn,Wt[Jt++]=pn,Wt[Jt++]=Zn,Zn=e;var s=mn;e=pn;var c=32-Ct(s)-1;s&=~(1<<c),n+=1;var d=32-Ct(t)+c;if(30<d){var y=c-c%5;d=(s&(1<<y)-1).toString(32),s>>=y,c-=y,mn=1<<32-Ct(t)+c|n<<c|s,pn=d+e}else mn=1<<d|n<<c|s,pn=e}function Vr(e){e.return!==null&&(En(e,1),Kf(e,1,0))}function Pr(e){for(;e===Bs;)Bs=vl[--xl],vl[xl]=null,xa=vl[--xl],vl[xl]=null;for(;e===Zn;)Zn=Wt[--Jt],Wt[Jt]=null,pn=Wt[--Jt],Wt[Jt]=null,mn=Wt[--Jt],Wt[Jt]=null}function If(e,t){Wt[Jt++]=mn,Wt[Jt++]=pn,Wt[Jt++]=Zn,mn=t.id,pn=t.overflow,Zn=e}var bt=null,Xe=null,He=!1,Wn=null,en=!1,Xr=Error(o(519));function Jn(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wa(Zt(t,e)),Xr}function Ff(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[gt]=e,t[Lt]=s,n){case"dialog":Oe("cancel",t),Oe("close",t);break;case"iframe":case"object":case"embed":Oe("load",t);break;case"video":case"audio":for(n=0;n<Ga.length;n++)Oe(Ga[n],t);break;case"source":Oe("error",t);break;case"img":case"image":case"link":Oe("error",t),Oe("load",t);break;case"details":Oe("toggle",t);break;case"input":Oe("invalid",t),ef(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Oe("invalid",t);break;case"textarea":Oe("invalid",t),nf(t,s.value,s.defaultValue,s.children)}n=s.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||s.suppressHydrationWarning===!0||ap(t.textContent,n)?(s.popover!=null&&(Oe("beforetoggle",t),Oe("toggle",t)),s.onScroll!=null&&Oe("scroll",t),s.onScrollEnd!=null&&Oe("scrollend",t),s.onClick!=null&&(t.onclick=Tn),t=!0):t=!1,t||Jn(e,!0)}function Gf(e){for(bt=e.return;bt;)switch(bt.tag){case 5:case 31:case 13:en=!1;return;case 27:case 3:en=!0;return;default:bt=bt.return}}function wl(e){if(e!==bt)return!1;if(!He)return Gf(e),He=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||hu(e.type,e.memoizedProps)),n=!n),n&&Xe&&Jn(e),Gf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Xe=mp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Xe=mp(e)}else t===27?(t=Xe,hi(e.type)?(e=yu,yu=null,Xe=e):Xe=t):Xe=bt?nn(e.stateNode.nextSibling):null;return!0}function Ui(){Xe=bt=null,He=!1}function Qr(){var e=Wn;return e!==null&&(Dt===null?Dt=e:Dt.push.apply(Dt,e),Wn=null),e}function wa(e){Wn===null?Wn=[e]:Wn.push(e)}var Zr=xe(null),Ki=null,Nn=null;function ei(e,t,n){ve(Zr,t._currentValue),t._currentValue=n}function kn(e){e._currentValue=Zr.current,ye(Zr)}function Wr(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function Jr(e,t,n,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var y=c.child;d=d.firstContext;e:for(;d!==null;){var S=d;d=c;for(var N=0;N<t.length;N++)if(S.context===t[N]){d.lanes|=n,S=d.alternate,S!==null&&(S.lanes|=n),Wr(d.return,n,e),s||(y=null);break e}d=S.next}}else if(c.tag===18){if(y=c.return,y===null)throw Error(o(341));y.lanes|=n,d=y.alternate,d!==null&&(d.lanes|=n),Wr(y,n,e),y=null}else y=c.child;if(y!==null)y.return=c;else for(y=c;y!==null;){if(y===e){y=null;break}if(c=y.sibling,c!==null){c.return=y.return,y=c;break}y=y.return}c=y}}function Sl(e,t,n,s){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var y=c.alternate;if(y===null)throw Error(o(387));if(y=y.memoizedProps,y!==null){var S=c.type;Ut(c.pendingProps.value,y.value)||(e!==null?e.push(S):e=[S])}}else if(c===se.current){if(y=c.alternate,y===null)throw Error(o(387));y.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(Pa):e=[Pa])}c=c.return}e!==null&&Jr(t,e,n,s),t.flags|=262144}function Us(e){for(e=e.firstContext;e!==null;){if(!Ut(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ii(e){Ki=e,Nn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return Yf(Ki,e)}function Ks(e,t){return Ki===null&&Ii(e),Yf(e,t)}function Yf(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Nn===null){if(e===null)throw Error(o(308));Nn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Nn=Nn.next=t;return n}var G0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},Y0=l.unstable_scheduleCallback,$0=l.unstable_NormalPriority,at={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ec(){return{controller:new G0,data:new Map,refCount:0}}function Sa(e){e.refCount--,e.refCount===0&&Y0($0,function(){e.controller.abort()})}var Ca=null,tc=0,Cl=0,Tl=null;function q0(e,t){if(Ca===null){var n=Ca=[];tc=0,Cl=lu(),Tl={status:"pending",value:void 0,then:function(s){n.push(s)}}}return tc++,t.then($f,$f),t}function $f(){if(--tc===0&&Ca!==null){Tl!==null&&(Tl.status="fulfilled");var e=Ca;Ca=null,Cl=0,Tl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function V0(e,t){var n=[],s={status:"pending",value:null,reason:null,then:function(c){n.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<n.length;c++)(0,n[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<n.length;c++)(0,n[c])(void 0)}),s}var qf=E.S;E.S=function(e,t){km=St(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&q0(e,t),qf!==null&&qf(e,t)};var Fi=xe(null);function nc(){var e=Fi.current;return e!==null?e:Ve.pooledCache}function Is(e,t){t===null?ve(Fi,Fi.current):ve(Fi,t.pool)}function Vf(){var e=nc();return e===null?null:{parent:at._currentValue,pool:e}}var Ml=Error(o(460)),ic=Error(o(474)),Fs=Error(o(542)),Gs={then:function(){}};function Pf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Xf(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Tn,Tn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Zf(e),e;default:if(typeof t.status=="string")t.then(Tn,Tn);else{if(e=Ve,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=s}},function(s){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Zf(e),e}throw Yi=t,Ml}}function Gi(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Yi=n,Ml):n}}var Yi=null;function Qf(){if(Yi===null)throw Error(o(459));var e=Yi;return Yi=null,e}function Zf(e){if(e===Ml||e===Fs)throw Error(o(483))}var Al=null,Ta=0;function Ys(e){var t=Ta;return Ta+=1,Al===null&&(Al=[]),Xf(Al,e,t)}function Ma(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function $s(e,t){throw t.$$typeof===w?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Wf(e){function t(B,j){if(e){var I=B.deletions;I===null?(B.deletions=[j],B.flags|=16):I.push(j)}}function n(B,j){if(!e)return null;for(;j!==null;)t(B,j),j=j.sibling;return null}function s(B){for(var j=new Map;B!==null;)B.key!==null?j.set(B.key,B):j.set(B.index,B),B=B.sibling;return j}function c(B,j){return B=An(B,j),B.index=0,B.sibling=null,B}function d(B,j,I){return B.index=I,e?(I=B.alternate,I!==null?(I=I.index,I<j?(B.flags|=67108866,j):I):(B.flags|=67108866,j)):(B.flags|=1048576,j)}function y(B){return e&&B.alternate===null&&(B.flags|=67108866),B}function S(B,j,I,ee){return j===null||j.tag!==6?(j=$r(I,B.mode,ee),j.return=B,j):(j=c(j,I),j.return=B,j)}function N(B,j,I,ee){var Ce=I.type;return Ce===M?Z(B,j,I.props.children,ee,I.key):j!==null&&(j.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===D&&Gi(Ce)===j.type)?(j=c(j,I.props),Ma(j,I),j.return=B,j):(j=Hs(I.type,I.key,I.props,null,B.mode,ee),Ma(j,I),j.return=B,j)}function F(B,j,I,ee){return j===null||j.tag!==4||j.stateNode.containerInfo!==I.containerInfo||j.stateNode.implementation!==I.implementation?(j=qr(I,B.mode,ee),j.return=B,j):(j=c(j,I.children||[]),j.return=B,j)}function Z(B,j,I,ee,Ce){return j===null||j.tag!==7?(j=Bi(I,B.mode,ee,Ce),j.return=B,j):(j=c(j,I),j.return=B,j)}function te(B,j,I){if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return j=$r(""+j,B.mode,I),j.return=B,j;if(typeof j=="object"&&j!==null){switch(j.$$typeof){case x:return I=Hs(j.type,j.key,j.props,null,B.mode,I),Ma(I,j),I.return=B,I;case T:return j=qr(j,B.mode,I),j.return=B,j;case D:return j=Gi(j),te(B,j,I)}if(U(j)||X(j))return j=Bi(j,B.mode,I,null),j.return=B,j;if(typeof j.then=="function")return te(B,Ys(j),I);if(j.$$typeof===O)return te(B,Ks(B,j),I);$s(B,j)}return null}function Y(B,j,I,ee){var Ce=j!==null?j.key:null;if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return Ce!==null?null:S(B,j,""+I,ee);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case x:return I.key===Ce?N(B,j,I,ee):null;case T:return I.key===Ce?F(B,j,I,ee):null;case D:return I=Gi(I),Y(B,j,I,ee)}if(U(I)||X(I))return Ce!==null?null:Z(B,j,I,ee,null);if(typeof I.then=="function")return Y(B,j,Ys(I),ee);if(I.$$typeof===O)return Y(B,j,Ks(B,I),ee);$s(B,I)}return null}function q(B,j,I,ee,Ce){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return B=B.get(I)||null,S(j,B,""+ee,Ce);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case x:return B=B.get(ee.key===null?I:ee.key)||null,N(j,B,ee,Ce);case T:return B=B.get(ee.key===null?I:ee.key)||null,F(j,B,ee,Ce);case D:return ee=Gi(ee),q(B,j,I,ee,Ce)}if(U(ee)||X(ee))return B=B.get(I)||null,Z(j,B,ee,Ce,null);if(typeof ee.then=="function")return q(B,j,I,Ys(ee),Ce);if(ee.$$typeof===O)return q(B,j,I,Ks(j,ee),Ce);$s(j,ee)}return null}function he(B,j,I,ee){for(var Ce=null,Ue=null,be=j,Re=j=0,ze=null;be!==null&&Re<I.length;Re++){be.index>Re?(ze=be,be=null):ze=be.sibling;var Ke=Y(B,be,I[Re],ee);if(Ke===null){be===null&&(be=ze);break}e&&be&&Ke.alternate===null&&t(B,be),j=d(Ke,j,Re),Ue===null?Ce=Ke:Ue.sibling=Ke,Ue=Ke,be=ze}if(Re===I.length)return n(B,be),He&&En(B,Re),Ce;if(be===null){for(;Re<I.length;Re++)be=te(B,I[Re],ee),be!==null&&(j=d(be,j,Re),Ue===null?Ce=be:Ue.sibling=be,Ue=be);return He&&En(B,Re),Ce}for(be=s(be);Re<I.length;Re++)ze=q(be,B,Re,I[Re],ee),ze!==null&&(e&&ze.alternate!==null&&be.delete(ze.key===null?Re:ze.key),j=d(ze,j,Re),Ue===null?Ce=ze:Ue.sibling=ze,Ue=ze);return e&&be.forEach(function(yi){return t(B,yi)}),He&&En(B,Re),Ce}function Te(B,j,I,ee){if(I==null)throw Error(o(151));for(var Ce=null,Ue=null,be=j,Re=j=0,ze=null,Ke=I.next();be!==null&&!Ke.done;Re++,Ke=I.next()){be.index>Re?(ze=be,be=null):ze=be.sibling;var yi=Y(B,be,Ke.value,ee);if(yi===null){be===null&&(be=ze);break}e&&be&&yi.alternate===null&&t(B,be),j=d(yi,j,Re),Ue===null?Ce=yi:Ue.sibling=yi,Ue=yi,be=ze}if(Ke.done)return n(B,be),He&&En(B,Re),Ce;if(be===null){for(;!Ke.done;Re++,Ke=I.next())Ke=te(B,Ke.value,ee),Ke!==null&&(j=d(Ke,j,Re),Ue===null?Ce=Ke:Ue.sibling=Ke,Ue=Ke);return He&&En(B,Re),Ce}for(be=s(be);!Ke.done;Re++,Ke=I.next())Ke=q(be,B,Re,Ke.value,ee),Ke!==null&&(e&&Ke.alternate!==null&&be.delete(Ke.key===null?Re:Ke.key),j=d(Ke,j,Re),Ue===null?Ce=Ke:Ue.sibling=Ke,Ue=Ke);return e&&be.forEach(function(lx){return t(B,lx)}),He&&En(B,Re),Ce}function qe(B,j,I,ee){if(typeof I=="object"&&I!==null&&I.type===M&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case x:e:{for(var Ce=I.key;j!==null;){if(j.key===Ce){if(Ce=I.type,Ce===M){if(j.tag===7){n(B,j.sibling),ee=c(j,I.props.children),ee.return=B,B=ee;break e}}else if(j.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===D&&Gi(Ce)===j.type){n(B,j.sibling),ee=c(j,I.props),Ma(ee,I),ee.return=B,B=ee;break e}n(B,j);break}else t(B,j);j=j.sibling}I.type===M?(ee=Bi(I.props.children,B.mode,ee,I.key),ee.return=B,B=ee):(ee=Hs(I.type,I.key,I.props,null,B.mode,ee),Ma(ee,I),ee.return=B,B=ee)}return y(B);case T:e:{for(Ce=I.key;j!==null;){if(j.key===Ce)if(j.tag===4&&j.stateNode.containerInfo===I.containerInfo&&j.stateNode.implementation===I.implementation){n(B,j.sibling),ee=c(j,I.children||[]),ee.return=B,B=ee;break e}else{n(B,j);break}else t(B,j);j=j.sibling}ee=qr(I,B.mode,ee),ee.return=B,B=ee}return y(B);case D:return I=Gi(I),qe(B,j,I,ee)}if(U(I))return he(B,j,I,ee);if(X(I)){if(Ce=X(I),typeof Ce!="function")throw Error(o(150));return I=Ce.call(I),Te(B,j,I,ee)}if(typeof I.then=="function")return qe(B,j,Ys(I),ee);if(I.$$typeof===O)return qe(B,j,Ks(B,I),ee);$s(B,I)}return typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint"?(I=""+I,j!==null&&j.tag===6?(n(B,j.sibling),ee=c(j,I),ee.return=B,B=ee):(n(B,j),ee=$r(I,B.mode,ee),ee.return=B,B=ee),y(B)):n(B,j)}return function(B,j,I,ee){try{Ta=0;var Ce=qe(B,j,I,ee);return Al=null,Ce}catch(be){if(be===Ml||be===Fs)throw be;var Ue=Kt(29,be,null,B.mode);return Ue.lanes=ee,Ue.return=B,Ue}finally{}}}var $i=Wf(!0),Jf=Wf(!1),ti=!1;function lc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ac(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 ni(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ii(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ie&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=zs(e),zf(e,null,n),t}return Ds(e,s,t,n),zs(e)}function Aa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,Gd(e,n)}}function sc(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var c=null,d=null;if(n=n.firstBaseUpdate,n!==null){do{var y={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};d===null?c=d=y:d=d.next=y,n=n.next}while(n!==null);d===null?c=d=t:d=d.next=t}else c=d=t;n={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var oc=!1;function Ea(){if(oc){var e=Tl;if(e!==null)throw e}}function Na(e,t,n,s){oc=!1;var c=e.updateQueue;ti=!1;var d=c.firstBaseUpdate,y=c.lastBaseUpdate,S=c.shared.pending;if(S!==null){c.shared.pending=null;var N=S,F=N.next;N.next=null,y===null?d=F:y.next=F,y=N;var Z=e.alternate;Z!==null&&(Z=Z.updateQueue,S=Z.lastBaseUpdate,S!==y&&(S===null?Z.firstBaseUpdate=F:S.next=F,Z.lastBaseUpdate=N))}if(d!==null){var te=c.baseState;y=0,Z=F=N=null,S=d;do{var Y=S.lane&-536870913,q=Y!==S.lane;if(q?(De&Y)===Y:(s&Y)===Y){Y!==0&&Y===Cl&&(oc=!0),Z!==null&&(Z=Z.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var he=e,Te=S;Y=t;var qe=n;switch(Te.tag){case 1:if(he=Te.payload,typeof he=="function"){te=he.call(qe,te,Y);break e}te=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=Te.payload,Y=typeof he=="function"?he.call(qe,te,Y):he,Y==null)break e;te=v({},te,Y);break e;case 2:ti=!0}}Y=S.callback,Y!==null&&(e.flags|=64,q&&(e.flags|=8192),q=c.callbacks,q===null?c.callbacks=[Y]:q.push(Y))}else q={lane:Y,tag:S.tag,payload:S.payload,callback:S.callback,next:null},Z===null?(F=Z=q,N=te):Z=Z.next=q,y|=Y;if(S=S.next,S===null){if(S=c.shared.pending,S===null)break;q=S,S=q.next,q.next=null,c.lastBaseUpdate=q,c.shared.pending=null}}while(!0);Z===null&&(N=te),c.baseState=N,c.firstBaseUpdate=F,c.lastBaseUpdate=Z,d===null&&(c.shared.lanes=0),ri|=y,e.lanes=y,e.memoizedState=te}}function eh(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function th(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)eh(n[e],t)}var El=xe(null),qs=xe(0);function nh(e,t){e=Bn,ve(qs,e),ve(El,t),Bn=e|t.baseLanes}function rc(){ve(qs,Bn),ve(El,El.current)}function cc(){Bn=qs.current,ye(El),ye(qs)}var It=xe(null),tn=null;function li(e){var t=e.alternate;ve(it,it.current&1),ve(It,e),tn===null&&(t===null||El.current!==null||t.memoizedState!==null)&&(tn=e)}function uc(e){ve(it,it.current),ve(It,e),tn===null&&(tn=e)}function ih(e){e.tag===22?(ve(it,it.current),ve(It,e),tn===null&&(tn=e)):ai()}function ai(){ve(it,it.current),ve(It,It.current)}function Ft(e){ye(It),tn===e&&(tn=null),ye(it)}var it=xe(0);function Vs(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||gu(n)||bu(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 Ln=0,Ne=null,Ye=null,st=null,Ps=!1,Nl=!1,qi=!1,Xs=0,ka=0,kl=null,P0=0;function tt(){throw Error(o(321))}function dc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ut(e[n],t[n]))return!1;return!0}function fc(e,t,n,s,c,d){return Ln=d,Ne=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?Kh:Ec,qi=!1,d=n(s,c),qi=!1,Nl&&(d=ah(t,n,s,c)),lh(e),d}function lh(e){E.H=_a;var t=Ye!==null&&Ye.next!==null;if(Ln=0,st=Ye=Ne=null,Ps=!1,ka=0,kl=null,t)throw Error(o(300));e===null||ot||(e=e.dependencies,e!==null&&Us(e)&&(ot=!0))}function ah(e,t,n,s){Ne=e;var c=0;do{if(Nl&&(kl=null),ka=0,Nl=!1,25<=c)throw Error(o(301));if(c+=1,st=Ye=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}E.H=Ih,d=t(n,s)}while(Nl);return d}function X0(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?La(t):t,e=e.useState()[0],(Ye!==null?Ye.memoizedState:null)!==e&&(Ne.flags|=1024),t}function hc(){var e=Xs!==0;return Xs=0,e}function mc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function pc(e){if(Ps){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ps=!1}Ln=0,st=Ye=Ne=null,Nl=!1,ka=Xs=0,kl=null}function At(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return st===null?Ne.memoizedState=st=e:st=st.next=e,st}function lt(){if(Ye===null){var e=Ne.alternate;e=e!==null?e.memoizedState:null}else e=Ye.next;var t=st===null?Ne.memoizedState:st.next;if(t!==null)st=t,Ye=e;else{if(e===null)throw Ne.alternate===null?Error(o(467)):Error(o(310));Ye=e,e={memoizedState:Ye.memoizedState,baseState:Ye.baseState,baseQueue:Ye.baseQueue,queue:Ye.queue,next:null},st===null?Ne.memoizedState=st=e:st=st.next=e}return st}function Qs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function La(e){var t=ka;return ka+=1,kl===null&&(kl=[]),e=Xf(kl,e,t),t=Ne,(st===null?t.memoizedState:st.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?Kh:Ec),e}function Zs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return La(e);if(e.$$typeof===O)return yt(e)}throw Error(o(438,String(e)))}function gc(e){var t=null,n=Ne.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=Ne.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Qs(),Ne.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),s=0;s<e;s++)n[s]=J;return t.index++,n}function Rn(e,t){return typeof t=="function"?t(e):t}function Ws(e){var t=lt();return bc(t,Ye,e)}function bc(e,t,n){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=n;var c=e.baseQueue,d=s.pending;if(d!==null){if(c!==null){var y=c.next;c.next=d.next,d.next=y}t.baseQueue=c=d,s.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var S=y=null,N=null,F=t,Z=!1;do{var te=F.lane&-536870913;if(te!==F.lane?(De&te)===te:(Ln&te)===te){var Y=F.revertLane;if(Y===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),te===Cl&&(Z=!0);else if((Ln&Y)===Y){F=F.next,Y===Cl&&(Z=!0);continue}else te={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},N===null?(S=N=te,y=d):N=N.next=te,Ne.lanes|=Y,ri|=Y;te=F.action,qi&&n(d,te),d=F.hasEagerState?F.eagerState:n(d,te)}else Y={lane:te,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},N===null?(S=N=Y,y=d):N=N.next=Y,Ne.lanes|=te,ri|=te;F=F.next}while(F!==null&&F!==t);if(N===null?y=d:N.next=S,!Ut(d,e.memoizedState)&&(ot=!0,Z&&(n=Tl,n!==null)))throw n;e.memoizedState=d,e.baseState=y,e.baseQueue=N,s.lastRenderedState=d}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function yc(e){var t=lt(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var s=n.dispatch,c=n.pending,d=t.memoizedState;if(c!==null){n.pending=null;var y=c=c.next;do d=e(d,y.action),y=y.next;while(y!==c);Ut(d,t.memoizedState)||(ot=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),n.lastRenderedState=d}return[d,s]}function sh(e,t,n){var s=Ne,c=lt(),d=He;if(d){if(n===void 0)throw Error(o(407));n=n()}else n=t();var y=!Ut((Ye||c).memoizedState,n);if(y&&(c.memoizedState=n,ot=!0),c=c.queue,wc(ch.bind(null,s,c,e),[e]),c.getSnapshot!==t||y||st!==null&&st.memoizedState.tag&1){if(s.flags|=2048,Ll(9,{destroy:void 0},rh.bind(null,s,c,n,t),null),Ve===null)throw Error(o(349));d||(Ln&127)!==0||oh(s,t,n)}return n}function oh(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ne.updateQueue,t===null?(t=Qs(),Ne.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function rh(e,t,n,s){t.value=n,t.getSnapshot=s,uh(t)&&dh(e)}function ch(e,t,n){return n(function(){uh(t)&&dh(e)})}function uh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ut(e,n)}catch{return!0}}function dh(e){var t=Hi(e,2);t!==null&&zt(t,e,2)}function vc(e){var t=At();if(typeof e=="function"){var n=e;if(e=n(),qi){cn(!0);try{n()}finally{cn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rn,lastRenderedState:e},t}function fh(e,t,n,s){return e.baseState=n,bc(e,Ye,typeof s=="function"?s:Rn)}function Q0(e,t,n,s,c){if(to(e))throw Error(o(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){d.listeners.push(y)}};E.T!==null?n(!0):d.isTransition=!1,s(d),n=t.pending,n===null?(d.next=t.pending=d,hh(t,d)):(d.next=n.next,t.pending=n.next=d)}}function hh(e,t){var n=t.action,s=t.payload,c=e.state;if(t.isTransition){var d=E.T,y={};E.T=y;try{var S=n(c,s),N=E.S;N!==null&&N(y,S),mh(e,t,S)}catch(F){xc(e,t,F)}finally{d!==null&&y.types!==null&&(d.types=y.types),E.T=d}}else try{d=n(c,s),mh(e,t,d)}catch(F){xc(e,t,F)}}function mh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){ph(e,t,s)},function(s){return xc(e,t,s)}):ph(e,t,n)}function ph(e,t,n){t.status="fulfilled",t.value=n,gh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,hh(e,n)))}function xc(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,gh(t),t=t.next;while(t!==s)}e.action=null}function gh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function bh(e,t){return t}function yh(e,t){if(He){var n=Ve.formState;if(n!==null){e:{var s=Ne;if(He){if(Xe){t:{for(var c=Xe,d=en;c.nodeType!==8;){if(!d){c=null;break t}if(c=nn(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){Xe=nn(c.nextSibling),s=c.data==="F!";break e}}Jn(s)}s=!1}s&&(t=n[0])}}return n=At(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bh,lastRenderedState:t},n.queue=s,n=Hh.bind(null,Ne,s),s.dispatch=n,s=vc(!1),d=Ac.bind(null,Ne,!1,s.queue),s=At(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,n=Q0.bind(null,Ne,c,d,n),c.dispatch=n,s.memoizedState=e,[t,n,!1]}function vh(e){var t=lt();return xh(t,Ye,e)}function xh(e,t,n){if(t=bc(e,t,bh)[0],e=Ws(Rn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=La(t)}catch(y){throw y===Ml?Fs:y}else s=t;t=lt();var c=t.queue,d=c.dispatch;return n!==t.memoizedState&&(Ne.flags|=2048,Ll(9,{destroy:void 0},Z0.bind(null,c,n),null)),[s,d,e]}function Z0(e,t){e.action=t}function wh(e){var t=lt(),n=Ye;if(n!==null)return xh(t,n,e);lt(),t=t.memoizedState,n=lt();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function Ll(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=Ne.updateQueue,t===null&&(t=Qs(),Ne.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e),e}function Sh(){return lt().memoizedState}function Js(e,t,n,s){var c=At();Ne.flags|=e,c.memoizedState=Ll(1|t,{destroy:void 0},n,s===void 0?null:s)}function eo(e,t,n,s){var c=lt();s=s===void 0?null:s;var d=c.memoizedState.inst;Ye!==null&&s!==null&&dc(s,Ye.memoizedState.deps)?c.memoizedState=Ll(t,d,n,s):(Ne.flags|=e,c.memoizedState=Ll(1|t,d,n,s))}function Ch(e,t){Js(8390656,8,e,t)}function wc(e,t){eo(2048,8,e,t)}function W0(e){Ne.flags|=4;var t=Ne.updateQueue;if(t===null)t=Qs(),Ne.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Th(e){var t=lt().memoizedState;return W0({ref:t,nextImpl:e}),function(){if((Ie&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Mh(e,t){return eo(4,2,e,t)}function Ah(e,t){return eo(4,4,e,t)}function Eh(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 Nh(e,t,n){n=n!=null?n.concat([e]):null,eo(4,4,Eh.bind(null,t,e),n)}function Sc(){}function kh(e,t){var n=lt();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&dc(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Lh(e,t){var n=lt();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&dc(t,s[1]))return s[0];if(s=e(),qi){cn(!0);try{e()}finally{cn(!1)}}return n.memoizedState=[s,t],s}function Cc(e,t,n){return n===void 0||(Ln&1073741824)!==0&&(De&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Rm(),Ne.lanes|=e,ri|=e,n)}function Rh(e,t,n,s){return Ut(n,t)?n:El.current!==null?(e=Cc(e,n,s),Ut(e,t)||(ot=!0),e):(Ln&42)===0||(Ln&1073741824)!==0&&(De&261930)===0?(ot=!0,e.memoizedState=n):(e=Rm(),Ne.lanes|=e,ri|=e,t)}function _h(e,t,n,s,c){var d=G.p;G.p=d!==0&&8>d?d:8;var y=E.T,S={};E.T=S,Ac(e,!1,t,n);try{var N=c(),F=E.S;if(F!==null&&F(S,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var Z=V0(N,s);Ra(e,t,Z,$t(e))}else Ra(e,t,s,$t(e))}catch(te){Ra(e,t,{then:function(){},status:"rejected",reason:te},$t())}finally{G.p=d,y!==null&&S.types!==null&&(y.types=S.types),E.T=y}}function J0(){}function Tc(e,t,n,s){if(e.tag!==5)throw Error(o(476));var c=jh(e).queue;_h(e,c,t,P,n===null?J0:function(){return Oh(e),n(s)})}function jh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rn,lastRenderedState:P},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Oh(e){var t=jh(e);t.next===null&&(t=e.alternate.memoizedState),Ra(e,t.next.queue,{},$t())}function Mc(){return yt(Pa)}function Dh(){return lt().memoizedState}function zh(){return lt().memoizedState}function ev(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=$t();e=ni(n);var s=ii(t,e,n);s!==null&&(zt(s,t,n),Aa(s,t,n)),t={cache:ec()},e.payload=t;return}t=t.return}}function tv(e,t,n){var s=$t();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},to(e)?Bh(t,n):(n=Gr(e,t,n,s),n!==null&&(zt(n,e,s),Uh(n,t,s)))}function Hh(e,t,n){var s=$t();Ra(e,t,n,s)}function Ra(e,t,n,s){var c={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(to(e))Bh(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var y=t.lastRenderedState,S=d(y,n);if(c.hasEagerState=!0,c.eagerState=S,Ut(S,y))return Ds(e,t,c,0),Ve===null&&Os(),!1}catch{}finally{}if(n=Gr(e,t,c,s),n!==null)return zt(n,e,s),Uh(n,t,s),!0}return!1}function Ac(e,t,n,s){if(s={lane:2,revertLane:lu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},to(e)){if(t)throw Error(o(479))}else t=Gr(e,n,s,2),t!==null&&zt(t,e,2)}function to(e){var t=e.alternate;return e===Ne||t!==null&&t===Ne}function Bh(e,t){Nl=Ps=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Uh(e,t,n){if((n&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,Gd(e,n)}}var _a={readContext:yt,use:Zs,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useLayoutEffect:tt,useInsertionEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useSyncExternalStore:tt,useId:tt,useHostTransitionStatus:tt,useFormState:tt,useActionState:tt,useOptimistic:tt,useMemoCache:tt,useCacheRefresh:tt};_a.useEffectEvent=tt;var Kh={readContext:yt,use:Zs,useCallback:function(e,t){return At().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:Ch,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Js(4194308,4,Eh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Js(4194308,4,e,t)},useInsertionEffect:function(e,t){Js(4,2,e,t)},useMemo:function(e,t){var n=At();t=t===void 0?null:t;var s=e();if(qi){cn(!0);try{e()}finally{cn(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=At();if(n!==void 0){var c=n(t);if(qi){cn(!0);try{n(t)}finally{cn(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=tv.bind(null,Ne,e),[s.memoizedState,e]},useRef:function(e){var t=At();return e={current:e},t.memoizedState=e},useState:function(e){e=vc(e);var t=e.queue,n=Hh.bind(null,Ne,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Sc,useDeferredValue:function(e,t){var n=At();return Cc(n,e,t)},useTransition:function(){var e=vc(!1);return e=_h.bind(null,Ne,e.queue,!0,!1),At().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Ne,c=At();if(He){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Ve===null)throw Error(o(349));(De&127)!==0||oh(s,t,n)}c.memoizedState=n;var d={value:n,getSnapshot:t};return c.queue=d,Ch(ch.bind(null,s,d,e),[e]),s.flags|=2048,Ll(9,{destroy:void 0},rh.bind(null,s,d,n,t),null),n},useId:function(){var e=At(),t=Ve.identifierPrefix;if(He){var n=pn,s=mn;n=(s&~(1<<32-Ct(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Xs++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=P0++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Mc,useFormState:yh,useActionState:yh,useOptimistic:function(e){var t=At();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ac.bind(null,Ne,!0,n),n.dispatch=t,[e,t]},useMemoCache:gc,useCacheRefresh:function(){return At().memoizedState=ev.bind(null,Ne)},useEffectEvent:function(e){var t=At(),n={impl:e};return t.memoizedState=n,function(){if((Ie&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},Ec={readContext:yt,use:Zs,useCallback:kh,useContext:yt,useEffect:wc,useImperativeHandle:Nh,useInsertionEffect:Mh,useLayoutEffect:Ah,useMemo:Lh,useReducer:Ws,useRef:Sh,useState:function(){return Ws(Rn)},useDebugValue:Sc,useDeferredValue:function(e,t){var n=lt();return Rh(n,Ye.memoizedState,e,t)},useTransition:function(){var e=Ws(Rn)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:La(e),t]},useSyncExternalStore:sh,useId:Dh,useHostTransitionStatus:Mc,useFormState:vh,useActionState:vh,useOptimistic:function(e,t){var n=lt();return fh(n,Ye,e,t)},useMemoCache:gc,useCacheRefresh:zh};Ec.useEffectEvent=Th;var Ih={readContext:yt,use:Zs,useCallback:kh,useContext:yt,useEffect:wc,useImperativeHandle:Nh,useInsertionEffect:Mh,useLayoutEffect:Ah,useMemo:Lh,useReducer:yc,useRef:Sh,useState:function(){return yc(Rn)},useDebugValue:Sc,useDeferredValue:function(e,t){var n=lt();return Ye===null?Cc(n,e,t):Rh(n,Ye.memoizedState,e,t)},useTransition:function(){var e=yc(Rn)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:La(e),t]},useSyncExternalStore:sh,useId:Dh,useHostTransitionStatus:Mc,useFormState:wh,useActionState:wh,useOptimistic:function(e,t){var n=lt();return Ye!==null?fh(n,Ye,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:gc,useCacheRefresh:zh};Ih.useEffectEvent=Th;function Nc(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:v({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var kc={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=$t(),c=ni(s);c.payload=t,n!=null&&(c.callback=n),t=ii(e,c,s),t!==null&&(zt(t,e,s),Aa(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=$t(),c=ni(s);c.tag=1,c.payload=t,n!=null&&(c.callback=n),t=ii(e,c,s),t!==null&&(zt(t,e,s),Aa(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=$t(),s=ni(n);s.tag=2,t!=null&&(s.callback=t),t=ii(e,s,n),t!==null&&(zt(t,e,n),Aa(t,e,n))}};function Fh(e,t,n,s,c,d,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,d,y):t.prototype&&t.prototype.isPureReactComponent?!ya(n,s)||!ya(c,d):!0}function Gh(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&kc.enqueueReplaceState(t,t.state,null)}function Vi(e,t){var n=t;if("ref"in t){n={};for(var s in t)s!=="ref"&&(n[s]=t[s])}if(e=e.defaultProps){n===t&&(n=v({},n));for(var c in e)n[c]===void 0&&(n[c]=e[c])}return n}function Yh(e){js(e)}function $h(e){console.error(e)}function qh(e){js(e)}function no(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Vh(e,t,n){try{var s=e.onCaughtError;s(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function Lc(e,t,n){return n=ni(n),n.tag=3,n.payload={element:null},n.callback=function(){no(e,t)},n}function Ph(e){return e=ni(e),e.tag=3,e}function Xh(e,t,n,s){var c=n.type.getDerivedStateFromError;if(typeof c=="function"){var d=s.value;e.payload=function(){return c(d)},e.callback=function(){Vh(t,n,s)}}var y=n.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){Vh(t,n,s),typeof c!="function"&&(ci===null?ci=new Set([this]):ci.add(this));var S=s.stack;this.componentDidCatch(s.value,{componentStack:S!==null?S:""})})}function nv(e,t,n,s,c){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&Sl(t,n,c,!0),n=It.current,n!==null){switch(n.tag){case 31:case 13:return tn===null?po():n.alternate===null&&nt===0&&(nt=3),n.flags&=-257,n.flags|=65536,n.lanes=c,s===Gs?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),tu(e,s,c)),!1;case 22:return n.flags|=65536,s===Gs?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([s]):n.add(s)),tu(e,s,c)),!1}throw Error(o(435,n.tag))}return tu(e,s,c),po(),!1}if(He)return t=It.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==Xr&&(e=Error(o(422),{cause:s}),wa(Zt(e,n)))):(s!==Xr&&(t=Error(o(423),{cause:s}),wa(Zt(t,n))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Zt(s,n),c=Lc(e.stateNode,s,c),sc(e,c),nt!==4&&(nt=2)),!1;var d=Error(o(520),{cause:s});if(d=Zt(d,n),Ka===null?Ka=[d]:Ka.push(d),nt!==4&&(nt=2),t===null)return!0;s=Zt(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=c&-c,n.lanes|=e,e=Lc(n.stateNode,s,e),sc(n,e),!1;case 1:if(t=n.type,d=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(ci===null||!ci.has(d))))return n.flags|=65536,c&=-c,n.lanes|=c,c=Ph(c),Xh(c,e,n,s),sc(n,c),!1}n=n.return}while(n!==null);return!1}var Rc=Error(o(461)),ot=!1;function vt(e,t,n,s){t.child=e===null?Jf(t,null,n,s):$i(t,e.child,n,s)}function Qh(e,t,n,s,c){n=n.render;var d=t.ref;if("ref"in s){var y={};for(var S in s)S!=="ref"&&(y[S]=s[S])}else y=s;return Ii(t),s=fc(e,t,n,y,d,c),S=hc(),e!==null&&!ot?(mc(e,t,c),_n(e,t,c)):(He&&S&&Vr(t),t.flags|=1,vt(e,t,s,c),t.child)}function Zh(e,t,n,s,c){if(e===null){var d=n.type;return typeof d=="function"&&!Yr(d)&&d.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=d,Wh(e,t,d,s,c)):(e=Hs(n.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Uc(e,c)){var y=d.memoizedProps;if(n=n.compare,n=n!==null?n:ya,n(y,s)&&e.ref===t.ref)return _n(e,t,c)}return t.flags|=1,e=An(d,s),e.ref=t.ref,e.return=t,t.child=e}function Wh(e,t,n,s,c){if(e!==null){var d=e.memoizedProps;if(ya(d,s)&&e.ref===t.ref)if(ot=!1,t.pendingProps=s=d,Uc(e,c))(e.flags&131072)!==0&&(ot=!0);else return t.lanes=e.lanes,_n(e,t,c)}return _c(e,t,n,s,c)}function Jh(e,t,n,s){var c=s.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|n:n,e!==null){for(s=t.child=e.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~d}else s=0,t.child=null;return em(e,t,d,n,s)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Is(t,d!==null?d.cachePool:null),d!==null?nh(t,d):rc(),ih(t);else return s=t.lanes=536870912,em(e,t,d!==null?d.baseLanes|n:n,n,s)}else d!==null?(Is(t,d.cachePool),nh(t,d),ai(),t.memoizedState=null):(e!==null&&Is(t,null),rc(),ai());return vt(e,t,c,n),t.child}function ja(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function em(e,t,n,s,c){var d=nc();return d=d===null?null:{parent:at._currentValue,pool:d},t.memoizedState={baseLanes:n,cachePool:d},e!==null&&Is(t,null),rc(),ih(t),e!==null&&Sl(e,t,s,!0),t.childLanes=c,null}function io(e,t){return t=ao({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function tm(e,t,n){return $i(t,e.child,null,n),e=io(t,t.pendingProps),e.flags|=2,Ft(t),t.memoizedState=null,e}function iv(e,t,n){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(He){if(s.mode==="hidden")return e=io(t,s),t.lanes=536870912,ja(null,e);if(uc(t),(e=Xe)?(e=hp(e,en),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zn!==null?{id:mn,overflow:pn}:null,retryLane:536870912,hydrationErrors:null},n=Bf(e),n.return=t,t.child=n,bt=t,Xe=null)):e=null,e===null)throw Jn(t);return t.lanes=536870912,null}return io(t,s)}var d=e.memoizedState;if(d!==null){var y=d.dehydrated;if(uc(t),c)if(t.flags&256)t.flags&=-257,t=tm(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(ot||Sl(e,t,n,!1),c=(n&e.childLanes)!==0,ot||c){if(s=Ve,s!==null&&(y=Yd(s,n),y!==0&&y!==d.retryLane))throw d.retryLane=y,Hi(e,y),zt(s,e,y),Rc;po(),t=tm(e,t,n)}else e=d.treeContext,Xe=nn(y.nextSibling),bt=t,He=!0,Wn=null,en=!1,e!==null&&If(t,e),t=io(t,s),t.flags|=4096;return t}return e=An(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function lo(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(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function _c(e,t,n,s,c){return Ii(t),n=fc(e,t,n,s,void 0,c),s=hc(),e!==null&&!ot?(mc(e,t,c),_n(e,t,c)):(He&&s&&Vr(t),t.flags|=1,vt(e,t,n,c),t.child)}function nm(e,t,n,s,c,d){return Ii(t),t.updateQueue=null,n=ah(t,s,n,c),lh(e),s=hc(),e!==null&&!ot?(mc(e,t,d),_n(e,t,d)):(He&&s&&Vr(t),t.flags|=1,vt(e,t,n,d),t.child)}function im(e,t,n,s,c){if(Ii(t),t.stateNode===null){var d=yl,y=n.contextType;typeof y=="object"&&y!==null&&(d=yt(y)),d=new n(s,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=kc,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=s,d.state=t.memoizedState,d.refs={},lc(t),y=n.contextType,d.context=typeof y=="object"&&y!==null?yt(y):yl,d.state=t.memoizedState,y=n.getDerivedStateFromProps,typeof y=="function"&&(Nc(t,n,y,s),d.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(y=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),y!==d.state&&kc.enqueueReplaceState(d,d.state,null),Na(t,s,d,c),Ea(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){d=t.stateNode;var S=t.memoizedProps,N=Vi(n,S);d.props=N;var F=d.context,Z=n.contextType;y=yl,typeof Z=="object"&&Z!==null&&(y=yt(Z));var te=n.getDerivedStateFromProps;Z=typeof te=="function"||typeof d.getSnapshotBeforeUpdate=="function",S=t.pendingProps!==S,Z||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(S||F!==y)&&Gh(t,d,s,y),ti=!1;var Y=t.memoizedState;d.state=Y,Na(t,s,d,c),Ea(),F=t.memoizedState,S||Y!==F||ti?(typeof te=="function"&&(Nc(t,n,te,s),F=t.memoizedState),(N=ti||Fh(t,n,N,s,Y,F,y))?(Z||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=F),d.props=s,d.state=F,d.context=y,s=N):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{d=t.stateNode,ac(e,t),y=t.memoizedProps,Z=Vi(n,y),d.props=Z,te=t.pendingProps,Y=d.context,F=n.contextType,N=yl,typeof F=="object"&&F!==null&&(N=yt(F)),S=n.getDerivedStateFromProps,(F=typeof S=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(y!==te||Y!==N)&&Gh(t,d,s,N),ti=!1,Y=t.memoizedState,d.state=Y,Na(t,s,d,c),Ea();var q=t.memoizedState;y!==te||Y!==q||ti||e!==null&&e.dependencies!==null&&Us(e.dependencies)?(typeof S=="function"&&(Nc(t,n,S,s),q=t.memoizedState),(Z=ti||Fh(t,n,Z,s,Y,q,N)||e!==null&&e.dependencies!==null&&Us(e.dependencies))?(F||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(s,q,N),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(s,q,N)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=q),d.props=s,d.state=q,d.context=N,s=Z):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),s=!1)}return d=s,lo(e,t),s=(t.flags&128)!==0,d||s?(d=t.stateNode,n=s&&typeof n.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&s?(t.child=$i(t,e.child,null,c),t.child=$i(t,null,n,c)):vt(e,t,n,c),t.memoizedState=d.state,e=t.child):e=_n(e,t,c),e}function lm(e,t,n,s){return Ui(),t.flags|=256,vt(e,t,n,s),t.child}var jc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Oc(e){return{baseLanes:e,cachePool:Vf()}}function Dc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Yt),e}function am(e,t,n){var s=t.pendingProps,c=!1,d=(t.flags&128)!==0,y;if((y=d)||(y=e!==null&&e.memoizedState===null?!1:(it.current&2)!==0),y&&(c=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(He){if(c?li(t):ai(),(e=Xe)?(e=hp(e,en),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zn!==null?{id:mn,overflow:pn}:null,retryLane:536870912,hydrationErrors:null},n=Bf(e),n.return=t,t.child=n,bt=t,Xe=null)):e=null,e===null)throw Jn(t);return bu(e)?t.lanes=32:t.lanes=536870912,null}var S=s.children;return s=s.fallback,c?(ai(),c=t.mode,S=ao({mode:"hidden",children:S},c),s=Bi(s,c,n,null),S.return=t,s.return=t,S.sibling=s,t.child=S,s=t.child,s.memoizedState=Oc(n),s.childLanes=Dc(e,y,n),t.memoizedState=jc,ja(null,s)):(li(t),zc(t,S))}var N=e.memoizedState;if(N!==null&&(S=N.dehydrated,S!==null)){if(d)t.flags&256?(li(t),t.flags&=-257,t=Hc(e,t,n)):t.memoizedState!==null?(ai(),t.child=e.child,t.flags|=128,t=null):(ai(),S=s.fallback,c=t.mode,s=ao({mode:"visible",children:s.children},c),S=Bi(S,c,n,null),S.flags|=2,s.return=t,S.return=t,s.sibling=S,t.child=s,$i(t,e.child,null,n),s=t.child,s.memoizedState=Oc(n),s.childLanes=Dc(e,y,n),t.memoizedState=jc,t=ja(null,s));else if(li(t),bu(S)){if(y=S.nextSibling&&S.nextSibling.dataset,y)var F=y.dgst;y=F,s=Error(o(419)),s.stack="",s.digest=y,wa({value:s,source:null,stack:null}),t=Hc(e,t,n)}else if(ot||Sl(e,t,n,!1),y=(n&e.childLanes)!==0,ot||y){if(y=Ve,y!==null&&(s=Yd(y,n),s!==0&&s!==N.retryLane))throw N.retryLane=s,Hi(e,s),zt(y,e,s),Rc;gu(S)||po(),t=Hc(e,t,n)}else gu(S)?(t.flags|=192,t.child=e.child,t=null):(e=N.treeContext,Xe=nn(S.nextSibling),bt=t,He=!0,Wn=null,en=!1,e!==null&&If(t,e),t=zc(t,s.children),t.flags|=4096);return t}return c?(ai(),S=s.fallback,c=t.mode,N=e.child,F=N.sibling,s=An(N,{mode:"hidden",children:s.children}),s.subtreeFlags=N.subtreeFlags&65011712,F!==null?S=An(F,S):(S=Bi(S,c,n,null),S.flags|=2),S.return=t,s.return=t,s.sibling=S,t.child=s,ja(null,s),s=t.child,S=e.child.memoizedState,S===null?S=Oc(n):(c=S.cachePool,c!==null?(N=at._currentValue,c=c.parent!==N?{parent:N,pool:N}:c):c=Vf(),S={baseLanes:S.baseLanes|n,cachePool:c}),s.memoizedState=S,s.childLanes=Dc(e,y,n),t.memoizedState=jc,ja(e.child,s)):(li(t),n=e.child,e=n.sibling,n=An(n,{mode:"visible",children:s.children}),n.return=t,n.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=n,t.memoizedState=null,n)}function zc(e,t){return t=ao({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ao(e,t){return e=Kt(22,e,null,t),e.lanes=0,e}function Hc(e,t,n){return $i(t,e.child,null,n),e=zc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sm(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Wr(e.return,t,n)}function Bc(e,t,n,s,c,d){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:c,treeForkCount:d}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=s,y.tail=n,y.tailMode=c,y.treeForkCount=d)}function om(e,t,n){var s=t.pendingProps,c=s.revealOrder,d=s.tail;s=s.children;var y=it.current,S=(y&2)!==0;if(S?(y=y&1|2,t.flags|=128):y&=1,ve(it,y),vt(e,t,s,n),s=He?xa:0,!S&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&sm(e,n,t);else if(e.tag===19)sm(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(c){case"forwards":for(n=t.child,c=null;n!==null;)e=n.alternate,e!==null&&Vs(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),Bc(t,!1,c,n,d,s);break;case"backwards":case"unstable_legacy-backwards":for(n=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Vs(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}Bc(t,!0,n,null,d,s);break;case"together":Bc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function _n(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ri|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Sl(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=An(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=An(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Uc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Us(e)))}function lv(e,t,n){switch(t.tag){case 3:Se(t,t.stateNode.containerInfo),ei(t,at,e.memoizedState.cache),Ui();break;case 27:case 5:pe(t);break;case 4:Se(t,t.stateNode.containerInfo);break;case 10:ei(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,uc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(li(t),t.flags|=128,null):(n&t.child.childLanes)!==0?am(e,t,n):(li(t),e=_n(e,t,n),e!==null?e.sibling:null);li(t);break;case 19:var c=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(Sl(e,t,n,!1),s=(n&t.childLanes)!==0),c){if(s)return om(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ve(it,it.current),s)break;return null;case 22:return t.lanes=0,Jh(e,t,n,t.pendingProps);case 24:ei(t,at,e.memoizedState.cache)}return _n(e,t,n)}function rm(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ot=!0;else{if(!Uc(e,n)&&(t.flags&128)===0)return ot=!1,lv(e,t,n);ot=(e.flags&131072)!==0}else ot=!1,He&&(t.flags&1048576)!==0&&Kf(t,xa,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Gi(t.elementType),t.type=e,typeof e=="function")Yr(e)?(s=Vi(e,s),t.tag=1,t=im(null,t,e,s,n)):(t.tag=0,t=_c(null,t,e,s,n));else{if(e!=null){var c=e.$$typeof;if(c===$){t.tag=11,t=Qh(null,t,e,s,n);break e}else if(c===L){t.tag=14,t=Zh(null,t,e,s,n);break e}}throw t=ue(e)||e,Error(o(306,t,""))}}return t;case 0:return _c(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,c=Vi(s,t.pendingProps),im(e,t,s,c,n);case 3:e:{if(Se(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var d=t.memoizedState;c=d.element,ac(e,t),Na(t,s,null,n);var y=t.memoizedState;if(s=y.cache,ei(t,at,s),s!==d.cache&&Jr(t,[at],n,!0),Ea(),s=y.element,d.isDehydrated)if(d={element:s,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=lm(e,t,s,n);break e}else if(s!==c){c=Zt(Error(o(424)),t),wa(c),t=lm(e,t,s,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(Xe=nn(e.firstChild),bt=t,He=!0,Wn=null,en=!0,n=Jf(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ui(),s===c){t=_n(e,t,n);break e}vt(e,t,s,n)}t=t.child}return t;case 26:return lo(e,t),e===null?(n=vp(t.type,null,t.pendingProps,null))?t.memoizedState=n:He||(n=t.type,e=t.pendingProps,s=So(we.current).createElement(n),s[gt]=t,s[Lt]=e,xt(s,n,e),ht(s),t.stateNode=s):t.memoizedState=vp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pe(t),e===null&&He&&(s=t.stateNode=gp(t.type,t.pendingProps,we.current),bt=t,en=!0,c=Xe,hi(t.type)?(yu=c,Xe=nn(s.firstChild)):Xe=c),vt(e,t,t.pendingProps.children,n),lo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&He&&((c=s=Xe)&&(s=Ov(s,t.type,t.pendingProps,en),s!==null?(t.stateNode=s,bt=t,Xe=nn(s.firstChild),en=!1,c=!0):c=!1),c||Jn(t)),pe(t),c=t.type,d=t.pendingProps,y=e!==null?e.memoizedProps:null,s=d.children,hu(c,d)?s=null:y!==null&&hu(c,y)&&(t.flags|=32),t.memoizedState!==null&&(c=fc(e,t,X0,null,null,n),Pa._currentValue=c),lo(e,t),vt(e,t,s,n),t.child;case 6:return e===null&&He&&((e=n=Xe)&&(n=Dv(n,t.pendingProps,en),n!==null?(t.stateNode=n,bt=t,Xe=null,e=!0):e=!1),e||Jn(t)),null;case 13:return am(e,t,n);case 4:return Se(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=$i(t,null,s,n):vt(e,t,s,n),t.child;case 11:return Qh(e,t,t.type,t.pendingProps,n);case 7:return vt(e,t,t.pendingProps,n),t.child;case 8:return vt(e,t,t.pendingProps.children,n),t.child;case 12:return vt(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,ei(t,t.type,s.value),vt(e,t,s.children,n),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,Ii(t),c=yt(c),s=s(c),t.flags|=1,vt(e,t,s,n),t.child;case 14:return Zh(e,t,t.type,t.pendingProps,n);case 15:return Wh(e,t,t.type,t.pendingProps,n);case 19:return om(e,t,n);case 31:return iv(e,t,n);case 22:return Jh(e,t,n,t.pendingProps);case 24:return Ii(t),s=yt(at),e===null?(c=nc(),c===null&&(c=Ve,d=ec(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=n),c=d),t.memoizedState={parent:s,cache:c},lc(t),ei(t,at,c)):((e.lanes&n)!==0&&(ac(e,t),Na(t,null,null,n),Ea()),c=e.memoizedState,d=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),ei(t,at,s)):(s=d.cache,ei(t,at,s),s!==c.cache&&Jr(t,[at],n,!0))),vt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function jn(e){e.flags|=4}function Kc(e,t,n,s,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Dm())e.flags|=8192;else throw Yi=Gs,ic}else e.flags&=-16777217}function cm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Tp(t))if(Dm())e.flags|=8192;else throw Yi=Gs,ic}function so(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Id():536870912,e.lanes|=t,Ol|=t)}function Oa(e,t){if(!He)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 s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Qe(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var c=e.child;c!==null;)n|=c.lanes|c.childLanes,s|=c.subtreeFlags&65011712,s|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)n|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function av(e,t,n){var s=t.pendingProps;switch(Pr(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(t),null;case 1:return Qe(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),kn(at),ae(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(wl(t)?jn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Qr())),Qe(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(jn(t),d!==null?(Qe(t),cm(t,d)):(Qe(t),Kc(t,c,null,s,n))):d?d!==e.memoizedState?(jn(t),Qe(t),cm(t,d)):(Qe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&jn(t),Qe(t),Kc(t,c,e,s,n)),null;case 27:if(Ee(t),n=we.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&jn(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}e=me.current,wl(t)?Ff(t):(e=gp(c,s,n),t.stateNode=e,jn(t))}return Qe(t),null;case 5:if(Ee(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&jn(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}if(d=me.current,wl(t))Ff(t);else{var y=So(we.current);switch(d){case 1:d=y.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=y.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=y.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof s.is=="string"?y.createElement("select",{is:s.is}):y.createElement("select"),s.multiple?d.multiple=!0:s.size&&(d.size=s.size);break;default:d=typeof s.is=="string"?y.createElement(c,{is:s.is}):y.createElement(c)}}d[gt]=t,d[Lt]=s;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)d.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=d;e:switch(xt(d,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&jn(t)}}return Qe(t),Kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&jn(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=we.current,wl(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,c=bt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[gt]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||ap(e.nodeValue,n)),e||Jn(t,!0)}else e=So(e).createTextNode(s),e[gt]=t,t.stateNode=e}return Qe(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=wl(t),n!==null){if(e===null){if(!s)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[gt]=t}else Ui(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),e=!1}else n=Qr(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ft(t),t):(Ft(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Qe(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=wl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[gt]=t}else Ui(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),c=!1}else c=Qr(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Ft(t),t):(Ft(t),null)}return Ft(t),(t.flags&128)!==0?(t.lanes=n,t):(n=s!==null,e=e!==null&&e.memoizedState!==null,n&&(s=t.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),so(t,t.updateQueue),Qe(t),null);case 4:return ae(),e===null&&ru(t.stateNode.containerInfo),Qe(t),null;case 10:return kn(t.type),Qe(t),null;case 19:if(ye(it),s=t.memoizedState,s===null)return Qe(t),null;if(c=(t.flags&128)!==0,d=s.rendering,d===null)if(c)Oa(s,!1);else{if(nt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Vs(e),d!==null){for(t.flags|=128,Oa(s,!1),e=d.updateQueue,t.updateQueue=e,so(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Hf(n,e),n=n.sibling;return ve(it,it.current&1|2),He&&En(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&St()>fo&&(t.flags|=128,c=!0,Oa(s,!1),t.lanes=4194304)}else{if(!c)if(e=Vs(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,so(t,e),Oa(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!He)return Qe(t),null}else 2*St()-s.renderingStartTime>fo&&n!==536870912&&(t.flags|=128,c=!0,Oa(s,!1),t.lanes=4194304);s.isBackwards?(d.sibling=t.child,t.child=d):(e=s.last,e!==null?e.sibling=d:t.child=d,s.last=d)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=St(),e.sibling=null,n=it.current,ve(it,c?n&1|2:n&1),He&&En(t,s.treeForkCount),e):(Qe(t),null);case 22:case 23:return Ft(t),cc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(n&536870912)!==0&&(t.flags&128)===0&&(Qe(t),t.subtreeFlags&6&&(t.flags|=8192)):Qe(t),n=t.updateQueue,n!==null&&so(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&ye(Fi),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),kn(at),Qe(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function sv(e,t){switch(Pr(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return kn(at),ae(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ee(t),null;case 31:if(t.memoizedState!==null){if(Ft(t),t.alternate===null)throw Error(o(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ft(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ye(it),null;case 4:return ae(),null;case 10:return kn(t.type),null;case 22:case 23:return Ft(t),cc(),e!==null&&ye(Fi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return kn(at),null;case 25:return null;default:return null}}function um(e,t){switch(Pr(t),t.tag){case 3:kn(at),ae();break;case 26:case 27:case 5:Ee(t);break;case 4:ae();break;case 31:t.memoizedState!==null&&Ft(t);break;case 13:Ft(t);break;case 19:ye(it);break;case 10:kn(t.type);break;case 22:case 23:Ft(t),cc(),e!==null&&ye(Fi);break;case 24:kn(at)}}function Da(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var c=s.next;n=c;do{if((n.tag&e)===e){s=void 0;var d=n.create,y=n.inst;s=d(),y.destroy=s}n=n.next}while(n!==c)}}catch(S){Ge(t,t.return,S)}}function si(e,t,n){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var d=c.next;s=d;do{if((s.tag&e)===e){var y=s.inst,S=y.destroy;if(S!==void 0){y.destroy=void 0,c=t;var N=n,F=S;try{F()}catch(Z){Ge(c,N,Z)}}}s=s.next}while(s!==d)}}catch(Z){Ge(t,t.return,Z)}}function dm(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{th(t,n)}catch(s){Ge(e,e.return,s)}}}function fm(e,t,n){n.props=Vi(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){Ge(e,t,s)}}function za(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(c){Ge(e,t,c)}}function gn(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(c){Ge(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(c){Ge(e,t,c)}else n.current=null}function hm(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(c){Ge(e,e.return,c)}}function Ic(e,t,n){try{var s=e.stateNode;Nv(s,e.type,n,t),s[Lt]=t}catch(c){Ge(e,e.return,c)}}function mm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&hi(e.type)||e.tag===4}function Fc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mm(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&&hi(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 Gc(e,t,n){var s=e.tag;if(s===5||s===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=Tn));else if(s!==4&&(s===27&&hi(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function oo(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&hi(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(oo(e,t,n),e=e.sibling;e!==null;)oo(e,t,n),e=e.sibling}function pm(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);xt(t,s,n),t[gt]=e,t[Lt]=n}catch(d){Ge(e,e.return,d)}}var On=!1,rt=!1,Yc=!1,gm=typeof WeakSet=="function"?WeakSet:Set,mt=null;function ov(e,t){if(e=e.containerInfo,du=ko,e=Nf(e),Hr(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var c=s.anchorOffset,d=s.focusNode;s=s.focusOffset;try{n.nodeType,d.nodeType}catch{n=null;break e}var y=0,S=-1,N=-1,F=0,Z=0,te=e,Y=null;t:for(;;){for(var q;te!==n||c!==0&&te.nodeType!==3||(S=y+c),te!==d||s!==0&&te.nodeType!==3||(N=y+s),te.nodeType===3&&(y+=te.nodeValue.length),(q=te.firstChild)!==null;)Y=te,te=q;for(;;){if(te===e)break t;if(Y===n&&++F===c&&(S=y),Y===d&&++Z===s&&(N=y),(q=te.nextSibling)!==null)break;te=Y,Y=te.parentNode}te=q}n=S===-1||N===-1?null:{start:S,end:N}}else n=null}n=n||{start:0,end:0}}else n=null;for(fu={focusedElem:e,selectionRange:n},ko=!1,mt=t;mt!==null;)if(t=mt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,mt=e;else for(;mt!==null;){switch(t=mt,d=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)c=e[n],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,n=t,c=d.memoizedProps,d=d.memoizedState,s=n.stateNode;try{var he=Vi(n.type,c);e=s.getSnapshotBeforeUpdate(he,d),s.__reactInternalSnapshotBeforeUpdate=e}catch(Te){Ge(n,n.return,Te)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)pu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":pu(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(o(163))}if(e=t.sibling,e!==null){e.return=t.return,mt=e;break}mt=t.return}}function bm(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:zn(e,n),s&4&&Da(5,n);break;case 1:if(zn(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(y){Ge(n,n.return,y)}else{var c=Vi(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Ge(n,n.return,y)}}s&64&&dm(n),s&512&&za(n,n.return);break;case 3:if(zn(e,n),s&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{th(e,t)}catch(y){Ge(n,n.return,y)}}break;case 27:t===null&&s&4&&pm(n);case 26:case 5:zn(e,n),t===null&&s&4&&hm(n),s&512&&za(n,n.return);break;case 12:zn(e,n);break;case 31:zn(e,n),s&4&&xm(e,n);break;case 13:zn(e,n),s&4&&wm(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=gv.bind(null,n),zv(e,n))));break;case 22:if(s=n.memoizedState!==null||On,!s){t=t!==null&&t.memoizedState!==null||rt,c=On;var d=rt;On=s,(rt=t)&&!d?Hn(e,n,(n.subtreeFlags&8772)!==0):zn(e,n),On=c,rt=d}break;case 30:break;default:zn(e,n)}}function ym(e){var t=e.alternate;t!==null&&(e.alternate=null,ym(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&xr(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 Je=null,_t=!1;function Dn(e,t,n){for(n=n.child;n!==null;)vm(e,t,n),n=n.sibling}function vm(e,t,n){if(Mt&&typeof Mt.onCommitFiberUnmount=="function")try{Mt.onCommitFiberUnmount(Li,n)}catch{}switch(n.tag){case 26:rt||gn(n,t),Dn(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:rt||gn(n,t);var s=Je,c=_t;hi(n.type)&&(Je=n.stateNode,_t=!1),Dn(e,t,n),$a(n.stateNode),Je=s,_t=c;break;case 5:rt||gn(n,t);case 6:if(s=Je,c=_t,Je=null,Dn(e,t,n),Je=s,_t=c,Je!==null)if(_t)try{(Je.nodeType===9?Je.body:Je.nodeName==="HTML"?Je.ownerDocument.body:Je).removeChild(n.stateNode)}catch(d){Ge(n,t,d)}else try{Je.removeChild(n.stateNode)}catch(d){Ge(n,t,d)}break;case 18:Je!==null&&(_t?(e=Je,dp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Fl(e)):dp(Je,n.stateNode));break;case 4:s=Je,c=_t,Je=n.stateNode.containerInfo,_t=!0,Dn(e,t,n),Je=s,_t=c;break;case 0:case 11:case 14:case 15:si(2,n,t),rt||si(4,n,t),Dn(e,t,n);break;case 1:rt||(gn(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&fm(n,t,s)),Dn(e,t,n);break;case 21:Dn(e,t,n);break;case 22:rt=(s=rt)||n.memoizedState!==null,Dn(e,t,n),rt=s;break;default:Dn(e,t,n)}}function xm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Fl(e)}catch(n){Ge(t,t.return,n)}}}function wm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Fl(e)}catch(n){Ge(t,t.return,n)}}function rv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new gm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new gm),t;default:throw Error(o(435,e.tag))}}function ro(e,t){var n=rv(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var c=bv.bind(null,e,s);s.then(c,c)}})}function jt(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var c=n[s],d=e,y=t,S=y;e:for(;S!==null;){switch(S.tag){case 27:if(hi(S.type)){Je=S.stateNode,_t=!1;break e}break;case 5:Je=S.stateNode,_t=!1;break e;case 3:case 4:Je=S.stateNode.containerInfo,_t=!0;break e}S=S.return}if(Je===null)throw Error(o(160));vm(d,y,c),Je=null,_t=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Sm(t,e),t=t.sibling}var dn=null;function Sm(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:jt(t,e),Ot(e),s&4&&(si(3,e,e.return),Da(3,e),si(5,e,e.return));break;case 1:jt(t,e),Ot(e),s&512&&(rt||n===null||gn(n,n.return)),s&64&&On&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?s:n.concat(s))));break;case 26:var c=dn;if(jt(t,e),Ot(e),s&512&&(rt||n===null||gn(n,n.return)),s&4){var d=n!==null?n.memoizedState:null;if(s=e.memoizedState,n===null)if(s===null)if(e.stateNode===null){e:{s=e.type,n=e.memoizedProps,c=c.ownerDocument||c;t:switch(s){case"title":d=c.getElementsByTagName("title")[0],(!d||d[ca]||d[gt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(s),c.head.insertBefore(d,c.querySelector("head > title"))),xt(d,s,n),d[gt]=e,ht(d),s=d;break e;case"link":var y=Sp("link","href",c).get(s+(n.href||""));if(y){for(var S=0;S<y.length;S++)if(d=y[S],d.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&d.getAttribute("rel")===(n.rel==null?null:n.rel)&&d.getAttribute("title")===(n.title==null?null:n.title)&&d.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){y.splice(S,1);break t}}d=c.createElement(s),xt(d,s,n),c.head.appendChild(d);break;case"meta":if(y=Sp("meta","content",c).get(s+(n.content||""))){for(S=0;S<y.length;S++)if(d=y[S],d.getAttribute("content")===(n.content==null?null:""+n.content)&&d.getAttribute("name")===(n.name==null?null:n.name)&&d.getAttribute("property")===(n.property==null?null:n.property)&&d.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&d.getAttribute("charset")===(n.charSet==null?null:n.charSet)){y.splice(S,1);break t}}d=c.createElement(s),xt(d,s,n),c.head.appendChild(d);break;default:throw Error(o(468,s))}d[gt]=e,ht(d),s=d}e.stateNode=s}else Cp(c,e.type,e.stateNode);else e.stateNode=wp(c,s,e.memoizedProps);else d!==s?(d===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):d.count--,s===null?Cp(c,e.type,e.stateNode):wp(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Ic(e,e.memoizedProps,n.memoizedProps)}break;case 27:jt(t,e),Ot(e),s&512&&(rt||n===null||gn(n,n.return)),n!==null&&s&4&&Ic(e,e.memoizedProps,n.memoizedProps);break;case 5:if(jt(t,e),Ot(e),s&512&&(rt||n===null||gn(n,n.return)),e.flags&32){c=e.stateNode;try{dl(c,"")}catch(he){Ge(e,e.return,he)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Ic(e,c,n!==null?n.memoizedProps:c)),s&1024&&(Yc=!0);break;case 6:if(jt(t,e),Ot(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(he){Ge(e,e.return,he)}}break;case 3:if(Mo=null,c=dn,dn=Co(t.containerInfo),jt(t,e),dn=c,Ot(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Fl(t.containerInfo)}catch(he){Ge(e,e.return,he)}Yc&&(Yc=!1,Cm(e));break;case 4:s=dn,dn=Co(e.stateNode.containerInfo),jt(t,e),Ot(e),dn=s;break;case 12:jt(t,e),Ot(e);break;case 31:jt(t,e),Ot(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ro(e,s)));break;case 13:jt(t,e),Ot(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(uo=St()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ro(e,s)));break;case 22:c=e.memoizedState!==null;var N=n!==null&&n.memoizedState!==null,F=On,Z=rt;if(On=F||c,rt=Z||N,jt(t,e),rt=Z,On=F,Ot(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(n===null||N||On||rt||Pi(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){N=n=t;try{if(d=N.stateNode,c)y=d.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{S=N.stateNode;var te=N.memoizedProps.style,Y=te!=null&&te.hasOwnProperty("display")?te.display:null;S.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(he){Ge(N,N.return,he)}}}else if(t.tag===6){if(n===null){N=t;try{N.stateNode.nodeValue=c?"":N.memoizedProps}catch(he){Ge(N,N.return,he)}}}else if(t.tag===18){if(n===null){N=t;try{var q=N.stateNode;c?fp(q,!0):fp(N.stateNode,!1)}catch(he){Ge(N,N.return,he)}}}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}s&4&&(s=e.updateQueue,s!==null&&(n=s.retryQueue,n!==null&&(s.retryQueue=null,ro(e,n))));break;case 19:jt(t,e),Ot(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ro(e,s)));break;case 30:break;case 21:break;default:jt(t,e),Ot(e)}}function Ot(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(mm(s)){n=s;break}s=s.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var c=n.stateNode,d=Fc(e);oo(e,d,c);break;case 5:var y=n.stateNode;n.flags&32&&(dl(y,""),n.flags&=-33);var S=Fc(e);oo(e,S,y);break;case 3:case 4:var N=n.stateNode.containerInfo,F=Fc(e);Gc(e,F,N);break;default:throw Error(o(161))}}catch(Z){Ge(e,e.return,Z)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Cm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Cm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function zn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)bm(e,t.alternate,t),t=t.sibling}function Pi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:si(4,t,t.return),Pi(t);break;case 1:gn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&fm(t,t.return,n),Pi(t);break;case 27:$a(t.stateNode);case 26:case 5:gn(t,t.return),Pi(t);break;case 22:t.memoizedState===null&&Pi(t);break;case 30:Pi(t);break;default:Pi(t)}e=e.sibling}}function Hn(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,d=t,y=d.flags;switch(d.tag){case 0:case 11:case 15:Hn(c,d,n),Da(4,d);break;case 1:if(Hn(c,d,n),s=d,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(F){Ge(s,s.return,F)}if(s=d,c=s.updateQueue,c!==null){var S=s.stateNode;try{var N=c.shared.hiddenCallbacks;if(N!==null)for(c.shared.hiddenCallbacks=null,c=0;c<N.length;c++)eh(N[c],S)}catch(F){Ge(s,s.return,F)}}n&&y&64&&dm(d),za(d,d.return);break;case 27:pm(d);case 26:case 5:Hn(c,d,n),n&&s===null&&y&4&&hm(d),za(d,d.return);break;case 12:Hn(c,d,n);break;case 31:Hn(c,d,n),n&&y&4&&xm(c,d);break;case 13:Hn(c,d,n),n&&y&4&&wm(c,d);break;case 22:d.memoizedState===null&&Hn(c,d,n),za(d,d.return);break;case 30:break;default:Hn(c,d,n)}t=t.sibling}}function $c(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&&Sa(n))}function qc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Sa(e))}function fn(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Tm(e,t,n,s),t=t.sibling}function Tm(e,t,n,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:fn(e,t,n,s),c&2048&&Da(9,t);break;case 1:fn(e,t,n,s);break;case 3:fn(e,t,n,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Sa(e)));break;case 12:if(c&2048){fn(e,t,n,s),e=t.stateNode;try{var d=t.memoizedProps,y=d.id,S=d.onPostCommit;typeof S=="function"&&S(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(N){Ge(t,t.return,N)}}else fn(e,t,n,s);break;case 31:fn(e,t,n,s);break;case 13:fn(e,t,n,s);break;case 23:break;case 22:d=t.stateNode,y=t.alternate,t.memoizedState!==null?d._visibility&2?fn(e,t,n,s):Ha(e,t):d._visibility&2?fn(e,t,n,s):(d._visibility|=2,Rl(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&$c(y,t);break;case 24:fn(e,t,n,s),c&2048&&qc(t.alternate,t);break;default:fn(e,t,n,s)}}function Rl(e,t,n,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,y=t,S=n,N=s,F=y.flags;switch(y.tag){case 0:case 11:case 15:Rl(d,y,S,N,c),Da(8,y);break;case 23:break;case 22:var Z=y.stateNode;y.memoizedState!==null?Z._visibility&2?Rl(d,y,S,N,c):Ha(d,y):(Z._visibility|=2,Rl(d,y,S,N,c)),c&&F&2048&&$c(y.alternate,y);break;case 24:Rl(d,y,S,N,c),c&&F&2048&&qc(y.alternate,y);break;default:Rl(d,y,S,N,c)}t=t.sibling}}function Ha(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,s=t,c=s.flags;switch(s.tag){case 22:Ha(n,s),c&2048&&$c(s.alternate,s);break;case 24:Ha(n,s),c&2048&&qc(s.alternate,s);break;default:Ha(n,s)}t=t.sibling}}var Ba=8192;function _l(e,t,n){if(e.subtreeFlags&Ba)for(e=e.child;e!==null;)Mm(e,t,n),e=e.sibling}function Mm(e,t,n){switch(e.tag){case 26:_l(e,t,n),e.flags&Ba&&e.memoizedState!==null&&Pv(n,dn,e.memoizedState,e.memoizedProps);break;case 5:_l(e,t,n);break;case 3:case 4:var s=dn;dn=Co(e.stateNode.containerInfo),_l(e,t,n),dn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Ba,Ba=16777216,_l(e,t,n),Ba=s):_l(e,t,n));break;default:_l(e,t,n)}}function Am(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 Ua(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];mt=s,Nm(s,e)}Am(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Em(e),e=e.sibling}function Em(e){switch(e.tag){case 0:case 11:case 15:Ua(e),e.flags&2048&&si(9,e,e.return);break;case 3:Ua(e);break;case 12:Ua(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,co(e)):Ua(e);break;default:Ua(e)}}function co(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];mt=s,Nm(s,e)}Am(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:si(8,t,t.return),co(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,co(t));break;default:co(t)}e=e.sibling}}function Nm(e,t){for(;mt!==null;){var n=mt;switch(n.tag){case 0:case 11:case 15:si(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var s=n.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Sa(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,mt=s;else e:for(n=e;mt!==null;){s=mt;var c=s.sibling,d=s.return;if(ym(s),s===n){mt=null;break e}if(c!==null){c.return=d,mt=c;break e}mt=d}}}var cv={getCacheForType:function(e){var t=yt(at),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return yt(at).controller.signal}},uv=typeof WeakMap=="function"?WeakMap:Map,Ie=0,Ve=null,je=null,De=0,Fe=0,Gt=null,oi=!1,jl=!1,Vc=!1,Bn=0,nt=0,ri=0,Xi=0,Pc=0,Yt=0,Ol=0,Ka=null,Dt=null,Xc=!1,uo=0,km=0,fo=1/0,ho=null,ci=null,dt=0,ui=null,Dl=null,Un=0,Qc=0,Zc=null,Lm=null,Ia=0,Wc=null;function $t(){return(Ie&2)!==0&&De!==0?De&-De:E.T!==null?lu():$d()}function Rm(){if(Yt===0)if((De&536870912)===0||He){var e=Ri;Ri<<=1,(Ri&3932160)===0&&(Ri=262144),Yt=e}else Yt=536870912;return e=It.current,e!==null&&(e.flags|=32),Yt}function zt(e,t,n){(e===Ve&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(zl(e,0),di(e,De,Yt,!1)),ra(e,n),((Ie&2)===0||e!==Ve)&&(e===Ve&&((Ie&2)===0&&(Xi|=n),nt===4&&di(e,De,Yt,!1)),bn(e))}function _m(e,t,n){if((Ie&6)!==0)throw Error(o(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||oa(e,t),c=s?hv(e,t):eu(e,t,!0),d=s;do{if(c===0){jl&&!s&&di(e,t,0,!1);break}else{if(n=e.current.alternate,d&&!dv(n)){c=eu(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var S=e;c=Ka;var N=S.current.memoizedState.isDehydrated;if(N&&(zl(S,y).flags|=256),y=eu(S,y,!1),y!==2){if(Vc&&!N){S.errorRecoveryDisabledLanes|=d,Xi|=d,c=4;break e}d=Dt,Dt=c,d!==null&&(Dt===null?Dt=d:Dt.push.apply(Dt,d))}c=y}if(d=!1,c!==2)continue}}if(c===1){zl(e,0),di(e,t,0,!0);break}e:{switch(s=e,d=c,d){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:di(s,t,Yt,!oi);break e;case 2:Dt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=uo+300-St(),10<c)){if(di(s,t,Yt,!oi),Ss(s,0,!0)!==0)break e;Un=t,s.timeoutHandle=cp(jm.bind(null,s,n,Dt,ho,Xc,t,Yt,Xi,Ol,oi,d,"Throttled",-0,0),c);break e}jm(s,n,Dt,ho,Xc,t,Yt,Xi,Ol,oi,d,null,-0,0)}}break}while(!0);bn(e)}function jm(e,t,n,s,c,d,y,S,N,F,Z,te,Y,q){if(e.timeoutHandle=-1,te=t.subtreeFlags,te&8192||(te&16785408)===16785408){te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Tn},Mm(t,d,te);var he=(d&62914560)===d?uo-St():(d&4194048)===d?km-St():0;if(he=Xv(te,he),he!==null){Un=d,e.cancelPendingCommit=he(Im.bind(null,e,t,d,n,s,c,y,S,N,Z,te,null,Y,q)),di(e,d,y,!F);return}}Im(e,t,d,n,s,c,y,S,N)}function dv(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 s=0;s<n.length;s++){var c=n[s],d=c.getSnapshot;c=c.value;try{if(!Ut(d(),c))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 di(e,t,n,s){t&=~Pc,t&=~Xi,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var d=31-Ct(c),y=1<<d;s[d]=-1,c&=~y}n!==0&&Fd(e,n,t)}function mo(){return(Ie&6)===0?(Fa(0),!1):!0}function Jc(){if(je!==null){if(Fe===0)var e=je.return;else e=je,Nn=Ki=null,pc(e),Al=null,Ta=0,e=je;for(;e!==null;)um(e.alternate,e),e=e.return;je=null}}function zl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Rv(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Un=0,Jc(),Ve=e,je=n=An(e.current,null),De=t,Fe=0,Gt=null,oi=!1,jl=oa(e,t),Vc=!1,Ol=Yt=Pc=Xi=ri=nt=0,Dt=Ka=null,Xc=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var c=31-Ct(s),d=1<<c;t|=e[c],s&=~d}return Bn=t,Os(),n}function Om(e,t){Ne=null,E.H=_a,t===Ml||t===Fs?(t=Qf(),Fe=3):t===ic?(t=Qf(),Fe=4):Fe=t===Rc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Gt=t,je===null&&(nt=1,no(e,Zt(t,e.current)))}function Dm(){var e=It.current;return e===null?!0:(De&4194048)===De?tn===null:(De&62914560)===De||(De&536870912)!==0?e===tn:!1}function zm(){var e=E.H;return E.H=_a,e===null?_a:e}function Hm(){var e=E.A;return E.A=cv,e}function po(){nt=4,oi||(De&4194048)!==De&&It.current!==null||(jl=!0),(ri&134217727)===0&&(Xi&134217727)===0||Ve===null||di(Ve,De,Yt,!1)}function eu(e,t,n){var s=Ie;Ie|=2;var c=zm(),d=Hm();(Ve!==e||De!==t)&&(ho=null,zl(e,t)),t=!1;var y=nt;e:do try{if(Fe!==0&&je!==null){var S=je,N=Gt;switch(Fe){case 8:Jc(),y=6;break e;case 3:case 2:case 9:case 6:It.current===null&&(t=!0);var F=Fe;if(Fe=0,Gt=null,Hl(e,S,N,F),n&&jl){y=0;break e}break;default:F=Fe,Fe=0,Gt=null,Hl(e,S,N,F)}}fv(),y=nt;break}catch(Z){Om(e,Z)}while(!0);return t&&e.shellSuspendCounter++,Nn=Ki=null,Ie=s,E.H=c,E.A=d,je===null&&(Ve=null,De=0,Os()),y}function fv(){for(;je!==null;)Bm(je)}function hv(e,t){var n=Ie;Ie|=2;var s=zm(),c=Hm();Ve!==e||De!==t?(ho=null,fo=St()+500,zl(e,t)):jl=oa(e,t);e:do try{if(Fe!==0&&je!==null){t=je;var d=Gt;t:switch(Fe){case 1:Fe=0,Gt=null,Hl(e,t,d,1);break;case 2:case 9:if(Pf(d)){Fe=0,Gt=null,Um(t);break}t=function(){Fe!==2&&Fe!==9||Ve!==e||(Fe=7),bn(e)},d.then(t,t);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:Pf(d)?(Fe=0,Gt=null,Um(t)):(Fe=0,Gt=null,Hl(e,t,d,7));break;case 5:var y=null;switch(je.tag){case 26:y=je.memoizedState;case 5:case 27:var S=je;if(y?Tp(y):S.stateNode.complete){Fe=0,Gt=null;var N=S.sibling;if(N!==null)je=N;else{var F=S.return;F!==null?(je=F,go(F)):je=null}break t}}Fe=0,Gt=null,Hl(e,t,d,5);break;case 6:Fe=0,Gt=null,Hl(e,t,d,6);break;case 8:Jc(),nt=6;break e;default:throw Error(o(462))}}mv();break}catch(Z){Om(e,Z)}while(!0);return Nn=Ki=null,E.H=s,E.A=c,Ie=n,je!==null?0:(Ve=null,De=0,Os(),nt)}function mv(){for(;je!==null&&!ps();)Bm(je)}function Bm(e){var t=rm(e.alternate,e,Bn);e.memoizedProps=e.pendingProps,t===null?go(e):je=t}function Um(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=nm(n,t,t.pendingProps,t.type,void 0,De);break;case 11:t=nm(n,t,t.pendingProps,t.type.render,t.ref,De);break;case 5:pc(t);default:um(n,t),t=je=Hf(t,Bn),t=rm(n,t,Bn)}e.memoizedProps=e.pendingProps,t===null?go(e):je=t}function Hl(e,t,n,s){Nn=Ki=null,pc(t),Al=null,Ta=0;var c=t.return;try{if(nv(e,c,t,n,De)){nt=1,no(e,Zt(n,e.current)),je=null;return}}catch(d){if(c!==null)throw je=c,d;nt=1,no(e,Zt(n,e.current)),je=null;return}t.flags&32768?(He||s===1?e=!0:jl||(De&536870912)!==0?e=!1:(oi=e=!0,(s===2||s===9||s===3||s===6)&&(s=It.current,s!==null&&s.tag===13&&(s.flags|=16384))),Km(t,e)):go(t)}function go(e){var t=e;do{if((t.flags&32768)!==0){Km(t,oi);return}e=t.return;var n=av(t.alternate,t,Bn);if(n!==null){je=n;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);nt===0&&(nt=5)}function Km(e,t){do{var n=sv(e.alternate,e);if(n!==null){n.flags&=32767,je=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){je=e;return}je=e=n}while(e!==null);nt=6,je=null}function Im(e,t,n,s,c,d,y,S,N){e.cancelPendingCommit=null;do bo();while(dt!==0);if((Ie&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(d=t.lanes|t.childLanes,d|=Fr,Vy(e,n,d,y,S,N),e===Ve&&(je=Ve=null,De=0),Dl=t,ui=e,Un=n,Qc=d,Zc=c,Lm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,yv(ki,function(){return qm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=E.T,E.T=null,c=G.p,G.p=2,y=Ie,Ie|=4;try{ov(e,t,n)}finally{Ie=y,G.p=c,E.T=s}}dt=1,Fm(),Gm(),Ym()}}function Fm(){if(dt===1){dt=0;var e=ui,t=Dl,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=E.T,E.T=null;var s=G.p;G.p=2;var c=Ie;Ie|=4;try{Sm(t,e);var d=fu,y=Nf(e.containerInfo),S=d.focusedElem,N=d.selectionRange;if(y!==S&&S&&S.ownerDocument&&Ef(S.ownerDocument.documentElement,S)){if(N!==null&&Hr(S)){var F=N.start,Z=N.end;if(Z===void 0&&(Z=F),"selectionStart"in S)S.selectionStart=F,S.selectionEnd=Math.min(Z,S.value.length);else{var te=S.ownerDocument||document,Y=te&&te.defaultView||window;if(Y.getSelection){var q=Y.getSelection(),he=S.textContent.length,Te=Math.min(N.start,he),qe=N.end===void 0?Te:Math.min(N.end,he);!q.extend&&Te>qe&&(y=qe,qe=Te,Te=y);var B=Af(S,Te),j=Af(S,qe);if(B&&j&&(q.rangeCount!==1||q.anchorNode!==B.node||q.anchorOffset!==B.offset||q.focusNode!==j.node||q.focusOffset!==j.offset)){var I=te.createRange();I.setStart(B.node,B.offset),q.removeAllRanges(),Te>qe?(q.addRange(I),q.extend(j.node,j.offset)):(I.setEnd(j.node,j.offset),q.addRange(I))}}}}for(te=[],q=S;q=q.parentNode;)q.nodeType===1&&te.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<te.length;S++){var ee=te[S];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}ko=!!du,fu=du=null}finally{Ie=c,G.p=s,E.T=n}}e.current=t,dt=2}}function Gm(){if(dt===2){dt=0;var e=ui,t=Dl,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=E.T,E.T=null;var s=G.p;G.p=2;var c=Ie;Ie|=4;try{bm(e,t.alternate,t)}finally{Ie=c,G.p=s,E.T=n}}dt=3}}function Ym(){if(dt===4||dt===3){dt=0,gs();var e=ui,t=Dl,n=Un,s=Lm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?dt=5:(dt=0,Dl=ui=null,$m(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(ci=null),yr(n),t=t.stateNode,Mt&&typeof Mt.onCommitFiberRoot=="function")try{Mt.onCommitFiberRoot(Li,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=E.T,c=G.p,G.p=2,E.T=null;try{for(var d=e.onRecoverableError,y=0;y<s.length;y++){var S=s[y];d(S.value,{componentStack:S.stack})}}finally{E.T=t,G.p=c}}(Un&3)!==0&&bo(),bn(e),c=e.pendingLanes,(n&261930)!==0&&(c&42)!==0?e===Wc?Ia++:(Ia=0,Wc=e):Ia=0,Fa(0)}}function $m(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Sa(t)))}function bo(){return Fm(),Gm(),Ym(),qm()}function qm(){if(dt!==5)return!1;var e=ui,t=Qc;Qc=0;var n=yr(Un),s=E.T,c=G.p;try{G.p=32>n?32:n,E.T=null,n=Zc,Zc=null;var d=ui,y=Un;if(dt=0,Dl=ui=null,Un=0,(Ie&6)!==0)throw Error(o(331));var S=Ie;if(Ie|=4,Em(d.current),Tm(d,d.current,y,n),Ie=S,Fa(0,!1),Mt&&typeof Mt.onPostCommitFiberRoot=="function")try{Mt.onPostCommitFiberRoot(Li,d)}catch{}return!0}finally{G.p=c,E.T=s,$m(e,t)}}function Vm(e,t,n){t=Zt(n,t),t=Lc(e.stateNode,t,2),e=ii(e,t,2),e!==null&&(ra(e,2),bn(e))}function Ge(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 s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(ci===null||!ci.has(s))){e=Zt(n,e),n=Ph(2),s=ii(t,n,2),s!==null&&(Xh(n,s,t,e),ra(s,2),bn(s));break}}t=t.return}}function tu(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new uv;var c=new Set;s.set(t,c)}else c=s.get(t),c===void 0&&(c=new Set,s.set(t,c));c.has(n)||(Vc=!0,c.add(n),e=pv.bind(null,e,t,n),t.then(e,e))}function pv(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ve===e&&(De&n)===n&&(nt===4||nt===3&&(De&62914560)===De&&300>St()-uo?(Ie&2)===0&&zl(e,0):Pc|=n,Ol===De&&(Ol=0)),bn(e)}function Pm(e,t){t===0&&(t=Id()),e=Hi(e,t),e!==null&&(ra(e,t),bn(e))}function gv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Pm(e,n)}function bv(e,t){var n=0;switch(e.tag){case 31:case 13:var s=e.stateNode,c=e.memoizedState;c!==null&&(n=c.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(o(314))}s!==null&&s.delete(t),Pm(e,n)}function yv(e,t){return kt(e,t)}var yo=null,Bl=null,nu=!1,vo=!1,iu=!1,fi=0;function bn(e){e!==Bl&&e.next===null&&(Bl===null?yo=Bl=e:Bl=Bl.next=e),vo=!0,nu||(nu=!0,xv())}function Fa(e,t){if(!iu&&vo){iu=!0;do for(var n=!1,s=yo;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var d=0;else{var y=s.suspendedLanes,S=s.pingedLanes;d=(1<<31-Ct(42|e)+1)-1,d&=c&~(y&~S),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(n=!0,Wm(s,d))}else d=De,d=Ss(s,s===Ve?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||oa(s,d)||(n=!0,Wm(s,d));s=s.next}while(n);iu=!1}}function vv(){Xm()}function Xm(){vo=nu=!1;var e=0;fi!==0&&Lv()&&(e=fi);for(var t=St(),n=null,s=yo;s!==null;){var c=s.next,d=Qm(s,t);d===0?(s.next=null,n===null?yo=c:n.next=c,c===null&&(Bl=n)):(n=s,(e!==0||(d&3)!==0)&&(vo=!0)),s=c}dt!==0&&dt!==5||Fa(e),fi!==0&&(fi=0)}function Qm(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var y=31-Ct(d),S=1<<y,N=c[y];N===-1?((S&n)===0||(S&s)!==0)&&(c[y]=qy(S,t)):N<=t&&(e.expiredLanes|=S),d&=~S}if(t=Ve,n=De,n=Ss(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Sn(s),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||oa(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&Sn(s),yr(n)){case 2:case 8:n=aa;break;case 32:n=ki;break;case 268435456:n=sa;break;default:n=ki}return s=Zm.bind(null,e),n=kt(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&Sn(s),e.callbackPriority=2,e.callbackNode=null,2}function Zm(e,t){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(bo()&&e.callbackNode!==n)return null;var s=De;return s=Ss(e,e===Ve?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(_m(e,s,t),Qm(e,St()),e.callbackNode!=null&&e.callbackNode===n?Zm.bind(null,e):null)}function Wm(e,t){if(bo())return null;_m(e,t,!0)}function xv(){_v(function(){(Ie&6)!==0?kt(la,vv):Xm()})}function lu(){if(fi===0){var e=Cl;e===0&&(e=Vt,Vt<<=1,(Vt&261888)===0&&(Vt=256)),fi=e}return fi}function Jm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:As(""+e)}function ep(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 wv(e,t,n,s,c){if(t==="submit"&&n&&n.stateNode===c){var d=Jm((c[Lt]||null).action),y=s.submitter;y&&(t=(t=y[Lt]||null)?Jm(t.formAction):y.getAttribute("formAction"),t!==null&&(d=t,y=null));var S=new Ls("action","action",null,s,c);e.push({event:S,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(fi!==0){var N=y?ep(c,y):new FormData(c);Tc(n,{pending:!0,data:N,method:c.method,action:d},null,N)}}else typeof d=="function"&&(S.preventDefault(),N=y?ep(c,y):new FormData(c),Tc(n,{pending:!0,data:N,method:c.method,action:d},d,N))},currentTarget:c}]})}}for(var au=0;au<Ir.length;au++){var su=Ir[au],Sv=su.toLowerCase(),Cv=su[0].toUpperCase()+su.slice(1);un(Sv,"on"+Cv)}un(Rf,"onAnimationEnd"),un(_f,"onAnimationIteration"),un(jf,"onAnimationStart"),un("dblclick","onDoubleClick"),un("focusin","onFocus"),un("focusout","onBlur"),un(U0,"onTransitionRun"),un(K0,"onTransitionStart"),un(I0,"onTransitionCancel"),un(Of,"onTransitionEnd"),cl("onMouseEnter",["mouseout","mouseover"]),cl("onMouseLeave",["mouseout","mouseover"]),cl("onPointerEnter",["pointerout","pointerover"]),cl("onPointerLeave",["pointerout","pointerover"]),ji("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ji("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ji("onBeforeInput",["compositionend","keypress","textInput","paste"]),ji("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ji("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ji("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ga="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(" "),Tv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ga));function tp(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],c=s.event;s=s.listeners;e:{var d=void 0;if(t)for(var y=s.length-1;0<=y;y--){var S=s[y],N=S.instance,F=S.currentTarget;if(S=S.listener,N!==d&&c.isPropagationStopped())break e;d=S,c.currentTarget=F;try{d(c)}catch(Z){js(Z)}c.currentTarget=null,d=N}else for(y=0;y<s.length;y++){if(S=s[y],N=S.instance,F=S.currentTarget,S=S.listener,N!==d&&c.isPropagationStopped())break e;d=S,c.currentTarget=F;try{d(c)}catch(Z){js(Z)}c.currentTarget=null,d=N}}}}function Oe(e,t){var n=t[vr];n===void 0&&(n=t[vr]=new Set);var s=e+"__bubble";n.has(s)||(np(t,e,2,!1),n.add(s))}function ou(e,t,n){var s=0;t&&(s|=4),np(n,e,s,t)}var xo="_reactListening"+Math.random().toString(36).slice(2);function ru(e){if(!e[xo]){e[xo]=!0,Pd.forEach(function(n){n!=="selectionchange"&&(Tv.has(n)||ou(n,!1,e),ou(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[xo]||(t[xo]=!0,ou("selectionchange",!1,t))}}function np(e,t,n,s){switch(Rp(t)){case 2:var c=Wv;break;case 8:c=Jv;break;default:c=Cu}n=c.bind(null,t,n,e),c=void 0,!Nr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),s?c!==void 0?e.addEventListener(t,n,{capture:!0,passive:c}):e.addEventListener(t,n,!0):c!==void 0?e.addEventListener(t,n,{passive:c}):e.addEventListener(t,n,!1)}function cu(e,t,n,s,c){var d=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var y=s.tag;if(y===3||y===4){var S=s.stateNode.containerInfo;if(S===c)break;if(y===4)for(y=s.return;y!==null;){var N=y.tag;if((N===3||N===4)&&y.stateNode.containerInfo===c)return;y=y.return}for(;S!==null;){if(y=sl(S),y===null)return;if(N=y.tag,N===5||N===6||N===26||N===27){s=d=y;continue e}S=S.parentNode}}s=s.return}of(function(){var F=d,Z=Ar(n),te=[];e:{var Y=Df.get(e);if(Y!==void 0){var q=Ls,he=e;switch(e){case"keypress":if(Ns(n)===0)break e;case"keydown":case"keyup":q=b0;break;case"focusin":he="focus",q=_r;break;case"focusout":he="blur",q=_r;break;case"beforeblur":case"afterblur":q=_r;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":q=uf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":q=a0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":q=x0;break;case Rf:case _f:case jf:q=r0;break;case Of:q=S0;break;case"scroll":case"scrollend":q=i0;break;case"wheel":q=T0;break;case"copy":case"cut":case"paste":q=u0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":q=ff;break;case"toggle":case"beforetoggle":q=A0}var Te=(t&4)!==0,qe=!Te&&(e==="scroll"||e==="scrollend"),B=Te?Y!==null?Y+"Capture":null:Y;Te=[];for(var j=F,I;j!==null;){var ee=j;if(I=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||I===null||B===null||(ee=da(j,B),ee!=null&&Te.push(Ya(j,ee,I))),qe)break;j=j.return}0<Te.length&&(Y=new q(Y,he,null,n,Z),te.push({event:Y,listeners:Te}))}}if((t&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",q=e==="mouseout"||e==="pointerout",Y&&n!==Mr&&(he=n.relatedTarget||n.fromElement)&&(sl(he)||he[al]))break e;if((q||Y)&&(Y=Z.window===Z?Z:(Y=Z.ownerDocument)?Y.defaultView||Y.parentWindow:window,q?(he=n.relatedTarget||n.toElement,q=F,he=he?sl(he):null,he!==null&&(qe=u(he),Te=he.tag,he!==qe||Te!==5&&Te!==27&&Te!==6)&&(he=null)):(q=null,he=F),q!==he)){if(Te=uf,ee="onMouseLeave",B="onMouseEnter",j="mouse",(e==="pointerout"||e==="pointerover")&&(Te=ff,ee="onPointerLeave",B="onPointerEnter",j="pointer"),qe=q==null?Y:ua(q),I=he==null?Y:ua(he),Y=new Te(ee,j+"leave",q,n,Z),Y.target=qe,Y.relatedTarget=I,ee=null,sl(Z)===F&&(Te=new Te(B,j+"enter",he,n,Z),Te.target=I,Te.relatedTarget=qe,ee=Te),qe=ee,q&&he)t:{for(Te=Mv,B=q,j=he,I=0,ee=B;ee;ee=Te(ee))I++;ee=0;for(var Ce=j;Ce;Ce=Te(Ce))ee++;for(;0<I-ee;)B=Te(B),I--;for(;0<ee-I;)j=Te(j),ee--;for(;I--;){if(B===j||j!==null&&B===j.alternate){Te=B;break t}B=Te(B),j=Te(j)}Te=null}else Te=null;q!==null&&ip(te,Y,q,Te,!1),he!==null&&qe!==null&&ip(te,qe,he,Te,!0)}}e:{if(Y=F?ua(F):window,q=Y.nodeName&&Y.nodeName.toLowerCase(),q==="select"||q==="input"&&Y.type==="file")var Ue=xf;else if(yf(Y))if(wf)Ue=z0;else{Ue=O0;var be=j0}else q=Y.nodeName,!q||q.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?F&&Tr(F.elementType)&&(Ue=xf):Ue=D0;if(Ue&&(Ue=Ue(e,F))){vf(te,Ue,n,Z);break e}be&&be(e,Y,F),e==="focusout"&&F&&Y.type==="number"&&F.memoizedProps.value!=null&&Cr(Y,"number",Y.value)}switch(be=F?ua(F):window,e){case"focusin":(yf(be)||be.contentEditable==="true")&&(pl=be,Br=F,va=null);break;case"focusout":va=Br=pl=null;break;case"mousedown":Ur=!0;break;case"contextmenu":case"mouseup":case"dragend":Ur=!1,kf(te,n,Z);break;case"selectionchange":if(B0)break;case"keydown":case"keyup":kf(te,n,Z)}var Re;if(Or)e:{switch(e){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else ml?gf(e,n)&&(ze="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(ze="onCompositionStart");ze&&(hf&&n.locale!=="ko"&&(ml||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&ml&&(Re=rf()):(Qn=Z,kr="value"in Qn?Qn.value:Qn.textContent,ml=!0)),be=wo(F,ze),0<be.length&&(ze=new df(ze,e,null,n,Z),te.push({event:ze,listeners:be}),Re?ze.data=Re:(Re=bf(n),Re!==null&&(ze.data=Re)))),(Re=N0?k0(e,n):L0(e,n))&&(ze=wo(F,"onBeforeInput"),0<ze.length&&(be=new df("onBeforeInput","beforeinput",null,n,Z),te.push({event:be,listeners:ze}),be.data=Re)),wv(te,e,F,n,Z)}tp(te,t)})}function Ya(e,t,n){return{instance:e,listener:t,currentTarget:n}}function wo(e,t){for(var n=t+"Capture",s=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=da(e,n),c!=null&&s.unshift(Ya(e,c,d)),c=da(e,t),c!=null&&s.push(Ya(e,c,d))),e.tag===3)return s;e=e.return}return[]}function Mv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ip(e,t,n,s,c){for(var d=t._reactName,y=[];n!==null&&n!==s;){var S=n,N=S.alternate,F=S.stateNode;if(S=S.tag,N!==null&&N===s)break;S!==5&&S!==26&&S!==27||F===null||(N=F,c?(F=da(n,d),F!=null&&y.unshift(Ya(n,F,N))):c||(F=da(n,d),F!=null&&y.push(Ya(n,F,N)))),n=n.return}y.length!==0&&e.push({event:t,listeners:y})}var Av=/\r\n?/g,Ev=/\u0000|\uFFFD/g;function lp(e){return(typeof e=="string"?e:""+e).replace(Av,`
33
- `).replace(Ev,"")}function ap(e,t){return t=lp(t),lp(e)===t}function $e(e,t,n,s,c,d){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||dl(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&dl(e,""+s);break;case"className":Ts(e,"class",s);break;case"tabIndex":Ts(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Ts(e,n,s);break;case"style":af(e,s,d);break;case"data":if(t!=="object"){Ts(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=As(""+s),e.setAttribute(n,s);break;case"action":case"formAction":if(typeof s=="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 d=="function"&&(n==="formAction"?(t!=="input"&&$e(e,t,"name",c.name,c,null),$e(e,t,"formEncType",c.formEncType,c,null),$e(e,t,"formMethod",c.formMethod,c,null),$e(e,t,"formTarget",c.formTarget,c,null)):($e(e,t,"encType",c.encType,c,null),$e(e,t,"method",c.method,c,null),$e(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=As(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=Tn);break;case"onScroll":s!=null&&Oe("scroll",e);break;case"onScrollEnd":s!=null&&Oe("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(n=s.__html,n!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=n}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}n=As(""+s),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":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""+s):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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":s===!0?e.setAttribute(n,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,s):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(n,s):e.removeAttribute(n);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(n):e.setAttribute(n,s);break;case"popover":Oe("beforetoggle",e),Oe("toggle",e),Cs(e,"popover",s);break;case"xlinkActuate":Cn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Cn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Cn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Cn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Cn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Cn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Cs(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=t0.get(n)||n,Cs(e,n,s))}}function uu(e,t,n,s,c,d){switch(n){case"style":af(e,s,d);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(n=s.__html,n!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=n}}break;case"children":typeof s=="string"?dl(e,s):(typeof s=="number"||typeof s=="bigint")&&dl(e,""+s);break;case"onScroll":s!=null&&Oe("scroll",e);break;case"onScrollEnd":s!=null&&Oe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Tn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xd.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(c=n.endsWith("Capture"),t=n.slice(2,c?n.length-7:void 0),d=e[Lt]||null,d=d!=null?d[n]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof s=="function")){typeof d!="function"&&d!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,s,c);break e}n in e?e[n]=s:s===!0?e.setAttribute(n,""):Cs(e,n,s)}}}function xt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Oe("error",e),Oe("load",e);var s=!1,c=!1,d;for(d in n)if(n.hasOwnProperty(d)){var y=n[d];if(y!=null)switch(d){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:$e(e,t,d,y,n,null)}}c&&$e(e,t,"srcSet",n.srcSet,n,null),s&&$e(e,t,"src",n.src,n,null);return;case"input":Oe("invalid",e);var S=d=y=c=null,N=null,F=null;for(s in n)if(n.hasOwnProperty(s)){var Z=n[s];if(Z!=null)switch(s){case"name":c=Z;break;case"type":y=Z;break;case"checked":N=Z;break;case"defaultChecked":F=Z;break;case"value":d=Z;break;case"defaultValue":S=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(o(137,t));break;default:$e(e,t,s,Z,n,null)}}ef(e,d,S,N,F,y,c,!1);return;case"select":Oe("invalid",e),s=y=d=null;for(c in n)if(n.hasOwnProperty(c)&&(S=n[c],S!=null))switch(c){case"value":d=S;break;case"defaultValue":y=S;break;case"multiple":s=S;default:$e(e,t,c,S,n,null)}t=d,n=y,e.multiple=!!s,t!=null?ul(e,!!s,t,!1):n!=null&&ul(e,!!s,n,!0);return;case"textarea":Oe("invalid",e),d=c=s=null;for(y in n)if(n.hasOwnProperty(y)&&(S=n[y],S!=null))switch(y){case"value":s=S;break;case"defaultValue":c=S;break;case"children":d=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(o(91));break;default:$e(e,t,y,S,n,null)}nf(e,s,c,d);return;case"option":for(N in n)if(n.hasOwnProperty(N)&&(s=n[N],s!=null))switch(N){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:$e(e,t,N,s,n,null)}return;case"dialog":Oe("beforetoggle",e),Oe("toggle",e),Oe("cancel",e),Oe("close",e);break;case"iframe":case"object":Oe("load",e);break;case"video":case"audio":for(s=0;s<Ga.length;s++)Oe(Ga[s],e);break;case"image":Oe("error",e),Oe("load",e);break;case"details":Oe("toggle",e);break;case"embed":case"source":case"link":Oe("error",e),Oe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(F in n)if(n.hasOwnProperty(F)&&(s=n[F],s!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:$e(e,t,F,s,n,null)}return;default:if(Tr(t)){for(Z in n)n.hasOwnProperty(Z)&&(s=n[Z],s!==void 0&&uu(e,t,Z,s,n,void 0));return}}for(S in n)n.hasOwnProperty(S)&&(s=n[S],s!=null&&$e(e,t,S,s,n,null))}function Nv(e,t,n,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,y=null,S=null,N=null,F=null,Z=null;for(q in n){var te=n[q];if(n.hasOwnProperty(q)&&te!=null)switch(q){case"checked":break;case"value":break;case"defaultValue":N=te;default:s.hasOwnProperty(q)||$e(e,t,q,null,s,te)}}for(var Y in s){var q=s[Y];if(te=n[Y],s.hasOwnProperty(Y)&&(q!=null||te!=null))switch(Y){case"type":d=q;break;case"name":c=q;break;case"checked":F=q;break;case"defaultChecked":Z=q;break;case"value":y=q;break;case"defaultValue":S=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(o(137,t));break;default:q!==te&&$e(e,t,Y,q,s,te)}}Sr(e,y,S,N,F,Z,d,c);return;case"select":q=y=S=Y=null;for(d in n)if(N=n[d],n.hasOwnProperty(d)&&N!=null)switch(d){case"value":break;case"multiple":q=N;default:s.hasOwnProperty(d)||$e(e,t,d,null,s,N)}for(c in s)if(d=s[c],N=n[c],s.hasOwnProperty(c)&&(d!=null||N!=null))switch(c){case"value":Y=d;break;case"defaultValue":S=d;break;case"multiple":y=d;default:d!==N&&$e(e,t,c,d,s,N)}t=S,n=y,s=q,Y!=null?ul(e,!!n,Y,!1):!!s!=!!n&&(t!=null?ul(e,!!n,t,!0):ul(e,!!n,n?[]:"",!1));return;case"textarea":q=Y=null;for(S in n)if(c=n[S],n.hasOwnProperty(S)&&c!=null&&!s.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:$e(e,t,S,null,s,c)}for(y in s)if(c=s[y],d=n[y],s.hasOwnProperty(y)&&(c!=null||d!=null))switch(y){case"value":Y=c;break;case"defaultValue":q=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==d&&$e(e,t,y,c,s,d)}tf(e,Y,q);return;case"option":for(var he in n)if(Y=n[he],n.hasOwnProperty(he)&&Y!=null&&!s.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:$e(e,t,he,null,s,Y)}for(N in s)if(Y=s[N],q=n[N],s.hasOwnProperty(N)&&Y!==q&&(Y!=null||q!=null))switch(N){case"selected":e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:$e(e,t,N,Y,s,q)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Te in n)Y=n[Te],n.hasOwnProperty(Te)&&Y!=null&&!s.hasOwnProperty(Te)&&$e(e,t,Te,null,s,Y);for(F in s)if(Y=s[F],q=n[F],s.hasOwnProperty(F)&&Y!==q&&(Y!=null||q!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(o(137,t));break;default:$e(e,t,F,Y,s,q)}return;default:if(Tr(t)){for(var qe in n)Y=n[qe],n.hasOwnProperty(qe)&&Y!==void 0&&!s.hasOwnProperty(qe)&&uu(e,t,qe,void 0,s,Y);for(Z in s)Y=s[Z],q=n[Z],!s.hasOwnProperty(Z)||Y===q||Y===void 0&&q===void 0||uu(e,t,Z,Y,s,q);return}}for(var B in n)Y=n[B],n.hasOwnProperty(B)&&Y!=null&&!s.hasOwnProperty(B)&&$e(e,t,B,null,s,Y);for(te in s)Y=s[te],q=n[te],!s.hasOwnProperty(te)||Y===q||Y==null&&q==null||$e(e,t,te,Y,s,q)}function sp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function kv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),s=0;s<n.length;s++){var c=n[s],d=c.transferSize,y=c.initiatorType,S=c.duration;if(d&&S&&sp(y)){for(y=0,S=c.responseEnd,s+=1;s<n.length;s++){var N=n[s],F=N.startTime;if(F>S)break;var Z=N.transferSize,te=N.initiatorType;Z&&sp(te)&&(N=N.responseEnd,y+=Z*(N<S?1:(S-F)/(N-F)))}if(--s,t+=8*(d+y)/(c.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 du=null,fu=null;function So(e){return e.nodeType===9?e:e.ownerDocument}function op(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 rp(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 hu(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 mu=null;function Lv(){var e=window.event;return e&&e.type==="popstate"?e===mu?!1:(mu=e,!0):(mu=null,!1)}var cp=typeof setTimeout=="function"?setTimeout:void 0,Rv=typeof clearTimeout=="function"?clearTimeout:void 0,up=typeof Promise=="function"?Promise:void 0,_v=typeof queueMicrotask=="function"?queueMicrotask:typeof up<"u"?function(e){return up.resolve(null).then(e).catch(jv)}:cp;function jv(e){setTimeout(function(){throw e})}function hi(e){return e==="head"}function dp(e,t){var n=t,s=0;do{var c=n.nextSibling;if(e.removeChild(n),c&&c.nodeType===8)if(n=c.data,n==="/$"||n==="/&"){if(s===0){e.removeChild(c),Fl(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")$a(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,$a(n);for(var d=n.firstChild;d;){var y=d.nextSibling,S=d.nodeName;d[ca]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&d.rel.toLowerCase()==="stylesheet"||n.removeChild(d),d=y}}else n==="body"&&$a(e.ownerDocument.body);n=c}while(n);Fl(t)}function fp(e,t){var n=e;e=0;do{var s=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||""),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=s}while(n)}function pu(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":pu(n),xr(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Ov(e,t,n,s){for(;e.nodeType===1;){var c=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[ca])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=nn(e.nextSibling),e===null)break}return null}function Dv(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=nn(e.nextSibling),e===null))return null;return e}function hp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=nn(e.nextSibling),e===null))return null;return e}function gu(e){return e.data==="$?"||e.data==="$~"}function bu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function zv(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var s=function(){t(),n.removeEventListener("DOMContentLoaded",s)};n.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function nn(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 yu=null;function mp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return nn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function pp(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 gp(e,t,n){switch(t=So(n),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function $a(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);xr(e)}var ln=new Map,bp=new Set;function Co(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Kn=G.d;G.d={f:Hv,r:Bv,D:Uv,C:Kv,L:Iv,m:Fv,X:Yv,S:Gv,M:$v};function Hv(){var e=Kn.f(),t=mo();return e||t}function Bv(e){var t=ol(e);t!==null&&t.tag===5&&t.type==="form"?Oh(t):Kn.r(e)}var Ul=typeof document>"u"?null:document;function yp(e,t,n){var s=Ul;if(s&&typeof t=="string"&&t){var c=Xt(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof n=="string"&&(c+='[crossorigin="'+n+'"]'),bp.has(c)||(bp.add(c),e={rel:e,crossOrigin:n,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),xt(t,"link",e),ht(t),s.head.appendChild(t)))}}function Uv(e){Kn.D(e),yp("dns-prefetch",e,null)}function Kv(e,t){Kn.C(e,t),yp("preconnect",e,t)}function Iv(e,t,n){Kn.L(e,t,n);var s=Ul;if(s&&e&&t){var c='link[rel="preload"][as="'+Xt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(c+='[imagesrcset="'+Xt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(c+='[imagesizes="'+Xt(n.imageSizes)+'"]')):c+='[href="'+Xt(e)+'"]';var d=c;switch(t){case"style":d=Kl(e);break;case"script":d=Il(e)}ln.has(d)||(e=v({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ln.set(d,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(qa(d))||t==="script"&&s.querySelector(Va(d))||(t=s.createElement("link"),xt(t,"link",e),ht(t),s.head.appendChild(t)))}}function Fv(e,t){Kn.m(e,t);var n=Ul;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Xt(s)+'"][href="'+Xt(e)+'"]',d=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Il(e)}if(!ln.has(d)&&(e=v({rel:"modulepreload",href:e},t),ln.set(d,e),n.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Va(d)))return}s=n.createElement("link"),xt(s,"link",e),ht(s),n.head.appendChild(s)}}}function Gv(e,t,n){Kn.S(e,t,n);var s=Ul;if(s&&e){var c=rl(s).hoistableStyles,d=Kl(e);t=t||"default";var y=c.get(d);if(!y){var S={loading:0,preload:null};if(y=s.querySelector(qa(d)))S.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ln.get(d))&&vu(e,n);var N=y=s.createElement("link");ht(N),xt(N,"link",e),N._p=new Promise(function(F,Z){N.onload=F,N.onerror=Z}),N.addEventListener("load",function(){S.loading|=1}),N.addEventListener("error",function(){S.loading|=2}),S.loading|=4,To(y,t,s)}y={type:"stylesheet",instance:y,count:1,state:S},c.set(d,y)}}}function Yv(e,t){Kn.X(e,t);var n=Ul;if(n&&e){var s=rl(n).hoistableScripts,c=Il(e),d=s.get(c);d||(d=n.querySelector(Va(c)),d||(e=v({src:e,async:!0},t),(t=ln.get(c))&&xu(e,t),d=n.createElement("script"),ht(d),xt(d,"link",e),n.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function $v(e,t){Kn.M(e,t);var n=Ul;if(n&&e){var s=rl(n).hoistableScripts,c=Il(e),d=s.get(c);d||(d=n.querySelector(Va(c)),d||(e=v({src:e,async:!0,type:"module"},t),(t=ln.get(c))&&xu(e,t),d=n.createElement("script"),ht(d),xt(d,"link",e),n.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function vp(e,t,n,s){var c=(c=we.current)?Co(c):null;if(!c)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Kl(n.href),n=rl(c).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Kl(n.href);var d=rl(c).hoistableStyles,y=d.get(e);if(y||(c=c.ownerDocument||c,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,y),(d=c.querySelector(qa(e)))&&!d._p&&(y.instance=d,y.state.loading=5),ln.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},ln.set(e,n),d||qv(c,e,n,y.state))),t&&s===null)throw Error(o(528,""));return y}if(t&&s!==null)throw Error(o(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Il(n),n=rl(c).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Kl(e){return'href="'+Xt(e)+'"'}function qa(e){return'link[rel="stylesheet"]['+e+"]"}function xp(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function qv(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),xt(t,"link",n),ht(t),e.head.appendChild(t))}function Il(e){return'[src="'+Xt(e)+'"]'}function Va(e){return"script[async]"+e}function wp(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Xt(n.href)+'"]');if(s)return t.instance=s,ht(s),s;var c=v({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),ht(s),xt(s,"style",c),To(s,n.precedence,e),t.instance=s;case"stylesheet":c=Kl(n.href);var d=e.querySelector(qa(c));if(d)return t.state.loading|=4,t.instance=d,ht(d),d;s=xp(n),(c=ln.get(c))&&vu(s,c),d=(e.ownerDocument||e).createElement("link"),ht(d);var y=d;return y._p=new Promise(function(S,N){y.onload=S,y.onerror=N}),xt(d,"link",s),t.state.loading|=4,To(d,n.precedence,e),t.instance=d;case"script":return d=Il(n.src),(c=e.querySelector(Va(d)))?(t.instance=c,ht(c),c):(s=n,(c=ln.get(d))&&(s=v({},n),xu(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),ht(c),xt(c,"link",s),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,To(s,n.precedence,e));return t.instance}function To(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,d=c,y=0;y<s.length;y++){var S=s[y];if(S.dataset.precedence===t)d=S;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function vu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function xu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Mo=null;function Sp(e,t,n){if(Mo===null){var s=new Map,c=Mo=new Map;c.set(n,s)}else c=Mo,s=c.get(n),s||(s=new Map,c.set(n,s));if(s.has(e))return s;for(s.set(e,null),n=n.getElementsByTagName(e),c=0;c<n.length;c++){var d=n[c];if(!(d[ca]||d[gt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var y=d.getAttribute(t)||"";y=e+y;var S=s.get(y);S?S.push(d):s.set(y,[d])}}return s}function Cp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Vv(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 Tp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Pv(e,t,n,s){if(n.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var c=Kl(s.href),d=t.querySelector(qa(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ao.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=d,ht(d);return}d=t.ownerDocument||t,s=xp(s),(c=ln.get(c))&&vu(s,c),d=d.createElement("link"),ht(d);var y=d;y._p=new Promise(function(S,N){y.onload=S,y.onerror=N}),xt(d,"link",s),n.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Ao.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var wu=0;function Xv(e,t){return e.stylesheets&&e.count===0&&No(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&No(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&wu===0&&(wu=62500*kv());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&No(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>wu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Ao(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)No(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Eo=null;function No(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Eo=new Map,t.forEach(Qv,e),Eo=null,Ao.call(e))}function Qv(e,t){if(!(t.state.loading&4)){var n=Eo.get(e);if(n)var s=n.get(null);else{n=new Map,Eo.set(e,n);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var y=c[d];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(n.set(y.dataset.precedence,y),s=y)}s&&n.set(null,s)}c=t.instance,y=c.getAttribute("data-precedence"),d=n.get(y)||s,d===s&&n.set(null,c),n.set(y,c),this.count++,s=Ao.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var Pa={$$typeof:O,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function Zv(e,t,n,s,c,d,y,S,N){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=gr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gr(0),this.hiddenUpdates=gr(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function Mp(e,t,n,s,c,d,y,S,N,F,Z,te){return e=new Zv(e,t,n,y,N,F,Z,te,S),t=1,d===!0&&(t|=24),d=Kt(3,null,null,t),e.current=d,d.stateNode=e,t=ec(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:s,isDehydrated:n,cache:t},lc(d),e}function Ap(e){return e?(e=yl,e):yl}function Ep(e,t,n,s,c,d){c=Ap(c),s.context===null?s.context=c:s.pendingContext=c,s=ni(t),s.payload={element:n},d=d===void 0?null:d,d!==null&&(s.callback=d),n=ii(e,s,t),n!==null&&(zt(n,e,t),Aa(n,e,t))}function Np(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Su(e,t){Np(e,t),(e=e.alternate)&&Np(e,t)}function kp(e){if(e.tag===13||e.tag===31){var t=Hi(e,67108864);t!==null&&zt(t,e,67108864),Su(e,67108864)}}function Lp(e){if(e.tag===13||e.tag===31){var t=$t();t=br(t);var n=Hi(e,t);n!==null&&zt(n,e,t),Su(e,t)}}var ko=!0;function Wv(e,t,n,s){var c=E.T;E.T=null;var d=G.p;try{G.p=2,Cu(e,t,n,s)}finally{G.p=d,E.T=c}}function Jv(e,t,n,s){var c=E.T;E.T=null;var d=G.p;try{G.p=8,Cu(e,t,n,s)}finally{G.p=d,E.T=c}}function Cu(e,t,n,s){if(ko){var c=Tu(s);if(c===null)cu(e,t,s,Lo,n),_p(e,s);else if(tx(c,e,t,n,s))s.stopPropagation();else if(_p(e,s),t&4&&-1<ex.indexOf(e)){for(;c!==null;){var d=ol(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var y=_i(d.pendingLanes);if(y!==0){var S=d;for(S.pendingLanes|=2,S.entangledLanes|=2;y;){var N=1<<31-Ct(y);S.entanglements[1]|=N,y&=~N}bn(d),(Ie&6)===0&&(fo=St()+500,Fa(0))}}break;case 31:case 13:S=Hi(d,2),S!==null&&zt(S,d,2),mo(),Su(d,2)}if(d=Tu(s),d===null&&cu(e,t,s,Lo,n),d===c)break;c=d}c!==null&&s.stopPropagation()}else cu(e,t,s,null,n)}}function Tu(e){return e=Ar(e),Mu(e)}var Lo=null;function Mu(e){if(Lo=null,e=sl(e),e!==null){var t=u(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=h(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 Lo=e,null}function Rp(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(bs()){case la:return 2;case aa:return 8;case ki:case ys:return 32;case sa:return 268435456;default:return 32}default:return 32}}var Au=!1,mi=null,pi=null,gi=null,Xa=new Map,Qa=new Map,bi=[],ex="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 _p(e,t){switch(e){case"focusin":case"focusout":mi=null;break;case"dragenter":case"dragleave":pi=null;break;case"mouseover":case"mouseout":gi=null;break;case"pointerover":case"pointerout":Xa.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qa.delete(t.pointerId)}}function Za(e,t,n,s,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:d,targetContainers:[c]},t!==null&&(t=ol(t),t!==null&&kp(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function tx(e,t,n,s,c){switch(t){case"focusin":return mi=Za(mi,e,t,n,s,c),!0;case"dragenter":return pi=Za(pi,e,t,n,s,c),!0;case"mouseover":return gi=Za(gi,e,t,n,s,c),!0;case"pointerover":var d=c.pointerId;return Xa.set(d,Za(Xa.get(d)||null,e,t,n,s,c)),!0;case"gotpointercapture":return d=c.pointerId,Qa.set(d,Za(Qa.get(d)||null,e,t,n,s,c)),!0}return!1}function jp(e){var t=sl(e.target);if(t!==null){var n=u(t);if(n!==null){if(t=n.tag,t===13){if(t=h(n),t!==null){e.blockedOn=t,qd(e.priority,function(){Lp(n)});return}}else if(t===31){if(t=p(n),t!==null){e.blockedOn=t,qd(e.priority,function(){Lp(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 Ro(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Tu(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Mr=s,n.target.dispatchEvent(s),Mr=null}else return t=ol(n),t!==null&&kp(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Ro(e)&&n.delete(t)}function nx(){Au=!1,mi!==null&&Ro(mi)&&(mi=null),pi!==null&&Ro(pi)&&(pi=null),gi!==null&&Ro(gi)&&(gi=null),Xa.forEach(Op),Qa.forEach(Op)}function _o(e,t){e.blockedOn===t&&(e.blockedOn=null,Au||(Au=!0,l.unstable_scheduleCallback(l.unstable_NormalPriority,nx)))}var jo=null;function Dp(e){jo!==e&&(jo=e,l.unstable_scheduleCallback(l.unstable_NormalPriority,function(){jo===e&&(jo=null);for(var t=0;t<e.length;t+=3){var n=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(Mu(s||n)===null)continue;break}var d=ol(n);d!==null&&(e.splice(t,3),t-=3,Tc(d,{pending:!0,data:c,method:n.method,action:s},s,c))}}))}function Fl(e){function t(N){return _o(N,e)}mi!==null&&_o(mi,e),pi!==null&&_o(pi,e),gi!==null&&_o(gi,e),Xa.forEach(t),Qa.forEach(t);for(var n=0;n<bi.length;n++){var s=bi[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<bi.length&&(n=bi[0],n.blockedOn===null);)jp(n),n.blockedOn===null&&bi.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(s=0;s<n.length;s+=3){var c=n[s],d=n[s+1],y=c[Lt]||null;if(typeof d=="function")y||Dp(n);else if(y){var S=null;if(d&&d.hasAttribute("formAction")){if(c=d,y=d[Lt]||null)S=y.formAction;else if(Mu(c)!==null)continue}else S=y.action;typeof S=="function"?n[s+1]=S:(n.splice(s,3),s-=3),Dp(n)}}}function zp(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(y){return c=y})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(n,20)}function n(){if(!s&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Eu(e){this._internalRoot=e}Oo.prototype.render=Eu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current,s=$t();Ep(n,s,e,t,null,null)},Oo.prototype.unmount=Eu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ep(e.current,2,null,e,null,null),mo(),t[al]=null}};function Oo(e){this._internalRoot=e}Oo.prototype.unstable_scheduleHydration=function(e){if(e){var t=$d();e={blockedOn:null,target:e,priority:t};for(var n=0;n<bi.length&&t!==0&&t<bi[n].priority;n++);bi.splice(n,0,e),n===0&&jp(e)}};var Hp=i.version;if(Hp!=="19.2.8")throw Error(o(527,Hp,"19.2.8"));G.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var ix={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Do=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Do.isDisabled&&Do.supportsFiber)try{Li=Do.inject(ix),Mt=Do}catch{}}return Ja.createRoot=function(e,t){if(!r(e))throw Error(o(299));var n=!1,s="",c=Yh,d=$h,y=qh;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=Mp(e,1,!1,null,null,n,s,null,c,d,y,zp),e[al]=t.current,ru(e),new Eu(t)},Ja.hydrateRoot=function(e,t,n){if(!r(e))throw Error(o(299));var s=!1,c="",d=Yh,y=$h,S=qh,N=null;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(y=n.onCaughtError),n.onRecoverableError!==void 0&&(S=n.onRecoverableError),n.formState!==void 0&&(N=n.formState)),t=Mp(e,1,!0,t,n??null,s,c,N,d,y,S,zp),t.context=Ap(null),n=t.current,s=$t(),s=br(s),c=ni(s),c.callback=null,ii(n,c,s),n=s,t.current.lanes=n,ra(t,n),bn(t),e[al]=t.current,ru(e),new Oo(t)},Ja.version="19.2.8",Ja}var Gp;function mx(){if(Gp)return ku.exports;Gp=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(i){console.error(i)}}return l(),ku.exports=hx(),ku.exports}var px=mx();const gx=lb(px),on="/ws/client",sb={header:{appName:"Herdr",tagline:"remote terminal client",terminalTab:"Terminal",adminTab:"Admin",rttMs:"{rtt}ms",hostLabel:"Host",clientIdLabel:"ID:",copyClientIdTitle:"Click to copy Client ID",languageToggleTitle:"Switch language (EN / 中文)",pairingTitle:"Connection & pairing",settingsTitle:"Terminal settings",virtualKeyboardTitle:"Quick command helper",latencyTitle:"Round-trip latency (RTT)",mainNavigationAria:"Main Navigation",actionKeyboard:"cmd",actionPairing:"link",actionSettings:"cfg",languageShort:"en"},common:{connecting:"Connecting...",connected:"Connected",reconnecting:"Reconnecting...",disconnected:"Disconnected",error:"Error",save:"Save",cancel:"Cancel",close:"Close",done:"Done",retry:"Retry",connect:"Connect",disconnect:"Disconnect",copy:"Copy",copied:"Copied",loading:"Loading...",offline:"Offline",role:"Role",host:"Host",status:"Status",settings:"Settings",admin:"Admin",terminal:"Terminal",pairing:"Pairing",keyBar:"Key bar",quickInput:"Quick input",dismissNotification:"Dismiss notification",closeDialog:"Close dialog",clickToCopy:"Click to copy",controller:"Controller",viewer:"Viewer",live:"Live"},connection:{live:"Live",connecting:"Connecting",reconnecting:"Reconnecting",reconnectNow:"Reconnect now",error:"Error",offline:"Offline",connect:"Connect",retry:"Retry"},role:{controllerMode:"Controller mode active",viewerMode:"Viewer mode",controlActive:"Full Control",viewerReadOnly:"Viewer",viewerWithController:"Viewer (Active: {controllerId})",sharedControl:"Full control",sharedControlDesc:"Every paired window shares this terminal and may type into it.",sharedWindows:"{count} windows",thisWindow:"Window",claimControl:"Claim Control",claimControlTitle:"Claim terminal control",releaseControl:"Release",releaseControlTitle:"Switch to viewer mode",takeoverControl:"Takeover",takeoverControlTitle:"Take over control from {controllerId}",takeoverModalTitle:"Confirm Control Takeover",takeoverModalDesc:"Another client is controlling this terminal.",takeoverModalWarning:"Input focus will transfer to this window.",confirmTakeover:"Confirm Takeover"},statusBanner:{connecting:"Connecting to relay...",reconnectingDefault:"Connection lost. Reconnecting...",reconnectNow:"Reconnect Now",errorDefault:"Unable to connect to relay",disconnected:"Terminal disconnected"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ restart for {version}",toast:"herdr-remote {version} is out for this workstation",toastRestart:"herdr-remote {version} is installed; restart it to apply",title:"herdr-remote update",running:"Running",installed:"Installed",latest:"Latest",restartPending:"{version} is installed but not running yet. Restart herdr-remote on the workstation:",stepTui:'On the workstation, open herdr-remote (the TUI), go to "Language & about" and press Enter on the update row.',stepCli:"Or run on the workstation:",restartNote:"Restarting reconnects this window after a few seconds.",ignore:"Skip this version"},herdrLaunch:{title:"Herdr is not running",body:"Herdr is not running on {host}. Start it on that workstation?",scope:"Only this paired workstation's own Herdr starts, as that workstation's user. No other machine is touched.",start:"Start Herdr",starting:"Starting Herdr on {host}…",failedTitle:"Herdr did not start",timeout:"The workstation did not answer within 30 seconds. Its herdr-remote may be too old to start Herdr from a browser.",thisHost:"this workstation"},onboarding:{title:"Pair with Herdr Remote",subtitle:"Connect your mobile or browser to your local terminal session",description:"Control Herdr sessions from any browser or phone.",firstTimeSetup:"First-time Setup",authRequired:"Authorization Required",authRequiredDesc:"Pair your device or provide a valid access token.",step1Title:"Generate Pairing Code on Host",step1Desc:"Run on the host running Herdr:",step1TuiNote:"Interactive TUI config:",step2Title:"Enter 6-character Pairing Code",step2Placeholder:"e.g. 7X9K2A",step2Note:"Pairing code expires in 10 minutes; credentials are saved automatically.",connectAndPair:"Connect & Pair",connectingAndPairing:"Pairing with Relay...",advancedTitle:"Advanced Options",manualTokenLabel:"Authentication Token",manualTokenPlaceholder:"Optional token (skips pairing code)",wsEndpointLabel:"Relay WebSocket Endpoint",wsEndpointPlaceholder:"/ws/client or wss://your-relay-host/ws/client",clientIdLabel:"Device Client Identifier"},pairing:{title:"Relay Connection & Pairing",addTitle:"Add Herdr Instance",displayNameLabel:"Host Name",displayNamePlaceholder:"e.g. Workstation",displayNameHelp:"This name is stored only in this browser.",credentialsRequired:"Enter a pairing code or device token.",subtitle:"Manage WebSocket endpoints and credentials",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A1B2C3",pairCodeHelp:'Run "herdr-remote pair" on host.',tokenLabel:"Access Token",tokenNote:"(Device secret)",tokenPlaceholder:"Device token...",wsUrlLabel:"Relay WebSocket Endpoint URL",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:"Defaults to same-origin /ws/client",clientIdLabel:"Client Identifier",newIdButton:"New ID",regenerateClientIdTitle:"Regenerate client ID",autoReconnectLabel:"Auto-reconnect",autoReconnectDesc:"Automatically reconnect when disconnected",copyDirectLink:"Copy direct pairing link",saveAndConnect:"Save & Connect"},settings:{title:"Terminal Preferences",subtitle:"Interface, font, input and alerts",tabGeneral:"General",sectionInterface:"Interface",sectionFont:"Font",sectionInput:"Input",sectionAdmin:"Administration",toggleOn:"On",toggleOff:"Off",hostFontLabel:"Workstation font",adminEntry:"Relay dashboard",adminEntryHint:"Hosts, devices and traffic; needs the admin token",adminEntryOpen:"Open",tabVirtualKeys:"Virtual Keys",tabAgentKeymaps:"Agent Keys",fontFamilyLabel:"Monospace Font",fontSizeHint:"This window only",fontSizeLabel:"Terminal Text Size ({size}px)",predictiveEchoLabel:"Predictive Echo",predictiveEchoAuto:"Auto",predictiveEchoAlways:"Always On",predictiveEchoOff:"Off",predictiveEchoDesc:"Show typing before the echo returns on slow links",touchKeyToolbar:"Touch Key Toolbar",touchKeyToolbarDesc:"Modifier and arrow keys",touchHaptics:"Haptic Feedback",touchHapticsDesc:"Vibrate on key press",agentAlertsLabel:"Agent alerts",agentAlertBadge:"Title and icon badge",agentAlertBadgeDesc:"Count waiting and finished agents in the tab title",agentAlertVibrate:"Vibrate",agentAlertVibrateDesc:"When an agent waits or finishes (page on screen)",agentAlertSound:"Chime",agentAlertSoundDesc:"In the background; works after your next tap",agentAlertNotify:"System notification",agentAlertNotifyDesc:"In the background (HTTPS only)",languageLabel:"Language",resetDefaults:"Reset to Defaults",resetDefaultsToast:"Settings reset to defaults",fontSizeFollowHost:"Same size as the workstation terminal ({size}px)",fontSizeFollowHostUnknown:"Same size as the workstation terminal (not reported)",hostFontSync:"Sync host font",hostGlyphLine:"CJK: {family} · {status}",hostGlyphStatus:{none:"",checking:"Checking…",installed:"Installed on this device",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading common characters",ready:"{count} characters on this device; others load as they appear",failed:"Could not be loaded"},hostFontStatus:{none:"The workstation did not report its terminal font",checking:"Checking…",installed:"Installed on this device",loaded:"Loaded from the workstation",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading {percent}%",failed:"Could not be loaded",unavailable:"No font file to load; drawn by name where installed"}},agentKeymaps:{keymapLabel:"Keymap",auto:"Auto",shell:"Shell",agentGroup:"Agent",listGroup:"{profile} shortcuts",genericGroup:"General",profileRowLabel:"Agent to edit",settingsProfileLabel:"Agent profile",autoProfile:"Auto · {profile}",pinnedProfile:"Pinned · {profile}",barGroup:"Key bar",barHint:"Tap to choose which {profile} shortcuts appear on the key bar ({count} shown); base keys are on the Virtual Keys tab.",restoreBar:"Restore default keys",customizeBar:"Choose which shortcuts the key bar shows",customizeBarShort:"Edit",shortcutLabel:"Shortcut",comboPlaceholder:"e.g. ctrl+e or esc esc",invalidCombo:"Invalid shortcut: {error}",defaultCombo:"Default: {combo}",resetAction:"Reset",moveUp:"Move up",moveDown:"Move down",unverified:"Unverified",addCustom:"Custom key",customLabel:"Function name",customCombo:"Key combo",addAction:"Add custom key",restoreProfile:"Restore this agent defaults",removeCustom:"Remove custom key",configHint:"Agent config: {path}",noAgentActions:"No agent-specific shortcuts.",errors:{empty:"Enter at least one key.",tooManySteps:"A shortcut can have at most {count} steps.",invalidStepSyntax:"Step {step} has invalid syntax. Use ctrl+o or esc esc.",duplicateModifier:"Step {step} repeats {modifier}.",missingKey:"Step {step} needs a key after the modifiers.",multipleKeys:"Step {step} can have only one key.",unsupportedKey:"Step {step} does not support “{key}”."}},agentActions:{mode:"Mode",rewind:"Rewind",details:"Details",model:"Model",thinking:"Thinking",todos:"Tasks",background:"Background",editor:"Editor",history:"History",stash:"Stash",pasteImage:"Paste image",newline:"New line",interrupt:"Interrupt",editPrevious:"Edit previous",queue:"Queue prompt",copy:"Copy",clear:"Clear",yolo:"YOLO mode",expand:"Expand",undo:"Undo",agent:"Next agent",agentBack:"Previous agent",palette:"Command palette",recentModel:"Recent model",variant:"Model variant",newSession:"New session",sessions:"Sessions",thinkingMode:"Thinking mode",nextModel:"Next model",modelPicker:"Model picker",tools:"Tools",thinkingBlocks:"Thinking blocks",followup:"Follow-up",dequeue:"Remove from queue",plan:"Plan mode",temporaryModel:"Temporary model",expandAll:"Expand all",reasoning:"Reasoning effort",review:"Review",specMode:"Spec mode",autonomy:"Autonomy",undoPicker:"Undo picker",steer:"Steer",sidebar:"Sidebar",agents:"Agents",permissionMode:"Permission mode",bypass:"Bypass permissions",tasks:"Tasks",interject:"Interject",multiline:"Multiline input",shortcuts:"Shortcuts",approve:"Approve",eof:"End of input",suspend:"Suspend",startOfLine:"Line start",endOfLine:"Line end",killToEnd:"Delete to line end",agentSwap:"Switch agent",activity:"Activity",planAct:"Plan / Act",autoApprove:"Auto-approve",search:"Search"},virtualKeyboard:{collapseToolbar:"Collapse Toolbar",expandToolbar:"Expand Toolbar",helperTitle:"Quick Commands",closeHelper:"Close Helper",placeholder:"Type command and press Enter...",sendButton:"Send",clearInput:"Clear Input",customizeTitle:"Custom Key Toolbar",customizeDesc:"Reorder, enable, or disable keys for your toolbar.",enabledKeysCount:"{count} keys enabled",resetLayout:"Reset to Default",addKey:"Add Key",availableKeys:"Available Keys",moveUp:"Move Up",moveDown:"Move Down",enableKey:"Enable Key",disableKey:"Disable Key",deleteKeyTitle:"Remove Key",keyTypeModifier:"Modifier",keyTypeNav:"Navigation",keyTypeAction:"Action",keyTypeChord:"Chord",keyTypeFn:"Function",keyTypeSymbol:"Symbol",fnDrawerTitle:"Function Keys (F1-F12)",chordsDrawerTitle:"Control Chords (^C, ^D, ^Z)",symbolsDrawerTitle:"Symbols (~, |, /, \\)",touchKeyboardShortcuts:"Shortcuts Toolbar",ctrlCTitle:"Ctrl+C (SIGINT)",ctrlDTitle:"Ctrl+D (EOF)",ctrlZTitle:"Ctrl+Z (SIGTSTP)",ctrlLTitle:"Ctrl+L (Clear)",ctrlRTitle:"Ctrl+R (Search)",ctrlATitle:"Ctrl+A (Start of line)",ctrlETitle:"Ctrl+E (End of line)",ctrlKTitle:"Ctrl+K (Kill to end)",badgeSigint:"SIGINT",badgeEof:"EOF",badgeTstp:"SIGTSTP",badgeClear:"CLEAR",badgeSearch:"SEARCH",badgeStart:"START",badgeEnd:"END",badgeKill:"KILL",keyEnter:"Enter",uploadImage:"Upload Image",uploadImageTitle:"Select and upload image to terminal",image:"Image",uploadProgressReading:"Reading...",uploadProgressProcessing:"Compressing...",uploadProgressSending:"Uploading...",uploadProgressWaitingHost:"Waiting for host...",uploadProgressCompleted:"Completed",uploadProgressFailed:"Upload failed"},profiles:{title:"Herdr instances",switcherLabel:"Switch Herdr instance",current:"current",empty:"No paired Herdr instances yet.",addHost:"Add Herdr instance",rename:"Rename instance",remove:"Remove locally",removeConfirm:"Remove this saved connection from this browser?"},mobile:{sessionControls:"Session controls",closeSessionControls:"Close session controls",terminalControlAria:"Terminal control",inputControl:"Input control",settingsAria:"Terminal settings",pairingAria:"Connection & pairing",keybarAria:"Toggle key toolbar",quickInputAria:"Toggle quick commands",menu:"Menu",statusBarAria:"Session status bar"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"Connected to Herdr session.",windowAriaLabel:"Terminal Window",bufferAriaLabel:"Terminal Buffer",offlineStatusAria:"Offline Status",releaseControlAria:"Release Control",takeoverControlAria:"Takeover Control",claimControlAria:"Claim Control"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab (Claude Code: cycle modes)",ctrl:"Toggle Ctrl Lock",alt:"Toggle Alt Lock",shift:"Toggle Shift Lock",meta:"Meta / Cmd",enter:"Enter",backspace:"Backspace",delete:"Delete",left:"Left (←)",up:"Up (↑)",down:"Down (↓)",right:"Right (→)",home:"Home",end:"End",page_up:"Page Up",page_down:"Page Down",insert:"Insert",drawer_chords:"Ctrl Chords",drawer_agent:"Agent shortcuts",drawer_symbols:"Symbols",drawer_fn:"Function Keys (F1-F12)",ctrl_c:"Ctrl+C (SIGINT)",ctrl_d:"Ctrl+D (EOF)",ctrl_z:"Ctrl+Z (SIGTSTP)",ctrl_l:"Ctrl+L (Clear)",ctrl_a:"Ctrl+A (Start of line)",ctrl_e:"Ctrl+E (End of line)",ctrl_k:"Ctrl+K (Kill to end)",ctrl_r:"Ctrl+R (Search history)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"Pipe (|)",sym_tilde:"Tilde (~)",sym_slash:"Slash (/)",sym_backslash:"Backslash (\\)",sym_dash:"Dash (-)",sym_underscore:"Underscore (_)",sym_dollar:"Dollar ($)",sym_ampersand:"Ampersand (&)",sym_quote:'Quote (")',sym_backtick:"Backtick (`)"},admin:{returnToTerminal:"Return to Terminal",terminalShells:"terminal sessions",startedAt:"Started at {time}",acrossWindows:"across {count} windows",perSecond:"{value}/s",unitDay:"d",unitHour:"h",unitMinute:"m",unitSecond:"s",startedRecently:"Started recently",updatedAt:"Updated at {time}",autoRefresh:"Auto refresh",paused:"Paused",refreshNow:"Refresh",connectedHosts:"Connected Hosts",activeUsers:"Active Users",activePtys:"Active PTYs",activeController:"Active Controller",uptime:"Uptime",none:"None",noHost:"No host connected",tabOverview:"Overview",tabClients:"Clients ({count})",tabPtys:"PTY Sessions ({count})",tabDevices:"Paired Devices ({count})",hostsTitle:"Hosts ({count})",noHosts:"No hosts connected or paired",hostConnectedDevices:"{count} connected",hostPairedDevices:"{count} paired",hostStatusOnline:"Online",hostStatusBusy:"In use",hostStatusReconnecting:"Reconnecting",hostStatusOffline:"Offline",hostRosterOperatorOnly:"Device list is visible to the relay operator only.",connectedClientsTitle:"Connected Clients ({count})",noClients:"No clients connected",colClientId:"Client ID",colDevice:"Device",colLastSeen:"Last Seen",colActions:"Actions",unknownDevice:"Unknown Device",pairedDevicesTitle:"Paired Devices ({count})",noDevices:"No paired devices",revokeDevice:"Revoke",revokeConfirm:"Confirm Revocation",revokeFailed:"Revocation failed",colRole:"Role",colIp:"IP Address",colConnectedAt:"Connected At",colTraffic:"Traffic ↓in / ↑out",activePtysTitle:"Active PTY Sessions ({count})",noPtys:"No active PTY sessions",colPtyId:"PTY ID",colPid:"PID",colCommand:"Command",colGrid:"Grid",colCwd:"Working Directory",colViewers:"Windows",copiedJson:"Copied",unauthorizedTitle:"Unauthorized (401/403)",unauthorizedDesc:"GET /api/status requires an authorized device token.",pairingStepsTitle:"Device Pairing:",pairingStepsHelp:"Run pairing command on host to get a code, then enter it here.",enterPairCodeBtn:"Enter Pairing Code",retryFetchBtn:"Retry Status",errorConnecting:"Failed to fetch GET /api/status: {error}",loadingStatus:"Loading status from /api/status...",remoteRelayTitle:"Remote Relay Administration",remoteRelayNotice:"Connected to remote relay. For server metrics, access the operator dashboard.",remoteRelayEndpoint:"Remote WebSocket Endpoint:",remoteRelayAdminUrl:"Remote Admin URL:",openRemoteAdminBtn:"Open Remote Admin",relayAdminTitle:"Relay Operator Dashboard",relayAdminTokenLabel:"Relay Admin Token (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"Enter RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"RELAY_ADMIN_TOKEN is not configured on this relay.",relayAdminLoginBtn:"Verify & View Metrics",relayAdminAuthError:"Invalid or unauthorized admin token.",remoteRelayClientNotice:"Terminal client connection. For server metrics, use the operator dashboard.",openOperatorPortal:"Open Operator Dashboard",localWorkstationBadge:"Local Relay",modeLocal:"Local Mode",modeRemote:"Remote Mode",hintTabs:"switch tabs",hintRefresh:"refresh status",hintBack:"return to terminal",relJustNow:"just now",relMinutes:"{count}m ago",relHours:"{count}h ago",relDays:"{count}d ago",statInbound:"Inbound",statOutbound:"Outbound",statTotal:"{value} total",hostsOfflineSub:"{count} more offline",colHost:"Host",colStatus:"Status",deviceWindows:"{count} windows open",hostPtys:"{count} PTY",relayAdminPrompt:"Enter RELAY_ADMIN_TOKEN to see this relay's hosts, devices and traffic."},toasts:{connected:"Connected to relay",connectionError:"Connection error",controlGranted:"Control granted",pairedSuccess:"Paired successfully",sessionEnded:"Session ended",controlReleased:"Control released",viewerModeWarning:'In viewer mode. Click "Claim Control" first.',clientIdCopied:"Client ID copied: {id}",pairingLinkCopied:"Pairing link copied",switchedLanguage:"Language switched to {lang}",settingsReset:"Settings reset to default",fontReset:"Font reset to default",commandCopied:"Command copied",keyLayoutReset:"Key layout reset"},shortcuts:{title:"Shortcuts",help:"Active outside terminal input area:",terminalInputNote:"Terminal shortcuts pass directly to host PTY."},serverErrors:{auth_required:"Pairing required: enter a pairing code, or a device token that is still valid.",unauthorized:"This device is not authorised for that workstation.",host_offline:"The paired workstation is not connected to this relay.",host_disconnected:"The workstation disconnected.",stale_host:"The workstation stopped answering and was dropped.",too_many_clients:"That workstation has reached its window limit.",rate_limited:"Too many pairing attempts. Wait a minute and try again.",invalid_handshake:"The relay rejected the handshake. Reload the page.",device_revoked:"This device was revoked by the relay operator.",connection_closed:"Connection closed. Reconnecting…",connection_stale:"The connection went quiet while the page was away. Reconnecting…",connection_stalled:"Connecting took too long. Trying again…",connection_failed:"Could not open a connection to the relay.",host_reconnecting:"The Herdr host is reconnecting.",host_reconnect_timeout:"The Herdr host did not reconnect in time.",host_replaced:"The Herdr host connection was replaced.",slow_client:"This browser was disconnected because it could not keep up.",client_send_failed:"The relay could not send data to this browser.",too_many_hosts:"This relay has reached its host limit.",paste_file_unsupported:"Unsupported image format for paste.",paste_file_too_large:"Pasted image exceeds 3 MB limit.",paste_file_write_failed:"Failed to save pasted image on host.",paste_file_empty:"Pasted image payload is empty.",paste_file_corrupt:"Pasted image data is corrupt or does not match declared MIME.",viewer_mode:"Viewer mode cannot paste to terminal.",no_session:"Terminal session is not ready."},fontPresets:{host:"Workstation font (default)",system:"System monospace"},hostFont:{title:"Workstation terminal font",body:"The terminal on {host} uses {family}{detail}. This device does not have it.",bodyGlyphsOnly:"The terminal on {host} draws Chinese with {family}. This device does not have it.",glyphs:"Chinese in {family}: about 2 MB of common characters first; any other character loads the first time it appears.",glyphsAll:"{family} is too large to send whole: about 2 MB of common characters first; any other character loads the first time it appears.",detail:" ({detail})",detailSeparator:", ",download:"Load {count} font file(s), {size} in total. Downloaded once, then kept in this browser.",load:"Load font",decline:"Use this device’s fonts",loading:"Loading {received} of {total}",failed:"The font could not be loaded: {reason}",loaded:"Workstation font loaded",reasons:{host_font_unavailable:"the font changed on the workstation. Sync it again from Settings",host_font_timeout:"the workstation stopped answering",disconnected:"the connection dropped",font_api_unavailable:"this browser cannot load fonts",other:"the browser could not read the font file"}},agents:{title:"Agents on this workstation",blocked:"blocked",done:"done",working:"working",allIdle:"agents idle",notifyBlocked:"{count} agent(s) waiting for you",notifyDone:"{count} agent(s) finished"},clipboard:{openLink:"Open Link",openLinkFailed:"This link cannot be opened from the browser",copySelection:"Copy Selection",copyLine:"Copy Line",copyScreen:"Copy Screen",paste:"Paste",cancel:"Cancel",copied:"Copied to clipboard",copyFailed:"Failed to copy",pasteHint:"Long-press here to paste, then tap Send",pasteSend:"Send",pasteUnavailable:"Clipboard is empty or unavailable",pasteTitle:"Paste Content",pasted:"Pasted",chooseImage:"Choose Image",takePhoto:"Take Photo",imageTooLarge:"Image exceeds 3 MB limit and cannot be compressed further.",imageCompressedSize:"Compressed: {size}",fileEmpty:"File is empty.",decodeFailed:"Failed to decode image file.",unsupportedType:"Unsupported format. Only PNG, JPEG, WebP, and GIF are supported.",imageSectionTitle:"Image",textSectionTitle:"Text",imageCompressing:"Processing image...",removeImage:"Remove image"}},bx={header:{appName:"Herdr",tagline:"远程终端客户端",terminalTab:"终端",adminTab:"管理面板",rttMs:"{rtt}ms",hostLabel:"主机",clientIdLabel:"客户端 ID:",copyClientIdTitle:"点击复制客户端 ID",languageToggleTitle:"切换语言 (EN / 中文)",pairingTitle:"连接与配对",settingsTitle:"终端设置",virtualKeyboardTitle:"快捷命令",latencyTitle:"网络延迟 (RTT)",mainNavigationAria:"主导航菜单",actionKeyboard:"命令",actionPairing:"配对",actionSettings:"设置",languageShort:"中"},common:{connecting:"连接中...",connected:"已连接",reconnecting:"重连中...",disconnected:"已断开",error:"错误",save:"保存",cancel:"取消",close:"关闭",done:"完成",retry:"重试",connect:"连接",disconnect:"断开连接",copy:"复制",copied:"已复制",loading:"加载中...",offline:"离线",role:"角色",host:"主机",status:"连接状态",settings:"设置",admin:"管理面板",terminal:"终端",pairing:"配对",keyBar:"按键条",quickInput:"快捷输入",dismissNotification:"关闭通知",closeDialog:"关闭对话框",clickToCopy:"点击复制",controller:"控制端",viewer:"观察者",live:"运行中"},connection:{live:"在线",connecting:"连接中",reconnecting:"正在重连",reconnectNow:"立即重连",error:"连接错误",offline:"离线",connect:"发起连接",retry:"重试"},role:{controllerMode:"控制模式",viewerMode:"观察者模式",controlActive:"控制端",viewerReadOnly:"观察者",viewerWithController:"观察者(控制者: {controllerId})",sharedControl:"完全控制",sharedControlDesc:"所有已配对窗口共享同一个终端,均可输入。",sharedWindows:"{count} 个窗口",thisWindow:"本窗口",claimControl:"获取控制权",claimControlTitle:"获取终端控制权",releaseControl:"释放控制权",releaseControlTitle:"切回观察者模式",takeoverControl:"强占控制权",takeoverControlTitle:"从 {controllerId} 接管控制权",takeoverModalTitle:"确认接管终端控制权?",takeoverModalDesc:"当前已有其他客户端控制该终端。",takeoverModalWarning:"接管后输入焦点切换至当前窗口。",confirmTakeover:"确认接管"},statusBanner:{connecting:"连接 Relay 服务中...",reconnectingDefault:"连接断开,正在重连...",reconnectNow:"立即重连",errorDefault:"无法连接 Relay 服务",disconnected:"会话已断开"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ 重启以应用 {version}",toast:"宿主机的 herdr-remote 有新版本 {version}",toastRestart:"herdr-remote {version} 已安装,重启后生效",title:"herdr-remote 更新",running:"正在运行",installed:"已安装",latest:"最新版本",restartPending:"{version} 已安装但尚未运行。在宿主机上重启 herdr-remote:",stepTui:"在宿主机打开 herdr-remote(TUI),进入「语言与关于」,在更新一行按 Enter。",stepCli:"或在宿主机上执行:",restartNote:"重启后这个窗口会在几秒内自动重连。",ignore:"忽略此版本"},herdrLaunch:{title:"Herdr 未运行",body:"{host} 上没有正在运行的 Herdr。要在这台宿主机上启动吗?",scope:"只会以这台已配对宿主机自己的用户身份,启动它自己的 Herdr,不会碰其他任何机器。",start:"启动 Herdr",starting:"正在 {host} 上启动 Herdr…",failedTitle:"Herdr 没有启动",timeout:"宿主机 30 秒内没有回应。它的 herdr-remote 可能版本过旧,不支持从浏览器启动 Herdr。",thisHost:"这台宿主机"},onboarding:{title:"配对 Herdr Remote",subtitle:"连接手机或浏览器至本地终端会话",description:"在浏览器或移动设备中控制 Herdr 会话。",firstTimeSetup:"首次配对",authRequired:"需要认证",authRequiredDesc:"使用配对码配对设备,或提供有效访问令牌。",step1Title:"在 Herdr 宿主机生成配对码",step1Desc:"在运行 Herdr 的主机终端执行:",step1TuiNote:"交互式 TUI 配置:",step2Title:"输入 6 位配对码",step2Placeholder:"例如:7X9K2A",step2Note:"配对码 10 分钟内有效,连接后自动保存凭据。",connectAndPair:"连接并完成配对",connectingAndPairing:"配对中...",advancedTitle:"高级选项",manualTokenLabel:"认证 Token",manualTokenPlaceholder:"可选 Token(跳过配对码)",wsEndpointLabel:"Relay WebSocket 端点",wsEndpointPlaceholder:"/ws/client 或 wss://relay-host/ws/client",clientIdLabel:"客户端标识 (Client ID)"},pairing:{title:"Relay 连接与配对",addTitle:"添加 Herdr 实例",displayNameLabel:"主机名称",displayNamePlaceholder:"例如:工作电脑",displayNameHelp:"名称仅保存在此浏览器中。",credentialsRequired:"请输入配对码或设备令牌。",subtitle:"管理 WebSocket 服务端点与凭证",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A1B2C3",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',tokenLabel:"访问 Token",tokenNote:"(设备凭据)",tokenPlaceholder:"设备 Token...",wsUrlLabel:"Relay WebSocket 端点",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:'默认同源端点 "/ws/client"',clientIdLabel:"客户端标识",newIdButton:"生成新 ID",regenerateClientIdTitle:"重新生成客户端 ID",autoReconnectLabel:"掉线自动重连",autoReconnectDesc:"连接断开时自动尝试重连",copyDirectLink:"复制配对链接(含配对码)",saveAndConnect:"保存并连接"},settings:{title:"终端设置",subtitle:"界面、字体、输入与提醒",tabGeneral:"通用",sectionInterface:"界面",sectionFont:"字体",sectionInput:"输入",sectionAdmin:"管理",toggleOn:"开",toggleOff:"关",hostFontLabel:"宿主机字体",adminEntry:"Relay 管理面板",adminEntryHint:"主机、设备与流量;需要管理员令牌",adminEntryOpen:"打开",tabVirtualKeys:"虚拟按键",tabAgentKeymaps:"智能体按键",fontFamilyLabel:"等宽字体",fontSizeHint:"只影响当前窗口",fontSizeLabel:"终端字号 ({size}px)",predictiveEchoLabel:"预测回显",predictiveEchoAuto:"自动",predictiveEchoAlways:"始终开启",predictiveEchoOff:"关闭",predictiveEchoDesc:"高延迟时先显示输入,回显到达后校正",touchKeyToolbar:"底部触控按键条",touchKeyToolbarDesc:"修饰键与方向键",touchHaptics:"触控振动反馈",touchHapticsDesc:"按键时轻微震动",agentAlertsLabel:"智能体提醒",agentAlertBadge:"标题与图标角标",agentAlertBadgeDesc:"标签页标题显示等待与完成数",agentAlertVibrate:"震动",agentAlertVibrateDesc:"等待确认或完成时(页面在前台)",agentAlertSound:"提示音",agentAlertSoundDesc:"页面在后台时播放,下次点击后生效",agentAlertNotify:"系统通知",agentAlertNotifyDesc:"页面在后台时通知(仅 HTTPS)",languageLabel:"显示语言",resetDefaults:"恢复默认设置",resetDefaultsToast:"设置已恢复默认",fontSizeFollowHost:"与宿主机终端同字号({size}px)",fontSizeFollowHostUnknown:"与宿主机终端同字号(宿主机未报告)",hostFontSync:"同步宿主机字体",hostGlyphLine:"中文:{family} · {status}",hostGlyphStatus:{none:"",checking:"检查中…",installed:"本机已安装",available:"未加载",declined:"未加载,正在使用本机字体",loading:"正在加载常用字",ready:"本机已有 {count} 字,其余出现时自动补齐",failed:"加载失败"},hostFontStatus:{none:"宿主机未报告终端字体",checking:"检查中…",installed:"本机已安装",loaded:"已从宿主机加载",available:"未加载",declined:"未加载,正在使用本机字体",loading:"加载中 {percent}%",failed:"加载失败",unavailable:"没有可传输的字体文件,已安装该字体的设备按名称显示"}},agentKeymaps:{keymapLabel:"按键方案",auto:"自动",shell:"Shell",agentGroup:"智能体",listGroup:"{profile} 快捷键",genericGroup:"通用",profileRowLabel:"编辑的智能体",settingsProfileLabel:"智能体方案",autoProfile:"自动 · {profile}",pinnedProfile:"固定 · {profile}",barGroup:"按键栏显示",barHint:"点选要在按键栏显示的 {profile} 快捷键(已显示 {count} 个);ESC、方向键在「虚拟按键」页。",restoreBar:"恢复默认显示",customizeBar:"自定义按键栏显示哪些快捷键",customizeBarShort:"自定义",shortcutLabel:"快捷键",comboPlaceholder:"例如 ctrl+e 或 esc esc",invalidCombo:"快捷键无效:{error}",defaultCombo:"默认:{combo}",resetAction:"重置",moveUp:"上移",moveDown:"下移",unverified:"未验证",addCustom:"自定义按键",customLabel:"功能名称",customCombo:"按键组合",addAction:"添加自定义按键",restoreProfile:"恢复此智能体默认设置",removeCustom:"删除自定义按键",configHint:"智能体配置:{path}",noAgentActions:"此智能体没有专用快捷键。",errors:{empty:"至少输入一个按键。",tooManySteps:"快捷键最多包含 {count} 个步骤。",invalidStepSyntax:"第 {step} 步格式无效。可输入 ctrl+o 或 esc esc。",duplicateModifier:"第 {step} 步重复使用了 {modifier}。",missingKey:"第 {step} 步需要在修饰键后输入一个按键。",multipleKeys:"第 {step} 步只能包含一个按键。",unsupportedKey:"第 {step} 步不支持按键“{key}”。"}},agentActions:{mode:"模式",rewind:"回退",details:"详情",model:"模型",thinking:"思考",todos:"任务",background:"后台运行",editor:"编辑器",history:"历史",stash:"暂存",pasteImage:"粘贴图片",newline:"换行",interrupt:"中断",editPrevious:"编辑上一条",queue:"排队发送",copy:"复制",clear:"清屏",yolo:"YOLO 模式",expand:"展开",undo:"撤销",agent:"下一个智能体",agentBack:"上一个智能体",palette:"命令面板",recentModel:"最近模型",variant:"模型变体",newSession:"新会话",sessions:"会话列表",thinkingMode:"思考模式",nextModel:"下一个模型",modelPicker:"模型选择器",tools:"工具",thinkingBlocks:"思考内容",followup:"后续提问",dequeue:"移出队列",plan:"计划模式",temporaryModel:"临时模型",expandAll:"全部展开",reasoning:"推理强度",review:"代码审查",specMode:"规格模式",autonomy:"自主模式",undoPicker:"撤销菜单",steer:"引导",sidebar:"侧栏",agents:"智能体列表",permissionMode:"权限模式",bypass:"绕过权限",tasks:"任务",interject:"插话",multiline:"多行输入",shortcuts:"快捷键",approve:"批准",eof:"结束输入",suspend:"挂起",startOfLine:"行首",endOfLine:"行尾",killToEnd:"删除至行尾",agentSwap:"切换智能体",activity:"活动面板",planAct:"计划 / 执行",autoApprove:"自动批准",search:"搜索"},virtualKeyboard:{collapseToolbar:"收起按键栏",expandToolbar:"展开按键栏",helperTitle:"快捷命令",closeHelper:"关闭命令助手",placeholder:"输入终端命令并回车...",sendButton:"发送",clearInput:"清除输入内容",customizeTitle:"自定义虚拟按键",customizeDesc:"调整按键顺序与启禁用状态。",enabledKeysCount:"已启用 {count} 个按键",resetLayout:"恢复默认布局",addKey:"添加按键",availableKeys:"可选按键库",moveUp:"前移",moveDown:"后移",enableKey:"启用按键",disableKey:"禁用按键",deleteKeyTitle:"删除按键",keyTypeModifier:"修饰键",keyTypeNav:"导航键",keyTypeAction:"动作键",keyTypeChord:"组合键",keyTypeFn:"功能键",keyTypeSymbol:"符号",fnDrawerTitle:"功能键 (F1-F12)",chordsDrawerTitle:"控制组合键 (^C, ^D, ^Z)",symbolsDrawerTitle:"终端常用符号 (~, |, /, \\)",touchKeyboardShortcuts:"快捷键工具栏",ctrlCTitle:"Ctrl+C (中断)",ctrlDTitle:"Ctrl+D (退出)",ctrlZTitle:"Ctrl+Z (挂起)",ctrlLTitle:"Ctrl+L (清屏)",ctrlRTitle:"Ctrl+R (搜索)",ctrlATitle:"Ctrl+A (行首)",ctrlETitle:"Ctrl+E (行尾)",ctrlKTitle:"Ctrl+K (剪切)",badgeSigint:"中断",badgeEof:"退出",badgeTstp:"挂起",badgeClear:"清屏",badgeSearch:"搜索",badgeStart:"行首",badgeEnd:"行尾",badgeKill:"剪切",keyEnter:"回车",uploadImage:"上传图片",uploadImageTitle:"选择图片并上传至终端",image:"图片",uploadProgressReading:"读取中...",uploadProgressProcessing:"处理压缩中...",uploadProgressSending:"上传中...",uploadProgressWaitingHost:"等待工作站保存...",uploadProgressCompleted:"完成",uploadProgressFailed:"上传失败"},profiles:{title:"Herdr 实例",switcherLabel:"切换 Herdr 实例",current:"当前",empty:"还没有已配对的 Herdr 实例。",addHost:"添加 Herdr 实例",rename:"重命名实例",remove:"仅本地移除",removeConfirm:"确认从此浏览器移除已保存的连接?"},mobile:{sessionControls:"会话控制",closeSessionControls:"关闭会话控制面板",terminalControlAria:"终端控制权",inputControl:"输入控制权",settingsAria:"终端设置",pairingAria:"连接与配对设置",keybarAria:"切换触控按键条",quickInputAria:"切换快捷命令",menu:"菜单",statusBarAria:"会话状态栏"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"已连接至 Herdr 会话。",windowAriaLabel:"远程终端窗口",bufferAriaLabel:"xterm 终端缓冲区",offlineStatusAria:"离线状态",releaseControlAria:"释放终端控制权",takeoverControlAria:"强占终端控制权",claimControlAria:"获取终端控制权"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab(Claude Code 切换模式)",ctrl:"切换 Ctrl 锁定",alt:"切换 Alt 锁定",shift:"切换 Shift 锁定",meta:"Meta / 命令键",enter:"回车 (Enter)",backspace:"退格 (Backspace)",delete:"删除 (Delete)",left:"左箭头 (←)",up:"上箭头 (↑)",down:"下箭头 (↓)",right:"右箭头 (→)",home:"行首 (Home)",end:"行尾 (End)",page_up:"向上翻页 (Page Up)",page_down:"向下翻页 (Page Down)",insert:"插入 (Insert)",drawer_chords:"常用 Ctrl 组合键",drawer_agent:"智能体快捷键",drawer_symbols:"常用特殊符号",drawer_fn:"功能键 (F1-F12)",ctrl_c:"Ctrl+C (中断)",ctrl_d:"Ctrl+D (退出)",ctrl_z:"Ctrl+Z (挂起)",ctrl_l:"Ctrl+L (清屏)",ctrl_a:"Ctrl+A (行首)",ctrl_e:"Ctrl+E (行尾)",ctrl_k:"Ctrl+K (剪切)",ctrl_r:"Ctrl+R (历史搜索)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"管道符 (|)",sym_tilde:"波浪号 (~)",sym_slash:"正斜杠 (/)",sym_backslash:"反斜杠 (\\)",sym_dash:"连字符 (-)",sym_underscore:"下划线 (_)",sym_dollar:"美元符 ($)",sym_ampersand:"与符号 (&)",sym_quote:'双引号 (")',sym_backtick:"反引号 (`)"},admin:{returnToTerminal:"返回终端",terminalShells:"终端会话",startedAt:"启动于 {time}",acrossWindows:"共 {count} 个窗口",perSecond:"{value}/秒",unitDay:" 天",unitHour:" 小时",unitMinute:" 分",unitSecond:" 秒",startedRecently:"最近启动",updatedAt:"更新于 {time}",autoRefresh:"自动刷新",paused:"暂停刷新",refreshNow:"立即刷新",connectedHosts:"接入主机",activeUsers:"活跃用户",activePtys:"活动 PTY",activeController:"活跃控制者",uptime:"运行时间",none:"无",noHost:"未连接主机",tabOverview:"概览",tabClients:"客户端 ({count})",tabPtys:"PTY ({count})",tabDevices:"设备 ({count})",hostsTitle:"主机 ({count})",noHosts:"暂无接入或配对的主机",hostConnectedDevices:"{count} 台在线",hostPairedDevices:"{count} 台已配对",hostStatusOnline:"在线",hostStatusBusy:"使用中",hostStatusReconnecting:"重连中",hostStatusOffline:"离线",hostRosterOperatorOnly:"设备清单仅 Relay 操作员可见。",connectedClientsTitle:"已连接客户端 ({count})",noClients:"当前暂无客户端连接",colClientId:"客户端 ID",colDevice:"设备",colLastSeen:"最近活动",colActions:"操作",unknownDevice:"未知设备",pairedDevicesTitle:"已配对设备 ({count})",noDevices:"尚未配对任何设备",revokeDevice:"撤销",revokeConfirm:"确认撤销",revokeFailed:"撤销失败",colRole:"角色",colIp:"IP 地址",colConnectedAt:"连接于",colTraffic:"流量 ↓入 / ↑出",activePtysTitle:"活动 PTY 终端会话 ({count})",noPtys:"当前无活跃的 PTY 会话",colPtyId:"PTY 标识",colPid:"进程 PID",colCommand:"运行命令",colGrid:"网格规格",colCwd:"工作目录",colViewers:"窗口数",copiedJson:"已复制",unauthorizedTitle:"管理接口未授权 (401/403)",unauthorizedDesc:"访问 GET /api/status 需要已授权的设备 Token。",pairingStepsTitle:"设备配对指引:",pairingStepsHelp:"在主机运行配对命令获取配对码后输入。",enterPairCodeBtn:"输入配对码",retryFetchBtn:"重新获取状态",errorConnecting:"连接 GET /api/status 失败:{error}",loadingStatus:"正在加载系统状态...",remoteRelayTitle:"远程 Relay 服务管理",remoteRelayNotice:"当前连接至远程独立 Relay 服务。如需查看服务端指标,请使用操作员后台。",remoteRelayEndpoint:"远程端点:",remoteRelayAdminUrl:"远程后台地址:",openRemoteAdminBtn:"前往远程管理后台",relayAdminTitle:"Relay 操作员管理后台",relayAdminTokenLabel:"Relay 管理员令牌 (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"请输入 RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"该 Relay 服务未配置 RELAY_ADMIN_TOKEN。",relayAdminLoginBtn:"验证并查看服务端指标",relayAdminAuthError:"管理员令牌无效或未授权。",remoteRelayClientNotice:"当前为终端客户端连接。如需查看服务端指标,请访问操作员后台。",openOperatorPortal:"打开服务端管理后台",localWorkstationBadge:"本地宿主 Relay",modeLocal:"本地模式",modeRemote:"远程模式",hintTabs:"切换标签页",hintRefresh:"刷新状态",hintBack:"返回终端",relJustNow:"刚刚",relMinutes:"{count} 分钟前",relHours:"{count} 小时前",relDays:"{count} 天前",statInbound:"入站流量",statOutbound:"出站流量",statTotal:"累计 {value}",hostsOfflineSub:"另有 {count} 台离线",colHost:"主机",colStatus:"状态",deviceWindows:"{count} 个窗口在线",hostPtys:"PTY {count}",relayAdminPrompt:"输入 RELAY_ADMIN_TOKEN,查看本 Relay 的主机、设备与流量。"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"处于观察者模式,请先获取控制权",clientIdCopied:"客户端 ID 已复制: {id}",pairingLinkCopied:"配对链接已复制",switchedLanguage:"语言已切换为 {lang}",settingsReset:"设置已恢复默认",fontReset:"字体已恢复默认",commandCopied:"命令已复制",keyLayoutReset:"虚拟按键布局已恢复默认"},shortcuts:{title:"WebUI 快捷键",help:"以下快捷键仅在非终端输入区域生效:",terminalInputNote:"终端操作快捷键直接透传至宿主 PTY。"},serverErrors:{auth_required:"需要配对:请输入配对码,或填写仍然有效的设备令牌。",unauthorized:"该设备无权访问此工作站。",host_offline:"已配对的工作站未连接到该 relay。",host_disconnected:"工作站已断开连接。",stale_host:"工作站长时间无响应,已被断开。",too_many_clients:"该工作站的窗口数量已达上限。",rate_limited:"配对尝试过于频繁,请稍后再试。",invalid_handshake:"relay 拒绝了握手,请刷新页面。",device_revoked:"该设备已被 relay 管理员撤销。",connection_closed:"连接已断开,正在重连…",connection_stale:"页面回到前台时连接已无响应,正在重连…",connection_stalled:"连接超时,正在重试…",connection_failed:"无法建立到 relay 的连接。",host_reconnecting:"Herdr 主机正在重连。",host_reconnect_timeout:"Herdr 主机未能及时恢复连接。",host_replaced:"Herdr 主机连接已被替换。",slow_client:"由于浏览器处理速度过慢,连接已关闭。",client_send_failed:"Relay 无法向此浏览器发送数据。",too_many_hosts:"此 relay 已达到主机数量上限。",paste_file_unsupported:"不支持的粘贴图片格式。",paste_file_too_large:"粘贴图片超过 3 MB 上限。",paste_file_write_failed:"工作站保存图片失败。",paste_file_empty:"粘贴图片内容为空。",paste_file_corrupt:"粘贴图片数据损坏或与声明格式不符。",viewer_mode:"观察者模式无法粘贴到终端。",no_session:"终端会话未准备就绪。"},fontPresets:{host:"宿主机终端字体(默认)",system:"系统等宽字体"},hostFont:{title:"宿主机终端字体",body:"{host} 的终端使用 {family}{detail}。这台设备没有安装该字体。",bodyGlyphsOnly:"{host} 的终端显示中文用 {family},这台设备没有安装该字体。",glyphs:"中文使用 {family}:先下载常用字约 2 MB,其余的字第一次出现时再补。",glyphsAll:"{family} 太大,不整包传输:先下载常用字符约 2 MB,其余字符第一次出现时再补。",detail:"({detail})",detailSeparator:",",download:"加载 {count} 个字体文件,共 {size}。只下载一次,之后保存在本浏览器。",load:"加载字体",decline:"使用本机字体",loading:"正在加载 {received} / {total}",failed:"字体加载失败:{reason}",loaded:"宿主机字体已加载",reasons:{host_font_unavailable:"宿主机上的字体已变化,请在设置里重新同步",host_font_timeout:"宿主机没有响应",disconnected:"连接已断开",font_api_unavailable:"此浏览器不支持加载字体",other:"浏览器无法解析该字体文件"}},agents:{title:"本工作站的智能体",blocked:"待确认",done:"已完成",working:"运行中",allIdle:"智能体空闲",notifyBlocked:"{count} 个智能体在等你确认",notifyDone:"{count} 个智能体已完成"},clipboard:{openLink:"打开链接",openLinkFailed:"该链接无法在浏览器中打开",copySelection:"复制选中",copyLine:"复制本行",copyScreen:"复制整屏",paste:"粘贴",cancel:"取消",copied:"已复制到剪贴板",copyFailed:"复制失败",pasteHint:"长按此处粘贴,然后按发送",pasteSend:"发送",pasteUnavailable:"剪贴板为空或不可用",pasteTitle:"粘贴内容",pasted:"已粘贴",chooseImage:"选择图片",takePhoto:"拍照",imageTooLarge:"图片超过 3 MB 限制且无法进一步压缩。",imageCompressedSize:"压缩后大小:{size}",fileEmpty:"文件内容为空。",decodeFailed:"无法解析图片文件。",unsupportedType:"不支持的图片格式,仅支持 PNG、JPEG、WebP 和 GIF。",imageSectionTitle:"图片",textSectionTitle:"文本",imageCompressing:"正在处理图片...",removeImage:"移除图片"}},_u={en:sb,zh:bx};function wd(l,i,a){const o=_u[l]||_u.en,r=i.split(".");let u=o;for(const h of r)if(u&&typeof u=="object"&&h in u)u=u[h];else{let p=_u.en;for(const m of r)if(p&&typeof p=="object"&&m in p)p=p[m];else return i;u=p;break}if(typeof u!="string")return i;if(a){let h=u;for(const[p,m]of Object.entries(a))h=h.replaceAll(`{${p}}`,String(m));return h}return u}function ju(l){return typeof l=="string"&&Object.hasOwn(sb.serverErrors,l)}const oe={ESC:"\x1B",TAB:" ",SHIFT_TAB:"\x1B[Z",ENTER:"\r",BACKSPACE:"",UP:"\x1B[A",DOWN:"\x1B[B",RIGHT:"\x1B[C",LEFT:"\x1B[D",HOME:"\x1B[H",END:"\x1B[F",PAGE_UP:"\x1B[5~",PAGE_DOWN:"\x1B[6~",INSERT:"\x1B[2~",DELETE:"\x1B[3~",CTRL_C:"",CTRL_D:"",CTRL_Z:"",CTRL_L:"\f",CTRL_A:"",CTRL_E:"",CTRL_K:"\v",CTRL_R:"",CTRL_W:"",CTRL_U:"",CTRL_X:"",CTRL_N:"",CTRL_P:"",F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F5:"\x1B[15~",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~",F11:"\x1B[23~",F12:"\x1B[24~"},yx=new TextEncoder;function Sd(l){return yx.encode(l)}function ob(l){if(!l||l.length===0)return"";const a=l.toUpperCase().charCodeAt(0);return a>=65&&a<=90?String.fromCharCode(a-64):l==="@"||l===" "?"\0":l==="["?"\x1B":l==="\\"?"":l==="]"?"":l==="^"?"":l==="_"?"":l==="?"?"":l}function vx(l){return`\x1B${l}`}function Yp({ctrl:l,alt:i,shift:a}){return 1+(a?1:0)+(i?2:0)+(l?4:0)}const rb=/^\x1b[[O]([ABCDHF])$/,cb=/^\x1bO([PQRS])$/,ub=/^\x1b\[(\d+)~$/;function tr(l,i){const{ctrl:a=!1,alt:o=!1,shift:r=!1}=i;if(!a&&!o&&!r)return l;const u=Yp(i),h=o&&!a&&!r,p=rb.exec(l);if(p)return`\x1B[1;${u}${p[1]}`;const m=cb.exec(l);if(m)return`\x1B[1;${u}${m[1]}`;const g=ub.exec(l);if(g)return`\x1B[${g[1]};${u}~`;switch(l){case oe.TAB:return r&&!a&&!o?oe.SHIFT_TAB:h?`\x1B${l}`:`\x1B[9;${u}u`;case oe.SHIFT_TAB:return!a&&!o?l:`\x1B[9;${Yp({...i,shift:!0})}u`;case oe.ENTER:return h?`\x1B${l}`:`\x1B[13;${u}u`;case oe.BACKSPACE:return a&&!o&&!r?"\b":h?`\x1B${l}`:`\x1B[127;${u}u`;case oe.ESC:return h?`\x1B${l}`:`\x1B[27;${u}u`}let b=l;return r&&l.length===1&&!a&&(b=l.toUpperCase()),a&&(b=ob(b)),o&&(b=vx(b)),b}function xx(l){return[...l].length===1?!0:rb.test(l)||cb.test(l)||ub.test(l)||l===oe.SHIFT_TAB}class vn extends Error{constructor(a,o={}){super(a);W(this,"code");W(this,"params");this.name="KeyComboError",this.code=a,this.params=o}}const wx={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},$p={esc:oe.ESC,tab:oe.TAB,enter:oe.ENTER,backspace:oe.BACKSPACE,delete:oe.DELETE,left:oe.LEFT,right:oe.RIGHT,up:oe.UP,down:oe.DOWN,home:oe.HOME,end:oe.END,pageup:oe.PAGE_UP,pagedown:oe.PAGE_DOWN,insert:oe.INSERT,space:" ","+":"+"},Sx={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},Cx={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function db(l,i){const a=l.toLowerCase().split("+");if(a.some(m=>!m))throw new vn("invalidStepSyntax",{step:i+1});const o={};let r;for(const m of a)if(m==="ctrl"||m==="control"){if(o.ctrl)throw new vn("duplicateModifier",{step:i+1,modifier:"Ctrl"});o.ctrl=!0}else if(m==="alt"||m==="option"){if(o.alt)throw new vn("duplicateModifier",{step:i+1,modifier:"Alt"});o.alt=!0}else if(m==="shift"){if(o.shift)throw new vn("duplicateModifier",{step:i+1,modifier:"Shift"});o.shift=!0}else if(r===void 0)r=m;else throw new vn("multipleKeys",{step:i+1});if(!r)throw new vn("missingKey",{step:i+1});const u=wx[r]||r,h=/^f(?:[1-9]|1[0-2])$/.exec(u);let p;if(h)p=oe[u.toUpperCase()];else if(Object.hasOwn($p,u))p=$p[u];else if([...u].length===1&&/^[\x21-\x7e]$/.test(u))p=u;else throw new vn("unsupportedKey",{step:i+1,key:u});return{key:p,keyName:u,modifiers:o,sequence:Mx(p,u,o)}}function Tx(l){return 1+(l.shift?1:0)+(l.alt?2:0)+(l.ctrl?4:0)}function qp(l,i){const a=[...l][0].codePointAt(0);return a===void 0?"":`\x1B[${a};${Tx(i)}u`}function Mx(l,i,a){if(!a.ctrl)return tr(l,a);if(i.length===1&&/^[\x20-\x7e]$/.test(i)){const o=i.toLowerCase();if(a.alt||a.shift||o==="m"||o==="i")return qp(o,a);if(o==="-"||o==="/"||o==="_")return"";const r=ob(o);return r!==o?r:qp(o,a)}return tr(l,a)}function xn(l){if(typeof l!="string"||!l.trim())throw new vn("empty");const i=l.trim().split(/\s+/);if(i.length>8)throw new vn("tooManySteps",{count:8});return i.map((a,o)=>db(a,o).sequence)}function is(l){const i=l.trim().split(/\s+/);return i.length>1&&i.every(a=>["esc","escape"].includes(a.toLowerCase()))?`ESC${Cx[i.length]||` ×${i.length}`}`:i.map((a,o)=>{const{keyName:r,modifiers:u}=db(a,o),h=Sx[r]||(/^f\d+$/.test(r),r.toUpperCase());return u.ctrl&&u.alt&&u.shift?`Ctrl+Alt+⇧${h}`:u.ctrl&&u.alt?`Ctrl+Alt+${h}`:u.ctrl&&u.shift?`^⇧${h}`:u.ctrl?`^${h}`:u.alt&&u.shift?`Alt+⇧${h}`:u.alt?`Alt+${h}`:u.shift?`⇧${h}`:h}).join(" ")}const H=(l,i,a,o=!0)=>({id:l,labelKey:i,combo:a,verified:o}),fb={claude:{id:"claude",name:"Claude Code",shortName:"Claude",configHint:"~/.claude/keybindings.json",bar:["mode","rewind","details","model"],actions:[H("mode","mode","shift+tab"),H("rewind","rewind","esc esc"),H("details","details","ctrl+o"),H("model","model","alt+p"),H("thinking","thinking","alt+t"),H("todos","todos","ctrl+t"),H("background","background","ctrl+b"),H("editor","editor","ctrl+g"),H("history","history","ctrl+r"),H("stash","stash","ctrl+s"),H("pasteImage","pasteImage","ctrl+v"),H("newline","newline","ctrl+j"),H("interrupt","interrupt","esc")]},codex:{id:"codex",name:"Codex",shortName:"Codex",configHint:"~/.codex/config.toml [tui.keymap]",bar:["mode","editPrevious","details"],actions:[H("mode","mode","shift+tab"),H("editPrevious","editPrevious","esc esc"),H("details","details","ctrl+t"),H("queue","queue","tab"),H("history","history","ctrl+r"),H("copy","copy","ctrl+o"),H("editor","editor","ctrl+g"),H("newline","newline","ctrl+j"),H("clear","clear","ctrl+l"),H("interrupt","interrupt","esc")]},gemini:{id:"gemini",name:"Gemini CLI",shortName:"Gemini",configHint:"~/.gemini/keybindings.json",bar:["mode","yolo","rewind"],actions:[H("mode","mode","shift+tab"),H("yolo","yolo","ctrl+y"),H("rewind","rewind","esc esc"),H("todos","todos","ctrl+t"),H("expand","expand","ctrl+o"),H("background","background","ctrl+b"),H("editor","editor","ctrl+g"),H("history","history","ctrl+r"),H("undo","undo","ctrl+z"),H("newline","newline","ctrl+j"),H("interrupt","interrupt","esc")]},qwen:{id:"qwen",name:"Qwen Code",shortName:"Qwen",bar:["mode","history"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","esc"),H("history","history","ctrl+r"),H("newline","newline","ctrl+j"),H("todos","todos","ctrl+t",!1),H("rewind","rewind","esc esc",!1)]},opencode:{id:"opencode",name:"OpenCode",shortName:"OpenCode",configHint:"tui.json keybinds",bar:["palette","model","sessions"],actions:[H("agent","agent","tab"),H("agentBack","agentBack","shift+tab"),H("interrupt","interrupt","esc"),H("palette","palette","ctrl+p"),H("model","model","ctrl+x m"),H("recentModel","recentModel","f2"),H("variant","variant","ctrl+t"),H("newSession","newSession","ctrl+x n"),H("sessions","sessions","ctrl+x l"),H("undo","undo","ctrl+x u"),H("editor","editor","ctrl+x e"),H("newline","newline","ctrl+j")]},kilo:{id:"kilo",name:"Kilo Code",shortName:"Kilo",configHint:"~/.config/kilo/tui.jsonc",bar:["palette","model","sessions"],actions:[H("agent","agent","tab",!1),H("agentBack","agentBack","shift+tab",!1),H("interrupt","interrupt","esc"),H("palette","palette","ctrl+p"),H("model","model","ctrl+x m"),H("recentModel","recentModel","f2"),H("variant","variant","ctrl+t"),H("newSession","newSession","ctrl+x n"),H("sessions","sessions","ctrl+x l"),H("undo","undo","ctrl+x u"),H("editor","editor","ctrl+x e"),H("newline","newline","ctrl+j")]},pi:{id:"pi",name:"Pi",shortName:"Pi",configHint:"~/.pi/agent/keybindings.json",bar:["thinkingMode","modelPicker","tools"],actions:[H("thinkingMode","thinkingMode","shift+tab"),H("interrupt","interrupt","esc"),H("nextModel","nextModel","ctrl+p"),H("modelPicker","modelPicker","ctrl+l"),H("tools","tools","ctrl+o"),H("thinkingBlocks","thinkingBlocks","ctrl+t"),H("editor","editor","ctrl+g"),H("followup","followup","alt+enter"),H("dequeue","dequeue","alt+up"),H("newline","newline","shift+enter")]},omp:{id:"omp",name:"Oh My Pi",shortName:"OMP",configHint:"~/.omp/agent/keybindings.yml",bar:["thinkingMode","plan","model"],actions:[H("thinkingMode","thinkingMode","shift+tab"),H("plan","plan","alt+shift+p"),H("model","model","alt+m"),H("temporaryModel","temporaryModel","alt+p"),H("nextModel","nextModel","ctrl+p"),H("tools","tools","ctrl+o"),H("thinking","thinking","ctrl+t"),H("history","history","ctrl+r"),H("editor","editor","ctrl+g"),H("followup","followup","ctrl+enter"),H("interrupt","interrupt","esc")]},copilot:{id:"copilot",name:"GitHub Copilot",shortName:"Copilot",bar:["mode","expand","reasoning"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","esc"),H("expand","expand","ctrl+o"),H("expandAll","expandAll","ctrl+e"),H("reasoning","reasoning","ctrl+t"),H("editor","editor","ctrl+g"),H("clear","clear","ctrl+l")]},cursor:{id:"cursor",name:"Cursor",shortName:"Cursor",bar:["mode","review"],actions:[H("mode","mode","shift+tab"),H("review","review","ctrl+r"),H("newline","newline","ctrl+j"),H("interrupt","interrupt","esc",!1)]},droid:{id:"droid",name:"Factory Droid",shortName:"Droid",configHint:"In-app settings",bar:["specMode","autonomy"],actions:[H("specMode","specMode","shift+tab"),H("autonomy","autonomy","ctrl+l"),H("details","details","ctrl+o",!1),H("queue","queue","ctrl+enter"),H("interrupt","interrupt","esc",!1)]},kimi:{id:"kimi",name:"Kimi Code",shortName:"Kimi",bar:["plan","undoPicker","expand"],actions:[H("plan","plan","shift+tab"),H("interrupt","interrupt","esc"),H("undoPicker","undoPicker","esc esc"),H("expand","expand","ctrl+o"),H("editor","editor","ctrl+g"),H("steer","steer","ctrl+s"),H("undo","undo","ctrl+-"),H("newline","newline","ctrl+j"),H("pasteImage","pasteImage","ctrl+v")]},amp:{id:"amp",name:"Amp",shortName:"Amp",bar:["palette","reasoning","mode"],actions:[H("palette","palette","ctrl+o"),H("reasoning","reasoning","alt+d"),H("mode","mode","ctrl+s",!1),H("editor","editor","ctrl+g"),H("history","history","ctrl+r"),H("sidebar","sidebar","ctrl+backslash"),H("pasteImage","pasteImage","ctrl+v"),H("interrupt","interrupt","esc",!1)]},hermes:{id:"hermes",name:"Hermes",shortName:"Hermes",bar:["interrupt","agents","sessions"],actions:[H("interrupt","interrupt","ctrl+c"),H("newline","newline","ctrl+j"),H("editor","editor","ctrl+g"),H("agents","agents","ctrl+t"),H("sessions","sessions","ctrl+x")]},qodercli:{id:"qodercli",name:"Qoder CLI",shortName:"Qoder",configHint:"/shortcuts in-app",bar:["permissionMode","bypass","tasks","interrupt"],actions:[H("permissionMode","permissionMode","shift+tab"),H("bypass","bypass","ctrl+y"),H("tasks","tasks","ctrl+t"),H("editor","editor","ctrl+x"),H("history","history","ctrl+r"),H("queue","queue","ctrl+enter"),H("newline","newline","ctrl+j"),H("pasteImage","pasteImage","alt+v"),H("interrupt","interrupt","ctrl+c")]},devin:{id:"devin",name:"Devin",shortName:"Devin",configHint:"~/.config/devin/config.json keymap",bar:["mode","thinking","interrupt"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","ctrl+c"),H("thinking","thinking","alt+t"),H("newline","newline","ctrl+j"),H("pasteImage","pasteImage","ctrl+v")]},grok:{id:"grok",name:"Grok CLI",shortName:"Grok",bar:["mode","rewind","interrupt"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","ctrl+c"),H("rewind","rewind","esc esc"),H("interject","interject","ctrl+enter"),H("multiline","multiline","ctrl+m"),H("newline","newline","alt+enter"),H("shortcuts","shortcuts","ctrl+.")]},agy:{id:"agy",name:"Antigravity",shortName:"Antigravity",configHint:"~/.gemini/antigravity-cli/keybindings.json",bar:["mode","approve","interrupt"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","ctrl+c"),H("background","background","ctrl+b"),H("approve","approve","ctrl+k"),H("clear","clear","esc esc")]},mastracode:{id:"mastracode",name:"MastraCode",shortName:"MastraCode",bar:["interrupt","thinking","expand"],actions:[H("interrupt","interrupt","ctrl+c"),H("thinking","thinking","ctrl+t"),H("expand","expand","ctrl+e"),H("followup","followup","ctrl+f")]},letta:{id:"letta",name:"Letta Code",shortName:"Letta",bar:["permissionMode"],actions:[H("permissionMode","permissionMode","shift+tab"),H("interrupt","interrupt","esc",!1)]},kiro:{id:"kiro",name:"Kiro CLI",shortName:"Kiro",configHint:"kiro-cli settings chat.keybindings.*",bar:["agentSwap","details","steer"],actions:[H("agentSwap","agentSwap","shift+tab"),H("interrupt","interrupt","esc"),H("details","details","ctrl+t"),H("steer","steer","ctrl+s"),H("expand","expand","ctrl+o"),H("activity","activity","ctrl+x"),H("newline","newline","ctrl+j")]},cline:{id:"cline",name:"Cline",shortName:"Cline",bar:["autoApprove"],actions:[H("planAct","planAct","tab"),H("autoApprove","autoApprove","shift+tab"),H("interrupt","interrupt","esc",!1)]},maki:{id:"maki",name:"Maki",shortName:"Maki",bar:["rewind","search"],actions:[H("rewind","rewind","esc esc"),H("search","search","ctrl+f"),H("interrupt","interrupt","esc",!1)]},muse:{id:"muse",name:"Muse",shortName:"Muse",configHint:"/keymap in-app",bar:["queue","interruptCtrl"],actions:[H("interrupt","interrupt","esc"),H("queue","queue","alt+enter"),H("interruptCtrl","interrupt","ctrl+c")]},shell:{id:"shell",name:"Shell",shortName:"Shell",actions:[]}},Ji=fb,Ax=Object.keys(fb),Vp={pi:"pi",claude:"claude","claude-code":"claude",codex:"codex",gemini:"gemini",cursor:"cursor","cursor-agent":"cursor",devin:"devin","devin-cli":"devin","devin cli":"devin",agy:"agy",antigravity:"agy","antigravity-cli":"agy",cline:"cline",".cline":"cline",omp:"omp",mastracode:"mastracode","mastra-code":"mastracode","mastra code":"mastracode",opencode:"opencode",opencode2:"opencode","open-code":"opencode",copilot:"copilot","github-copilot":"copilot",ghcs:"copilot",kimi:"kimi","kimi-code":"kimi","kimi code":"kimi",kiro:"kiro","kiro-cli":"kiro",droid:"droid",amp:"amp","amp-local":"amp",grok:"grok","grok-build":"grok",hermes:"hermes","hermes-agent":"hermes",kilo:"kilo","kilo-code":"kilo","kilo code":"kilo",qodercli:"qodercli",qoderclicn:"qodercli",qoder:"qodercli",qodercn:"qodercli",qwen:"qwen","qwen-code":"qwen","qwen code":"qwen",letta:"letta","letta-code":"letta","letta code":"letta",maki:"maki",muse:"muse","muse-code":"muse","muse-cli":"muse",shell:"shell"};function Ex(l){return l&&l.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function Pp(l){const i=Ex(l);return Vp[i]?Vp[i]:/^muse-bin-\d/.test(i)?"muse":null}function Nx(l,i="auto"){return i&&i!=="auto"?Pp(i)||"shell":Pp(l)||"shell"}const kx=[H("genericCtrlC","interrupt","ctrl+c"),H("genericCtrlD","eof","ctrl+d"),H("genericCtrlZ","suspend","ctrl+z"),H("genericCtrlL","clear","ctrl+l"),H("genericCtrlR","history","ctrl+r"),H("genericCtrlA","startOfLine","ctrl+a"),H("genericCtrlE","endOfLine","ctrl+e"),H("genericCtrlK","killToEnd","ctrl+k")],Lx=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],Rx=["genericCtrlC"];function _x(l,i){var r,u;const a=l.map(h=>{var g;const p=(g=i==null?void 0:i.actions)==null?void 0:g[h.id];let m=typeof(p==null?void 0:p.keys)=="string"?p.keys:h.combo;try{xn(m)}catch{m=h.combo}return{...h,defaultCombo:h.combo,combo:m,hidden:typeof(p==null?void 0:p.hidden)=="boolean"?p.hidden:h.defaultHidden===!0,custom:!1}}),o=new Set(a.map(h=>h.id));for(const h of(i==null?void 0:i.custom)||[]){if(!h||typeof h.id!="string"||o.has(h.id))continue;const p=h.keys;try{xn(p)}catch{continue}a.push({id:h.id,labelKey:"custom",defaultCombo:p,combo:p,verified:!0,hidden:((u=(r=i==null?void 0:i.actions)==null?void 0:r[h.id])==null?void 0:u.hidden)===!0,custom:!0,customLabel:h.label}),o.add(h.id)}if(Array.isArray(i==null?void 0:i.order)){const h=new Map(i.order.map((p,m)=>[p,m]));a.sort((p,m)=>(h.get(p.id)??Number.MAX_SAFE_INTEGER)-(h.get(m.id)??Number.MAX_SAFE_INTEGER))}return a}function jx(l,i){const a=new Set(l.map(o=>o.combo.trim().toLowerCase()));return i.filter(o=>!a.has(o.combo.trim().toLowerCase()))}const as=l=>l.id.startsWith("generic");function hb(l,i){const a=Ji[l],o=new Set([...a.bar||[],...l==="shell"?Lx:Rx]),r=[...a.actions,...kx].map(u=>({...u,defaultHidden:!o.has(u.id)}));return _x(r,i)}function mb(l,i){const a=hb(l,i),o=a.filter(u=>!as(u)),r=new Set(jx(o,a.filter(as)));return a.filter(u=>!as(u)||r.has(u))}function Ox(l,i){const a=mb(l,i).filter(o=>!o.hidden);return{agentActions:a.filter(o=>!as(o)),genericActions:a.filter(as)}}function Dx(l){const i={};for(const[a,o]of Object.entries(l.actions||{})){const r={...o};delete r.hidden,Object.keys(r).length>0&&(i[a]=r)}return{...l,actions:i}}function pb(l){if(!l||typeof l!="object"||Array.isArray(l))return{};const i=Object.create(null);for(const[a,o]of Object.entries(l).slice(0,32)){if(!/^[a-z][a-z0-9_-]{0,31}$/i.test(a)||["__proto__","constructor","prototype"].includes(a)||!o||typeof o!="object"||Array.isArray(o))continue;const r=o,u={};if(Array.isArray(r.order)&&(u.order=[...new Set(r.order.filter(h=>typeof h=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(h)))].slice(0,256)),r.actions&&typeof r.actions=="object"&&!Array.isArray(r.actions)){const h=Object.create(null);for(const[p,m]of Object.entries(r.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(p)||!m||typeof m!="object"||Array.isArray(m))continue;const g=m,b={};if(typeof g.keys=="string"&&g.keys.trim()){const v=g.keys.trim().slice(0,80);try{xn(v),b.keys=v}catch{}}typeof g.hidden=="boolean"&&(b.hidden=g.hidden),Object.keys(b).length>0&&(h[p]=b)}u.actions=h}if(Array.isArray(r.custom)){const h=new Set;u.custom=r.custom.slice(0,64).flatMap(p=>{if(!p||typeof p!="object"||Array.isArray(p))return[];const m=p;if(typeof m.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(m.id)||["__proto__","constructor","prototype"].includes(m.id)||h.has(m.id))return[];if(typeof m.label!="string"||!m.label.trim()||typeof m.keys!="string"||!m.keys.trim())return[];const g=m.keys.trim().slice(0,80);try{xn(g)}catch{return[]}return h.add(m.id),[{id:m.id,label:m.label.trim().slice(0,64),keys:g}]})}i[a]=u}return i}const zx=10,Hx=24,ss=15,nr=13,Cd=640;function Bx(){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 Zl()<Cd}function Zl(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function ed(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function Wl(l,i=ss){const a=typeof l=="number"?l:Number(l);return!Number.isFinite(a)||a<=0?i:Math.min(Hx,Math.max(zx,Math.round(a)))}function Xp(l,i=Zl()){if(i<Cd){const o=Wl(l,nr);return Math.min(15,Math.max(12,o))}return Wl(l,ss)}const Qp="#11111b",Ux=['"Symbols Nerd Font Mono"','"Sarasa Mono SC"','"Noto Sans Mono CJK SC"','"Noto Sans Mono CJK TC"','"Microsoft YaHei Mono"','"PingFang SC"',"monospace"],ir=["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"'],td=[{id:"host",name:"Host terminal font",faces:[]},{id:"system",name:"System monospace",faces:ir},{id:"jetbrains-mono",name:"JetBrains Mono",faces:['"JetBrains Mono"','"Herdr JetBrains Mono"']},{id:"fira-code",name:"Fira Code",faces:['"Fira Code"','"Herdr Fira Code"']},{id:"cascadia-code",name:"Cascadia Code",faces:['"Cascadia Code"','"Herdr Cascadia Code"']},{id:"source-code-pro",name:"Source Code Pro",faces:['"Source Code Pro"','"Herdr Source Code Pro"']},{id:"ibm-plex-mono",name:"IBM Plex Mono",faces:['"IBM Plex Mono"','"Herdr IBM Plex Mono"']}],gb="host",Kx='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',Ix='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',Fx="JetBrains Mono, Menlo, Monaco, Consolas, monospace",Gx={[Kx]:"host",[Ix]:"host",[Fx]:"host",'SFMono-Regular, Menlo, Monaco, "Symbols Nerd Font Mono", monospace':"system",'Consolas, "Lucida Console", "Symbols Nerd Font Mono", monospace':"system",'"Liberation Mono", "DejaVu Sans Mono", "Symbols Nerd Font Mono", monospace':"system",'"Courier New", Courier, "Symbols Nerd Font Mono", monospace':"system",'"Fira Code", "Symbols Nerd Font Mono", monospace':"fira-code"};function Ou(l){return typeof l!="string"||!l.trim()?gb:Gx[l]??l}const Yx=[[/^jetbrains\s*mono/i,'"Herdr JetBrains Mono"'],[/^fira\s*code/i,'"Herdr Fira Code"'],[/^(cascadia\s*(code|mono)|caskaydia\s*(cove|mono))/i,'"Herdr Cascadia Code"'],[/^(source\s*code\s*pro|sauce\s*code\s*pro)/i,'"Herdr Source Code Pro"'],[/^(ibm\s*plex\s*mono|blex\s*mono)/i,'"Herdr IBM Plex Mono"']];function $x(l){const i=Yx.find(([a])=>a.test(l.trim()));return i?i[1]:null}function es(l){return`"${l.replace(/["\\]/g,"")}"`}function nd(l){return[...new Set([...l,...Ux])].join(", ")}const qx=nd(ir);function Vx(l,i){const a=typeof l=="string"?l.trim():"";if(!a||a==="host"){if(!(i!=null&&i.family))return qx;const u=[],h=i.glyphs;(h==null?void 0:h.scope)==="all"&&h.alias&&u.push(es(h.alias)),i.alias&&u.push(es(i.alias)),u.push(es(i.family));const p=$x(i.family);return p&&u.push(p),(h==null?void 0:h.scope)==="cjk"&&(h.alias&&u.push(es(h.alias)),u.push(es(h.family))),nd([...u,...ir])}const o=td.find(u=>u.id===a);if(o)return nd([...o.faces,...ir]);if(a.includes("Symbols Nerd Font"))return a;if(/^['"]?monospace['"]?$/i.test(a))return'"Symbols Nerd Font Mono", monospace';const r=/,\s*['"]?monospace['"]?\s*$/i;return r.test(a)?a.replace(r,', "Symbols Nerd Font Mono", monospace'):`${a}, "Symbols Nerd Font Mono", monospace`}function Px(l){if(!l)return null;const i={};return l.background&&(i.background=l.background,i.cursorAccent=l.background),l.foreground&&(i.foreground=l.foreground),l.cursor&&(i.cursor=l.cursor),l.ansi&&Object.assign(i,l.ansi),Object.keys(i).length===0?null:i}function bb(){if(typeof document>"u")return;const l=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",l==null||l.setAttribute("content",Qp),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=Qp}const pt={settings:"herdr_remote_settings_v1",sessionView:"herdr_remote_session_view_v1",ignoredUpdate:"herdr_remote_ignored_update_v1",hostFontConsent:"herdr_remote_host_font_consent_v1",rendererProbe:"herdr_remote_renderer_probe_v3"},id={local:{},session:{}};function Mi(l,i){if(typeof window>"u")return id[l][i]||null;try{return(l==="local"?window.localStorage:window.sessionStorage).getItem(i)}catch{return id[l][i]||null}}function wn(l,i,a){if(id[l][i]=a,!(typeof window>"u"))try{(l==="local"?window.localStorage:window.sessionStorage).setItem(i,a)}catch(o){console.warn(`Failed to write to ${l}Storage:`,o)}}const Zp=["啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆","榜膀绑棒磅蚌镑傍谤苞胞包褒剥薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁","便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍","舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称","城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤","垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮怠耽担丹单郸掸胆旦氮","但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟","蝶迭谍叠丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅","俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿","愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感","秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤","姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍","旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖弧虎唬护互沪","户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸","击圾基机畸稽积箕肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰","奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节","桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎","就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤","靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊","辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐痢立","粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫","馏留刘瘤流柳六龙聋咙笼窿隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落","洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥","米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜","纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕","呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬篇偏片","骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣","讫掐恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷","秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉","柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢","捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓","逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕","朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔獭挞蹋踏胎苔抬台","泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳","贴铁帖厅听烃汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完","碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬","屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔","舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣","辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡","殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶摇尧遥窑","谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音","阴姻吟银淫寅饮尹引隐印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔","隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载","再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐","账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨","纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑住注祝驻抓爪拽专砖转撰赚篆桩","庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"," 、。〃〄々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〡〢〣〤〥〦〧〨〩〪〭〮〯〫〬〰〱〲〳〴〵〶〷〸〹〺〻〼〽〾〿!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¬ ̄¦¥₩"].join(""),Du=256*1024,Xx=2,Qx={regular:{weight:"400",style:"normal"},bold:{weight:"700",style:"normal"},italic:{weight:"400",style:"italic"},boldItalic:{weight:"700",style:"italic"}};function Qi(l){return l?[l.family,...l.faces.map(i=>i.sha256),...(l.subsets||[]).map(i=>i.sha256)].join("|"):null}function Wp(l){const i=l==null?void 0:l.faces.find(a=>a.style==="regular");return i?`Herdr Host ${i.sha256.slice(0,12)}`:null}function Jp(l){return l?l.faces.reduce((i,a)=>i+a.bytes,0):0}function zu(l){return l>=1024*1024?`${(l/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(l/1024))} KB`}function Zx(l){if(typeof document>"u")return!1;let i=null;try{i=document.createElement("canvas").getContext("2d")}catch{return!1}if(!i)return!1;const a="mmmmmmmmmmlli10OQ@#WWww";for(const o of["serif","sans-serif"]){i.font=`72px ${o}`;const r=i.measureText(a).width;if(i.font=`72px "${l}", ${o}`,i.measureText(a).width!==r)return!0}return!1}const Wx="herdr-remote-fonts",Jl="faces",ea="subsets",yb=new Map,ld=new Map;function cr(){return new Promise(l=>{if(typeof indexedDB>"u"){l(null);return}try{const i=indexedDB.open(Wx,2);i.onupgradeneeded=()=>{i.result.objectStoreNames.contains(Jl)||i.result.createObjectStore(Jl),i.result.objectStoreNames.contains(ea)||i.result.createObjectStore(ea)},i.onsuccess=()=>l(i.result),i.onerror=()=>l(null),i.onblocked=()=>l(null)}catch{l(null)}})}async function Jx(l){const i=yb.get(l);if(i)return i;const a=await cr();return a?new Promise(o=>{try{const r=a.transaction(Jl,"readonly").objectStore(Jl).get(l);r.onsuccess=()=>{const u=r.result;o(u instanceof ArrayBuffer?u:null)},r.onerror=()=>o(null)}catch{o(null)}finally{a.close()}}):null}async function ew(l,i){yb.set(l,i);const a=await cr();a&&await new Promise(o=>{try{const r=a.transaction(Jl,"readwrite");r.objectStore(Jl).put(i,l),r.oncomplete=()=>o(),r.onerror=()=>o(),r.onabort=()=>o()}catch{o()}finally{a.close()}})}async function tw(l){const i=await cr();return i?new Promise(a=>{try{const o=IDBKeyRange.bound(`${l}:`,`${l}:￿`),r=i.transaction(ea,"readonly").objectStore(ea).getAll(o);r.onsuccess=()=>{const u=Array.isArray(r.result)?r.result:[];a(u.filter(h=>h&&h.data instanceof ArrayBuffer&&Array.isArray(h.codepoints)))},r.onerror=()=>a([])}catch{a([])}finally{i.close()}}):ld.get(l)??[]}async function nw(l,i){ld.set(l,[...ld.get(l)??[],i]);const a=await cr();a&&await new Promise(o=>{try{const r=a.transaction(ea,"readwrite");r.objectStore(ea).put(i,`${l}:${i.subsetSha}`),r.oncomplete=()=>o(),r.onerror=()=>o(),r.onabort=()=>o()}catch{o()}finally{a.close()}})}function Hu(l){return l?`Herdr Glyphs ${l.sha256.slice(0,12)}`:null}function iw(l){return l>=11904&&l<=12255||l>=12288&&l<=13311||l>=13312&&l<=19903||l>=19968&&l<=40959||l>=44032&&l<=55215||l>=63744&&l<=64255||l>=65072&&l<=65103||l>=65280&&l<=65519||l>=131072&&l<=201551}function vb(l,i){return i<32||i>=127&&i<160||i>=9472&&i<=9631?!1:l==="all"||iw(i)}function lw(l){const i=[...new Set(l)].sort((o,r)=>o-r),a=[];for(let o=0;o<i.length;o+=1){const r=i[o];let u=r;for(;o+1<i.length&&i[o+1]===u+1;)u=i[o+1],o+=1;const h=p=>p.toString(16).toUpperCase();a.push(r===u?`U+${h(r)}`:`U+${h(r)}-${h(u)}`)}return a.join(", ")}async function aw(l,i){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const a=new FontFace(l,i.data,{weight:"400",style:"normal",unicodeRange:lw(i.codepoints)});document.fonts.add(await a.load())}const ad=new Set;function sw(l){return!!(l&&ad.has(l))}async function ow(l,i){if(ad.has(l))return;if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const a=await Promise.all(i.map(({face:o,data:r})=>new FontFace(l,r,Qx[o.style]).load()));for(const o of a)document.fonts.add(o);ad.add(l)}function eg(l){const i=atob(l),a=new Uint8Array(i.length);for(let o=0;o<i.length;o+=1)a[o]=i.charCodeAt(o);return a}async function xb(l,i,a){const o=Math.ceil(l.bytes/Du),r=new Uint8Array(l.bytes);let u=0;const h=async()=>{for(;u<o;){const p=u;u+=1;const m=await i(l.sha256,p),g=p*Du,b=Math.min(Du,l.bytes-g);if(m.length!==b)throw new Error("host_font_corrupt");r.set(m,g),a(m.length)}};return await Promise.all(Array.from({length:Math.min(Xx,o)},h)),r.buffer}function wb(){try{const l=JSON.parse(Mi("local",pt.hostFontConsent)||"{}");return l&&typeof l=="object"&&!Array.isArray(l)?l:{}}catch{return{}}}function tg(l,i){const a=wb()[l];return a&&a.fingerprint===i?a.decision:null}function ng(l,i,a){const o=wb();o[l]={fingerprint:i,decision:a},wn("local",pt.hostFontConsent,JSON.stringify(o))}const Sb={source:null,status:"none",alias:null,covered:0},Bu={font:null,status:"none",alias:null,receivedBytes:0,totalBytes:0,error:null,glyphs:Sb,interactive:!1,glyphRevision:0},rw=String.fromCodePoint(...Array.from({length:95},(l,i)=>32+i),...Array.from({length:96},(l,i)=>160+i),...Array.from({length:112},(l,i)=>8192+i));function ig(l){const i=(l==null?void 0:l.subsets)??[];return i.find(a=>a.scope==="all")??i.find(a=>a.scope==="cjk")??null}function cw(l,i){const a=new Set;for(const o of l){const r=o.codePointAt(0);vb(i,r)&&a.add(r)}return[...a]}const lg=3e4;function uw(l){const i=C.useRef(new Map),a=C.useRef(new Map),o=C.useRef(new Map),r=C.useCallback(p=>{for(const m of[i.current,a.current]){for(const g of m.values())clearTimeout(g.timer),g.reject(new Error(p));m.clear()}},[]),u=C.useCallback((p,m)=>new Promise((g,b)=>{if(!l){b(new Error("disconnected"));return}const v=`${p}:${m}`,w=setTimeout(()=>{i.current.delete(v),b(new Error("host_font_timeout"))},lg);i.current.set(v,{resolve:g,reject:b,timer:w}),l.sendHostFontChunkRequest(p,m)}),[l]),h=C.useCallback((p,m,g)=>new Promise((b,v)=>{if(!l){v(new Error("disconnected"));return}const w=Math.random().toString(36).slice(2,12),x=setTimeout(()=>{a.current.delete(w),v(new Error("host_font_timeout"))},lg);a.current.set(w,{resolve:T=>b({...T,codepoints:m}),reject:v,timer:x}),o.current.set(w,g),l.sendHostFontSubsetRequest(p.sha256,String.fromCodePoint(...m),w)}),[l]);return C.useEffect(()=>{if(!l)return;const p=i.current,m=a.current,g=l.on("hostFontChunk",x=>{const T=`${x.sha256}:${x.index}`,M=p.get(T);if(M){p.delete(T),clearTimeout(M.timer);try{M.resolve(eg(x.dataBase64))}catch{M.reject(new Error("host_font_corrupt"))}}}),b=l.on("hostFontSubset",x=>{const T=m.get(x.requestId);if(!T)return;m.delete(x.requestId),clearTimeout(T.timer);const M=o.current.get(x.requestId)??(()=>{});if(o.current.delete(x.requestId),x.dataBase64!==void 0){try{const R=eg(x.dataBase64);M(R.length,R.length),T.resolve({subsetSha:x.subsetSha,data:R.buffer,codepoints:[]})}catch{T.reject(new Error("host_font_corrupt"))}return}M(0,x.bytes);const A={bytes:x.bytes,sha256:x.subsetSha};xb(A,u,R=>M(R,x.bytes)).then(R=>T.resolve({subsetSha:x.subsetSha,data:R,codepoints:[]})).catch(R=>T.reject(R instanceof Error?R:new Error("host_font_failed")))}),v=l.on("error",x=>{(x.code==="host_font_unavailable"||x.code==="host_font_subset_failed")&&r(String(x.code))}),w=l.on("stateChange",x=>{x!=="connected"&&r("disconnected")});return()=>{g(),b(),v(),w(),r("disconnected")}},[l,r,u]),{requestChunk:u,requestSubset:h,rejectPending:r}}const dw=15e3,fw=80,hw=2e3;function mw(l,i={}){const[a,o]=C.useState(Bu),r=C.useRef(a);r.current=a;const u=C.useRef(i);u.current=i;const h=C.useRef(0),p=C.useRef(0),m=C.useRef(new Set),g=C.useRef(new Set),b=C.useRef(new Set),v=C.useRef(null),{requestChunk:w,requestSubset:x,rejectPending:T}=uw(l),M=C.useCallback(()=>({isInstalled:u.current.isInstalled??Zx,readCached:u.current.readCached??Jx,writeCached:u.current.writeCached??ew,register:u.current.register??ow,isRegistered:u.current.isRegistered??sw,readSubsets:u.current.readSubsets??tw,writeSubset:u.current.writeSubset??nw,registerGlyphs:u.current.registerGlyphs??aw}),[]),A=C.useCallback(()=>(l==null?void 0:l.getHostId())||"default",[l]),R=C.useCallback((K,J)=>{K===h.current&&o(V=>({...V,glyphs:{...V.glyphs,...J}}))},[]),k=C.useCallback(async(K,J,V)=>{const{registerGlyphs:X}=M();for(const ie of V){if(await X(J,ie),K!==h.current)return;for(const ue of ie.codepoints)m.current.add(ue)}K!==h.current||!V.length||o(ie=>({...ie,glyphs:{...ie.glyphs,alias:J,covered:m.current.size},glyphRevision:ie.glyphRevision+1}))},[M]),O=C.useCallback(async(K,J,V)=>{const X=Hu(J),ie=J.scope==="all"?rw+Zp:Zp,ue=cw(ie,J.scope).filter(E=>!m.current.has(E));if(!ue.length)return;for(const E of ue)g.current.add(E);const U=await x(J,ue,V);K===h.current&&(await M().writeSubset(J.sha256,U),await k(K,X,[U]))},[x,M,k]),$=C.useCallback(async(K,{interactive:J=!0}={})=>{const V=K??r.current.font,X=Qi(V);if(!V||!X)return;const ie=r.current,ue=Qi(ie.font)===X;if(ue&&(ie.status==="loading"||ie.glyphs.status==="loading"))return;const U=h.current,{isInstalled:E,isRegistered:G,readCached:P,writeCached:le,register:Q}=M();ng(A(),X,"accepted");const xe=Wp(V),ye=ig(V),ve=!!(xe&&!G(xe)&&!E(V.family)),me=ue?ie.glyphs:{...Sb,source:ye},de=!!(ye&&!["installed","ready","none"].includes(me.status));let we=ve?Jp(V):0,se=0;const Se=()=>{U===h.current&&o(ae=>({...ae,receivedBytes:se,totalBytes:we}))};if(o(ae=>({...ae,font:V,interactive:J,receivedBytes:0,totalBytes:we,error:null,status:ve?"loading":ae.status,glyphs:de?{...me,status:"loading"}:me})),ve&&xe)try{const ae=[];for(const pe of V.faces){let Ee=await P(pe.sha256);if(Ee?(se+=pe.bytes,Se()):(Ee=await xb(pe,w,Be=>{se+=Be,Se()}),await le(pe.sha256,Ee)),U!==h.current)return;ae.push({face:pe,data:Ee})}if(await Q(xe,ae),U!==h.current)return;o(pe=>({...pe,status:"loaded",alias:xe}))}catch(ae){if(U!==h.current)return;const pe=ae instanceof Error&&ae.message?ae.message:"host_font_failed";o(Ee=>({...Ee,status:"failed",alias:null,error:pe}))}if(de&&ye){let ae=0;try{await O(U,ye,(pe,Ee)=>{Ee&&!ae&&(ae=Ee,we+=Ee),se+=pe,Se()}),R(U,{status:"ready"})}catch(pe){if(U!==h.current)return;const Ee=pe instanceof Error&&pe.message?pe.message:"host_font_failed";o(Be=>({...Be,error:Be.error??Ee,glyphs:{...Be.glyphs,status:"failed"}}))}}},[w,O,M,A,R]),_=C.useCallback(async K=>{const J=Qi(K)!==Qi(r.current.font);J&&(T("superseded"),m.current=new Set,g.current=new Set,b.current=new Set);const V=++h.current;if(!K){o(Bu);return}const{isInstalled:X,readCached:ie,register:ue,isRegistered:U,readSubsets:E}=M(),G=Wp(K),P=Qi(K),le=ig(K);let Q="checking";G&&U(G)?Q="loaded":X(K.family)?Q="installed":G||(Q="unavailable");let xe="checking";if(le?(le.scope==="cjk"?X(le.family):Q==="installed")&&(xe="installed"):xe="none",o(de=>({...Bu,font:K,status:Q==="checking"?"checking":Q,alias:Q==="loaded"?G:null,totalBytes:Jp(K),glyphs:{source:le,status:xe,alias:J?null:de.glyphs.alias,covered:m.current.size},glyphRevision:de.glyphRevision})),Q==="checking"&&G){const de=await Promise.all(K.faces.map(we=>ie(we.sha256)));if(V!==h.current)return;if(Q="needs",de.every(Boolean))try{if(await ue(G,K.faces.map((we,se)=>({face:we,data:de[se]}))),V!==h.current)return;Q="loaded",o(we=>({...we,status:"loaded",alias:G}))}catch{}}if(xe==="checking"&&le){const de=await E(le.sha256);if(V!==h.current)return;if(de.length)try{await k(V,Hu(le),de),xe="cached"}catch{xe="needs"}else xe="needs";if(V!==h.current)return}const ye=tg(A(),P),ve=ye==="accepted"||xe==="cached"||Date.now()<p.current;if(xe==="cached"&&(xe="ready",R(V,{status:"ready"}),O(V,le,()=>{}).catch(()=>{})),Q!=="needs"&&xe!=="needs")return;if(ve){$(K,{interactive:!1});return}const me=ye==="declined"?"declined":"available";o(de=>({...de,status:Q==="needs"?me:de.status,glyphs:xe==="needs"?{...de.glyphs,status:me}:de.glyphs}))},[$,T,A,R,O,M,k]),z=C.useCallback(()=>{const K=Qi(r.current.font);K&&ng(A(),K,"declined"),o(J=>({...J,interactive:!1,status:["available","failed"].includes(J.status)?"declined":J.status,glyphs:["available","failed"].includes(J.glyphs.status)?{...J.glyphs,status:"declined"}:J.glyphs}))},[A]),L=C.useCallback(()=>{p.current=Date.now()+dw,l==null||l.sendHostFontRefresh();const K=r.current,J=["available","declined","failed"];K.font&&(J.includes(K.status)||J.includes(K.glyphs.status))&&$(K.font,{interactive:!1})},[l,$]),D=C.useCallback(K=>{const{glyphs:J}=r.current;if(J.status!=="ready"||!J.source)return;const V=J.source;for(const X of K){const ie=X.codePointAt(0);ie<128&&V.scope!=="all"||vb(V.scope,ie)&&(m.current.has(ie)||g.current.has(ie)||b.current.add(ie))}!b.current.size||v.current||(v.current=setTimeout(()=>{v.current=null;const X=h.current,ie=[...b.current].slice(0,hw);for(const ue of ie)b.current.delete(ue),g.current.add(ue);(async()=>{const ue=await x(V,ie,()=>{});X===h.current&&(await M().writeSubset(V.sha256,ue),await k(X,Hu(V),[ue]))})().catch(()=>{})},fw))},[x,M,k]);return C.useEffect(()=>{if(!l)return;const K=l.on("terminalFont",J=>{_(J)});return()=>{K(),v.current&&clearTimeout(v.current),v.current=null}},[l,_]),C.useEffect(()=>{const K=J=>{if(J.key!==pt.hostFontConsent)return;const V=r.current,X=Qi(V.font),ie=V.status==="available"||V.glyphs.status==="available";if(!X||!ie)return;const ue=tg(A(),X);ue==="accepted"?$(V.font,{interactive:!1}):ue==="declined"&&z()};return window.addEventListener("storage",K),()=>window.removeEventListener("storage",K)},[$,z,A]),{hostFont:a,loadHostFont:$,declineHostFont:z,syncHostFont:L,ensureHostGlyphs:D}}function pw(l,i=window,a=document){const o=g=>{var b;((b=i.navigator)==null?void 0:b.onLine)!==!1&&l.wake(g)},r=()=>{a.visibilityState==="visible"&&o("visible")},u=()=>o("pageshow"),h=()=>o("online"),p=()=>o("focus"),m=()=>o("resume");return a.addEventListener("visibilitychange",r),a.addEventListener("resume",m),i.addEventListener("pageshow",u),i.addEventListener("online",h),i.addEventListener("focus",p),()=>{a.removeEventListener("visibilitychange",r),a.removeEventListener("resume",m),i.removeEventListener("pageshow",u),i.removeEventListener("online",h),i.removeEventListener("focus",p)}}function zo(l){return{wsUrl:l.wsUrl,token:l.token||void 0,pairCode:l.pairCode||void 0,clientId:l.clientId,autoReconnect:l.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}const gw={connectionState:"disconnected",role:"viewer",hostPalette:null,rttMs:null,sharedWindowCount:1,terminalResetVersion:0,agentStatus:null,lastPairedAt:null},ag={role:"viewer",controllerId:void 0,hostname:void 0,hostPalette:null,rttMs:null,sharedWindowCount:1};function bw(l,i){switch(i.type){case"stateChange":return{...l,connectionState:i.state,stateCode:i.code,stateDetail:i.detail,agentStatus:i.state==="connected"?l.agentStatus:null};case"ready":{const{message:a}=i;return{...l,terminalResetVersion:l.terminalResetVersion+(i.resetTerminal?1:0),role:a.role,controllerId:a.controllerId,hostId:a.hostId,hostname:a.hostname,assignedClientId:a.clientId||l.assignedClientId,hostPalette:a.terminalPalette||null}}case"hostReconnecting":return{...l,...ag,stateCode:i.code,stateDetail:i.detail};case"sessionRestarted":return{...l,hostname:i.hostname,hostPalette:i.palette||null,terminalResetVersion:l.terminalResetVersion+1};case"roleChange":return{...l,role:i.role,controllerId:i.controllerId,hostId:i.hostId||l.hostId,assignedClientId:i.assignedClientId||l.assignedClientId};case"controlGranted":return{...l,role:"controller"};case"paired":return{...l,lastPairedAt:i.at};case"rtt":return{...l,rttMs:i.rttMs};case"peerCount":return{...l,sharedWindowCount:Math.max(1,i.count)};case"sessionReady":return{...l,connectionState:"connected"};case"agentStatus":return{...l,agentStatus:i.status};case"reset":return{...l,...ag,hostId:void 0,assignedClientId:void 0,terminalResetVersion:l.terminalResetVersion+(i.resetTerminal?1:0)}}}const yw=3e4;function vw(l,i){const[a,o]=C.useState(null),r=C.useRef(null),u=C.useRef(null),h=C.useCallback(b=>{(b==null?void 0:b.phase)!=="starting"&&u.current&&(clearTimeout(u.current),u.current=null),r.current=b,o(b)},[]),p=C.useCallback(()=>{const b=l.current;b&&(h({phase:"starting"}),b.sendHerdrStart(),u.current=setTimeout(()=>{var v;u.current=null,((v=r.current)==null?void 0:v.phase)==="starting"&&h({phase:"failed",message:i.current("herdrLaunch.timeout")})},yw))},[l,i,h]),m=C.useCallback(b=>{var v;return b.code==="herdr_not_running"?(((v=r.current)==null?void 0:v.phase)!=="starting"&&h({phase:"stopped"}),!0):b.code==="herdr_start_failed"&&r.current?(h({phase:"failed",message:b.message||""}),!0):!1},[h]),g=C.useCallback(()=>h(null),[h]);return C.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]),{herdrLaunch:a,startHerdr:p,handleLaunchError:m,forgetHerdrLaunch:g}}class xw{constructor(){W(this,"listeners",{stateChange:new Set,roleChange:new Set,ready:new Set,paired:new Set,controlState:new Set,sessionReady:new Set,exit:new Set,controlGranted:new Set,peerCount:new Set,hostReconnecting:new Set,sessionRestarted:new Set,error:new Set,binaryData:new Set,rttUpdate:new Set,pasteFileReady:new Set,agentStatus:new Set,updateStatus:new Set,terminalFont:new Set,hostFontChunk:new Set,hostFontSubset:new Set})}on(i,a){return this.listeners[i].add(a),()=>{this.listeners[i].delete(a)}}emit(i,...a){this.listeners[i].forEach(r=>{try{r(...a)}catch(u){console.error(`Error in event listener for ${i}:`,u)}})}}const Cb=27,Tb=91,ww=60,sg=59,Mb=77,Ab=48,Sw=57,Cw=64,Tw=-30,Uu=32,og=255;function Eb(l){return Number.isInteger(l)&&(l&Tw)===Cw}function Mw(l){return l>=Ab&&l<=Sw}function Ku(l,i){let a=i,o=0;for(;a<l.length&&Mw(l[a]);){if(o=o*10+(l[a]-Ab),o>65535)return null;a+=1}return a===i?null:{value:o,next:a}}function Aw(l,i){if(l[i]!==Cb||l[i+1]!==Tb||l[i+2]!==ww)return-1;const a=Ku(l,i+3);if(!a||!Eb(a.value)||l[a.next]!==sg)return-1;const o=Ku(l,a.next+1);if(!o||l[o.next]!==sg)return-1;const r=Ku(l,o.next+1);return!r||l[r.next]!==Mb?-1:r.next+1}function Ew(l,i){if(l[i]!==Cb||l[i+1]!==Tb||l[i+2]!==Mb||i+6>l.length)return-1;const a=l[i+3]-Uu,o=l[i+4],r=l[i+5];return!Eb(a)||o<Uu||o>og||r<Uu||r>og?-1:i+6}function lr(l){if(!l)return!1;const i=l instanceof Uint8Array?l:new Uint8Array(l);if(i.length===0)return!1;let a=0;for(;a<i.length;){const o=Aw(i,a);if(o>a){a=o;continue}const r=Ew(i,a);if(r>a){a=r;continue}return!1}return!0}class Nw{constructor(i){W(this,"segments",[]);W(this,"flushScheduled",!1);this.getSocket=i}push(i){const a=i instanceof Uint8Array?i:new Uint8Array(i);a.length!==0&&(this.segments.push(a),this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flush())))}flush(){if(this.flushScheduled=!1,this.segments.length===0)return;let i=this.segments;this.segments=[];const a=this.getSocket();if(a&&(a.bufferedAmount??0)>256*1024&&(i=i.filter(r=>!lr(r))),i.length===0)return;let o;if(i.length===1)o=i[0];else{let r=0;for(let h=0;h<i.length;h++)r+=i[h].byteLength;o=new Uint8Array(r);let u=0;for(let h=0;h<i.length;h++)o.set(i[h],u),u+=i[h].byteLength}a&&a.readyState===WebSocket.OPEN&&a.send(o)}clear(){this.segments=[],this.flushScheduled=!1}}const kw=3e3,Lw=1e4,Rw=1500;class _w extends xw{constructor(a){super();W(this,"ws",null);W(this,"config");W(this,"state","disconnected");W(this,"reconnectAttempts",0);W(this,"reconnectTimer",null);W(this,"pingTimer",null);W(this,"pingTimestamp",null);W(this,"lastInboundAt",0);W(this,"pingSentAt",null);W(this,"connectStartedAt",0);W(this,"lastWakeConnectAt",0);W(this,"probeTimer",null);W(this,"rejectedByRelay",!1);W(this,"isManuallyClosed",!1);W(this,"authFailureDetail",null);W(this,"authFailureCode",null);W(this,"temporaryFailureCode",null);W(this,"input",new Nw(()=>this.ws));W(this,"terminalCols",80);W(this,"terminalRows",24);this.config={...a}}updateConfig(a){this.config={...this.config,...a}}getConfig(){return{...this.config}}getState(){return this.state}setState(a,o,r){this.state!==a&&(this.state=a,this.emit("stateChange",a,o,r))}connect(a){if(a&&(this.terminalCols=a.cols,this.terminalRows=a.rows),!(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))){this.teardownSocket(1e3,"Replaced by a new connection"),this.isManuallyClosed=!1,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.rejectedByRelay=!1,this.clearTimers(),this.setState("connecting");try{const o=jw(this.config.wsUrl),r=new WebSocket(o);this.ws=r,this.connectStartedAt=Date.now(),r.binaryType="arraybuffer",r.onopen=()=>{this.isStaleSocket(r)||this.handleOpen()},r.onmessage=u=>{this.isStaleSocket(r)||this.handleMessage(u)},r.onerror=u=>{this.isStaleSocket(r)||this.handleError(u)},r.onclose=u=>{this.isStaleSocket(r)||this.handleClose(u)}}catch(o){this.setState("error",o instanceof Error?o.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(a){return this.ws!==a}teardownSocket(a=1e3,o="Client closed the connection"){this.input.clear();const r=this.ws;if(r){this.ws=null,r.onopen=null,r.onmessage=null,r.onerror=null,r.onclose=null;try{(r.readyState===WebSocket.OPEN||r.readyState===WebSocket.CONNECTING)&&r.close(a,o)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.input.clear(),this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(a){this.updateConfig(a),this.clearTimers(),this.teardownSocket(1e3,"Reconnecting with new credentials"),this.isManuallyClosed=!1,this.reconnectAttempts=0,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.connect()}wake(a){if(this.isManuallyClosed||!this.config.autoReconnect||this.authFailureDetail||this.rejectedByRelay)return;const o=Date.now(),r=this.ws;if(!r){if(o-this.lastWakeConnectAt<Rw)return;this.lastWakeConnectAt=o,this.reconnectAttempts=0,this.connect();return}if(r.readyState===WebSocket.CONNECTING){o-this.connectStartedAt>Lw&&this.dropStaleSocket("connection_stalled");return}r.readyState===WebSocket.OPEN&&o-this.lastInboundAt>this.pingIntervalMs()+2e3&&this.probeLiveness()}pingIntervalMs(){return this.config.pingIntervalMs||1e4}probeLiveness(){const a=this.ws;if(!a||a.readyState!==WebSocket.OPEN||this.probeTimer)return;const o=Date.now();this.sendPing(),this.probeTimer=setTimeout(()=>{this.probeTimer=null,this.ws===a&&this.lastInboundAt<o&&this.dropStaleSocket("connection_stale")},kw)}dropStaleSocket(a){this.clearTimers(),this.teardownSocket(4e3,"Connection went silent"),this.setState("reconnecting","The connection went silent. Reconnecting...",a),this.reconnectAttempts=0,this.lastWakeConnectAt=Date.now(),this.connect()}handleOpen(){this.lastInboundAt=Date.now(),this.sendHello(),this.startHeartbeat()}async handleMessage(a){if(this.lastInboundAt=Date.now(),typeof a.data=="string")try{const o=JSON.parse(a.data);o.type==="pong"?this.handlePong():this.handleServerMessage(o)}catch(o){console.warn("Received unparseable text frame from server:",o)}else if(a.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(a.data));else if(typeof Blob<"u"&&a.data instanceof Blob)try{const o=await a.data.arrayBuffer();this.emit("binaryData",new Uint8Array(o))}catch(o){console.error("Failed to convert Blob to ArrayBuffer:",o)}}handlePong(){if(this.pingTimestamp){const a=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(a))}}handleError(a){console.error("WebSocket error:",a),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(a){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(a.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",a.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(a.code===1008){this.rejectedByRelay=!0,this.setState("error",a.reason||"The relay rejected the connection",String(a.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${a.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${a.reason||a.code}`,"connection_closed")}scheduleReconnect(){if(this.isManuallyClosed||!this.config.autoReconnect)return;if(this.config.maxReconnectAttempts>0&&this.reconnectAttempts>=this.config.maxReconnectAttempts){this.setState("error","Max reconnect attempts reached");return}this.reconnectAttempts++;const a=this.config.reconnectIntervalMs||2e3,r=Math.min(3e4,Math.floor(a*1.5**(this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},r)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const a=this.pingIntervalMs();this.pingSentAt=null,this.pingTimer=setInterval(()=>{if(!(!this.ws||this.ws.readyState!==WebSocket.OPEN)){if(this.pingSentAt!==null&&this.lastInboundAt<this.pingSentAt&&Date.now()-this.pingSentAt>=a){this.probeLiveness();return}this.sendPing()}},a)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=null),this.probeTimer&&(clearTimeout(this.probeTimer),this.probeTimer=null)}sendPing(){this.pingTimestamp=performance.now(),this.pingSentAt=Date.now();const a={type:"ping"};this.sendJson(a)}sendJson(a){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(a))}sendInput(a){this.input.push(a)}flushInput(){this.input.flush()}sendBinary(a){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(a)}sendText(a){const o=Sd(a);this.sendInput(o)}}function jw(l){if(/^wss?:\/\//i.test(l))return l;if(/^https?:\/\//i.test(l)){const i=new URL(l);return i.protocol=i.protocol==="https:"?"wss:":"ws:",(!i.pathname||i.pathname==="/")&&(i.pathname=on),i.toString()}if(typeof window<"u"&&window.location){const a=window.location.protocol==="https:"?"wss:":"ws:",o=window.location.host,r=l.startsWith("/")?l:`/${l}`;return`${a}//${o}${r}`}return"ws://127.0.0.1:8787/ws/client"}class Ow extends _w{constructor(){super(...arguments);W(this,"currentRole","viewer");W(this,"controllerId");W(this,"hostId");W(this,"assignedClientId")}getRole(){return this.currentRole}getControllerId(){return this.controllerId}getHostId(){return this.hostId}getAssignedClientId(){return this.assignedClientId}handleServerMessage(a){switch(a.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=a.role,this.controllerId=a.controllerId,this.hostId=a.hostId,this.assignedClientId=a.clientId,this.emit("ready",a),this.emit("roleChange",a.role,a.controllerId,a.hostId,a.clientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount),this.emit("terminalFont",a.terminalFont??null);break}case"paired":{this.emit("paired",{token:a.token,deviceId:a.deviceId,hostId:a.hostId,expiresAt:a.expiresAt});break}case"control_state":{this.currentRole=a.role,this.controllerId=a.controllerId,this.emit("controlState",a.role,a.controllerId),this.emit("roleChange",a.role,a.controllerId,this.hostId,this.assignedClientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",a.code||"host_reconnecting"),this.emit("hostReconnecting",a.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",a.cols,a.rows,a.terminalPalette,a.hostname),this.emit("terminalFont",a.terminalFont??null);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",a);break}case"exit":{this.emit("exit",a.code,a.reason);break}case"control_granted":{this.currentRole="controller",this.controllerId=this.assignedClientId||this.config.clientId,this.emit("controlGranted"),this.emit("roleChange","controller",this.controllerId,this.hostId,this.assignedClientId);break}case"error":{a.code==="host_offline"||a.code==="host_reconnecting"||a.code==="host_reconnect_timeout"||a.code==="rate_limited"?(this.temporaryFailureCode=String(a.code),this.setState("reconnecting",a.message,String(a.code))):(a.code==="auth_required"||a.code==="unauthorized"||a.code==="device_revoked"||a.code==="invalid_handshake"||a.code==="too_many_hosts"||a.code===401||a.code===403)&&(this.authFailureDetail=a.message,this.authFailureCode=String(a.code),this.setState("error",a.message,this.authFailureCode)),this.emit("error",{code:a.code,message:a.message});break}case"paste_file_ready":{this.emit("pasteFileReady",a.path);break}case"agent_status":{this.emit("agentStatus",a);break}case"update_status":{this.emit("updateStatus",a);break}case"terminal_font":{this.emit("terminalFont",a.terminalFont??null);break}case"host_font_chunk":{this.emit("hostFontChunk",a);break}case"host_font_subset_ready":{this.emit("hostFontSubset",a);break}}}sendHello(){const a={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(a.token=this.config.token),this.config.pairCode&&(a.pairCode=this.config.pairCode),this.sendJson(a)}claimControl(a=!1){const o={type:"claim_control",...a?{force:!0}:{}};this.sendJson(o)}releaseControl(){const a={type:"release_control"};this.sendJson(a)}sendResize(a,o){this.terminalCols=a,this.terminalRows=o;const r={type:"resize",cols:a,rows:o};this.sendJson(r)}sendPasteFile(a,o){this.sendJson({type:"paste_file",mime:a,dataBase64:o})}sendHostFontChunkRequest(a,o){this.sendJson({type:"host_font_chunk_request",sha256:a,index:o})}sendHostFontSubsetRequest(a,o,r){this.sendJson({type:"host_font_subset_request",sha256:a,text:o,requestId:r})}sendHostFontRefresh(){this.sendJson({type:"host_font_refresh"})}sendHerdrStart(){this.sendJson({type:"herdr_start"})}}function Dw(l,i,a){const o=C.useRef(a);if(o.current=a,!l.current){const r=new Ow(i());for(const u of Object.keys(a)){const h=(...p)=>{var m,g;return(g=(m=o.current)[u])==null?void 0:g.call(m,...p)};r.on(u,h)}l.current=r}return l.current}const zw=3*1024*1024,Nb=1568,Hw=[.85,.7,.55,.4],Ho={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function Bw(l,i,a=Nb){if(l<=0||i<=0)return{width:Math.max(1,l),height:Math.max(1,i)};const o=Math.max(l,i);if(o<=a)return{width:l,height:i};const r=a/o;return{width:Math.max(1,Math.round(l*r)),height:Math.max(1,Math.round(i*r))}}function Uw(l){if(typeof l!="string"||l.length===0)return 0;const i=l.length;let a=0;l.endsWith("==")?a=2:l.endsWith("=")&&(a=1);const o=Math.floor(i*3/4)-a;return Number.isFinite(o)&&o>0?o:0}function Kw(l){return l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/(1024*1024)).toFixed(1)} MB`}async function Iw(l){if(typeof createImageBitmap=="function")try{const i=await createImageBitmap(l,{imageOrientation:"from-image"});return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{try{const i=await createImageBitmap(l);return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{}}return new Promise((i,a)=>{if(typeof Image>"u")return a(new Error("Image decoding not supported in this environment"));const o=new Image,r=URL.createObjectURL(l);o.onload=()=>{i({source:o,width:o.naturalWidth||o.width,height:o.naturalHeight||o.height,cleanup:()=>{try{URL.revokeObjectURL(r)}catch{}}})},o.onerror=()=>{try{URL.revokeObjectURL(r)}catch{}a(new Error("Failed to decode image source"))},o.src=r})}async function kb(l,i=Nb,a=zw){var r;if(!l||l.size===0||l.type&&!l.type.startsWith("image/"))return null;let o;try{o=await Iw(l)}catch(u){return console.warn("Failed to decode image for paste:",u),null}try{const{width:u,height:h}=Bw(o.width,o.height,i),p=document.createElement("canvas");p.width=u,p.height=h;const m=p.getContext("2d");if(!m)return null;m.drawImage(o.source,0,0,u,h);let g="image/webp";try{p.toDataURL("image/webp",.85).startsWith("data:image/webp")||(g="image/jpeg")}catch{g="image/jpeg"}for(const b of Hw){let v;try{v=p.toDataURL(g,b)}catch{continue}if(!(v!=null&&v.startsWith("data:")))continue;const w=v.indexOf(","),x=w!==-1?v.slice(w+1):"",T=Uw(x);if(T<=a)return{mime:g,dataBase64:x,dataUrl:v,byteLength:T,width:u,height:h}}return null}finally{(r=o.cleanup)==null||r.call(o)}}const Fw=3e4,Gw=1200;function Yw({adapterRef:l,role:i,connectionState:a,warnViewerMode:o,addToast:r,t:u,sendPasteFile:h}){const[p,m]=C.useState(Ho),g=C.useRef(null),b=C.useRef(0),v=C.useRef(null),w=C.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null)},[]),x=C.useCallback(()=>{w(),g.current=null,m(Ho)},[w]),T=C.useCallback(()=>{g.current!==null&&x()},[x]),M=C.useCallback(()=>{const R=g.current;R!==null&&(w(),m({active:!0,phase:"completed",ratio:1,percent:100,statusText:u("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{g.current===R&&(g.current=null,m(Ho))},Gw))},[w,u]);C.useEffect(()=>{a!=="connected"&&T()},[a,T]),C.useEffect(()=>w,[w]);const A=C.useCallback(async R=>{if(i!=="controller")return o(),!1;if(!l.current||a!=="connected")return r("error",u("serverErrors.host_offline")),!1;if(g.current!==null)return!1;const k=++b.current;g.current=k,w();const O=_=>(_&&r("error",_),g.current=null,m(Ho),!1),$="dataBase64"in R&&typeof R.dataBase64=="string";try{let _;if($)_=R;else{const L=R;if(m({active:!0,phase:"reading",ratio:.1,percent:10,statusText:u("virtualKeyboard.uploadProgressReading")}),!L||L.size===0)return O(u("clipboard.fileEmpty"));if(L.type&&!L.type.startsWith("image/"))return O(u("clipboard.unsupportedType"));m({active:!0,phase:"processing",ratio:.35,percent:35,statusText:u("virtualKeyboard.uploadProgressProcessing")});const D=await kb(L);if(g.current!==k)return!1;if(!D)return O(u("clipboard.imageTooLarge"));_=D,m({active:!0,phase:"processing",ratio:.6,percent:60,statusText:u("virtualKeyboard.uploadProgressProcessing")})}m({active:!0,phase:"sending",ratio:.75,percent:75,statusText:u("virtualKeyboard.uploadProgressSending")});const z=h(_.mime,_.dataBase64);return g.current!==k?!1:z?(m({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:u("virtualKeyboard.uploadProgressWaitingHost")}),v.current=setTimeout(()=>{g.current===k&&O(u("serverErrors.paste_file_write_failed"))},Fw),!0):O()}catch(_){return console.error("Failed to process/upload image:",_),g.current===k&&O(u("clipboard.imageTooLarge")),!1}},[l,i,a,o,r,u,h,w]);return{uploadProgress:p,uploadImage:A,resetUploadProgress:x,abortUpload:T,completeUpload:M}}const $w=4096,qw=8*1024*1024;function Vw(){const l=C.useRef(null),i=C.useRef([]),a=C.useRef(0),o=C.useCallback(m=>{for(i.current.push(m),a.current+=m.byteLength;i.current.length>$w||a.current>qw;){const g=i.current.shift();if(!g)break;a.current-=g.byteLength}},[]),r=C.useCallback(m=>{const g=l.current;if(g)try{g(m);return}catch(b){console.debug("Terminal output sink threw, buffering chunk instead:",b)}o(m)},[o]),u=C.useCallback(m=>{l.current=m;const g=i.current;i.current=[],a.current=0;for(let b=0;b<g.length;b++)try{m(g[b])}catch(v){console.debug("Terminal sink threw while flushing, re-buffering the tail:",v);for(let w=b;w<g.length;w++)o(g[w]);break}return()=>{l.current===m&&(l.current=null)}},[o]),h=C.useCallback(()=>i.current.length,[]),p=C.useCallback(()=>{i.current=[],a.current=0},[]);return{receiveOutput:r,subscribeToOutput:u,getPendingOutputChunkCount:h,clearPendingOutput:p}}const Lb=64,os=4096;function Td(){const l=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${l}`}function Pw(l,i){return(typeof l=="string"?l.trim().slice(0,Lb):"")||i}function ar(l,i){if(!l||typeof l!="object"||Array.isArray(l))return null;const a=l,o=typeof a.wsUrl=="string"?a.wsUrl.trim().slice(0,2048):"",r=typeof a.token=="string"?a.token.slice(0,os):"",u=typeof a.pairCode=="string"?a.pairCode.trim().toUpperCase().slice(0,32):"";if(!o||!o.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(o)||!r&&!u)return null;const h=Date.now(),p=typeof a.id=="string"&&a.id.length>0?a.id.slice(0,128):Td(),m=typeof a.hostname=="string"&&a.hostname.trim()?a.hostname.trim().slice(0,Lb):`Herdr ${i+1}`;return{id:p,displayName:Pw(a.displayName,m),wsUrl:o,token:r,...u?{pairCode:u}:{},...typeof a.hostId=="string"&&a.hostId.trim()?{hostId:a.hostId.trim().slice(0,128)}:{},...typeof a.hostname=="string"&&a.hostname.trim()?{hostname:a.hostname.trim().slice(0,128)}:{},...typeof a.deviceId=="string"&&a.deviceId.trim()?{deviceId:a.deviceId.trim().slice(0,128)}:{},autoReconnect:a.autoReconnect!==!1,createdAt:Number.isFinite(a.createdAt)?Number(a.createdAt):h,lastUsedAt:Number.isFinite(a.lastUsedAt)?Number(a.lastUsedAt):h}}function rg(l,i=0){const a=ar({...l,id:l.id||Td()},i);if(!a)throw new Error("a connection profile requires a relay URL and token or pairing code");return a}function cg(l){let i=l.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const a=new URL(l.wsUrl,window.location.origin);a.protocol=a.protocol==="wss:"?"https:":"http:",a.pathname=a.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",a.search="",a.hash="",i=a.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${i}::${l.hostId||""}`}function Rb(l){var u;const i=[];if((Array.isArray(l.profiles)?l.profiles.slice(0,64):[]).forEach((h,p)=>{const m=ar(h,p);m&&!i.some(g=>g.id===m.id)&&i.push(m)}),i.length===0&&(typeof l.token=="string"&&l.token||typeof l.pairCode=="string"&&l.pairCode)){const h=ar({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof l.wsUrl=="string"&&l.wsUrl.trim()?l.wsUrl:on,token:l.token||"",pairCode:l.pairCode||"",autoReconnect:l.autoReconnect!==!1},0);h&&i.push(h)}const o=typeof l.activeProfileId=="string"?l.activeProfileId:"",r=i.some(h=>h.id===o)?o:((u=i[0])==null?void 0:u.id)||"";return{profiles:i,activeProfileId:r}}const _b=[{id:"esc",label:"ESC",code:oe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:oe.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:oe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:oe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:oe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:oe.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"drawer_symbols",label:"~|/",code:"",type:"drawer",enabled:!0,drawerType:"symbols",title:"Special Symbols"},{id:"drawer_fn",label:"Fn",code:"",type:"drawer",enabled:!0,drawerType:"fn",title:"Function Keys (F1-F12)"},{id:"enter",label:"Enter",code:oe.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],Xw=[{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:oe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:oe.TAB,type:"key",enabled:!0,title:"Tab"},{id:"shift_tab",label:"⇧TAB",code:oe.SHIFT_TAB,type:"key",enabled:!0,title:"Shift+Tab"},{id:"enter",label:"Enter",code:oe.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:oe.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:oe.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:oe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:oe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:oe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:oe.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:oe.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:oe.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:oe.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:oe.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:oe.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:oe.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:oe.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:oe.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:oe.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:oe.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:oe.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:oe.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:oe.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:oe.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:oe.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:oe.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:oe.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:oe.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:oe.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:oe.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:oe.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:oe.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:oe.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:oe.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:oe.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 rs(){return JSON.parse(JSON.stringify(_b))}const Qw=[["esc","tab","shift_tab","ctrl","alt","left","up","down","right","drawer_chords","drawer_symbols","drawer_fn","enter"],["esc","tab","ctrl","alt","left","up","down","right","enter","drawer_chords","drawer_symbols","drawer_fn"],["esc","tab","ctrl","alt","left","up","down","right","drawer_chords","drawer_symbols","drawer_fn","enter"],["esc","tab","ctrl","alt","left","up","down","right","drawer_agent","drawer_symbols","drawer_fn","enter"]];function Zw(l){return Qw.some(i=>l.length===i.length&&l.every((a,o)=>a.id===i[o]&&a.enabled!==!1))}function Ww(l){if(!Array.isArray(l)||l.length===0)return rs();const i=l.filter(a=>typeof a=="object"&&a!==null&&typeof a.id=="string"&&typeof a.label=="string"&&typeof a.code=="string");return Zw(i)?rs():i.filter(a=>a.id!=="drawer_agent")}function sd(l,i){if(i){const a=`keyTitles.${l.id}`,o=i(a);if(o&&o!==a)return o}return l.title||l.label}const ug="herdr-remote.ignoredUpdate";function Jw(){const l=Mi("local",pt.ignoredUpdate);if(l!==null)return l;const i=Mi("local",ug);if(i===null)return null;jb(i);try{window.localStorage.removeItem(ug)}catch{}return i}function jb(l){wn("local",pt.ignoredUpdate,l)}function e1(){return`client-${Math.random().toString(36).substring(2,8)}`}function Ob(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function Db(){const l=typeof window<"u"&&window.innerWidth<640;return{wsUrl:on,token:"",pairCode:"",clientId:e1(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:l?nr:ss,fontSizeFollowsHost:!0,fontFamily:gb,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:Ob(),virtualKeys:rs(),agentKeymaps:{},adminToken:"",adminTokens:{}}}const t1=["wsUrl","token","pairCode","clientId","autoReconnect","language","agentKeymaps"],n1=["wsUrl","token","pairCode","autoReconnect"],Md=["fontSize","fontSizeFollowsHost","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify","adminToken","adminTokens"],i1=Md.filter(l=>l!=="adminToken"&&l!=="adminTokens"),dg=["theme","colorMode"];function od(l){const i=l;if(!dg.some(r=>i[r]!==void 0))return{data:l,changed:!1};const o={...i};for(const r of dg)delete o[r];return{data:o,changed:!0}}function zb(l){if(!l||typeof l!="object"||Array.isArray(l))return{};const i={};for(const[a,o]of Object.entries(l).slice(0,32))typeof o!="string"||o.length===0||(i[a.slice(0,512)]=o.slice(0,os));return i}function Ad(){const l=Db();if(typeof window>"u")return l;let i={};const a=Mi("local",pt.settings);if(a)try{i=JSON.parse(a)}catch(X){console.warn("Failed to parse localStorage settings:",X)}const o=od(i);o.changed&&(i=o.data,wn("local",pt.settings,JSON.stringify(i)));let r=null;const u=Mi("session",pt.sessionView);if(u)try{r=JSON.parse(u)}catch(X){console.warn("Failed to parse sessionStorage settings:",X)}if(!r){const X={};for(const ie of Md)i[ie]!==void 0&&(X[ie]=i[ie]);r=X,wn("session",pt.sessionView,JSON.stringify(r))}const h=Ou(r.fontFamily??i.fontFamily??l.fontFamily),p=window.innerWidth<640?nr:ss,m=r.fontSize??i.fontSize??l.fontSize,g=Wl(m,p),b=r.fontSizeFollowsHost??i.fontSizeFollowsHost,v=typeof b=="boolean"?b:m===void 0||g===ss||g===nr,w=r.virtualKeys??i.virtualKeys??l.virtualKeys,x=Ww(w),T=i.language??l.language,M=T==="zh"||T==="en"?T:Ob(),A=Rb(i),R=A.profiles.find(X=>X.id===A.activeProfileId),k=od(r);k.changed&&(r=k.data,wn("session",pt.sessionView,JSON.stringify(r)));const O=r.toolbarVisible??i.toolbarVisible??l.toolbarVisible,$=r.toolbarPosition??i.toolbarPosition??l.toolbarPosition,_=r.vibrateOnKeyPress??i.vibrateOnKeyPress??l.vibrateOnKeyPress,z=X=>{const ie=r[X]??i[X];return typeof ie=="boolean"?ie:l[X]},L=(r==null?void 0:r.predictiveEcho)??(i==null?void 0:i.predictiveEcho)??l.predictiveEcho,D=L==="always"||L==="off"||L==="auto"?L:"auto",K=typeof r.adminToken=="string"?r.adminToken.slice(0,os):typeof i.adminToken=="string"?i.adminToken.slice(0,os):l.adminToken,J=zb(r.adminTokens),V={...l,...i,...r,wsUrl:(R==null?void 0:R.wsUrl)||(typeof i.wsUrl=="string"?i.wsUrl:l.wsUrl),token:(R==null?void 0:R.token)||"",pairCode:(R==null?void 0:R.pairCode)||"",autoReconnect:(R==null?void 0:R.autoReconnect)??l.autoReconnect,profiles:A.profiles,activeProfileId:A.activeProfileId,clientId:typeof i.clientId=="string"&&i.clientId.trim()?i.clientId.trim().slice(0,128):l.clientId,fontFamily:h,fontSize:g,fontSizeFollowsHost:v,toolbarVisible:O,toolbarPosition:$,vibrateOnKeyPress:_,predictiveEcho:D,virtualKeys:x,agentKeymaps:pb(i.agentKeymaps),agentAlertBadge:z("agentAlertBadge"),agentAlertSound:z("agentAlertSound"),agentAlertVibrate:z("agentAlertVibrate"),agentAlertNotify:z("agentAlertNotify"),language:M,adminToken:K,adminTokens:J};return typeof i.fontFamily=="string"&&Ou(i.fontFamily)!==i.fontFamily&&(i.fontFamily=Ou(i.fontFamily),wn("local",pt.settings,JSON.stringify(i))),V}function vi(l){var w;const a={...Ad(),...l};a.agentKeymaps=pb(a.agentKeymaps),a.adminTokens=zb(a.adminTokens),typeof a.adminToken=="string"&&(a.adminToken=a.adminToken.slice(0,os)),l.fontSize!==void 0&&(a.fontSize=Wl(l.fontSize)),l.predictiveEcho!==void 0&&(l.predictiveEcho==="auto"||l.predictiveEcho==="always"||l.predictiveEcho==="off"?a.predictiveEcho=l.predictiveEcho:a.predictiveEcho="auto");const o=Rb(a);let r=o.profiles,u=o.activeProfileId;if(n1.some(x=>l[x]!==void 0)){const x=r.findIndex(A=>A.id===u),T=x>=0?{...r[x]}:{id:Td(),displayName:`Herdr ${r.length+1}`,wsUrl:a.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};T.wsUrl=a.wsUrl,T.token=a.token,T.pairCode=a.pairCode||void 0,T.autoReconnect=a.autoReconnect,T.lastUsedAt=Date.now();const M=ar(T,Math.max(x,0));M?x>=0?r[x]=M:(r.push(M),u=M.id):x>=0&&(r=r.filter(A=>A.id!==u),u=((w=r[0])==null?void 0:w.id)||"")}r.length>0&&!r.some(x=>x.id===u)&&(u=r[0].id);const p=r.find(x=>x.id===u);a.profiles=r,a.activeProfileId=u,a.wsUrl=(p==null?void 0:p.wsUrl)||a.wsUrl||on,a.token=(p==null?void 0:p.token)||"",a.pairCode=(p==null?void 0:p.pairCode)||"",a.autoReconnect=(p==null?void 0:p.autoReconnect)??a.autoReconnect;const m=Mi("local",pt.settings);let g={};if(m)try{g=JSON.parse(m)}catch{}g=od(g).data;for(const x of t1)a[x]!==void 0&&(g[x]=a[x]);g.profiles=r,g.activeProfileId=u,wn("local",pt.settings,JSON.stringify(g));const b=Mi("session",pt.sessionView);let v={};if(b)try{v=JSON.parse(b)}catch{}for(const x of Md)a[x]!==void 0&&(v[x]=a[x]);wn("session",pt.sessionView,JSON.stringify(v));for(const x of i1)a[x]!==void 0&&(g[x]=a[x]);return wn("local",pt.settings,JSON.stringify(g)),a}function l1(l){const[i,a]=C.useState(Ad),o=C.useRef(i);o.current=i;const r=C.useRef(l);r.current=l;const u=C.useCallback(x=>{const T=vi(x);o.current=T,a(T)},[]),h=C.useCallback(x=>{o.current=x,a(x)},[]),p=C.useCallback(x=>{const T=o.current,M=rg({...x,wsUrl:x.wsUrl||on,token:x.token||"",displayName:x.displayName||`Herdr ${T.profiles.length+1}`,autoReconnect:x.autoReconnect!==!1},T.profiles.length),A=vi({profiles:[...T.profiles,M],activeProfileId:M.id,wsUrl:M.wsUrl,token:M.token,pairCode:M.pairCode||"",autoReconnect:M.autoReconnect});h(A),r.current(A)},[h]),m=C.useCallback(x=>{const T=o.current,M=T.profiles.find(R=>R.id===x);if(!M||M.id===T.activeProfileId)return;const A=vi({activeProfileId:M.id,wsUrl:M.wsUrl,token:M.token,pairCode:M.pairCode||"",autoReconnect:M.autoReconnect,profiles:T.profiles.map(R=>R.id===M.id?{...R,lastUsedAt:Date.now()}:R)});h(A),r.current(A)},[h]),g=C.useCallback((x,T)=>{const M=o.current;if(!M.profiles.find(O=>O.id===x))return;const R=T.trim().slice(0,64);if(!R)return;const k=vi({profiles:M.profiles.map(O=>O.id===x?{...O,displayName:R}:O)});h(k)},[h]),b=C.useCallback(x=>{const T=o.current;if(!T.profiles.some(k=>k.id===x))return;const M=T.profiles.filter(k=>k.id!==x),A=M.find(k=>k.id===T.activeProfileId)||M[0],R=vi(A?{profiles:M,activeProfileId:A.id,wsUrl:A.wsUrl,token:A.token,pairCode:A.pairCode||"",autoReconnect:A.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:on,token:"",pairCode:""});h(R),x===T.activeProfileId&&r.current(R)},[h]),v=C.useCallback(x=>{const T=o.current,M=T.profiles.find(D=>D.id===T.activeProfileId),A=x.hostId?cg({wsUrl:T.wsUrl,hostId:x.hostId}):null,R=A?T.profiles.findIndex(D=>cg(D)===A):-1,k=R>=0?R:Math.max(0,T.profiles.findIndex(D=>D.id===T.activeProfileId)),$={...T.profiles[k]||M||rg({wsUrl:T.wsUrl||on,token:"",pairCode:T.pairCode||"PENDING",displayName:`Herdr ${T.profiles.length+1}`},T.profiles.length),token:x.token,pairCode:void 0,...x.hostId?{hostId:x.hostId}:{},...x.deviceId?{deviceId:x.deviceId}:{},lastUsedAt:Date.now()};let _=[...T.profiles];k>=0&&k<_.length?_[k]=$:_.push($);const z=M==null?void 0:M.id;_=_.filter((D,K)=>K===k||D.id===$.id?!0:!(R>=0&&z&&D.id===z));const L=vi({profiles:_,activeProfileId:$.id,wsUrl:$.wsUrl,token:$.token,pairCode:"",autoReconnect:$.autoReconnect});return h(L),L},[h]),w=C.useCallback(x=>{const T=o.current,M=T.profiles.find(O=>O.id===T.activeProfileId);if(!M||!x.hostId&&!x.hostname)return;const A=/^Herdr \d+$/.test(M.displayName),R={...M,...x.hostId?{hostId:x.hostId}:{},...x.hostname?{hostname:x.hostname}:{},...x.hostname&&A?{displayName:x.hostname}:{}},k=vi({profiles:T.profiles.map(O=>O.id===M.id?R:O)});h(k)},[h]);return{settings:i,updateSettings:u,addProfileAndConnect:p,switchProfile:m,renameProfile:g,removeProfile:b,savePairedProfile:v,noteReadyProfile:w}}const Bo={ctrl:!1,alt:!1,shift:!1};function a1({adapterRef:l,role:i,addToast:a,tRef:o}){const[r,u]=C.useState({cols:80,rows:24}),h=C.useRef(r);h.current=r;const p=C.useRef(new Set),m=C.useRef(new Set),g=C.useRef(!0);C.useEffect(()=>{i==="controller"&&(g.current=!0)},[i]);const b=C.useCallback(()=>{g.current&&(g.current=!1,a("warning",o.current("toasts.viewerModeWarning")))},[a,o]),v=C.useCallback(L=>{if(i!=="controller"){b();return}const D=l.current;if(!D)return;const K=Sd(L);for(const J of m.current)try{J(K)}catch(V){console.debug("Key input observer threw:",V)}D.sendInput(K)},[l,i,b]),w=C.useCallback(L=>(m.current.add(L),()=>{m.current.delete(L)}),[]),[x,T]=C.useState(Bo),M=C.useRef(Bo),A=C.useCallback(L=>{const D={...M.current,[L]:!M.current[L]};M.current=D,T(D)},[]),R=C.useCallback(()=>{const L=M.current;return!L.ctrl&&!L.alt&&!L.shift?null:(M.current=Bo,T(Bo),L)},[]),k=C.useCallback(L=>{var D;i!=="controller"&&!lr(L)||(D=l.current)==null||D.sendInput(L)},[l,i]),O=C.useCallback((L,D)=>{var K;h.current={cols:L,rows:D},u({cols:L,rows:D}),(K=l.current)==null||K.sendResize(L,D)},[l]),$=C.useCallback((L,D)=>i!=="controller"?(b(),!1):l.current?(l.current.sendPasteFile(L,D),!0):!1,[l,i,b]),_=C.useCallback(L=>(p.current.add(L),()=>{p.current.delete(L)}),[]),z=C.useCallback(L=>{for(const D of p.current)try{D(L)}catch(K){console.error("Error in pasteFileReady listener:",K)}},[]);return{terminalDimensions:r,dimensionsRef:h,warnViewerMode:b,sendKey:v,observeKeyInput:w,modifierLatch:x,toggleModifierLatch:A,consumeModifierLatch:R,sendBinary:k,sendResize:O,sendPasteFile:$,subscribeToPasteFileReady:_,notifyPasteFileReady:z}}const s1=4e3,o1=3;function r1(){const[l,i]=C.useState([]),a=C.useRef([]),o=C.useRef(new Map),r=C.useCallback(p=>{a.current=p,i(p)},[]),u=C.useCallback(p=>{const m=o.current.get(p);m&&(clearTimeout(m),o.current.delete(p)),r(a.current.filter(g=>g.id!==p))},[r]),h=C.useCallback((p,m)=>{const g=Date.now(),b=a.current,v=b.find(M=>M.type===p&&M.message===m),w=v?v.id:`${g}-${Math.random().toString(36).substring(2,6)}`;let x;if(v)x=b.map(M=>M.id===w?{...M,count:M.count+1,timestamp:g}:M);else for(x=[...b,{id:w,type:p,message:m,timestamp:g,count:1}];x.length>o1;){const[M,...A]=x,R=o.current.get(M.id);R&&(clearTimeout(R),o.current.delete(M.id)),x=A}r(x);const T=o.current.get(w);T&&clearTimeout(T),o.current.set(w,setTimeout(()=>u(w),s1))},[r,u]);return C.useEffect(()=>{const p=o.current;return()=>{for(const m of p.values())clearTimeout(m);p.clear()}},[]),{toasts:l,addToast:h,removeToast:u}}function c1(l,i){const[a,o]=C.useState(null),[r,u]=C.useState(Jw),h=C.useRef(r),p=C.useRef(new Set),m=C.useCallback(v=>{h.current=v,u(v),jb(v)},[]),g=C.useCallback(v=>{if(o(v),!v.updateAvailable||h.current===v.latest)return;const w=`${v.latest}:${v.restartPending?"restart":"update"}`;p.current.has(w)||(p.current.add(w),l("info",v.restartPending?i.current("update.toastRestart",{version:v.latest}):i.current("update.toast",{version:v.latest})))},[l,i]),b=C.useCallback(()=>o(null),[]);return{updateStatus:a,ignoredUpdate:r,ignoreUpdate:m,receiveUpdateStatus:g,forgetUpdateStatus:b}}const Hb=C.createContext(null),Bb=C.createContext(null),Ub=C.createContext(null),Kb=C.createContext(null),Ib=C.createContext(null),u1=({children:l})=>{var cn,Ct;const[i,a]=C.useReducer(bw,gw),o=C.useRef(null),r=C.useRef(!1);C.useEffect(()=>{bb()},[]);const{receiveOutput:u,subscribeToOutput:h,getPendingOutputChunkCount:p,clearPendingOutput:m}=Vw(),{toasts:g,addToast:b,removeToast:v}=r1(),w=C.useCallback(()=>{m(),a({type:"reset",resetTerminal:!0})},[m]),{settings:x,updateSettings:T,addProfileAndConnect:M,switchProfile:A,renameProfile:R,removeProfile:k,savePairedProfile:O,noteReadyProfile:$}=l1(ge=>{var We;w(),(We=o.current)==null||We.reconnectWith(zo(ge))}),_=C.useCallback((ge,We)=>wd(x.language,ge,We),[x.language]),z=C.useRef(_);z.current=_;const{herdrLaunch:L,startHerdr:D,handleLaunchError:K,forgetHerdrLaunch:J}=vw(o,z),{updateStatus:V,ignoredUpdate:X,ignoreUpdate:ie,receiveUpdateStatus:ue,forgetUpdateStatus:U}=c1(b,z),E=a1({adapterRef:o,role:i.role,addToast:b,tRef:z}),{uploadProgress:G,uploadImage:P,resetUploadProgress:le,abortUpload:Q,completeUpload:xe}=Yw({adapterRef:o,role:i.role,connectionState:i.connectionState,warnViewerMode:E.warnViewerMode,addToast:b,t:_,sendPasteFile:E.sendPasteFile}),ye=Dw(o,()=>zo(x),{stateChange:(ge,We,qt)=>{const Vt=ju(qt)?_(`serverErrors.${qt}`):We;a({type:"stateChange",state:ge,detail:Vt,code:qt}),ge==="connected"?b("success",_("toasts.connected")):ge==="error"&&b("error",Vt||_("toasts.connectionError")),ge!=="connected"&&J()},ready:ge=>{const We=r.current;We&&m(),r.current=!0,J(),U(),a({type:"ready",message:ge,resetTerminal:We}),$(ge)},hostReconnecting:ge=>{a({type:"hostReconnecting",code:ge||"host_reconnecting",detail:_(`serverErrors.${ju(ge)?ge:"host_reconnecting"}`)}),m()},sessionRestarted:(ge,We,qt,Vt)=>{var Ri;m(),a({type:"sessionRestarted",hostname:Vt,palette:qt}),$({hostId:(Ri=o.current)==null?void 0:Ri.getHostId(),hostname:Vt})},roleChange:(ge,We,qt,Vt)=>{a({type:"roleChange",role:ge,controllerId:We,hostId:qt,assignedClientId:Vt})},controlGranted:()=>{a({type:"controlGranted"}),b("success",_("toasts.controlGranted"))},paired:ge=>{var qt;const We=O(ge);b("success",_("toasts.pairedSuccess")),a({type:"paired",at:Date.now()}),(qt=o.current)==null||qt.reconnectWith(zo(We))},exit:(ge,We)=>{b("info",`${_("toasts.sessionEnded")}${We?`: ${We}`:""}${ge!=null?` (${ge})`:""}`)},error:ge=>{if(K(ge)||ge.code==="host_font_unavailable")return;Q();const We=ju(ge.code)?_(`serverErrors.${ge.code}`):ge.message||`[${ge.code}]`;b("error",We)},pasteFileReady:ge=>{xe(),E.notifyPasteFileReady(ge)},rttUpdate:ge=>a({type:"rtt",rttMs:ge}),peerCount:ge=>a({type:"peerCount",count:ge}),sessionReady:()=>{a({type:"sessionReady"}),J()},agentStatus:ge=>a({type:"agentStatus",status:ge}),updateStatus:ue,binaryData:u}),ve=x.profiles.find(ge=>ge.id===x.activeProfileId),{hostFont:me,loadHostFont:de,declineHostFont:we,syncHostFont:se,ensureHostGlyphs:Se}=mw(ye),ae=C.useCallback(()=>{de()},[de]),pe=Vx(x.fontFamily,me.font?{family:me.font.family,alias:me.status==="loaded"?me.alias:null,glyphs:me.glyphs.source?{family:me.glyphs.source.family,scope:me.glyphs.source.scope,alias:me.glyphs.alias}:null}:null),Ee=x.fontSizeFollowsHost&&((cn=me.font)!=null&&cn.sizePx)?Wl(me.font.sizePx,x.fontSize):x.fontSize;C.useEffect(()=>{document.documentElement.style.setProperty("--tui-font",pe)},[pe]),C.useEffect(()=>{var ge;(ge=o.current)==null||ge.updateConfig(zo(x))},[x]),C.useEffect(()=>{const ge=o.current;return ge?pw(ge):void 0},[]);const{dimensionsRef:Be}=E,re=C.useCallback(ge=>{o.current&&(ge&&o.current.updateConfig(ge),o.current.connect(Be.current))},[Be]),Ae=C.useCallback(()=>{var ge;(ge=o.current)==null||ge.disconnect()},[]),Pe=C.useCallback((ge=!1)=>{var We;(We=o.current)==null||We.claimControl(ge)},[]),wt=C.useCallback(()=>{var ge;(ge=o.current)==null||ge.releaseControl()},[]),Nt=C.useCallback(ge=>T({language:ge}),[T]),Vn=Nx((Ct=i.agentStatus)==null?void 0:Ct.focusedAgent,"auto"),Pn=C.useMemo(()=>({settings:x,updateSettings:T,language:x.language,setLanguage:Nt,t:_,profiles:x.profiles,activeProfileId:x.activeProfileId,activeProfile:ve,switchProfile:A,addProfileAndConnect:M,renameProfile:R,removeProfile:k,hostFont:me,loadHostFont:ae,declineHostFont:we,syncHostFont:se,ensureHostGlyphs:Se,terminalFontFamily:pe,terminalFontSize:Ee}),[x,T,Nt,_,ve,A,M,R,k,me,ae,we,se,Se,pe,Ee]),kt=C.useMemo(()=>({...i,isController:i.role==="controller",agentProfile:Vn,adapter:ye,connect:re,disconnect:Ae,claimControl:Pe,releaseControl:wt,herdrLaunch:L,startHerdr:D,updateStatus:V,ignoredUpdate:X,ignoreUpdate:ie}),[i,Vn,ye,re,Ae,Pe,wt,L,D,V,X,ie]),Sn=C.useMemo(()=>({toasts:g,addToast:b,removeToast:v}),[g,b,v]),{terminalDimensions:ps,sendKey:gs,observeKeyInput:St,modifierLatch:bs,toggleModifierLatch:la,consumeModifierLatch:aa,sendBinary:ki,sendResize:ys,warnViewerMode:sa,sendPasteFile:vs,subscribeToPasteFileReady:xs}=E,Li=C.useMemo(()=>({terminalDimensions:ps,sendKey:gs,observeKeyInput:St,modifierLatch:bs,toggleModifierLatch:la,consumeModifierLatch:aa,sendBinary:ki,sendResize:ys,warnViewerMode:sa,sendPasteFile:vs,subscribeToPasteFileReady:xs,subscribeToOutput:h,getPendingOutputChunkCount:p}),[ps,gs,St,bs,la,aa,ki,ys,sa,vs,xs,h,p]),Mt=C.useMemo(()=>({uploadProgress:G,uploadImage:P,resetUploadProgress:le}),[G,P,le]);return f.jsx(Hb.Provider,{value:Pn,children:f.jsx(Bb.Provider,{value:kt,children:f.jsx(Ub.Provider,{value:Sn,children:f.jsx(Kb.Provider,{value:Li,children:f.jsx(Ib.Provider,{value:Mt,children:l})})})})})};function fs(l,i){const a=C.useContext(l);if(!a)throw new Error(`${i} must be used within a TerminalProvider`);return a}const Le=()=>fs(Hb,"useSettings"),et=()=>fs(Bb,"useConnection"),rn=()=>fs(Ub,"useToasts"),hs=()=>fs(Kb,"useTerminalIO"),ur=()=>fs(Ib,"useUpload");function cs(l){var i,a;return l?{blocked:((i=l.counts)==null?void 0:i.blocked)??0,done:((a=l.counts)==null?void 0:a.done)??0}:null}function d1(l){return l?l.blocked>0?"blocked":l.done>0?"done":null:null}function f1(l){if(!l)return"";const i=[];return l.blocked>0&&i.push(`${l.blocked}⚠`),l.done>0&&i.push(`${l.done}✓`),i.length>0?`(${i.join(" ")})`:""}function h1(l,i){if(!l||!i)return null;const a=new Map(l.agents.map(h=>[h.paneId,h.status]));let o=null;for(const h of i.agents)if(!(h.status!=="blocked"&&h.status!=="done")&&a.get(h.paneId)!==h.status){if(h.status==="blocked")return"blocked";o="done"}const r=cs(l),u=cs(i);return u.blocked>r.blocked?"blocked":(!o&&u.done>r.done&&(o="done"),o)}const m1={blocked:"%23f9e2af",done:"%23a6e3a1"};function p1(l){return`<circle cx='19' cy='5' r='4.5' fill='${m1[l]}' stroke='%2311111b' stroke-width='1.5'/>`}function g1(l,i){return!i||!l.includes("</svg>")?l:l.replace("</svg>",`${p1(i)}</svg>`)}function fg(l,i=document){const a=i.querySelector('link[rel~="icon"]');if(!a)return;a.dataset.baseHref===void 0&&(a.dataset.baseHref=a.getAttribute("href")??"");const o=g1(a.dataset.baseHref,l);a.getAttribute("href")!==o&&a.setAttribute("href",o)}let an=null;function b1(){if(typeof window>"u")return null;const l=window;return l.AudioContext??l.webkitAudioContext??null}function Fb(){const l=b1();if(l)try{an=an??new l,an.state==="suspended"&&an.resume()}catch{an=null}}function y1(l=window){const i=()=>{Fb(),a()},a=()=>{l.removeEventListener("pointerdown",i),l.removeEventListener("keydown",i)};return l.addEventListener("pointerdown",i),l.addEventListener("keydown",i),a}const v1={blocked:[880,660],done:[660,880]};function Gb(l){if((an==null?void 0:an.state)==="running")try{const i=an.currentTime;v1[l].forEach((a,o)=>{const r=an.createOscillator(),u=an.createGain(),h=i+o*.11;r.type="sine",r.frequency.value=a,u.gain.setValueAtTime(1e-4,h),u.gain.exponentialRampToValueAtTime(.06,h+.01),u.gain.exponentialRampToValueAtTime(1e-4,h+.09),r.connect(u),u.connect(an.destination),r.start(h),r.stop(h+.1)})}catch{}}const x1=15e3,w1={blocked:[70,50,70],done:[40]};function S1(){const{settings:l,t:i}=Le(),{agentStatus:a}=et(),o=C.useRef(l);o.current=l;const r=C.useRef(i);r.current=i;const u=C.useRef(null),h=C.useRef(Number.NEGATIVE_INFINITY);C.useEffect(()=>{fg(l.agentAlertBadge?d1(cs(a)):null)},[a,l.agentAlertBadge]),C.useEffect(()=>()=>fg(null),[]),C.useEffect(()=>{if(!(!l.agentAlertSound||typeof window>"u"))return y1(window)},[l.agentAlertSound]),C.useEffect(()=>{const p=u.current;u.current=a;const m=h1(p,a);if(!m)return;const g=Date.now();if(g-h.current<x1)return;h.current=g;const b=o.current,v=typeof document<"u"&&document.visibilityState==="hidden",w=v||typeof document<"u"&&!document.hasFocus();if(b.agentAlertVibrate&&!v&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(w1[m])}catch{}if(b.agentAlertSound&&w&&Gb(m),b.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const x=cs(a),T=m==="blocked"?r.current("agents.notifyBlocked",{count:x.blocked}):r.current("agents.notifyDone",{count:x.done});try{new Notification("Herdr Remote",{body:T,tag:"herdr-agents"})}catch{}}},[a])}function Yb(l){var i,a,o="";if(typeof l=="string"||typeof l=="number")o+=l;else if(typeof l=="object")if(Array.isArray(l)){var r=l.length;for(i=0;i<r;i++)l[i]&&(a=Yb(l[i]))&&(o&&(o+=" "),o+=a)}else for(a in l)l[a]&&(o&&(o+=" "),o+=a);return o}function C1(){for(var l,i,a=0,o="",r=arguments.length;a<r;a++)(l=arguments[a])&&(i=Yb(l))&&(o&&(o+=" "),o+=i);return o}const T1=(l,i)=>{const a=new Array(l.length+i.length);for(let o=0;o<l.length;o++)a[o]=l[o];for(let o=0;o<i.length;o++)a[l.length+o]=i[o];return a},M1=(l,i)=>({classGroupId:l,validator:i}),$b=(l=new Map,i=null,a)=>({nextPart:l,validators:i,classGroupId:a}),sr="-",hg=[],A1="arbitrary..",E1=l=>{const i=k1(l),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=l;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return N1(h);const p=h.split(sr),m=p[0]===""&&p.length>1?1:0;return qb(p,m,i)},getConflictingClassGroupIds:(h,p)=>{if(p){const m=o[h],g=a[h];return m?g?T1(g,m):m:g||hg}return a[h]||hg}}},qb=(l,i,a)=>{if(l.length-i===0)return a.classGroupId;const r=l[i],u=a.nextPart.get(r);if(u){const g=qb(l,i+1,u);if(g)return g}const h=a.validators;if(h===null)return;const p=i===0?l.join(sr):l.slice(i).join(sr),m=h.length;for(let g=0;g<m;g++){const b=h[g];if(b.validator(p))return b.classGroupId}},N1=l=>l.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const i=l.slice(1,-1),a=i.indexOf(":"),o=i.slice(0,a);return o?A1+o:void 0})(),k1=l=>{const{theme:i,classGroups:a}=l;return L1(a,i)},L1=(l,i)=>{const a=$b();for(const o in l){const r=l[o];Ed(r,a,o,i)}return a},Ed=(l,i,a,o)=>{const r=l.length;for(let u=0;u<r;u++){const h=l[u];R1(h,i,a,o)}},R1=(l,i,a,o)=>{if(typeof l=="string"){_1(l,i,a);return}if(typeof l=="function"){j1(l,i,a,o);return}O1(l,i,a,o)},_1=(l,i,a)=>{const o=l===""?i:Vb(i,l);o.classGroupId=a},j1=(l,i,a,o)=>{if(D1(l)){Ed(l(o),i,a,o);return}i.validators===null&&(i.validators=[]),i.validators.push(M1(a,l))},O1=(l,i,a,o)=>{const r=Object.entries(l),u=r.length;for(let h=0;h<u;h++){const[p,m]=r[h];Ed(m,Vb(i,p),a,o)}},Vb=(l,i)=>{let a=l;const o=i.split(sr),r=o.length;for(let u=0;u<r;u++){const h=o[u];let p=a.nextPart.get(h);p||(p=$b(),a.nextPart.set(h,p)),a=p}return a},D1=l=>"isThemeGetter"in l&&l.isThemeGetter===!0,z1=l=>{if(l<1)return{get:()=>{},set:()=>{}};let i=0,a=Object.create(null),o=Object.create(null);const r=(u,h)=>{a[u]=h,i++,i>l&&(i=0,o=a,a=Object.create(null))};return{get(u){let h=a[u];if(h!==void 0)return h;if((h=o[u])!==void 0)return r(u,h),h},set(u,h){u in a?a[u]=h:r(u,h)}}},rd="!",mg=":",H1=[],pg=(l,i,a,o,r)=>({modifiers:l,hasImportantModifier:i,baseClassName:a,maybePostfixModifierPosition:o,isExternal:r}),B1=l=>{const{prefix:i,experimentalParseClassName:a}=l;let o=r=>{const u=[];let h=0,p=0,m=0,g;const b=r.length;for(let M=0;M<b;M++){const A=r[M];if(h===0&&p===0){if(A===mg){u.push(r.slice(m,M)),m=M+1;continue}if(A==="/"){g=M;continue}}A==="["?h++:A==="]"?h--:A==="("?p++:A===")"&&p--}const v=u.length===0?r:r.slice(m);let w=v,x=!1;v.endsWith(rd)?(w=v.slice(0,-1),x=!0):v.startsWith(rd)&&(w=v.slice(1),x=!0);const T=g&&g>m?g-m:void 0;return pg(u,x,w,T)};if(i){const r=i+mg,u=o;o=h=>h.startsWith(r)?u(h.slice(r.length)):pg(H1,!1,h,void 0,!0)}if(a){const r=o;o=u=>a({className:u,parseClassName:r})}return o},U1=l=>{const i=new Map;return l.orderSensitiveModifiers.forEach((a,o)=>{i.set(a,1e6+o)}),a=>{const o=[];let r=[];for(let u=0;u<a.length;u++){const h=a[u],p=h[0]==="[",m=i.has(h);p||m?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(h)):r.push(h)}return r.length>0&&(r.sort(),o.push(...r)),o}},K1=l=>({cache:z1(l.cacheSize),parseClassName:B1(l),sortModifiers:U1(l),postfixLookupClassGroupIds:I1(l),...E1(l)}),I1=l=>{const i=Object.create(null),a=l.postfixLookupClassGroups;if(a)for(let o=0;o<a.length;o++)i[a[o]]=!0;return i},F1=/\s+/,G1=(l,i)=>{const{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:u,postfixLookupClassGroupIds:h}=i,p=[],m=l.trim().split(F1);let g="";for(let b=m.length-1;b>=0;b-=1){const v=m[b],{isExternal:w,modifiers:x,hasImportantModifier:T,baseClassName:M,maybePostfixModifierPosition:A}=a(v);if(w){g=v+(g.length>0?" "+g:g);continue}let R=!!A,k;if(R){const L=M.substring(0,A);k=o(L);const D=k&&h[k]?o(M):void 0;D&&D!==k&&(k=D,R=!1)}else k=o(M);if(!k){if(!R){g=v+(g.length>0?" "+g:g);continue}if(k=o(M),!k){g=v+(g.length>0?" "+g:g);continue}R=!1}const O=x.length===0?"":x.length===1?x[0]:u(x).join(":"),$=T?O+rd:O,_=$+k;if(p.indexOf(_)>-1)continue;p.push(_);const z=r(k,R);for(let L=0;L<z.length;++L){const D=z[L];p.push($+D)}g=v+(g.length>0?" "+g:g)}return g},Y1=(...l)=>{let i=0,a,o,r="";for(;i<l.length;)(a=l[i++])&&(o=Pb(a))&&(r&&(r+=" "),r+=o);return r},Pb=l=>{if(typeof l=="string")return l;let i,a="";for(let o=0;o<l.length;o++)l[o]&&(i=Pb(l[o]))&&(a&&(a+=" "),a+=i);return a},gg=(l,...i)=>{let a,o,r,u;const h=m=>{const g=i.reduce((b,v)=>v(b),l());return a=K1(g),o=a.cache.get,r=a.cache.set,u=p,p(m)},p=m=>{const g=o(m);if(g)return g;const b=G1(m,a);return r(m,b),b};return u=h,(...m)=>u(Y1(...m))},$1=[],ft=l=>{const i=a=>a[l]||$1;return i.isThemeGetter=!0,i},Xb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Qb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,q1=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,V1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,P1=/\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$/,X1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Q1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Z1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xi=l=>q1.test(l),_e=l=>!!l&&!Number.isNaN(Number(l)),yn=l=>!!l&&Number.isInteger(Number(l)),Iu=l=>l.endsWith("%")&&_e(l.slice(0,-1)),In=l=>V1.test(l),Zb=()=>!0,W1=l=>P1.test(l)&&!X1.test(l),Nd=()=>!1,J1=l=>Q1.test(l),eS=l=>Z1.test(l),tS=l=>!ce(l)&&!fe(l),nS=l=>l.startsWith("@container")&&(l[10]==="/"&&l[11]!==void 0||l[11]==="s"&&l[16]!==void 0&&l.startsWith("-size/",10)||l[11]==="n"&&l[18]!==void 0&&l.startsWith("-normal/",10)),iS=l=>Ni(l,ey,Nd),ce=l=>Xb.test(l),Zi=l=>Ni(l,ty,W1),bg=l=>Ni(l,dS,_e),lS=l=>Ni(l,iy,Zb),aS=l=>Ni(l,ny,Nd),yg=l=>Ni(l,Wb,Nd),sS=l=>Ni(l,Jb,eS),Uo=l=>Ni(l,ly,J1),fe=l=>Qb.test(l),ts=l=>ll(l,ty),oS=l=>ll(l,ny),vg=l=>ll(l,Wb),rS=l=>ll(l,ey),cS=l=>ll(l,Jb),Ko=l=>ll(l,ly,!0),uS=l=>ll(l,iy,!0),Ni=(l,i,a)=>{const o=Xb.exec(l);return o?o[1]?i(o[1]):a(o[2]):!1},ll=(l,i,a=!1)=>{const o=Qb.exec(l);return o?o[1]?i(o[1]):a:!1},Wb=l=>l==="position"||l==="percentage",Jb=l=>l==="image"||l==="url",ey=l=>l==="length"||l==="size"||l==="bg-size",ty=l=>l==="length",dS=l=>l==="number",ny=l=>l==="family-name",iy=l=>l==="number"||l==="weight",ly=l=>l==="shadow",xg=()=>{const l=ft("color"),i=ft("font"),a=ft("text"),o=ft("font-weight"),r=ft("tracking"),u=ft("leading"),h=ft("breakpoint"),p=ft("container"),m=ft("spacing"),g=ft("radius"),b=ft("shadow"),v=ft("inset-shadow"),w=ft("text-shadow"),x=ft("drop-shadow"),T=ft("blur"),M=ft("perspective"),A=ft("aspect"),R=ft("ease"),k=ft("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...$(),fe,ce],z=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],D=()=>[fe,ce,m],K=()=>[xi,"full","auto",...D()],J=()=>[yn,"none","subgrid",fe,ce],V=()=>["auto",{span:["full",yn,fe,ce]},yn,fe,ce],X=()=>[yn,"auto",fe,ce],ie=()=>["auto","min","max","fr",fe,ce],ue=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],E=()=>["auto",...D()],G=()=>[xi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],P=()=>[xi,"screen","full","dvw","lvw","svw","min","max","fit",...D()],le=()=>[xi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],Q=()=>[l,fe,ce],xe=()=>[...$(),vg,yg,{position:[fe,ce]}],ye=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ve=()=>["auto","cover","contain",rS,iS,{size:[fe,ce]}],me=()=>[Iu,ts,Zi],de=()=>["","none","full",g,fe,ce],we=()=>["",_e,ts,Zi],se=()=>["solid","dashed","dotted","double"],Se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[_e,Iu,vg,yg],pe=()=>["","none",T,fe,ce],Ee=()=>["none",_e,fe,ce],Be=()=>["none",_e,fe,ce],re=()=>[_e,fe,ce],Ae=()=>[xi,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[In],breakpoint:[In],color:[Zb],container:[In],"drop-shadow":[In],ease:["in","out","in-out"],font:[tS],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[In],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[In],shadow:[In],spacing:["px",_e],text:[In],"text-shadow":[In],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",xi,ce,fe,A]}],container:["container"],"container-type":[{"@container":["","normal","size",fe,ce]}],"container-named":[nS],columns:[{columns:[_e,ce,fe,p]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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:_()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:K()}],"inset-x":[{"inset-x":K()}],"inset-y":[{"inset-y":K()}],start:[{"inset-s":K(),start:K()}],end:[{"inset-e":K(),end:K()}],"inset-bs":[{"inset-bs":K()}],"inset-be":[{"inset-be":K()}],top:[{top:K()}],right:[{right:K()}],bottom:[{bottom:K()}],left:[{left:K()}],visibility:["visible","invisible","collapse"],z:[{z:[yn,"auto",fe,ce]}],basis:[{basis:[xi,"full","auto",p,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[_e,xi,"auto","initial","none",ce]}],grow:[{grow:["",_e,fe,ce]}],shrink:[{shrink:["",_e,fe,ce]}],order:[{order:[yn,"first","last","none",fe,ce]}],"grid-cols":[{"grid-cols":J()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":J()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...ue(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...ue()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":ue()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pbs:[{pbs:D()}],pbe:[{pbe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mbs:[{mbs:E()}],mbe:[{mbe:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:G()}],"inline-size":[{inline:["auto",...P()]}],"min-inline-size":[{"min-inline":["auto",...P()]}],"max-inline-size":[{"max-inline":["none",...P()]}],"block-size":[{block:["auto",...le()]}],"min-block-size":[{"min-block":["auto",...le()]}],"max-block-size":[{"max-block":["none",...le()]}],w:[{w:[p,"screen",...G()]}],"min-w":[{"min-w":[p,"screen","none",...G()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[h]},...G()]}],h:[{h:["screen","lh",...G()]}],"min-h":[{"min-h":["screen","lh","none",...G()]}],"max-h":[{"max-h":["screen","lh",...G()]}],"font-size":[{text:["base",a,ts,Zi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,uS,lS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Iu,ce]}],"font-family":[{font:[oS,aS,i]}],"font-features":[{"font-features":[ce]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,fe,ce]}],"line-clamp":[{"line-clamp":[_e,"none",fe,bg]}],leading:[{leading:[u,...D()]}],"list-image":[{"list-image":["none",fe,ce]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",fe,ce]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Q()}],"text-color":[{text:Q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[_e,"from-font","auto",fe,Zi]}],"text-decoration-color":[{decoration:Q()}],"underline-offset":[{"underline-offset":[_e,"auto",fe,ce]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"tab-size":[{tab:[yn,fe,ce]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fe,ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",fe,ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:xe()}],"bg-repeat":[{bg:ye()}],"bg-size":[{bg:ve()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},yn,fe,ce],radial:["",fe,ce],conic:[yn,fe,ce]},cS,sS]}],"bg-color":[{bg:Q()}],"gradient-from-pos":[{from:me()}],"gradient-via-pos":[{via:me()}],"gradient-to-pos":[{to:me()}],"gradient-from":[{from:Q()}],"gradient-via":[{via:Q()}],"gradient-to":[{to:Q()}],rounded:[{rounded:de()}],"rounded-s":[{"rounded-s":de()}],"rounded-e":[{"rounded-e":de()}],"rounded-t":[{"rounded-t":de()}],"rounded-r":[{"rounded-r":de()}],"rounded-b":[{"rounded-b":de()}],"rounded-l":[{"rounded-l":de()}],"rounded-ss":[{"rounded-ss":de()}],"rounded-se":[{"rounded-se":de()}],"rounded-ee":[{"rounded-ee":de()}],"rounded-es":[{"rounded-es":de()}],"rounded-tl":[{"rounded-tl":de()}],"rounded-tr":[{"rounded-tr":de()}],"rounded-br":[{"rounded-br":de()}],"rounded-bl":[{"rounded-bl":de()}],"border-w":[{border:we()}],"border-w-x":[{"border-x":we()}],"border-w-y":[{"border-y":we()}],"border-w-s":[{"border-s":we()}],"border-w-e":[{"border-e":we()}],"border-w-bs":[{"border-bs":we()}],"border-w-be":[{"border-be":we()}],"border-w-t":[{"border-t":we()}],"border-w-r":[{"border-r":we()}],"border-w-b":[{"border-b":we()}],"border-w-l":[{"border-l":we()}],"divide-x":[{"divide-x":we()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":we()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:Q()}],"border-color-x":[{"border-x":Q()}],"border-color-y":[{"border-y":Q()}],"border-color-s":[{"border-s":Q()}],"border-color-e":[{"border-e":Q()}],"border-color-bs":[{"border-bs":Q()}],"border-color-be":[{"border-be":Q()}],"border-color-t":[{"border-t":Q()}],"border-color-r":[{"border-r":Q()}],"border-color-b":[{"border-b":Q()}],"border-color-l":[{"border-l":Q()}],"divide-color":[{divide:Q()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[_e,fe,ce]}],"outline-w":[{outline:["",_e,ts,Zi]}],"outline-color":[{outline:Q()}],shadow:[{shadow:["","none",b,Ko,Uo]}],"shadow-color":[{shadow:Q()}],"inset-shadow":[{"inset-shadow":["none",v,Ko,Uo]}],"inset-shadow-color":[{"inset-shadow":Q()}],"ring-w":[{ring:we()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Q()}],"ring-offset-w":[{"ring-offset":[_e,Zi]}],"ring-offset-color":[{"ring-offset":Q()}],"inset-ring-w":[{"inset-ring":we()}],"inset-ring-color":[{"inset-ring":Q()}],"text-shadow":[{"text-shadow":["none",w,Ko,Uo]}],"text-shadow-color":[{"text-shadow":Q()}],opacity:[{opacity:[_e,fe,ce]}],"mix-blend":[{"mix-blend":[...Se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Se()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[_e]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":Q()}],"mask-image-linear-to-color":[{"mask-linear-to":Q()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":Q()}],"mask-image-t-to-color":[{"mask-t-to":Q()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":Q()}],"mask-image-r-to-color":[{"mask-r-to":Q()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":Q()}],"mask-image-b-to-color":[{"mask-b-to":Q()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":Q()}],"mask-image-l-to-color":[{"mask-l-to":Q()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":Q()}],"mask-image-x-to-color":[{"mask-x-to":Q()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":Q()}],"mask-image-y-to-color":[{"mask-y-to":Q()}],"mask-image-radial":[{"mask-radial":[fe,ce]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":Q()}],"mask-image-radial-to-color":[{"mask-radial-to":Q()}],"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":$()}],"mask-image-conic-pos":[{"mask-conic":[_e]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":Q()}],"mask-image-conic-to-color":[{"mask-conic-to":Q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:xe()}],"mask-repeat":[{mask:ye()}],"mask-size":[{mask:ve()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",fe,ce]}],filter:[{filter:["","none",fe,ce]}],blur:[{blur:pe()}],brightness:[{brightness:[_e,fe,ce]}],contrast:[{contrast:[_e,fe,ce]}],"drop-shadow":[{"drop-shadow":["","none",x,Ko,Uo]}],"drop-shadow-color":[{"drop-shadow":Q()}],grayscale:[{grayscale:["",_e,fe,ce]}],"hue-rotate":[{"hue-rotate":[_e,fe,ce]}],invert:[{invert:["",_e,fe,ce]}],saturate:[{saturate:[_e,fe,ce]}],sepia:[{sepia:["",_e,fe,ce]}],"backdrop-filter":[{"backdrop-filter":["","none",fe,ce]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[_e,fe,ce]}],"backdrop-contrast":[{"backdrop-contrast":[_e,fe,ce]}],"backdrop-grayscale":[{"backdrop-grayscale":["",_e,fe,ce]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[_e,fe,ce]}],"backdrop-invert":[{"backdrop-invert":["",_e,fe,ce]}],"backdrop-opacity":[{"backdrop-opacity":[_e,fe,ce]}],"backdrop-saturate":[{"backdrop-saturate":[_e,fe,ce]}],"backdrop-sepia":[{"backdrop-sepia":["",_e,fe,ce]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",fe,ce]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[_e,"initial",fe,ce]}],ease:[{ease:["linear","initial",R,fe,ce]}],delay:[{delay:[_e,fe,ce]}],animate:[{animate:["none",k,fe,ce]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[M,fe,ce]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:Be()}],"scale-x":[{"scale-x":Be()}],"scale-y":[{"scale-y":Be()}],"scale-z":[{"scale-z":Be()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[fe,ce,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ae()}],"translate-x":[{"translate-x":Ae()}],"translate-y":[{"translate-y":Ae()}],"translate-z":[{"translate-z":Ae()}],"translate-none":["translate-none"],zoom:[{zoom:[yn,fe,ce]}],accent:[{accent:Q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",fe,ce]}],"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":Q()}],"scrollbar-track-color":[{"scrollbar-track":Q()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mbs":[{"scroll-mbs":D()}],"scroll-mbe":[{"scroll-mbe":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pbs":[{"scroll-pbs":D()}],"scroll-pbe":[{"scroll-pbe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",fe,ce]}],fill:[{fill:["none",...Q()]}],"stroke-w":[{stroke:[_e,ts,Zi,bg]}],stroke:[{stroke:["none",...Q()]}],"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"]}},fS=(l,{cacheSize:i,prefix:a,experimentalParseClassName:o,extend:r={},override:u={}})=>(ql(l,"cacheSize",i),ql(l,"prefix",a),ql(l,"experimentalParseClassName",o),Io(l.theme,u.theme),Io(l.classGroups,u.classGroups),Io(l.conflictingClassGroups,u.conflictingClassGroups),Io(l.conflictingClassGroupModifiers,u.conflictingClassGroupModifiers),ql(l,"postfixLookupClassGroups",u.postfixLookupClassGroups),ql(l,"orderSensitiveModifiers",u.orderSensitiveModifiers),Fo(l.theme,r.theme),Fo(l.classGroups,r.classGroups),Fo(l.conflictingClassGroups,r.conflictingClassGroups),Fo(l.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),cd(l,r,"postfixLookupClassGroups"),cd(l,r,"orderSensitiveModifiers"),l),ql=(l,i,a)=>{a!==void 0&&(l[i]=a)},Io=(l,i)=>{if(i)for(const a in i)ql(l,a,i[a])},Fo=(l,i)=>{if(i)for(const a in i)cd(l,i,a)},cd=(l,i,a)=>{const o=i[a];o!==void 0&&(l[a]=l[a]?l[a].concat(o):o)},hS=(l,...i)=>typeof l=="function"?gg(xg,l,...i):gg(()=>fS(xg(),l),...i),mS=hS({extend:{classGroups:{"font-size":[{text:["tui","tui-sm","tui-lg"]}]}}});function ne(...l){return mS(C1(l))}const ke={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},sn={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"}},ia={ok:sn.ok.text,warn:sn.warn.text,bad:sn.bad.text,idle:sn.idle.text,accent:sn.accent.text,alt:sn.alt.text,info:sn.info.text},Bt=({level:l,className:i})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none leading-none",ia[l],i),children:l==="idle"?ke.off:ke.on}),kd=({className:l})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none text-tui-faint",l),children:ke.dot}),ay={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"},Tt=({title:l,aside:i,tone:a="accent",className:o,bodyClassName:r,children:u,...h})=>f.jsxs("fieldset",{className:ne("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",l?"px-3 pb-3 pt-1":"p-3",o),...h,children:[l?f.jsx("legend",{className:ne("flex items-center gap-2 text-tui font-bold",ia[a]),children:f.jsx("span",{children:l})}):null,i?f.jsx("span",{className:"pointer-events-none absolute -top-[10px] right-2 max-w-[60%] truncate bg-tui-base px-1 text-tui-sm text-tui-faint",children:i}):null,f.jsx("div",{className:ne("min-w-0",r),children:u})]}),Si=({label:l,labelWidth:i=16,className:a,children:o})=>f.jsxs("div",{className:ne("flex items-baseline gap-2 text-tui",a),children:[f.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${i}ch`},title:typeof l=="string"?l:void 0,children:l}),f.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:o})]}),pS=({className:l,label:i})=>i?f.jsxs("div",{className:ne("flex items-center gap-2",l),children:[f.jsx("span",{className:"h-px w-3 bg-tui-border-dim","aria-hidden":"true"}),f.jsx("span",{className:"text-tui-sm text-tui-faint",children:i}),f.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):f.jsx("div",{className:ne("h-px w-full bg-tui-border-dim",l),"aria-hidden":"true"}),Ti=({tone:l="accent",className:i,children:a,action:o})=>{const r=l==="ok"?ke.check:l==="bad"?ke.cross:l==="warn"?ke.warn:"›",u=sn[l].edgeL;return f.jsxs("div",{className:ne("flex items-start gap-2 border border-tui-border-dim border-l-2 bg-tui-mantle px-2 py-1.5 text-tui",u,i),children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",ia[l]),children:r}),f.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:a}),o?f.jsx("div",{className:"shrink-0",children:o}):null]})},gS={default:"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",primary:"border-tui-accent text-tui-accent hover:bg-tui-accent hover:text-tui-crust active:bg-tui-accent-dim",danger:"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust active:bg-tui-bad",warn:"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust active:bg-tui-warn",ghost:"border-transparent text-tui-muted hover:text-tui-accent hover:border-tui-border active:bg-tui-selection disabled:border-transparent"},Me=({variant:l="default",brackets:i=!0,glyph:a,block:o=!1,className:r,children:u,type:h="button",...p})=>f.jsxs("button",{type:h,className:ne("tui-focusable inline-flex select-none items-center justify-center gap-1.5 border bg-transparent px-2 py-0.5 text-tui font-medium transition-colors","disabled:cursor-not-allowed disabled:border-tui-border-dim disabled:text-tui-faint disabled:hover:bg-transparent",gS[l],o&&"w-full",r),...p,children:[i?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,a?f.jsx("span",{"aria-hidden":"true",className:"leading-none",children:a}):null,f.jsx("span",{className:"truncate",children:u}),i?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),Ld=({tone:l="accent",dot:i=!1,className:a,children:o})=>f.jsxs("span",{className:ne("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",ia[l],a),children:[i?f.jsx(Bt,{level:l}):null,o]}),Rd=({tabs:l,activeId:i,onSelect:a,ariaLabel:o,className:r,labelClassName:u})=>f.jsx("nav",{className:ne("flex items-center gap-2",r),"aria-label":o,children:l.map((h,p)=>{const m=h.id===i;return f.jsxs(qn.Fragment,{children:[p>0?f.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:ke.tabDivider}):null,f.jsxs("button",{type:"button",onClick:()=>a(h.id),"aria-current":m?"page":void 0,"aria-label":h.ariaLabel??h.label,title:h.title,className:ne("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",m?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[h.index!==void 0?f.jsx("span",{"aria-hidden":"true",className:ne("text-tui-faint",m&&"text-tui-accent"),children:h.index}):null,f.jsx("span",{"aria-hidden":"true",className:ne("ml-1",u),children:h.label})]})]},h.id)})}),sy=({hints:l,className:i})=>f.jsx("div",{className:ne("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",i),children:l.map(a=>f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("kbd",{className:"border border-tui-border-dim px-1 not-italic text-tui-muted",children:a.keys}),f.jsx("span",{children:a.action})]},`${a.keys} ${a.action}`))}),oy=({active:l=!1,className:i,children:a})=>f.jsx("span",{className:ne("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",l?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",i),children:a}),Fn=({htmlFor:l,hint:i,className:a,children:o})=>f.jsxs("label",{htmlFor:l,className:ne("block text-tui-sm font-bold text-tui-muted",a),children:[o,i?f.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:i}):null]}),Et=qn.forwardRef(({className:l,...i},a)=>f.jsx("input",{ref:a,className:ne("tui-input w-full px-2 py-1 text-tui",l),...i}));Et.displayName="Input";const dr=qn.forwardRef(({className:l,children:i,...a},o)=>f.jsx("select",{ref:o,className:ne("tui-input w-full px-2 py-1 text-tui",l),...a,children:i}));dr.displayName="Select";const bS=({checked:l,onChange:i,disabled:a=!1,label:o,description:r,className:u,id:h})=>f.jsxs("label",{className:ne("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",a&&"cursor-not-allowed opacity-60",u),children:[f.jsx("input",{id:h,type:"checkbox",className:"sr-only",checked:l,disabled:a,onChange:p=>i(p.target.checked)}),f.jsx("span",{"aria-hidden":"true",className:ne("mt-px shrink-0 font-bold leading-tight",l?"text-tui-ok":"text-tui-faint",!a&&"group-hover:text-tui-accent"),children:l?"[x]":"[ ]"}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:ne("block",l?"text-tui-text":"text-tui-muted"),children:o}),r?f.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:r}):null]})]}),fr="h-8",hn=({title:l,aside:i,className:a,children:o})=>f.jsxs("section",{className:ne("min-w-0",a),children:[f.jsxs("div",{className:"flex min-h-[var(--tui-row)] items-center gap-2 border-b border-tui-border pb-1",children:[f.jsx("h3",{className:"text-tui font-bold text-tui-accent",children:l}),i?f.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:i}):null]}),f.jsx("div",{className:"divide-y divide-tui-border-dim",children:o})]}),Ht=({label:l,hint:i,htmlFor:a,control:o,className:r})=>f.jsxs("div",{className:ne("flex flex-col gap-1 py-1.5 sm:flex-row sm:items-center sm:gap-4",r),children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[a?f.jsx("label",{htmlFor:a,className:"block text-tui text-tui-text",children:l}):f.jsx("span",{className:"block text-tui text-tui-text",children:l}),i?f.jsx("span",{className:"block text-tui-sm leading-snug text-tui-faint",children:i}):null]}),f.jsx("div",{className:"w-full shrink-0 sm:w-[20rem]",children:o})]}),ud="flex min-w-0 cursor-pointer select-none items-center justify-center px-1 text-tui transition-colors has-[:focus-visible]:outline has-[:focus-visible]:outline-1 has-[:focus-visible]:-outline-offset-2 has-[:focus-visible]:outline-tui-text",dd="text-tui-muted hover:bg-tui-selection hover:text-tui-text";function wg({name:l,value:i,options:a,onChange:o,tone:r="accent",className:u,"aria-label":h}){return f.jsx("div",{role:"radiogroup","aria-label":h,className:ne("grid w-full border border-tui-border bg-tui-mantle",fr,u),style:{gridTemplateColumns:`repeat(${a.length}, minmax(max-content, 1fr))`},children:a.map((p,m)=>{const g=p.value===i;return f.jsxs("label",{className:ne(ud,m>0&&"border-l border-tui-border",g?ne(ay[r],"font-bold text-tui-crust"):dd),children:[f.jsx("input",{type:"radio",name:l,value:p.value,className:"sr-only",checked:g,onChange:()=>o(p.value)}),f.jsx("span",{className:"whitespace-nowrap",children:p.label})]},p.value)})})}const wi=({checked:l,onChange:i,label:a,offLabel:o,onLabel:r,disabled:u=!1,className:h})=>{const p=m=>g=>{g.preventDefault(),!(u||m===l)&&i(m)};return f.jsxs("label",{className:ne("grid w-full grid-cols-2 border border-tui-border bg-tui-mantle has-[:focus-visible]:outline has-[:focus-visible]:outline-1 has-[:focus-visible]:outline-tui-accent",fr,u&&"cursor-not-allowed opacity-60",h),children:[f.jsx("input",{type:"checkbox",className:"sr-only","aria-label":a,checked:l,disabled:u,onChange:m=>i(m.target.checked)}),f.jsx("span",{"aria-hidden":"true",onClick:p(!1),className:ne(ud,l?dd:"bg-tui-selection font-bold text-tui-text"),children:o}),f.jsx("span",{"aria-hidden":"true",onClick:p(!0),className:ne(ud,"border-l border-tui-border",l?"bg-tui-ok font-bold text-tui-crust":dd),children:r})]})},tl=({variant:l="neutral",className:i,type:a="button",children:o,...r})=>f.jsx("button",{type:a,className:ne("tui-focusable inline-flex h-7 w-7 shrink-0 select-none items-center justify-center border border-transparent text-tui transition-colors","disabled:cursor-not-allowed disabled:text-tui-border disabled:hover:border-transparent disabled:hover:bg-transparent",l==="danger"?"text-tui-bad hover:border-tui-bad":"text-tui-muted hover:border-tui-border hover:text-tui-accent",i),...r,children:o}),yS=({value:l,width:i=20,tone:a="accent",className:o})=>{const r=Number.isFinite(l)?Math.min(1,Math.max(0,l)):0,u=Math.round(r*i);return f.jsxs("span",{className:ne("inline-flex select-none whitespace-pre font-mono leading-none",o),role:"presentation",children:[f.jsx("span",{className:ia[a],children:ke.meterFull.repeat(u)}),f.jsx("span",{className:"text-tui-border",children:ke.meterEmpty.repeat(Math.max(0,i-u))})]})},vS=({ratio:l,label:i,tone:a="accent",className:o,...r})=>{const u=Number.isFinite(l)?Math.min(1,Math.max(0,l)):0;return f.jsxs("div",{className:ne("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",o),role:"progressbar","aria-valuenow":Math.round(u*100),"aria-valuemin":0,"aria-valuemax":100,...r,children:[f.jsx("div",{className:ne("absolute inset-y-0 left-0",ay[a]),style:{width:`${u*100}%`},"aria-hidden":"true"}),i!==void 0?f.jsx("span",{className:"absolute inset-0 flex items-center justify-center whitespace-nowrap px-1 text-tui font-bold text-tui-text mix-blend-difference",children:i}):null]})},Gl=({label:l,value:i,sub:a,tone:o,title:r,className:u})=>f.jsxs("div",{className:ne("min-w-0 border border-tui-border bg-tui-base px-2.5 py-1.5",u),title:r,children:[f.jsx("div",{className:"truncate text-tui-sm text-tui-muted",children:l}),f.jsx("div",{className:ne("truncate text-tui-lg font-bold",o?ia[o]:"text-tui-text"),children:i}),f.jsx("div",{className:"truncate text-tui-sm text-tui-faint",children:a||" "})]}),Sg=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],nl=({className:l,label:i})=>{const[a,o]=qn.useState(0);return qn.useEffect(()=>{const r=setInterval(()=>o(u=>(u+1)%Sg.length),90);return()=>clearInterval(r)},[]),f.jsxs("span",{className:ne("inline-flex items-center gap-1.5",l),role:"status",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:Sg[a]}),i?f.jsx("span",{children:i}):null]})};function _d({columns:l,items:i,rowKey:a,empty:o,className:r}){return i.length===0?f.jsx("div",{className:ne("px-1 py-4 text-center text-tui text-tui-faint",r),children:o}):f.jsx("div",{className:ne("w-full overflow-x-auto",r),children:f.jsxs("table",{className:"w-full border-collapse text-tui",children:[f.jsx("thead",{children:f.jsx("tr",{className:"border-b border-tui-border",children:l.map(u=>f.jsx("th",{scope:"col",style:u.width?{width:`${u.width}ch`}:void 0,className:ne("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",u.align==="right"?"text-right":"text-left",u.className),children:u.header},u.key))})}),f.jsx("tbody",{children:i.map((u,h)=>f.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:l.map(p=>f.jsx("td",{className:ne("px-2 py-1 align-top text-tui-text",p.align==="right"?"text-right":"text-left",p.className),children:p.render(u,h)},p.key))},a(u,h)))})]})})}var xS=ab();const hr=({isOpen:l,onClose:i,title:a,subtitle:o,closeLabel:r,footer:u,hints:h,size:p="md",fixedHeight:m=!1,className:g,children:b})=>{if(!l)return null;const v=p==="sm"?"max-w-md":p==="lg"?"max-w-3xl":"max-w-xl",w=`tui-modal-${a.replace(/\s+/g,"-").toLowerCase()}`,x=f.jsx("div",{className:"fixed inset-0 inset-x-0 z-50 flex items-center justify-center overflow-hidden bg-tui-crust/85 p-3 sm:p-6",style:{height:"var(--app-height, 100dvh)",width:"100vw"},role:"dialog","aria-modal":"true","aria-labelledby":w,onMouseDown:T=>{T.target===T.currentTarget&&i()},children:f.jsxs("div",{className:ne("relative flex max-h-full w-full flex-col border border-tui-border bg-tui-base",v,m&&"h-[46rem]",g),children:[f.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-tui-border bg-tui-mantle px-3 py-1.5",children:[f.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2",children:[f.jsx("h2",{id:w,className:"break-words text-tui font-bold text-tui-accent",children:a}),o?f.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint",children:o}):null]}),f.jsx(Me,{variant:"ghost",onClick:i,"aria-label":r,title:r,children:"esc"})]}),f.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-3",children:b}),u||h?f.jsxs("footer",{className:"flex shrink-0 flex-wrap items-center justify-between gap-2 border-t border-tui-border bg-tui-mantle px-3 py-1.5",children:[h?f.jsx(sy,{hints:h}):f.jsx("span",{}),u?f.jsx("div",{className:"flex items-center gap-2",children:u}):null]}):null]})});return typeof document>"u"?x:xS.createPortal(x,document.body)},fd=({items:l,className:i})=>{const a=l.filter(Boolean);return f.jsx("span",{className:ne("flex min-w-0 items-center gap-1.5",i),children:a.map((o,r)=>f.jsxs(qn.Fragment,{children:[r>0?f.jsx(kd,{className:"shrink-0"}):null,o]},r))})},ry=({left:l,right:i,className:a})=>f.jsxs("footer",{className:ne("relative flex h-[var(--tui-row)] w-full shrink-0 items-center justify-between gap-3 overflow-visible border-t border-tui-border bg-tui-mantle px-2 text-tui-sm",a),children:[f.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:l}),f.jsx("div",{className:"flex shrink-0 items-center gap-3",children:i})]}),wS=({name:l,tagline:i,aside:a,tabs:o,activeTabId:r,onSelectTab:u,tabsAriaLabel:h,toolbarStart:p,toolbarAside:m,hints:g,footerAside:b,bodyClassName:v,className:w,children:x})=>{const T=!!(o&&o.length>0&&r!==void 0&&u);return f.jsxs("div",{className:ne("flex h-full min-h-0 w-full flex-col bg-tui-crust",w),children:[l?f.jsxs("div",{className:"flex h-[var(--tui-row)] shrink-0 items-center justify-between gap-3 overflow-hidden border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[f.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[f.jsx("span",{className:"shrink-0 font-bold text-tui-accent",children:l}),i?f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:i}):null]}),a?f.jsx("span",{className:"flex shrink-0 items-center gap-2",children:a}):null]}):null,T||p||m?f.jsxs("div",{className:"flex min-h-[var(--tui-row)] shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border bg-tui-mantle px-2 py-1",children:[p?f.jsx("div",{className:"flex shrink-0 items-center",children:p}):null,T?f.jsx("div",{className:"scrollbar-none order-last min-w-0 basis-full overflow-x-auto sm:order-none sm:basis-auto",children:f.jsx(Rd,{tabs:o,activeId:r,onSelect:u,ariaLabel:h,className:"gap-3"})}):null,m?f.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:m}):null]}):null,f.jsx("div",{className:ne("min-h-0 flex-1 overflow-y-auto p-2",v),children:x}),g||b?f.jsx(ry,{left:g?f.jsx(sy,{hints:g}):null,right:b}):null]})},Go="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",Yo="text-tui-muted hover:border-tui-border hover:text-tui-accent",SS="border-tui-accent bg-tui-accent text-tui-crust",CS=({currentView:l,onNavigate:i,onOpenPairing:a,onOpenSettings:o,onToggleVirtualKeyboard:r,isVirtualKeyboardOpen:u})=>{const{language:h,setLanguage:p,t:m}=Le(),{addToast:g}=rn(),b=()=>{const w=h==="zh"?"en":"zh";p(w),g("info",wd(w,"toasts.switchedLanguage",{lang:w==="zh"?"简体中文":"English"}))},v=[{id:"terminal",label:m("header.terminalTab"),index:1,ariaLabel:m("header.terminalTab")},...l==="admin"?[{id:"admin",label:m("header.adminTab"),index:2,ariaLabel:m("header.adminTab")}]:[]];return f.jsx("header",{className:"z-30 w-full shrink-0 select-none overflow-hidden border-b border-tui-border bg-tui-mantle px-2 pt-[max(env(safe-area-inset-top,0px),0.125rem)]",children:f.jsxs("div",{className:"scrollbar-none flex min-h-[var(--tui-row)] items-center gap-2 overflow-x-auto text-tui",children:[f.jsxs("span",{className:"flex shrink-0 items-baseline gap-2",children:[f.jsx("span",{className:"font-bold text-tui-accent",children:"herdr-remote"}),f.jsx("span",{className:"hidden text-tui-sm text-tui-faint sm:inline",children:m("header.tagline")})]}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsx(Rd,{tabs:v,activeId:l,onSelect:w=>i(w),ariaLabel:m("header.mainNavigationAria"),className:"shrink-0 gap-3"}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[f.jsx("button",{type:"button",onClick:b,className:ne(Go,Yo),title:m("header.languageToggleTitle"),"aria-label":m("header.languageToggleTitle"),children:m("header.languageShort")}),l==="terminal"&&f.jsx("button",{type:"button",onClick:r,className:ne(Go,u?SS:Yo),title:m("header.virtualKeyboardTitle"),"aria-label":m("header.virtualKeyboardTitle"),children:m("header.actionKeyboard")}),f.jsx("button",{type:"button",onClick:a,className:ne(Go,Yo),title:m("header.pairingTitle"),"aria-label":m("header.pairingTitle"),children:m("header.actionPairing")}),f.jsx("button",{type:"button",onClick:o,className:ne(Go,Yo),title:m("header.settingsTitle"),"aria-label":m("header.settingsTitle"),children:m("header.actionSettings")})]})]})})},$o=({tone:l,glyph:i,message:a,assertive:o=!1,action:r})=>f.jsxs("aside",{className:ne("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",sn[l].edgeB),"aria-live":o?"assertive":"polite",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",sn[l].text),children:i}),f.jsx("span",{className:"truncate text-tui-text",children:a})]}),r]}),TS=()=>{const{settings:l,t:i}=Le(),{connectionState:a,stateDetail:o,connect:r}=et();return a==="connected"||!l.token&&!l.pairCode&&a==="disconnected"?null:a==="connecting"?f.jsx($o,{tone:"accent",glyph:f.jsx(nl,{}),message:i("statusBanner.connecting")}):a==="reconnecting"?f.jsx($o,{tone:"warn",glyph:f.jsx(nl,{}),assertive:!0,message:o||i("statusBanner.reconnectingDefault"),action:f.jsx(Me,{variant:"warn",onClick:()=>r(),className:"shrink-0",children:i("statusBanner.reconnectNow")})}):a==="error"?f.jsx($o,{tone:"bad",glyph:ke.cross,assertive:!0,message:o||i("statusBanner.errorDefault"),action:f.jsx(Me,{variant:"danger",onClick:()=>r(),className:"shrink-0",children:i("common.retry")})}):a==="disconnected"?f.jsx($o,{tone:"idle",glyph:ke.off,message:i("statusBanner.disconnected"),action:f.jsx(Me,{variant:"primary",onClick:()=>r(),className:"shrink-0",children:i("common.connect")})}):null},Fu="Herdr Remote",Cg=80,MS=/[\u0000-\u001F\u007F-\u009F]/g;function hd(l){if(typeof l!="string")return"";const i=l.replace(MS," ").replace(/\s+/g," ").trim();return i.length<=Cg?i:`${i.slice(0,Cg-1).trimEnd()}…`}function AS(l,i,a){const o=f1(a??null),r=o?`${o} `:"",u=hd(l);if(u)return`${r}${u} · ${Fu}`;const h=hd(i);return h?`${r}${h} · ${Fu}`:`${r}${Fu}`}function ES(l,i,a){const o=AS(l,i,a);return typeof document<"u"&&(document.title=o),o}const NS=new Set(["http:","https:","mailto:"]),Gu=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,kS=/[.,;:!?'"]+$/,Tg=8;function jd(l){return/^www\./i.test(l)?`https://${l}`:l}function LS(l){const i=(r,u)=>r.split(u).length-1;let a=l.replace(kS,"");const o=[["(",")"],["[","]"],["{","}"]];for(const[r,u]of o)for(;a.endsWith(u)&&i(a,u)>i(a,r);)a=a.slice(0,-1);return a}function cy(l){if(typeof l!="string"||l.length===0)return!1;try{return NS.has(new URL(jd(l)).protocol)}catch{return!1}}function RS(l,i){if(typeof l!="string"||i<0)return null;Gu.lastIndex=0;for(let a=Gu.exec(l);a;a=Gu.exec(l)){const o=LS(a[0]);if(!o)continue;const r=a.index,u=r+o.length;if(i>=r&&i<u&&cy(o))return o}return null}function _S(l,i,a){var p;const o=(p=l==null?void 0:l.buffer)==null?void 0:p.active;if(!o||typeof o.getLine!="function"||!o.getLine(a))return null;let r=a;for(let m=0;m<Tg;m+=1){const g=o.getLine(r);if(!(g!=null&&g.isWrapped)||r===0)break;r-=1}let u="",h=-1;for(let m=r;m<r+Tg;m+=1){const g=o.getLine(m);if(!g||m>r&&!g.isWrapped)break;m===a&&(h=u.length+i),u+=g.translateToString(!1)}return h<0?null:{text:u,index:h}}function jS(l,i,a){const o=_S(l,i,a);return o?RS(o.text,o.index):null}function OS(l){try{const i=new URL(jd(l));return i.host||i.pathname}catch{return""}}function md(l){return!cy(l)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(jd(l),"_blank","noopener,noreferrer"),!0)}async function Od(l){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(l),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let i=null,a=null,o=null;try{if(i=document.createElement("textarea"),i.style.userSelect="text",i.style.webkitUserSelect="text",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="1px",i.style.height="1px",i.style.padding="0",i.style.border="none",i.style.outline="none",i.style.boxShadow="none",i.style.background="transparent",i.style.opacity="0",i.style.fontSize="16px",i.setAttribute("readonly",""),i.setAttribute("aria-hidden","true"),i.value=l,typeof window<"u"&&typeof window.getSelection=="function"&&(o=window.getSelection(),o&&o.rangeCount>0&&(a=o.getRangeAt(0))),document.body.appendChild(i),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const h=document.createRange();h.selectNodeContents(i),o&&(o.removeAllRanges(),o.addRange(h)),i.setSelectionRange(0,l.length)}else i.focus({preventScroll:!0}),i.select();if(document.execCommand("copy"))return"exec"}catch{}finally{i!=null&&i.parentNode&&i.parentNode.removeChild(i),o&&(o.removeAllRanges(),a&&o.addRange(a))}}return"failed"}async function DS(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.readText();return!i||i.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:i}}catch(i){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(i==null?void 0:i.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function zS(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.read();if(!i||i.length===0)return{ok:!1,reason:"empty"};for(const a of i){const o=a.types.find(r=>r.startsWith("image/"));if(o){const r=await a.getType(o);if(r&&r.size>0)return{ok:!0,blob:r}}}return{ok:!1,reason:"empty"}}catch(i){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const a=i==null?void 0:i.name;return a==="SecurityError"?{ok:!1,reason:"insecure"}:a==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function uy(l){const i=l.clipboardData;if(!i)return null;if(i.files&&i.files.length>0)for(let a=0;a<i.files.length;a++){const o=i.files[a];if(o!=null&&o.type.startsWith("image/"))return o}if(i.items&&i.items.length>0)for(let a=0;a<i.items.length;a++){const o=i.items[a];if(o!=null&&o.type.startsWith("image/")){const r=o.getAsFile();if(r)return r}}return null}function HS(l){if(!l||l.length===0)return null;for(let i=0;i<l.length;i++){const a=l[i];if(a&&(a.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(a.name)))return a}return null}const BS=({isOpen:l,onClose:i,onSend:a,onSendImage:o})=>{const{t:r}=Le(),{addToast:u}=rn(),[h,p]=C.useState(""),[m,g]=C.useState(null),[b,v]=C.useState(!1),w=C.useRef(null),x=C.useRef(null),T=C.useRef(null);C.useEffect(()=>{l&&(p(""),g(null),v(!1),w.current&&(w.current.value=""),x.current&&(x.current.value=""))},[l]);const M=async z=>{if(z.size===0){u("error",r("clipboard.fileEmpty"));return}v(!0);try{const L=await kb(z);L?(g(L),p("")):u("error",r("clipboard.imageTooLarge"))}catch(L){console.error("Failed to process image:",L),u("error",r("clipboard.imageTooLarge"))}finally{v(!1)}},A=async z=>{const L=uy(z);L&&(z.preventDefault(),await M(L))},R=async z=>{const L=HS(z.target.files);z.target.value="",L&&await M(L)},k=z=>{const L=z.target.value;p(L),L&&m&&g(null)},O=()=>{g(null),w.current&&(w.current.value=""),x.current&&(x.current.value="")},$=()=>{m?(o==null||o(m),i()):h.trim()&&(a(h),i())},_=!!(h.trim()||m);return f.jsx(hr,{isOpen:l,onClose:i,title:r("clipboard.pasteTitle"),closeLabel:r("clipboard.cancel"),size:"sm",footer:f.jsxs("div",{className:"flex items-center justify-end gap-2",children:[f.jsx(Me,{variant:"ghost",onClick:i,children:r("clipboard.cancel")}),f.jsx(Me,{variant:"primary",onClick:$,disabled:!_||b,children:r("clipboard.pasteSend")})]}),children:f.jsxs("div",{className:"flex flex-col gap-3 p-3 font-mono select-text",children:[f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsx("label",{htmlFor:"paste-fallback-input",className:"text-tui-sm text-tui-muted font-sans font-medium",children:r("clipboard.pasteHint")}),f.jsx("textarea",{ref:T,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:r("clipboard.pasteHint"),value:h,onChange:k,onPaste:A,disabled:!!m||b,className:"tui-input min-h-[90px] w-full resize-none p-2 text-tui font-mono rounded border border-tui-border bg-tui-bg focus:outline-none focus:ring-1 focus:ring-tui-accent disabled:opacity-50"})]}),f.jsxs("div",{className:"relative my-1",children:[f.jsx("div",{className:"absolute inset-0 flex items-center",children:f.jsx("div",{className:"w-full border-t border-tui-border"})}),f.jsx("div",{className:"relative flex justify-center text-tui-xs uppercase",children:f.jsx("span",{className:"bg-tui-bg px-2 text-tui-muted font-sans",children:r("clipboard.imageSectionTitle")})})]}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx("input",{ref:w,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:R}),f.jsx("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:R}),m?f.jsxs("div",{className:"flex flex-col items-center gap-2 p-3 border border-tui-border bg-tui-bg rounded",children:[f.jsx("img",{src:m.dataUrl,alt:"Pasted preview","data-testid":"pasted-image-preview",className:"max-h-40 max-w-full object-contain rounded border border-tui-border"}),f.jsxs("div",{className:"flex items-center justify-between w-full text-tui-xs text-tui-muted pt-1",children:[f.jsx("span",{children:r("clipboard.imageCompressedSize",{size:Kw(m.byteLength)})}),f.jsx(Me,{variant:"ghost",onClick:O,"aria-label":r("clipboard.removeImage"),children:r("clipboard.cancel")})]})]}):f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Me,{variant:"default",onClick:()=>{var z;return(z=w.current)==null?void 0:z.click()},disabled:b||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.chooseImage"),children:r("clipboard.chooseImage")}),f.jsx(Me,{variant:"default",onClick:()=>{var z;return(z=x.current)==null?void 0:z.click()},disabled:b||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.takePhoto"),children:r("clipboard.takePhoto")})]}),b&&f.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:f.jsx("span",{children:r("clipboard.imageCompressing")})})]})]})})},Yl="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",$l="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",US=({anchorPoint:l,hasSelection:i,isController:a,vibrateOnKeyPress:o=!1,linkUrl:r=null,onOpenLink:u,onCopySelection:h,onCopyLine:p,onCopyScreen:m,onPaste:g,onClose:b})=>{const{t:v}=Le(),w=C.useRef(null),[x,T]=C.useState(null);C.useEffect(()=>{if(o&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[o]),C.useLayoutEffect(()=>{const k=w.current;if(!(k!=null&&k.parentElement))return;const O=k.parentElement.getBoundingClientRect(),$=k.getBoundingClientRect(),_=$.width||208,z=$.height||220,L=O.width,D=O.height;let K=l.x-_/2;K=Math.max(8,Math.min(Math.max(8,L-_-8),K));let J=l.y-z-8;J<8&&(J=l.y+8),J=Math.max(8,Math.min(Math.max(8,D-z-8),J)),T({x:K,y:J})},[l.x,l.y,i,a,r]);const M=Math.max(8,l.x-104),A=Math.max(8,l.y-200),R={position:"absolute",left:`${x?x.x:M}px`,top:`${x?x.y:A}px`,visibility:x?"visible":"hidden"};return f.jsx("div",{ref:w,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:R,onMouseDown:k=>k.stopPropagation(),onTouchStart:k=>k.stopPropagation(),onPointerDown:k=>k.stopPropagation(),children:f.jsxs(Tt,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[r&&u&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Yl,$l),onClick:()=>{u(r),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.openLink")}),f.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:OS(r)})]}),i&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Yl,$l),onClick:()=>{h(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copySelection")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Yl,$l),onClick:()=>{p(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyLine")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Yl,$l),onClick:()=>{m(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyScreen")})]}),a&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Yl,$l),onClick:()=>{g(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.paste")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Yl,$l),onClick:b,children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.cancel")})]})]})})},KS={state:"idle",deltaY:0,lines:0,viewportY:null,scrollTop:null,scrollHeight:null,clientHeight:null,moved:!1,focused:!1,bufferType:null,baseY:null,cursorY:null,hasScrollback:null,mouseTracking:!1,scrollMode:"none",scrollCalls:0,lastScrollLines:null,lastInputEvent:"",pointerEvents:0,touchEvents:0};function IS(){return typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1"}function FS(l){const i=C.useRef([]),[a,o]=C.useState({framesPerSec:0,bytesPerSec:0}),r=C.useCallback(h=>{const p=h-1e3,m=i.current;for(;m.length>0&&m[0].time<p;)m.shift()},[]);C.useEffect(()=>{if(!l)return;const h=setInterval(()=>{r(performance.now());let p=0;for(const m of i.current)p+=m.bytes;o({framesPerSec:i.current.length,bytesPerSec:p})},1e3);return()=>clearInterval(h)},[l,r]);const u=C.useCallback(h=>{const p=performance.now();i.current.push({time:p,bytes:h}),r(p)},[r]);return{metrics:a,record:u}}function GS(l){return l?`${l.kind} row ${l.row} cols ${l.startCol}-${l.endCol} caret ${l.caretCol}`:"none"}function YS(l){var o;const i=(o=l==null?void 0:l.canvas)==null?void 0:o.stats;if(!i)return`paint: ${(l==null?void 0:l.kind)??"-"} renderer
32
+ `+s.stack}}var Xn=Object.prototype.hasOwnProperty,kt=l.unstable_scheduleCallback,Cn=l.unstable_cancelCallback,ps=l.unstable_shouldYield,gs=l.unstable_requestPaint,St=l.unstable_now,bs=l.unstable_getCurrentPriorityLevel,la=l.unstable_ImmediatePriority,aa=l.unstable_UserBlockingPriority,Li=l.unstable_NormalPriority,ys=l.unstable_LowPriority,sa=l.unstable_IdlePriority,vs=l.log,xs=l.unstable_setDisableYieldValue,Ri=null,Mt=null;function cn(e){if(typeof vs=="function"&&xs(e),Mt&&typeof Mt.setStrictMode=="function")try{Mt.setStrictMode(Ri,e)}catch{}}var Ct=Math.clz32?Math.clz32:qt,ge=Math.log,We=Math.LN2;function qt(e){return e>>>=0,e===0?32:31-(ge(e)/We|0)|0}var Vt=256,_i=262144,ws=4194304;function ji(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 Ss(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var c=0,d=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var S=s&134217727;return S!==0?(s=S&~d,s!==0?c=ji(s):(y&=S,y!==0?c=ji(y):n||(n=S&~e,n!==0&&(c=ji(n))))):(S=s&~d,S!==0?c=ji(S):y!==0?c=ji(y):n||(n=s&~e,n!==0&&(c=ji(n)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,n=t&-t,d>=n||d===32&&(n&4194048)!==0)?t:c}function oa(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Vy(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 Gd(){var e=ws;return ws<<=1,(ws&62914560)===0&&(ws=4194304),e}function gr(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ra(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Py(e,t,n,s,c,d){var y=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 S=e.entanglements,N=e.expirationTimes,F=e.hiddenUpdates;for(n=y&~n;0<n;){var Z=31-Ct(n),te=1<<Z;S[Z]=0,N[Z]=-1;var Y=F[Z];if(Y!==null)for(F[Z]=null,Z=0;Z<Y.length;Z++){var q=Y[Z];q!==null&&(q.lane&=-536870913)}n&=~te}s!==0&&Yd(e,s,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(y&~t))}function Yd(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Ct(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function $d(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Ct(n),c=1<<s;c&t|e[s]&t&&(e[s]|=t),n&=~c}}function qd(e,t){var n=t&-t;return n=(n&42)!==0?1:br(n),(n&(e.suspendedLanes|t))!==0?0:n}function br(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 yr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Vd(){var e=G.p;return e!==0?e:(e=window.event,e===void 0?32:jp(e.type))}function Pd(e,t){var n=G.p;try{return G.p=e,t()}finally{G.p=n}}var Qn=Math.random().toString(36).slice(2),gt="__reactFiber$"+Qn,Lt="__reactProps$"+Qn,sl="__reactContainer$"+Qn,vr="__reactEvents$"+Qn,Xy="__reactListeners$"+Qn,Qy="__reactHandles$"+Qn,Xd="__reactResources$"+Qn,ca="__reactMarker$"+Qn;function xr(e){delete e[gt],delete e[Lt],delete e[vr],delete e[Xy],delete e[Qy]}function ol(e){var t=e[gt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[sl]||n[gt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=bp(e);e!==null;){if(n=e[gt])return n;e=bp(e)}return t}e=n,n=e.parentNode}return null}function rl(e){if(e=e[gt]||e[sl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ua(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function cl(e){var t=e[Xd];return t||(t=e[Xd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ht(e){e[ca]=!0}var Qd=new Set,Zd={};function Oi(e,t){ul(e,t),ul(e+"Capture",t)}function ul(e,t){for(Zd[e]=t,e=0;e<t.length;e++)Qd.add(t[e])}var Zy=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]*$"),Wd={},Jd={};function Wy(e){return Xn.call(Jd,e)?!0:Xn.call(Wd,e)?!1:Zy.test(e)?Jd[e]=!0:(Wd[e]=!0,!1)}function Cs(e,t,n){if(Wy(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Ts(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 Tn(e,t,n,s){if(s===null)e.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+s)}}function Pt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ef(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Jy(e,t,n){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,d=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(y){n=""+y,d.call(this,y)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(y){n=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function wr(e){if(!e._valueTracker){var t=ef(e)?"checked":"value";e._valueTracker=Jy(e,t,""+e[t])}}function tf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=ef(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Ms(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 e0=/[\n"\\]/g;function Xt(e){return e.replace(e0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Sr(e,t,n,s,c,d,y,S){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Pt(t)):e.value!==""+Pt(t)&&(e.value=""+Pt(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?Cr(e,y,Pt(t)):n!=null?Cr(e,y,Pt(n)):s!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.name=""+Pt(S):e.removeAttribute("name")}function nf(e,t,n,s,c,d,y,S){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||n!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){wr(e);return}n=n!=null?""+Pt(n):"",t=t!=null?""+Pt(t):n,S||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=S?e.checked:!!s,e.defaultChecked=!!s,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),wr(e)}function Cr(e,t,n){t==="number"&&Ms(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function dl(e,t,n,s){if(e=e.options,t){t={};for(var c=0;c<n.length;c++)t["$"+n[c]]=!0;for(n=0;n<e.length;n++)c=t.hasOwnProperty("$"+e[n].value),e[n].selected!==c&&(e[n].selected=c),c&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Pt(n),t=null,c=0;c<e.length;c++){if(e[c].value===n){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function lf(e,t,n){if(t!=null&&(t=""+Pt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Pt(n):""}function af(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(o(92));if(U(s)){if(1<s.length)throw Error(o(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=Pt(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),wr(e)}function fl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var t0=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 sf(e,t,n){var s=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,n):typeof n!="number"||n===0||t0.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function of(e,t,n){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,n!=null){for(var s in n)!n.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var c in t)s=t[c],t.hasOwnProperty(c)&&n[c]!==s&&sf(e,c,s)}else for(var d in t)t.hasOwnProperty(d)&&sf(e,d,t[d])}function Tr(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 n0=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"]]),i0=/^[\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 As(e){return i0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Mn(){}var Mr=null;function Ar(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hl=null,ml=null;function rf(e){var t=rl(e);if(t&&(e=t.stateNode)){var n=e[Lt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Sr(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="'+Xt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var c=s[Lt]||null;if(!c)throw Error(o(90));Sr(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<n.length;t++)s=n[t],s.form===e.form&&tf(s)}break e;case"textarea":lf(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&dl(e,!!n.multiple,t,!1)}}}var Er=!1;function cf(e,t,n){if(Er)return e(t,n);Er=!0;try{var s=e(t);return s}finally{if(Er=!1,(hl!==null||ml!==null)&&(mo(),hl&&(t=hl,e=ml,ml=hl=null,rf(t),e)))for(t=0;t<e.length;t++)rf(e[t])}}function da(e,t){var n=e.stateNode;if(n===null)return null;var s=n[Lt]||null;if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(o(231,t,typeof n));return n}var An=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Nr=!1;if(An)try{var fa={};Object.defineProperty(fa,"passive",{get:function(){Nr=!0}}),window.addEventListener("test",fa,fa),window.removeEventListener("test",fa,fa)}catch{Nr=!1}var Zn=null,kr=null,Es=null;function uf(){if(Es)return Es;var e,t=kr,n=t.length,s,c="value"in Zn?Zn.value:Zn.textContent,d=c.length;for(e=0;e<n&&t[e]===c[e];e++);var y=n-e;for(s=1;s<=y&&t[n-s]===c[d-s];s++);return Es=c.slice(e,1<s?1-s:void 0)}function Ns(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 ks(){return!0}function df(){return!1}function Rt(e){function t(n,s,c,d,y){this._reactName=n,this._targetInst=c,this.type=s,this.nativeEvent=d,this.target=y,this.currentTarget=null;for(var S in e)e.hasOwnProperty(S)&&(n=e[S],this[S]=n?n(d):d[S]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?ks:df,this.isPropagationStopped=df,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ks)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ks)},persist:function(){},isPersistent:ks}),t}var Di={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ls=Rt(Di),ha=v({},Di,{view:0,detail:0}),l0=Rt(ha),Lr,Rr,ma,Rs=v({},ha,{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!==ma&&(ma&&e.type==="mousemove"?(Lr=e.screenX-ma.screenX,Rr=e.screenY-ma.screenY):Rr=Lr=0,ma=e),Lr)},movementY:function(e){return"movementY"in e?e.movementY:Rr}}),ff=Rt(Rs),a0=v({},Rs,{dataTransfer:0}),s0=Rt(a0),o0=v({},ha,{relatedTarget:0}),_r=Rt(o0),r0=v({},Di,{animationName:0,elapsedTime:0,pseudoElement:0}),c0=Rt(r0),u0=v({},Di,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),d0=Rt(u0),f0=v({},Di,{data:0}),hf=Rt(f0),h0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},m0={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"},p0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function g0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=p0[e])?!!t[e]:!1}function jr(){return g0}var b0=v({},ha,{key:function(e){if(e.key){var t=h0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ns(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?m0[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"?Ns(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ns(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),y0=Rt(b0),v0=v({},Rs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),mf=Rt(v0),x0=v({},ha,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jr}),w0=Rt(x0),S0=v({},Di,{propertyName:0,elapsedTime:0,pseudoElement:0}),C0=Rt(S0),T0=v({},Rs,{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}),M0=Rt(T0),A0=v({},Di,{newState:0,oldState:0}),E0=Rt(A0),N0=[9,13,27,32],Or=An&&"CompositionEvent"in window,pa=null;An&&"documentMode"in document&&(pa=document.documentMode);var k0=An&&"TextEvent"in window&&!pa,pf=An&&(!Or||pa&&8<pa&&11>=pa),gf=" ",bf=!1;function yf(e,t){switch(e){case"keyup":return N0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var pl=!1;function L0(e,t){switch(e){case"compositionend":return vf(t);case"keypress":return t.which!==32?null:(bf=!0,gf);case"textInput":return e=t.data,e===gf&&bf?null:e;default:return null}}function R0(e,t){if(pl)return e==="compositionend"||!Or&&yf(e,t)?(e=uf(),Es=kr=Zn=null,pl=!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 pf&&t.locale!=="ko"?null:t.data;default:return null}}var _0={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 xf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!_0[e.type]:t==="textarea"}function wf(e,t,n,s){hl?ml?ml.push(s):ml=[s]:hl=s,t=wo(t,"onChange"),0<t.length&&(n=new Ls("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var ga=null,ba=null;function j0(e){ip(e,0)}function _s(e){var t=ua(e);if(tf(t))return e}function Sf(e,t){if(e==="change")return t}var Cf=!1;if(An){var Dr;if(An){var zr="oninput"in document;if(!zr){var Tf=document.createElement("div");Tf.setAttribute("oninput","return;"),zr=typeof Tf.oninput=="function"}Dr=zr}else Dr=!1;Cf=Dr&&(!document.documentMode||9<document.documentMode)}function Mf(){ga&&(ga.detachEvent("onpropertychange",Af),ba=ga=null)}function Af(e){if(e.propertyName==="value"&&_s(ba)){var t=[];wf(t,ba,e,Ar(e)),cf(j0,t)}}function O0(e,t,n){e==="focusin"?(Mf(),ga=t,ba=n,ga.attachEvent("onpropertychange",Af)):e==="focusout"&&Mf()}function D0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return _s(ba)}function z0(e,t){if(e==="click")return _s(t)}function H0(e,t){if(e==="input"||e==="change")return _s(t)}function B0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ut=typeof Object.is=="function"?Object.is:B0;function ya(e,t){if(Ut(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var c=n[s];if(!Xn.call(t,c)||!Ut(e[c],t[c]))return!1}return!0}function Ef(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Nf(e,t){var n=Ef(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ef(n)}}function kf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?kf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Lf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ms(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=Ms(e.document)}return t}function Hr(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 U0=An&&"documentMode"in document&&11>=document.documentMode,gl=null,Br=null,va=null,Ur=!1;function Rf(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ur||gl==null||gl!==Ms(s)||(s=gl,"selectionStart"in s&&Hr(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),va&&ya(va,s)||(va=s,s=wo(Br,"onSelect"),0<s.length&&(t=new Ls("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=gl)))}function zi(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var bl={animationend:zi("Animation","AnimationEnd"),animationiteration:zi("Animation","AnimationIteration"),animationstart:zi("Animation","AnimationStart"),transitionrun:zi("Transition","TransitionRun"),transitionstart:zi("Transition","TransitionStart"),transitioncancel:zi("Transition","TransitionCancel"),transitionend:zi("Transition","TransitionEnd")},Kr={},_f={};An&&(_f=document.createElement("div").style,"AnimationEvent"in window||(delete bl.animationend.animation,delete bl.animationiteration.animation,delete bl.animationstart.animation),"TransitionEvent"in window||delete bl.transitionend.transition);function Hi(e){if(Kr[e])return Kr[e];if(!bl[e])return e;var t=bl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in _f)return Kr[e]=t[n];return e}var jf=Hi("animationend"),Of=Hi("animationiteration"),Df=Hi("animationstart"),K0=Hi("transitionrun"),I0=Hi("transitionstart"),F0=Hi("transitioncancel"),zf=Hi("transitionend"),Hf=new Map,Ir="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(" ");Ir.push("scrollEnd");function un(e,t){Hf.set(e,t),Oi(t,[e])}var js=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Qt=[],yl=0,Fr=0;function Os(){for(var e=yl,t=Fr=yl=0;t<e;){var n=Qt[t];Qt[t++]=null;var s=Qt[t];Qt[t++]=null;var c=Qt[t];Qt[t++]=null;var d=Qt[t];if(Qt[t++]=null,s!==null&&c!==null){var y=s.pending;y===null?c.next=c:(c.next=y.next,y.next=c),s.pending=c}d!==0&&Bf(n,c,d)}}function Ds(e,t,n,s){Qt[yl++]=e,Qt[yl++]=t,Qt[yl++]=n,Qt[yl++]=s,Fr|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Gr(e,t,n,s){return Ds(e,t,n,s),zs(e)}function Bi(e,t){return Ds(e,null,null,t),zs(e)}function Bf(e,t,n){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n);for(var c=!1,d=e.return;d!==null;)d.childLanes|=n,s=d.alternate,s!==null&&(s.childLanes|=n),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-Ct(n),e=d.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=n|536870912),d):null}function zs(e){if(50<Ia)throw Ia=0,Wc=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var vl={};function G0(e,t,n,s){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=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kt(e,t,n,s){return new G0(e,t,n,s)}function Yr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function En(e,t){var n=e.alternate;return n===null?(n=Kt(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 Uf(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 Hs(e,t,n,s,c,d){var y=0;if(s=e,typeof e=="function")Yr(e)&&(y=1);else if(typeof e=="string")y=Pv(e,n,me.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case K:return e=Kt(31,n,t,c),e.elementType=K,e.lanes=d,e;case M:return Ui(n.children,c,d,t);case A:y=8,c|=24;break;case R:return e=Kt(12,n,t,c|2),e.elementType=R,e.lanes=d,e;case _:return e=Kt(13,n,t,c),e.elementType=_,e.lanes=d,e;case z:return e=Kt(19,n,t,c),e.elementType=z,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O:y=10;break e;case k:y=9;break e;case $:y=11;break e;case L:y=14;break e;case D:y=16,s=null;break e}y=29,n=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=Kt(y,n,t,c),t.elementType=e,t.type=s,t.lanes=d,t}function Ui(e,t,n,s){return e=Kt(7,e,s,t),e.lanes=n,e}function $r(e,t,n){return e=Kt(6,e,null,t),e.lanes=n,e}function Kf(e){var t=Kt(18,null,null,0);return t.stateNode=e,t}function qr(e,t,n){return t=Kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var If=new WeakMap;function Zt(e,t){if(typeof e=="object"&&e!==null){var n=If.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Pn(t)},If.set(e,t),t)}return{value:e,source:t,stack:Pn(t)}}var xl=[],wl=0,Bs=null,xa=0,Wt=[],Jt=0,Wn=null,mn=1,pn="";function Nn(e,t){xl[wl++]=xa,xl[wl++]=Bs,Bs=e,xa=t}function Ff(e,t,n){Wt[Jt++]=mn,Wt[Jt++]=pn,Wt[Jt++]=Wn,Wn=e;var s=mn;e=pn;var c=32-Ct(s)-1;s&=~(1<<c),n+=1;var d=32-Ct(t)+c;if(30<d){var y=c-c%5;d=(s&(1<<y)-1).toString(32),s>>=y,c-=y,mn=1<<32-Ct(t)+c|n<<c|s,pn=d+e}else mn=1<<d|n<<c|s,pn=e}function Vr(e){e.return!==null&&(Nn(e,1),Ff(e,1,0))}function Pr(e){for(;e===Bs;)Bs=xl[--wl],xl[wl]=null,xa=xl[--wl],xl[wl]=null;for(;e===Wn;)Wn=Wt[--Jt],Wt[Jt]=null,pn=Wt[--Jt],Wt[Jt]=null,mn=Wt[--Jt],Wt[Jt]=null}function Gf(e,t){Wt[Jt++]=mn,Wt[Jt++]=pn,Wt[Jt++]=Wn,mn=t.id,pn=t.overflow,Wn=e}var bt=null,Xe=null,He=!1,Jn=null,en=!1,Xr=Error(o(519));function ei(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wa(Zt(t,e)),Xr}function Yf(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[gt]=e,t[Lt]=s,n){case"dialog":Oe("cancel",t),Oe("close",t);break;case"iframe":case"object":case"embed":Oe("load",t);break;case"video":case"audio":for(n=0;n<Ga.length;n++)Oe(Ga[n],t);break;case"source":Oe("error",t);break;case"img":case"image":case"link":Oe("error",t),Oe("load",t);break;case"details":Oe("toggle",t);break;case"input":Oe("invalid",t),nf(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Oe("invalid",t);break;case"textarea":Oe("invalid",t),af(t,s.value,s.defaultValue,s.children)}n=s.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||s.suppressHydrationWarning===!0||op(t.textContent,n)?(s.popover!=null&&(Oe("beforetoggle",t),Oe("toggle",t)),s.onScroll!=null&&Oe("scroll",t),s.onScrollEnd!=null&&Oe("scrollend",t),s.onClick!=null&&(t.onclick=Mn),t=!0):t=!1,t||ei(e,!0)}function $f(e){for(bt=e.return;bt;)switch(bt.tag){case 5:case 31:case 13:en=!1;return;case 27:case 3:en=!0;return;default:bt=bt.return}}function Sl(e){if(e!==bt)return!1;if(!He)return $f(e),He=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||hu(e.type,e.memoizedProps)),n=!n),n&&Xe&&ei(e),$f(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Xe=gp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Xe=gp(e)}else t===27?(t=Xe,mi(e.type)?(e=yu,yu=null,Xe=e):Xe=t):Xe=bt?nn(e.stateNode.nextSibling):null;return!0}function Ki(){Xe=bt=null,He=!1}function Qr(){var e=Jn;return e!==null&&(Dt===null?Dt=e:Dt.push.apply(Dt,e),Jn=null),e}function wa(e){Jn===null?Jn=[e]:Jn.push(e)}var Zr=xe(null),Ii=null,kn=null;function ti(e,t,n){ve(Zr,t._currentValue),t._currentValue=n}function Ln(e){e._currentValue=Zr.current,ye(Zr)}function Wr(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function Jr(e,t,n,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var y=c.child;d=d.firstContext;e:for(;d!==null;){var S=d;d=c;for(var N=0;N<t.length;N++)if(S.context===t[N]){d.lanes|=n,S=d.alternate,S!==null&&(S.lanes|=n),Wr(d.return,n,e),s||(y=null);break e}d=S.next}}else if(c.tag===18){if(y=c.return,y===null)throw Error(o(341));y.lanes|=n,d=y.alternate,d!==null&&(d.lanes|=n),Wr(y,n,e),y=null}else y=c.child;if(y!==null)y.return=c;else for(y=c;y!==null;){if(y===e){y=null;break}if(c=y.sibling,c!==null){c.return=y.return,y=c;break}y=y.return}c=y}}function Cl(e,t,n,s){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var y=c.alternate;if(y===null)throw Error(o(387));if(y=y.memoizedProps,y!==null){var S=c.type;Ut(c.pendingProps.value,y.value)||(e!==null?e.push(S):e=[S])}}else if(c===se.current){if(y=c.alternate,y===null)throw Error(o(387));y.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(Pa):e=[Pa])}c=c.return}e!==null&&Jr(t,e,n,s),t.flags|=262144}function Us(e){for(e=e.firstContext;e!==null;){if(!Ut(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Fi(e){Ii=e,kn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return qf(Ii,e)}function Ks(e,t){return Ii===null&&Fi(e),qf(e,t)}function qf(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},kn===null){if(e===null)throw Error(o(308));kn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else kn=kn.next=t;return n}var Y0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},$0=l.unstable_scheduleCallback,q0=l.unstable_NormalPriority,at={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ec(){return{controller:new Y0,data:new Map,refCount:0}}function Sa(e){e.refCount--,e.refCount===0&&$0(q0,function(){e.controller.abort()})}var Ca=null,tc=0,Tl=0,Ml=null;function V0(e,t){if(Ca===null){var n=Ca=[];tc=0,Tl=lu(),Ml={status:"pending",value:void 0,then:function(s){n.push(s)}}}return tc++,t.then(Vf,Vf),t}function Vf(){if(--tc===0&&Ca!==null){Ml!==null&&(Ml.status="fulfilled");var e=Ca;Ca=null,Tl=0,Ml=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function P0(e,t){var n=[],s={status:"pending",value:null,reason:null,then:function(c){n.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<n.length;c++)(0,n[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<n.length;c++)(0,n[c])(void 0)}),s}var Pf=E.S;E.S=function(e,t){Rm=St(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&V0(e,t),Pf!==null&&Pf(e,t)};var Gi=xe(null);function nc(){var e=Gi.current;return e!==null?e:Ve.pooledCache}function Is(e,t){t===null?ve(Gi,Gi.current):ve(Gi,t.pool)}function Xf(){var e=nc();return e===null?null:{parent:at._currentValue,pool:e}}var Al=Error(o(460)),ic=Error(o(474)),Fs=Error(o(542)),Gs={then:function(){}};function Qf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Zf(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Mn,Mn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Jf(e),e;default:if(typeof t.status=="string")t.then(Mn,Mn);else{if(e=Ve,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=s}},function(s){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Jf(e),e}throw $i=t,Al}}function Yi(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?($i=n,Al):n}}var $i=null;function Wf(){if($i===null)throw Error(o(459));var e=$i;return $i=null,e}function Jf(e){if(e===Al||e===Fs)throw Error(o(483))}var El=null,Ta=0;function Ys(e){var t=Ta;return Ta+=1,El===null&&(El=[]),Zf(El,e,t)}function Ma(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function $s(e,t){throw t.$$typeof===w?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function eh(e){function t(B,j){if(e){var I=B.deletions;I===null?(B.deletions=[j],B.flags|=16):I.push(j)}}function n(B,j){if(!e)return null;for(;j!==null;)t(B,j),j=j.sibling;return null}function s(B){for(var j=new Map;B!==null;)B.key!==null?j.set(B.key,B):j.set(B.index,B),B=B.sibling;return j}function c(B,j){return B=En(B,j),B.index=0,B.sibling=null,B}function d(B,j,I){return B.index=I,e?(I=B.alternate,I!==null?(I=I.index,I<j?(B.flags|=67108866,j):I):(B.flags|=67108866,j)):(B.flags|=1048576,j)}function y(B){return e&&B.alternate===null&&(B.flags|=67108866),B}function S(B,j,I,ee){return j===null||j.tag!==6?(j=$r(I,B.mode,ee),j.return=B,j):(j=c(j,I),j.return=B,j)}function N(B,j,I,ee){var Ce=I.type;return Ce===M?Z(B,j,I.props.children,ee,I.key):j!==null&&(j.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===D&&Yi(Ce)===j.type)?(j=c(j,I.props),Ma(j,I),j.return=B,j):(j=Hs(I.type,I.key,I.props,null,B.mode,ee),Ma(j,I),j.return=B,j)}function F(B,j,I,ee){return j===null||j.tag!==4||j.stateNode.containerInfo!==I.containerInfo||j.stateNode.implementation!==I.implementation?(j=qr(I,B.mode,ee),j.return=B,j):(j=c(j,I.children||[]),j.return=B,j)}function Z(B,j,I,ee,Ce){return j===null||j.tag!==7?(j=Ui(I,B.mode,ee,Ce),j.return=B,j):(j=c(j,I),j.return=B,j)}function te(B,j,I){if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return j=$r(""+j,B.mode,I),j.return=B,j;if(typeof j=="object"&&j!==null){switch(j.$$typeof){case x:return I=Hs(j.type,j.key,j.props,null,B.mode,I),Ma(I,j),I.return=B,I;case T:return j=qr(j,B.mode,I),j.return=B,j;case D:return j=Yi(j),te(B,j,I)}if(U(j)||X(j))return j=Ui(j,B.mode,I,null),j.return=B,j;if(typeof j.then=="function")return te(B,Ys(j),I);if(j.$$typeof===O)return te(B,Ks(B,j),I);$s(B,j)}return null}function Y(B,j,I,ee){var Ce=j!==null?j.key:null;if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return Ce!==null?null:S(B,j,""+I,ee);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case x:return I.key===Ce?N(B,j,I,ee):null;case T:return I.key===Ce?F(B,j,I,ee):null;case D:return I=Yi(I),Y(B,j,I,ee)}if(U(I)||X(I))return Ce!==null?null:Z(B,j,I,ee,null);if(typeof I.then=="function")return Y(B,j,Ys(I),ee);if(I.$$typeof===O)return Y(B,j,Ks(B,I),ee);$s(B,I)}return null}function q(B,j,I,ee,Ce){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return B=B.get(I)||null,S(j,B,""+ee,Ce);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case x:return B=B.get(ee.key===null?I:ee.key)||null,N(j,B,ee,Ce);case T:return B=B.get(ee.key===null?I:ee.key)||null,F(j,B,ee,Ce);case D:return ee=Yi(ee),q(B,j,I,ee,Ce)}if(U(ee)||X(ee))return B=B.get(I)||null,Z(j,B,ee,Ce,null);if(typeof ee.then=="function")return q(B,j,I,Ys(ee),Ce);if(ee.$$typeof===O)return q(B,j,I,Ks(j,ee),Ce);$s(j,ee)}return null}function he(B,j,I,ee){for(var Ce=null,Ue=null,be=j,Re=j=0,ze=null;be!==null&&Re<I.length;Re++){be.index>Re?(ze=be,be=null):ze=be.sibling;var Ke=Y(B,be,I[Re],ee);if(Ke===null){be===null&&(be=ze);break}e&&be&&Ke.alternate===null&&t(B,be),j=d(Ke,j,Re),Ue===null?Ce=Ke:Ue.sibling=Ke,Ue=Ke,be=ze}if(Re===I.length)return n(B,be),He&&Nn(B,Re),Ce;if(be===null){for(;Re<I.length;Re++)be=te(B,I[Re],ee),be!==null&&(j=d(be,j,Re),Ue===null?Ce=be:Ue.sibling=be,Ue=be);return He&&Nn(B,Re),Ce}for(be=s(be);Re<I.length;Re++)ze=q(be,B,Re,I[Re],ee),ze!==null&&(e&&ze.alternate!==null&&be.delete(ze.key===null?Re:ze.key),j=d(ze,j,Re),Ue===null?Ce=ze:Ue.sibling=ze,Ue=ze);return e&&be.forEach(function(vi){return t(B,vi)}),He&&Nn(B,Re),Ce}function Te(B,j,I,ee){if(I==null)throw Error(o(151));for(var Ce=null,Ue=null,be=j,Re=j=0,ze=null,Ke=I.next();be!==null&&!Ke.done;Re++,Ke=I.next()){be.index>Re?(ze=be,be=null):ze=be.sibling;var vi=Y(B,be,Ke.value,ee);if(vi===null){be===null&&(be=ze);break}e&&be&&vi.alternate===null&&t(B,be),j=d(vi,j,Re),Ue===null?Ce=vi:Ue.sibling=vi,Ue=vi,be=ze}if(Ke.done)return n(B,be),He&&Nn(B,Re),Ce;if(be===null){for(;!Ke.done;Re++,Ke=I.next())Ke=te(B,Ke.value,ee),Ke!==null&&(j=d(Ke,j,Re),Ue===null?Ce=Ke:Ue.sibling=Ke,Ue=Ke);return He&&Nn(B,Re),Ce}for(be=s(be);!Ke.done;Re++,Ke=I.next())Ke=q(be,B,Re,Ke.value,ee),Ke!==null&&(e&&Ke.alternate!==null&&be.delete(Ke.key===null?Re:Ke.key),j=d(Ke,j,Re),Ue===null?Ce=Ke:Ue.sibling=Ke,Ue=Ke);return e&&be.forEach(function(ax){return t(B,ax)}),He&&Nn(B,Re),Ce}function qe(B,j,I,ee){if(typeof I=="object"&&I!==null&&I.type===M&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case x:e:{for(var Ce=I.key;j!==null;){if(j.key===Ce){if(Ce=I.type,Ce===M){if(j.tag===7){n(B,j.sibling),ee=c(j,I.props.children),ee.return=B,B=ee;break e}}else if(j.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===D&&Yi(Ce)===j.type){n(B,j.sibling),ee=c(j,I.props),Ma(ee,I),ee.return=B,B=ee;break e}n(B,j);break}else t(B,j);j=j.sibling}I.type===M?(ee=Ui(I.props.children,B.mode,ee,I.key),ee.return=B,B=ee):(ee=Hs(I.type,I.key,I.props,null,B.mode,ee),Ma(ee,I),ee.return=B,B=ee)}return y(B);case T:e:{for(Ce=I.key;j!==null;){if(j.key===Ce)if(j.tag===4&&j.stateNode.containerInfo===I.containerInfo&&j.stateNode.implementation===I.implementation){n(B,j.sibling),ee=c(j,I.children||[]),ee.return=B,B=ee;break e}else{n(B,j);break}else t(B,j);j=j.sibling}ee=qr(I,B.mode,ee),ee.return=B,B=ee}return y(B);case D:return I=Yi(I),qe(B,j,I,ee)}if(U(I))return he(B,j,I,ee);if(X(I)){if(Ce=X(I),typeof Ce!="function")throw Error(o(150));return I=Ce.call(I),Te(B,j,I,ee)}if(typeof I.then=="function")return qe(B,j,Ys(I),ee);if(I.$$typeof===O)return qe(B,j,Ks(B,I),ee);$s(B,I)}return typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint"?(I=""+I,j!==null&&j.tag===6?(n(B,j.sibling),ee=c(j,I),ee.return=B,B=ee):(n(B,j),ee=$r(I,B.mode,ee),ee.return=B,B=ee),y(B)):n(B,j)}return function(B,j,I,ee){try{Ta=0;var Ce=qe(B,j,I,ee);return El=null,Ce}catch(be){if(be===Al||be===Fs)throw be;var Ue=Kt(29,be,null,B.mode);return Ue.lanes=ee,Ue.return=B,Ue}finally{}}}var qi=eh(!0),th=eh(!1),ni=!1;function lc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ac(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 ii(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function li(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ie&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=zs(e),Bf(e,null,n),t}return Ds(e,s,t,n),zs(e)}function Aa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,$d(e,n)}}function sc(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var c=null,d=null;if(n=n.firstBaseUpdate,n!==null){do{var y={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};d===null?c=d=y:d=d.next=y,n=n.next}while(n!==null);d===null?c=d=t:d=d.next=t}else c=d=t;n={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var oc=!1;function Ea(){if(oc){var e=Ml;if(e!==null)throw e}}function Na(e,t,n,s){oc=!1;var c=e.updateQueue;ni=!1;var d=c.firstBaseUpdate,y=c.lastBaseUpdate,S=c.shared.pending;if(S!==null){c.shared.pending=null;var N=S,F=N.next;N.next=null,y===null?d=F:y.next=F,y=N;var Z=e.alternate;Z!==null&&(Z=Z.updateQueue,S=Z.lastBaseUpdate,S!==y&&(S===null?Z.firstBaseUpdate=F:S.next=F,Z.lastBaseUpdate=N))}if(d!==null){var te=c.baseState;y=0,Z=F=N=null,S=d;do{var Y=S.lane&-536870913,q=Y!==S.lane;if(q?(De&Y)===Y:(s&Y)===Y){Y!==0&&Y===Tl&&(oc=!0),Z!==null&&(Z=Z.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var he=e,Te=S;Y=t;var qe=n;switch(Te.tag){case 1:if(he=Te.payload,typeof he=="function"){te=he.call(qe,te,Y);break e}te=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=Te.payload,Y=typeof he=="function"?he.call(qe,te,Y):he,Y==null)break e;te=v({},te,Y);break e;case 2:ni=!0}}Y=S.callback,Y!==null&&(e.flags|=64,q&&(e.flags|=8192),q=c.callbacks,q===null?c.callbacks=[Y]:q.push(Y))}else q={lane:Y,tag:S.tag,payload:S.payload,callback:S.callback,next:null},Z===null?(F=Z=q,N=te):Z=Z.next=q,y|=Y;if(S=S.next,S===null){if(S=c.shared.pending,S===null)break;q=S,S=q.next,q.next=null,c.lastBaseUpdate=q,c.shared.pending=null}}while(!0);Z===null&&(N=te),c.baseState=N,c.firstBaseUpdate=F,c.lastBaseUpdate=Z,d===null&&(c.shared.lanes=0),ci|=y,e.lanes=y,e.memoizedState=te}}function nh(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function ih(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)nh(n[e],t)}var Nl=xe(null),qs=xe(0);function lh(e,t){e=Un,ve(qs,e),ve(Nl,t),Un=e|t.baseLanes}function rc(){ve(qs,Un),ve(Nl,Nl.current)}function cc(){Un=qs.current,ye(Nl),ye(qs)}var It=xe(null),tn=null;function ai(e){var t=e.alternate;ve(it,it.current&1),ve(It,e),tn===null&&(t===null||Nl.current!==null||t.memoizedState!==null)&&(tn=e)}function uc(e){ve(it,it.current),ve(It,e),tn===null&&(tn=e)}function ah(e){e.tag===22?(ve(it,it.current),ve(It,e),tn===null&&(tn=e)):si()}function si(){ve(it,it.current),ve(It,It.current)}function Ft(e){ye(It),tn===e&&(tn=null),ye(it)}var it=xe(0);function Vs(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||gu(n)||bu(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 Rn=0,Ne=null,Ye=null,st=null,Ps=!1,kl=!1,Vi=!1,Xs=0,ka=0,Ll=null,X0=0;function tt(){throw Error(o(321))}function dc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ut(e[n],t[n]))return!1;return!0}function fc(e,t,n,s,c,d){return Rn=d,Ne=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?Fh:Ec,Vi=!1,d=n(s,c),Vi=!1,kl&&(d=oh(t,n,s,c)),sh(e),d}function sh(e){E.H=_a;var t=Ye!==null&&Ye.next!==null;if(Rn=0,st=Ye=Ne=null,Ps=!1,ka=0,Ll=null,t)throw Error(o(300));e===null||ot||(e=e.dependencies,e!==null&&Us(e)&&(ot=!0))}function oh(e,t,n,s){Ne=e;var c=0;do{if(kl&&(Ll=null),ka=0,kl=!1,25<=c)throw Error(o(301));if(c+=1,st=Ye=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}E.H=Gh,d=t(n,s)}while(kl);return d}function Q0(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?La(t):t,e=e.useState()[0],(Ye!==null?Ye.memoizedState:null)!==e&&(Ne.flags|=1024),t}function hc(){var e=Xs!==0;return Xs=0,e}function mc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function pc(e){if(Ps){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ps=!1}Rn=0,st=Ye=Ne=null,kl=!1,ka=Xs=0,Ll=null}function At(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return st===null?Ne.memoizedState=st=e:st=st.next=e,st}function lt(){if(Ye===null){var e=Ne.alternate;e=e!==null?e.memoizedState:null}else e=Ye.next;var t=st===null?Ne.memoizedState:st.next;if(t!==null)st=t,Ye=e;else{if(e===null)throw Ne.alternate===null?Error(o(467)):Error(o(310));Ye=e,e={memoizedState:Ye.memoizedState,baseState:Ye.baseState,baseQueue:Ye.baseQueue,queue:Ye.queue,next:null},st===null?Ne.memoizedState=st=e:st=st.next=e}return st}function Qs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function La(e){var t=ka;return ka+=1,Ll===null&&(Ll=[]),e=Zf(Ll,e,t),t=Ne,(st===null?t.memoizedState:st.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?Fh:Ec),e}function Zs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return La(e);if(e.$$typeof===O)return yt(e)}throw Error(o(438,String(e)))}function gc(e){var t=null,n=Ne.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=Ne.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Qs(),Ne.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),s=0;s<e;s++)n[s]=J;return t.index++,n}function _n(e,t){return typeof t=="function"?t(e):t}function Ws(e){var t=lt();return bc(t,Ye,e)}function bc(e,t,n){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=n;var c=e.baseQueue,d=s.pending;if(d!==null){if(c!==null){var y=c.next;c.next=d.next,d.next=y}t.baseQueue=c=d,s.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var S=y=null,N=null,F=t,Z=!1;do{var te=F.lane&-536870913;if(te!==F.lane?(De&te)===te:(Rn&te)===te){var Y=F.revertLane;if(Y===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),te===Tl&&(Z=!0);else if((Rn&Y)===Y){F=F.next,Y===Tl&&(Z=!0);continue}else te={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},N===null?(S=N=te,y=d):N=N.next=te,Ne.lanes|=Y,ci|=Y;te=F.action,Vi&&n(d,te),d=F.hasEagerState?F.eagerState:n(d,te)}else Y={lane:te,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},N===null?(S=N=Y,y=d):N=N.next=Y,Ne.lanes|=te,ci|=te;F=F.next}while(F!==null&&F!==t);if(N===null?y=d:N.next=S,!Ut(d,e.memoizedState)&&(ot=!0,Z&&(n=Ml,n!==null)))throw n;e.memoizedState=d,e.baseState=y,e.baseQueue=N,s.lastRenderedState=d}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function yc(e){var t=lt(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var s=n.dispatch,c=n.pending,d=t.memoizedState;if(c!==null){n.pending=null;var y=c=c.next;do d=e(d,y.action),y=y.next;while(y!==c);Ut(d,t.memoizedState)||(ot=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),n.lastRenderedState=d}return[d,s]}function rh(e,t,n){var s=Ne,c=lt(),d=He;if(d){if(n===void 0)throw Error(o(407));n=n()}else n=t();var y=!Ut((Ye||c).memoizedState,n);if(y&&(c.memoizedState=n,ot=!0),c=c.queue,wc(dh.bind(null,s,c,e),[e]),c.getSnapshot!==t||y||st!==null&&st.memoizedState.tag&1){if(s.flags|=2048,Rl(9,{destroy:void 0},uh.bind(null,s,c,n,t),null),Ve===null)throw Error(o(349));d||(Rn&127)!==0||ch(s,t,n)}return n}function ch(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ne.updateQueue,t===null?(t=Qs(),Ne.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function uh(e,t,n,s){t.value=n,t.getSnapshot=s,fh(t)&&hh(e)}function dh(e,t,n){return n(function(){fh(t)&&hh(e)})}function fh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ut(e,n)}catch{return!0}}function hh(e){var t=Bi(e,2);t!==null&&zt(t,e,2)}function vc(e){var t=At();if(typeof e=="function"){var n=e;if(e=n(),Vi){cn(!0);try{n()}finally{cn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_n,lastRenderedState:e},t}function mh(e,t,n,s){return e.baseState=n,bc(e,Ye,typeof s=="function"?s:_n)}function Z0(e,t,n,s,c){if(to(e))throw Error(o(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){d.listeners.push(y)}};E.T!==null?n(!0):d.isTransition=!1,s(d),n=t.pending,n===null?(d.next=t.pending=d,ph(t,d)):(d.next=n.next,t.pending=n.next=d)}}function ph(e,t){var n=t.action,s=t.payload,c=e.state;if(t.isTransition){var d=E.T,y={};E.T=y;try{var S=n(c,s),N=E.S;N!==null&&N(y,S),gh(e,t,S)}catch(F){xc(e,t,F)}finally{d!==null&&y.types!==null&&(d.types=y.types),E.T=d}}else try{d=n(c,s),gh(e,t,d)}catch(F){xc(e,t,F)}}function gh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){bh(e,t,s)},function(s){return xc(e,t,s)}):bh(e,t,n)}function bh(e,t,n){t.status="fulfilled",t.value=n,yh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,ph(e,n)))}function xc(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,yh(t),t=t.next;while(t!==s)}e.action=null}function yh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function vh(e,t){return t}function xh(e,t){if(He){var n=Ve.formState;if(n!==null){e:{var s=Ne;if(He){if(Xe){t:{for(var c=Xe,d=en;c.nodeType!==8;){if(!d){c=null;break t}if(c=nn(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){Xe=nn(c.nextSibling),s=c.data==="F!";break e}}ei(s)}s=!1}s&&(t=n[0])}}return n=At(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vh,lastRenderedState:t},n.queue=s,n=Uh.bind(null,Ne,s),s.dispatch=n,s=vc(!1),d=Ac.bind(null,Ne,!1,s.queue),s=At(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,n=Z0.bind(null,Ne,c,d,n),c.dispatch=n,s.memoizedState=e,[t,n,!1]}function wh(e){var t=lt();return Sh(t,Ye,e)}function Sh(e,t,n){if(t=bc(e,t,vh)[0],e=Ws(_n)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=La(t)}catch(y){throw y===Al?Fs:y}else s=t;t=lt();var c=t.queue,d=c.dispatch;return n!==t.memoizedState&&(Ne.flags|=2048,Rl(9,{destroy:void 0},W0.bind(null,c,n),null)),[s,d,e]}function W0(e,t){e.action=t}function Ch(e){var t=lt(),n=Ye;if(n!==null)return Sh(t,n,e);lt(),t=t.memoizedState,n=lt();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function Rl(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=Ne.updateQueue,t===null&&(t=Qs(),Ne.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e),e}function Th(){return lt().memoizedState}function Js(e,t,n,s){var c=At();Ne.flags|=e,c.memoizedState=Rl(1|t,{destroy:void 0},n,s===void 0?null:s)}function eo(e,t,n,s){var c=lt();s=s===void 0?null:s;var d=c.memoizedState.inst;Ye!==null&&s!==null&&dc(s,Ye.memoizedState.deps)?c.memoizedState=Rl(t,d,n,s):(Ne.flags|=e,c.memoizedState=Rl(1|t,d,n,s))}function Mh(e,t){Js(8390656,8,e,t)}function wc(e,t){eo(2048,8,e,t)}function J0(e){Ne.flags|=4;var t=Ne.updateQueue;if(t===null)t=Qs(),Ne.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ah(e){var t=lt().memoizedState;return J0({ref:t,nextImpl:e}),function(){if((Ie&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Eh(e,t){return eo(4,2,e,t)}function Nh(e,t){return eo(4,4,e,t)}function kh(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 Lh(e,t,n){n=n!=null?n.concat([e]):null,eo(4,4,kh.bind(null,t,e),n)}function Sc(){}function Rh(e,t){var n=lt();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&dc(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function _h(e,t){var n=lt();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&dc(t,s[1]))return s[0];if(s=e(),Vi){cn(!0);try{e()}finally{cn(!1)}}return n.memoizedState=[s,t],s}function Cc(e,t,n){return n===void 0||(Rn&1073741824)!==0&&(De&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=jm(),Ne.lanes|=e,ci|=e,n)}function jh(e,t,n,s){return Ut(n,t)?n:Nl.current!==null?(e=Cc(e,n,s),Ut(e,t)||(ot=!0),e):(Rn&42)===0||(Rn&1073741824)!==0&&(De&261930)===0?(ot=!0,e.memoizedState=n):(e=jm(),Ne.lanes|=e,ci|=e,t)}function Oh(e,t,n,s,c){var d=G.p;G.p=d!==0&&8>d?d:8;var y=E.T,S={};E.T=S,Ac(e,!1,t,n);try{var N=c(),F=E.S;if(F!==null&&F(S,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var Z=P0(N,s);Ra(e,t,Z,$t(e))}else Ra(e,t,s,$t(e))}catch(te){Ra(e,t,{then:function(){},status:"rejected",reason:te},$t())}finally{G.p=d,y!==null&&S.types!==null&&(y.types=S.types),E.T=y}}function ev(){}function Tc(e,t,n,s){if(e.tag!==5)throw Error(o(476));var c=Dh(e).queue;Oh(e,c,t,P,n===null?ev:function(){return zh(e),n(s)})}function Dh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_n,lastRenderedState:P},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_n,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function zh(e){var t=Dh(e);t.next===null&&(t=e.alternate.memoizedState),Ra(e,t.next.queue,{},$t())}function Mc(){return yt(Pa)}function Hh(){return lt().memoizedState}function Bh(){return lt().memoizedState}function tv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=$t();e=ii(n);var s=li(t,e,n);s!==null&&(zt(s,t,n),Aa(s,t,n)),t={cache:ec()},e.payload=t;return}t=t.return}}function nv(e,t,n){var s=$t();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},to(e)?Kh(t,n):(n=Gr(e,t,n,s),n!==null&&(zt(n,e,s),Ih(n,t,s)))}function Uh(e,t,n){var s=$t();Ra(e,t,n,s)}function Ra(e,t,n,s){var c={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(to(e))Kh(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var y=t.lastRenderedState,S=d(y,n);if(c.hasEagerState=!0,c.eagerState=S,Ut(S,y))return Ds(e,t,c,0),Ve===null&&Os(),!1}catch{}finally{}if(n=Gr(e,t,c,s),n!==null)return zt(n,e,s),Ih(n,t,s),!0}return!1}function Ac(e,t,n,s){if(s={lane:2,revertLane:lu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},to(e)){if(t)throw Error(o(479))}else t=Gr(e,n,s,2),t!==null&&zt(t,e,2)}function to(e){var t=e.alternate;return e===Ne||t!==null&&t===Ne}function Kh(e,t){kl=Ps=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ih(e,t,n){if((n&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,$d(e,n)}}var _a={readContext:yt,use:Zs,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useLayoutEffect:tt,useInsertionEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useSyncExternalStore:tt,useId:tt,useHostTransitionStatus:tt,useFormState:tt,useActionState:tt,useOptimistic:tt,useMemoCache:tt,useCacheRefresh:tt};_a.useEffectEvent=tt;var Fh={readContext:yt,use:Zs,useCallback:function(e,t){return At().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:Mh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Js(4194308,4,kh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Js(4194308,4,e,t)},useInsertionEffect:function(e,t){Js(4,2,e,t)},useMemo:function(e,t){var n=At();t=t===void 0?null:t;var s=e();if(Vi){cn(!0);try{e()}finally{cn(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=At();if(n!==void 0){var c=n(t);if(Vi){cn(!0);try{n(t)}finally{cn(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=nv.bind(null,Ne,e),[s.memoizedState,e]},useRef:function(e){var t=At();return e={current:e},t.memoizedState=e},useState:function(e){e=vc(e);var t=e.queue,n=Uh.bind(null,Ne,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Sc,useDeferredValue:function(e,t){var n=At();return Cc(n,e,t)},useTransition:function(){var e=vc(!1);return e=Oh.bind(null,Ne,e.queue,!0,!1),At().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Ne,c=At();if(He){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Ve===null)throw Error(o(349));(De&127)!==0||ch(s,t,n)}c.memoizedState=n;var d={value:n,getSnapshot:t};return c.queue=d,Mh(dh.bind(null,s,d,e),[e]),s.flags|=2048,Rl(9,{destroy:void 0},uh.bind(null,s,d,n,t),null),n},useId:function(){var e=At(),t=Ve.identifierPrefix;if(He){var n=pn,s=mn;n=(s&~(1<<32-Ct(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Xs++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=X0++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Mc,useFormState:xh,useActionState:xh,useOptimistic:function(e){var t=At();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ac.bind(null,Ne,!0,n),n.dispatch=t,[e,t]},useMemoCache:gc,useCacheRefresh:function(){return At().memoizedState=tv.bind(null,Ne)},useEffectEvent:function(e){var t=At(),n={impl:e};return t.memoizedState=n,function(){if((Ie&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},Ec={readContext:yt,use:Zs,useCallback:Rh,useContext:yt,useEffect:wc,useImperativeHandle:Lh,useInsertionEffect:Eh,useLayoutEffect:Nh,useMemo:_h,useReducer:Ws,useRef:Th,useState:function(){return Ws(_n)},useDebugValue:Sc,useDeferredValue:function(e,t){var n=lt();return jh(n,Ye.memoizedState,e,t)},useTransition:function(){var e=Ws(_n)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:La(e),t]},useSyncExternalStore:rh,useId:Hh,useHostTransitionStatus:Mc,useFormState:wh,useActionState:wh,useOptimistic:function(e,t){var n=lt();return mh(n,Ye,e,t)},useMemoCache:gc,useCacheRefresh:Bh};Ec.useEffectEvent=Ah;var Gh={readContext:yt,use:Zs,useCallback:Rh,useContext:yt,useEffect:wc,useImperativeHandle:Lh,useInsertionEffect:Eh,useLayoutEffect:Nh,useMemo:_h,useReducer:yc,useRef:Th,useState:function(){return yc(_n)},useDebugValue:Sc,useDeferredValue:function(e,t){var n=lt();return Ye===null?Cc(n,e,t):jh(n,Ye.memoizedState,e,t)},useTransition:function(){var e=yc(_n)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:La(e),t]},useSyncExternalStore:rh,useId:Hh,useHostTransitionStatus:Mc,useFormState:Ch,useActionState:Ch,useOptimistic:function(e,t){var n=lt();return Ye!==null?mh(n,Ye,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:gc,useCacheRefresh:Bh};Gh.useEffectEvent=Ah;function Nc(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:v({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var kc={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=$t(),c=ii(s);c.payload=t,n!=null&&(c.callback=n),t=li(e,c,s),t!==null&&(zt(t,e,s),Aa(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=$t(),c=ii(s);c.tag=1,c.payload=t,n!=null&&(c.callback=n),t=li(e,c,s),t!==null&&(zt(t,e,s),Aa(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=$t(),s=ii(n);s.tag=2,t!=null&&(s.callback=t),t=li(e,s,n),t!==null&&(zt(t,e,n),Aa(t,e,n))}};function Yh(e,t,n,s,c,d,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,d,y):t.prototype&&t.prototype.isPureReactComponent?!ya(n,s)||!ya(c,d):!0}function $h(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&kc.enqueueReplaceState(t,t.state,null)}function Pi(e,t){var n=t;if("ref"in t){n={};for(var s in t)s!=="ref"&&(n[s]=t[s])}if(e=e.defaultProps){n===t&&(n=v({},n));for(var c in e)n[c]===void 0&&(n[c]=e[c])}return n}function qh(e){js(e)}function Vh(e){console.error(e)}function Ph(e){js(e)}function no(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Xh(e,t,n){try{var s=e.onCaughtError;s(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function Lc(e,t,n){return n=ii(n),n.tag=3,n.payload={element:null},n.callback=function(){no(e,t)},n}function Qh(e){return e=ii(e),e.tag=3,e}function Zh(e,t,n,s){var c=n.type.getDerivedStateFromError;if(typeof c=="function"){var d=s.value;e.payload=function(){return c(d)},e.callback=function(){Xh(t,n,s)}}var y=n.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){Xh(t,n,s),typeof c!="function"&&(ui===null?ui=new Set([this]):ui.add(this));var S=s.stack;this.componentDidCatch(s.value,{componentStack:S!==null?S:""})})}function iv(e,t,n,s,c){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&Cl(t,n,c,!0),n=It.current,n!==null){switch(n.tag){case 31:case 13:return tn===null?po():n.alternate===null&&nt===0&&(nt=3),n.flags&=-257,n.flags|=65536,n.lanes=c,s===Gs?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),tu(e,s,c)),!1;case 22:return n.flags|=65536,s===Gs?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([s]):n.add(s)),tu(e,s,c)),!1}throw Error(o(435,n.tag))}return tu(e,s,c),po(),!1}if(He)return t=It.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==Xr&&(e=Error(o(422),{cause:s}),wa(Zt(e,n)))):(s!==Xr&&(t=Error(o(423),{cause:s}),wa(Zt(t,n))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Zt(s,n),c=Lc(e.stateNode,s,c),sc(e,c),nt!==4&&(nt=2)),!1;var d=Error(o(520),{cause:s});if(d=Zt(d,n),Ka===null?Ka=[d]:Ka.push(d),nt!==4&&(nt=2),t===null)return!0;s=Zt(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=c&-c,n.lanes|=e,e=Lc(n.stateNode,s,e),sc(n,e),!1;case 1:if(t=n.type,d=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(ui===null||!ui.has(d))))return n.flags|=65536,c&=-c,n.lanes|=c,c=Qh(c),Zh(c,e,n,s),sc(n,c),!1}n=n.return}while(n!==null);return!1}var Rc=Error(o(461)),ot=!1;function vt(e,t,n,s){t.child=e===null?th(t,null,n,s):qi(t,e.child,n,s)}function Wh(e,t,n,s,c){n=n.render;var d=t.ref;if("ref"in s){var y={};for(var S in s)S!=="ref"&&(y[S]=s[S])}else y=s;return Fi(t),s=fc(e,t,n,y,d,c),S=hc(),e!==null&&!ot?(mc(e,t,c),jn(e,t,c)):(He&&S&&Vr(t),t.flags|=1,vt(e,t,s,c),t.child)}function Jh(e,t,n,s,c){if(e===null){var d=n.type;return typeof d=="function"&&!Yr(d)&&d.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=d,em(e,t,d,s,c)):(e=Hs(n.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Uc(e,c)){var y=d.memoizedProps;if(n=n.compare,n=n!==null?n:ya,n(y,s)&&e.ref===t.ref)return jn(e,t,c)}return t.flags|=1,e=En(d,s),e.ref=t.ref,e.return=t,t.child=e}function em(e,t,n,s,c){if(e!==null){var d=e.memoizedProps;if(ya(d,s)&&e.ref===t.ref)if(ot=!1,t.pendingProps=s=d,Uc(e,c))(e.flags&131072)!==0&&(ot=!0);else return t.lanes=e.lanes,jn(e,t,c)}return _c(e,t,n,s,c)}function tm(e,t,n,s){var c=s.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|n:n,e!==null){for(s=t.child=e.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~d}else s=0,t.child=null;return nm(e,t,d,n,s)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Is(t,d!==null?d.cachePool:null),d!==null?lh(t,d):rc(),ah(t);else return s=t.lanes=536870912,nm(e,t,d!==null?d.baseLanes|n:n,n,s)}else d!==null?(Is(t,d.cachePool),lh(t,d),si(),t.memoizedState=null):(e!==null&&Is(t,null),rc(),si());return vt(e,t,c,n),t.child}function ja(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function nm(e,t,n,s,c){var d=nc();return d=d===null?null:{parent:at._currentValue,pool:d},t.memoizedState={baseLanes:n,cachePool:d},e!==null&&Is(t,null),rc(),ah(t),e!==null&&Cl(e,t,s,!0),t.childLanes=c,null}function io(e,t){return t=ao({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function im(e,t,n){return qi(t,e.child,null,n),e=io(t,t.pendingProps),e.flags|=2,Ft(t),t.memoizedState=null,e}function lv(e,t,n){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(He){if(s.mode==="hidden")return e=io(t,s),t.lanes=536870912,ja(null,e);if(uc(t),(e=Xe)?(e=pp(e,en),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Wn!==null?{id:mn,overflow:pn}:null,retryLane:536870912,hydrationErrors:null},n=Kf(e),n.return=t,t.child=n,bt=t,Xe=null)):e=null,e===null)throw ei(t);return t.lanes=536870912,null}return io(t,s)}var d=e.memoizedState;if(d!==null){var y=d.dehydrated;if(uc(t),c)if(t.flags&256)t.flags&=-257,t=im(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(ot||Cl(e,t,n,!1),c=(n&e.childLanes)!==0,ot||c){if(s=Ve,s!==null&&(y=qd(s,n),y!==0&&y!==d.retryLane))throw d.retryLane=y,Bi(e,y),zt(s,e,y),Rc;po(),t=im(e,t,n)}else e=d.treeContext,Xe=nn(y.nextSibling),bt=t,He=!0,Jn=null,en=!1,e!==null&&Gf(t,e),t=io(t,s),t.flags|=4096;return t}return e=En(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function lo(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(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function _c(e,t,n,s,c){return Fi(t),n=fc(e,t,n,s,void 0,c),s=hc(),e!==null&&!ot?(mc(e,t,c),jn(e,t,c)):(He&&s&&Vr(t),t.flags|=1,vt(e,t,n,c),t.child)}function lm(e,t,n,s,c,d){return Fi(t),t.updateQueue=null,n=oh(t,s,n,c),sh(e),s=hc(),e!==null&&!ot?(mc(e,t,d),jn(e,t,d)):(He&&s&&Vr(t),t.flags|=1,vt(e,t,n,d),t.child)}function am(e,t,n,s,c){if(Fi(t),t.stateNode===null){var d=vl,y=n.contextType;typeof y=="object"&&y!==null&&(d=yt(y)),d=new n(s,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=kc,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=s,d.state=t.memoizedState,d.refs={},lc(t),y=n.contextType,d.context=typeof y=="object"&&y!==null?yt(y):vl,d.state=t.memoizedState,y=n.getDerivedStateFromProps,typeof y=="function"&&(Nc(t,n,y,s),d.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(y=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),y!==d.state&&kc.enqueueReplaceState(d,d.state,null),Na(t,s,d,c),Ea(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){d=t.stateNode;var S=t.memoizedProps,N=Pi(n,S);d.props=N;var F=d.context,Z=n.contextType;y=vl,typeof Z=="object"&&Z!==null&&(y=yt(Z));var te=n.getDerivedStateFromProps;Z=typeof te=="function"||typeof d.getSnapshotBeforeUpdate=="function",S=t.pendingProps!==S,Z||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(S||F!==y)&&$h(t,d,s,y),ni=!1;var Y=t.memoizedState;d.state=Y,Na(t,s,d,c),Ea(),F=t.memoizedState,S||Y!==F||ni?(typeof te=="function"&&(Nc(t,n,te,s),F=t.memoizedState),(N=ni||Yh(t,n,N,s,Y,F,y))?(Z||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=F),d.props=s,d.state=F,d.context=y,s=N):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{d=t.stateNode,ac(e,t),y=t.memoizedProps,Z=Pi(n,y),d.props=Z,te=t.pendingProps,Y=d.context,F=n.contextType,N=vl,typeof F=="object"&&F!==null&&(N=yt(F)),S=n.getDerivedStateFromProps,(F=typeof S=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(y!==te||Y!==N)&&$h(t,d,s,N),ni=!1,Y=t.memoizedState,d.state=Y,Na(t,s,d,c),Ea();var q=t.memoizedState;y!==te||Y!==q||ni||e!==null&&e.dependencies!==null&&Us(e.dependencies)?(typeof S=="function"&&(Nc(t,n,S,s),q=t.memoizedState),(Z=ni||Yh(t,n,Z,s,Y,q,N)||e!==null&&e.dependencies!==null&&Us(e.dependencies))?(F||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(s,q,N),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(s,q,N)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=q),d.props=s,d.state=q,d.context=N,s=Z):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),s=!1)}return d=s,lo(e,t),s=(t.flags&128)!==0,d||s?(d=t.stateNode,n=s&&typeof n.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&s?(t.child=qi(t,e.child,null,c),t.child=qi(t,null,n,c)):vt(e,t,n,c),t.memoizedState=d.state,e=t.child):e=jn(e,t,c),e}function sm(e,t,n,s){return Ki(),t.flags|=256,vt(e,t,n,s),t.child}var jc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Oc(e){return{baseLanes:e,cachePool:Xf()}}function Dc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Yt),e}function om(e,t,n){var s=t.pendingProps,c=!1,d=(t.flags&128)!==0,y;if((y=d)||(y=e!==null&&e.memoizedState===null?!1:(it.current&2)!==0),y&&(c=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(He){if(c?ai(t):si(),(e=Xe)?(e=pp(e,en),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Wn!==null?{id:mn,overflow:pn}:null,retryLane:536870912,hydrationErrors:null},n=Kf(e),n.return=t,t.child=n,bt=t,Xe=null)):e=null,e===null)throw ei(t);return bu(e)?t.lanes=32:t.lanes=536870912,null}var S=s.children;return s=s.fallback,c?(si(),c=t.mode,S=ao({mode:"hidden",children:S},c),s=Ui(s,c,n,null),S.return=t,s.return=t,S.sibling=s,t.child=S,s=t.child,s.memoizedState=Oc(n),s.childLanes=Dc(e,y,n),t.memoizedState=jc,ja(null,s)):(ai(t),zc(t,S))}var N=e.memoizedState;if(N!==null&&(S=N.dehydrated,S!==null)){if(d)t.flags&256?(ai(t),t.flags&=-257,t=Hc(e,t,n)):t.memoizedState!==null?(si(),t.child=e.child,t.flags|=128,t=null):(si(),S=s.fallback,c=t.mode,s=ao({mode:"visible",children:s.children},c),S=Ui(S,c,n,null),S.flags|=2,s.return=t,S.return=t,s.sibling=S,t.child=s,qi(t,e.child,null,n),s=t.child,s.memoizedState=Oc(n),s.childLanes=Dc(e,y,n),t.memoizedState=jc,t=ja(null,s));else if(ai(t),bu(S)){if(y=S.nextSibling&&S.nextSibling.dataset,y)var F=y.dgst;y=F,s=Error(o(419)),s.stack="",s.digest=y,wa({value:s,source:null,stack:null}),t=Hc(e,t,n)}else if(ot||Cl(e,t,n,!1),y=(n&e.childLanes)!==0,ot||y){if(y=Ve,y!==null&&(s=qd(y,n),s!==0&&s!==N.retryLane))throw N.retryLane=s,Bi(e,s),zt(y,e,s),Rc;gu(S)||po(),t=Hc(e,t,n)}else gu(S)?(t.flags|=192,t.child=e.child,t=null):(e=N.treeContext,Xe=nn(S.nextSibling),bt=t,He=!0,Jn=null,en=!1,e!==null&&Gf(t,e),t=zc(t,s.children),t.flags|=4096);return t}return c?(si(),S=s.fallback,c=t.mode,N=e.child,F=N.sibling,s=En(N,{mode:"hidden",children:s.children}),s.subtreeFlags=N.subtreeFlags&65011712,F!==null?S=En(F,S):(S=Ui(S,c,n,null),S.flags|=2),S.return=t,s.return=t,s.sibling=S,t.child=s,ja(null,s),s=t.child,S=e.child.memoizedState,S===null?S=Oc(n):(c=S.cachePool,c!==null?(N=at._currentValue,c=c.parent!==N?{parent:N,pool:N}:c):c=Xf(),S={baseLanes:S.baseLanes|n,cachePool:c}),s.memoizedState=S,s.childLanes=Dc(e,y,n),t.memoizedState=jc,ja(e.child,s)):(ai(t),n=e.child,e=n.sibling,n=En(n,{mode:"visible",children:s.children}),n.return=t,n.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=n,t.memoizedState=null,n)}function zc(e,t){return t=ao({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ao(e,t){return e=Kt(22,e,null,t),e.lanes=0,e}function Hc(e,t,n){return qi(t,e.child,null,n),e=zc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function rm(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Wr(e.return,t,n)}function Bc(e,t,n,s,c,d){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:c,treeForkCount:d}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=s,y.tail=n,y.tailMode=c,y.treeForkCount=d)}function cm(e,t,n){var s=t.pendingProps,c=s.revealOrder,d=s.tail;s=s.children;var y=it.current,S=(y&2)!==0;if(S?(y=y&1|2,t.flags|=128):y&=1,ve(it,y),vt(e,t,s,n),s=He?xa:0,!S&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&rm(e,n,t);else if(e.tag===19)rm(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(c){case"forwards":for(n=t.child,c=null;n!==null;)e=n.alternate,e!==null&&Vs(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),Bc(t,!1,c,n,d,s);break;case"backwards":case"unstable_legacy-backwards":for(n=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Vs(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}Bc(t,!0,n,null,d,s);break;case"together":Bc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function jn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ci|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Cl(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=En(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=En(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Uc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Us(e)))}function av(e,t,n){switch(t.tag){case 3:Se(t,t.stateNode.containerInfo),ti(t,at,e.memoizedState.cache),Ki();break;case 27:case 5:pe(t);break;case 4:Se(t,t.stateNode.containerInfo);break;case 10:ti(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,uc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(ai(t),t.flags|=128,null):(n&t.child.childLanes)!==0?om(e,t,n):(ai(t),e=jn(e,t,n),e!==null?e.sibling:null);ai(t);break;case 19:var c=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(Cl(e,t,n,!1),s=(n&t.childLanes)!==0),c){if(s)return cm(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ve(it,it.current),s)break;return null;case 22:return t.lanes=0,tm(e,t,n,t.pendingProps);case 24:ti(t,at,e.memoizedState.cache)}return jn(e,t,n)}function um(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ot=!0;else{if(!Uc(e,n)&&(t.flags&128)===0)return ot=!1,av(e,t,n);ot=(e.flags&131072)!==0}else ot=!1,He&&(t.flags&1048576)!==0&&Ff(t,xa,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Yi(t.elementType),t.type=e,typeof e=="function")Yr(e)?(s=Pi(e,s),t.tag=1,t=am(null,t,e,s,n)):(t.tag=0,t=_c(null,t,e,s,n));else{if(e!=null){var c=e.$$typeof;if(c===$){t.tag=11,t=Wh(null,t,e,s,n);break e}else if(c===L){t.tag=14,t=Jh(null,t,e,s,n);break e}}throw t=ue(e)||e,Error(o(306,t,""))}}return t;case 0:return _c(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,c=Pi(s,t.pendingProps),am(e,t,s,c,n);case 3:e:{if(Se(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var d=t.memoizedState;c=d.element,ac(e,t),Na(t,s,null,n);var y=t.memoizedState;if(s=y.cache,ti(t,at,s),s!==d.cache&&Jr(t,[at],n,!0),Ea(),s=y.element,d.isDehydrated)if(d={element:s,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=sm(e,t,s,n);break e}else if(s!==c){c=Zt(Error(o(424)),t),wa(c),t=sm(e,t,s,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(Xe=nn(e.firstChild),bt=t,He=!0,Jn=null,en=!0,n=th(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ki(),s===c){t=jn(e,t,n);break e}vt(e,t,s,n)}t=t.child}return t;case 26:return lo(e,t),e===null?(n=wp(t.type,null,t.pendingProps,null))?t.memoizedState=n:He||(n=t.type,e=t.pendingProps,s=So(we.current).createElement(n),s[gt]=t,s[Lt]=e,xt(s,n,e),ht(s),t.stateNode=s):t.memoizedState=wp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pe(t),e===null&&He&&(s=t.stateNode=yp(t.type,t.pendingProps,we.current),bt=t,en=!0,c=Xe,mi(t.type)?(yu=c,Xe=nn(s.firstChild)):Xe=c),vt(e,t,t.pendingProps.children,n),lo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&He&&((c=s=Xe)&&(s=Dv(s,t.type,t.pendingProps,en),s!==null?(t.stateNode=s,bt=t,Xe=nn(s.firstChild),en=!1,c=!0):c=!1),c||ei(t)),pe(t),c=t.type,d=t.pendingProps,y=e!==null?e.memoizedProps:null,s=d.children,hu(c,d)?s=null:y!==null&&hu(c,y)&&(t.flags|=32),t.memoizedState!==null&&(c=fc(e,t,Q0,null,null,n),Pa._currentValue=c),lo(e,t),vt(e,t,s,n),t.child;case 6:return e===null&&He&&((e=n=Xe)&&(n=zv(n,t.pendingProps,en),n!==null?(t.stateNode=n,bt=t,Xe=null,e=!0):e=!1),e||ei(t)),null;case 13:return om(e,t,n);case 4:return Se(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=qi(t,null,s,n):vt(e,t,s,n),t.child;case 11:return Wh(e,t,t.type,t.pendingProps,n);case 7:return vt(e,t,t.pendingProps,n),t.child;case 8:return vt(e,t,t.pendingProps.children,n),t.child;case 12:return vt(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,ti(t,t.type,s.value),vt(e,t,s.children,n),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,Fi(t),c=yt(c),s=s(c),t.flags|=1,vt(e,t,s,n),t.child;case 14:return Jh(e,t,t.type,t.pendingProps,n);case 15:return em(e,t,t.type,t.pendingProps,n);case 19:return cm(e,t,n);case 31:return lv(e,t,n);case 22:return tm(e,t,n,t.pendingProps);case 24:return Fi(t),s=yt(at),e===null?(c=nc(),c===null&&(c=Ve,d=ec(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=n),c=d),t.memoizedState={parent:s,cache:c},lc(t),ti(t,at,c)):((e.lanes&n)!==0&&(ac(e,t),Na(t,null,null,n),Ea()),c=e.memoizedState,d=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),ti(t,at,s)):(s=d.cache,ti(t,at,s),s!==c.cache&&Jr(t,[at],n,!0))),vt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function On(e){e.flags|=4}function Kc(e,t,n,s,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Hm())e.flags|=8192;else throw $i=Gs,ic}else e.flags&=-16777217}function dm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Ap(t))if(Hm())e.flags|=8192;else throw $i=Gs,ic}function so(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Gd():536870912,e.lanes|=t,Dl|=t)}function Oa(e,t){if(!He)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 s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Qe(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var c=e.child;c!==null;)n|=c.lanes|c.childLanes,s|=c.subtreeFlags&65011712,s|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)n|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function sv(e,t,n){var s=t.pendingProps;switch(Pr(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(t),null;case 1:return Qe(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Ln(at),ae(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Sl(t)?On(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Qr())),Qe(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(On(t),d!==null?(Qe(t),dm(t,d)):(Qe(t),Kc(t,c,null,s,n))):d?d!==e.memoizedState?(On(t),Qe(t),dm(t,d)):(Qe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&On(t),Qe(t),Kc(t,c,e,s,n)),null;case 27:if(Ee(t),n=we.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&On(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}e=me.current,Sl(t)?Yf(t):(e=yp(c,s,n),t.stateNode=e,On(t))}return Qe(t),null;case 5:if(Ee(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&On(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}if(d=me.current,Sl(t))Yf(t);else{var y=So(we.current);switch(d){case 1:d=y.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=y.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=y.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof s.is=="string"?y.createElement("select",{is:s.is}):y.createElement("select"),s.multiple?d.multiple=!0:s.size&&(d.size=s.size);break;default:d=typeof s.is=="string"?y.createElement(c,{is:s.is}):y.createElement(c)}}d[gt]=t,d[Lt]=s;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)d.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=d;e:switch(xt(d,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&On(t)}}return Qe(t),Kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&On(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=we.current,Sl(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,c=bt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[gt]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||op(e.nodeValue,n)),e||ei(t,!0)}else e=So(e).createTextNode(s),e[gt]=t,t.stateNode=e}return Qe(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=Sl(t),n!==null){if(e===null){if(!s)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[gt]=t}else Ki(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),e=!1}else n=Qr(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ft(t),t):(Ft(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Qe(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Sl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[gt]=t}else Ki(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),c=!1}else c=Qr(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Ft(t),t):(Ft(t),null)}return Ft(t),(t.flags&128)!==0?(t.lanes=n,t):(n=s!==null,e=e!==null&&e.memoizedState!==null,n&&(s=t.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),so(t,t.updateQueue),Qe(t),null);case 4:return ae(),e===null&&ru(t.stateNode.containerInfo),Qe(t),null;case 10:return Ln(t.type),Qe(t),null;case 19:if(ye(it),s=t.memoizedState,s===null)return Qe(t),null;if(c=(t.flags&128)!==0,d=s.rendering,d===null)if(c)Oa(s,!1);else{if(nt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Vs(e),d!==null){for(t.flags|=128,Oa(s,!1),e=d.updateQueue,t.updateQueue=e,so(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Uf(n,e),n=n.sibling;return ve(it,it.current&1|2),He&&Nn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&St()>fo&&(t.flags|=128,c=!0,Oa(s,!1),t.lanes=4194304)}else{if(!c)if(e=Vs(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,so(t,e),Oa(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!He)return Qe(t),null}else 2*St()-s.renderingStartTime>fo&&n!==536870912&&(t.flags|=128,c=!0,Oa(s,!1),t.lanes=4194304);s.isBackwards?(d.sibling=t.child,t.child=d):(e=s.last,e!==null?e.sibling=d:t.child=d,s.last=d)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=St(),e.sibling=null,n=it.current,ve(it,c?n&1|2:n&1),He&&Nn(t,s.treeForkCount),e):(Qe(t),null);case 22:case 23:return Ft(t),cc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(n&536870912)!==0&&(t.flags&128)===0&&(Qe(t),t.subtreeFlags&6&&(t.flags|=8192)):Qe(t),n=t.updateQueue,n!==null&&so(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&ye(Gi),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ln(at),Qe(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function ov(e,t){switch(Pr(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ln(at),ae(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ee(t),null;case 31:if(t.memoizedState!==null){if(Ft(t),t.alternate===null)throw Error(o(340));Ki()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ft(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ki()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ye(it),null;case 4:return ae(),null;case 10:return Ln(t.type),null;case 22:case 23:return Ft(t),cc(),e!==null&&ye(Gi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ln(at),null;case 25:return null;default:return null}}function fm(e,t){switch(Pr(t),t.tag){case 3:Ln(at),ae();break;case 26:case 27:case 5:Ee(t);break;case 4:ae();break;case 31:t.memoizedState!==null&&Ft(t);break;case 13:Ft(t);break;case 19:ye(it);break;case 10:Ln(t.type);break;case 22:case 23:Ft(t),cc(),e!==null&&ye(Gi);break;case 24:Ln(at)}}function Da(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var c=s.next;n=c;do{if((n.tag&e)===e){s=void 0;var d=n.create,y=n.inst;s=d(),y.destroy=s}n=n.next}while(n!==c)}}catch(S){Ge(t,t.return,S)}}function oi(e,t,n){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var d=c.next;s=d;do{if((s.tag&e)===e){var y=s.inst,S=y.destroy;if(S!==void 0){y.destroy=void 0,c=t;var N=n,F=S;try{F()}catch(Z){Ge(c,N,Z)}}}s=s.next}while(s!==d)}}catch(Z){Ge(t,t.return,Z)}}function hm(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ih(t,n)}catch(s){Ge(e,e.return,s)}}}function mm(e,t,n){n.props=Pi(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){Ge(e,t,s)}}function za(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(c){Ge(e,t,c)}}function gn(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(c){Ge(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(c){Ge(e,t,c)}else n.current=null}function pm(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(c){Ge(e,e.return,c)}}function Ic(e,t,n){try{var s=e.stateNode;kv(s,e.type,n,t),s[Lt]=t}catch(c){Ge(e,e.return,c)}}function gm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&mi(e.type)||e.tag===4}function Fc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||gm(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&&mi(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 Gc(e,t,n){var s=e.tag;if(s===5||s===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=Mn));else if(s!==4&&(s===27&&mi(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function oo(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&mi(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(oo(e,t,n),e=e.sibling;e!==null;)oo(e,t,n),e=e.sibling}function bm(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);xt(t,s,n),t[gt]=e,t[Lt]=n}catch(d){Ge(e,e.return,d)}}var Dn=!1,rt=!1,Yc=!1,ym=typeof WeakSet=="function"?WeakSet:Set,mt=null;function rv(e,t){if(e=e.containerInfo,du=ko,e=Lf(e),Hr(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var c=s.anchorOffset,d=s.focusNode;s=s.focusOffset;try{n.nodeType,d.nodeType}catch{n=null;break e}var y=0,S=-1,N=-1,F=0,Z=0,te=e,Y=null;t:for(;;){for(var q;te!==n||c!==0&&te.nodeType!==3||(S=y+c),te!==d||s!==0&&te.nodeType!==3||(N=y+s),te.nodeType===3&&(y+=te.nodeValue.length),(q=te.firstChild)!==null;)Y=te,te=q;for(;;){if(te===e)break t;if(Y===n&&++F===c&&(S=y),Y===d&&++Z===s&&(N=y),(q=te.nextSibling)!==null)break;te=Y,Y=te.parentNode}te=q}n=S===-1||N===-1?null:{start:S,end:N}}else n=null}n=n||{start:0,end:0}}else n=null;for(fu={focusedElem:e,selectionRange:n},ko=!1,mt=t;mt!==null;)if(t=mt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,mt=e;else for(;mt!==null;){switch(t=mt,d=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)c=e[n],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,n=t,c=d.memoizedProps,d=d.memoizedState,s=n.stateNode;try{var he=Pi(n.type,c);e=s.getSnapshotBeforeUpdate(he,d),s.__reactInternalSnapshotBeforeUpdate=e}catch(Te){Ge(n,n.return,Te)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)pu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":pu(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(o(163))}if(e=t.sibling,e!==null){e.return=t.return,mt=e;break}mt=t.return}}function vm(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:Hn(e,n),s&4&&Da(5,n);break;case 1:if(Hn(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(y){Ge(n,n.return,y)}else{var c=Pi(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Ge(n,n.return,y)}}s&64&&hm(n),s&512&&za(n,n.return);break;case 3:if(Hn(e,n),s&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{ih(e,t)}catch(y){Ge(n,n.return,y)}}break;case 27:t===null&&s&4&&bm(n);case 26:case 5:Hn(e,n),t===null&&s&4&&pm(n),s&512&&za(n,n.return);break;case 12:Hn(e,n);break;case 31:Hn(e,n),s&4&&Sm(e,n);break;case 13:Hn(e,n),s&4&&Cm(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=bv.bind(null,n),Hv(e,n))));break;case 22:if(s=n.memoizedState!==null||Dn,!s){t=t!==null&&t.memoizedState!==null||rt,c=Dn;var d=rt;Dn=s,(rt=t)&&!d?Bn(e,n,(n.subtreeFlags&8772)!==0):Hn(e,n),Dn=c,rt=d}break;case 30:break;default:Hn(e,n)}}function xm(e){var t=e.alternate;t!==null&&(e.alternate=null,xm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&xr(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 Je=null,_t=!1;function zn(e,t,n){for(n=n.child;n!==null;)wm(e,t,n),n=n.sibling}function wm(e,t,n){if(Mt&&typeof Mt.onCommitFiberUnmount=="function")try{Mt.onCommitFiberUnmount(Ri,n)}catch{}switch(n.tag){case 26:rt||gn(n,t),zn(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:rt||gn(n,t);var s=Je,c=_t;mi(n.type)&&(Je=n.stateNode,_t=!1),zn(e,t,n),$a(n.stateNode),Je=s,_t=c;break;case 5:rt||gn(n,t);case 6:if(s=Je,c=_t,Je=null,zn(e,t,n),Je=s,_t=c,Je!==null)if(_t)try{(Je.nodeType===9?Je.body:Je.nodeName==="HTML"?Je.ownerDocument.body:Je).removeChild(n.stateNode)}catch(d){Ge(n,t,d)}else try{Je.removeChild(n.stateNode)}catch(d){Ge(n,t,d)}break;case 18:Je!==null&&(_t?(e=Je,hp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Gl(e)):hp(Je,n.stateNode));break;case 4:s=Je,c=_t,Je=n.stateNode.containerInfo,_t=!0,zn(e,t,n),Je=s,_t=c;break;case 0:case 11:case 14:case 15:oi(2,n,t),rt||oi(4,n,t),zn(e,t,n);break;case 1:rt||(gn(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&mm(n,t,s)),zn(e,t,n);break;case 21:zn(e,t,n);break;case 22:rt=(s=rt)||n.memoizedState!==null,zn(e,t,n),rt=s;break;default:zn(e,t,n)}}function Sm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Gl(e)}catch(n){Ge(t,t.return,n)}}}function Cm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Gl(e)}catch(n){Ge(t,t.return,n)}}function cv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ym),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ym),t;default:throw Error(o(435,e.tag))}}function ro(e,t){var n=cv(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var c=yv.bind(null,e,s);s.then(c,c)}})}function jt(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var c=n[s],d=e,y=t,S=y;e:for(;S!==null;){switch(S.tag){case 27:if(mi(S.type)){Je=S.stateNode,_t=!1;break e}break;case 5:Je=S.stateNode,_t=!1;break e;case 3:case 4:Je=S.stateNode.containerInfo,_t=!0;break e}S=S.return}if(Je===null)throw Error(o(160));wm(d,y,c),Je=null,_t=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Tm(t,e),t=t.sibling}var dn=null;function Tm(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:jt(t,e),Ot(e),s&4&&(oi(3,e,e.return),Da(3,e),oi(5,e,e.return));break;case 1:jt(t,e),Ot(e),s&512&&(rt||n===null||gn(n,n.return)),s&64&&Dn&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?s:n.concat(s))));break;case 26:var c=dn;if(jt(t,e),Ot(e),s&512&&(rt||n===null||gn(n,n.return)),s&4){var d=n!==null?n.memoizedState:null;if(s=e.memoizedState,n===null)if(s===null)if(e.stateNode===null){e:{s=e.type,n=e.memoizedProps,c=c.ownerDocument||c;t:switch(s){case"title":d=c.getElementsByTagName("title")[0],(!d||d[ca]||d[gt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(s),c.head.insertBefore(d,c.querySelector("head > title"))),xt(d,s,n),d[gt]=e,ht(d),s=d;break e;case"link":var y=Tp("link","href",c).get(s+(n.href||""));if(y){for(var S=0;S<y.length;S++)if(d=y[S],d.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&d.getAttribute("rel")===(n.rel==null?null:n.rel)&&d.getAttribute("title")===(n.title==null?null:n.title)&&d.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){y.splice(S,1);break t}}d=c.createElement(s),xt(d,s,n),c.head.appendChild(d);break;case"meta":if(y=Tp("meta","content",c).get(s+(n.content||""))){for(S=0;S<y.length;S++)if(d=y[S],d.getAttribute("content")===(n.content==null?null:""+n.content)&&d.getAttribute("name")===(n.name==null?null:n.name)&&d.getAttribute("property")===(n.property==null?null:n.property)&&d.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&d.getAttribute("charset")===(n.charSet==null?null:n.charSet)){y.splice(S,1);break t}}d=c.createElement(s),xt(d,s,n),c.head.appendChild(d);break;default:throw Error(o(468,s))}d[gt]=e,ht(d),s=d}e.stateNode=s}else Mp(c,e.type,e.stateNode);else e.stateNode=Cp(c,s,e.memoizedProps);else d!==s?(d===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):d.count--,s===null?Mp(c,e.type,e.stateNode):Cp(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Ic(e,e.memoizedProps,n.memoizedProps)}break;case 27:jt(t,e),Ot(e),s&512&&(rt||n===null||gn(n,n.return)),n!==null&&s&4&&Ic(e,e.memoizedProps,n.memoizedProps);break;case 5:if(jt(t,e),Ot(e),s&512&&(rt||n===null||gn(n,n.return)),e.flags&32){c=e.stateNode;try{fl(c,"")}catch(he){Ge(e,e.return,he)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Ic(e,c,n!==null?n.memoizedProps:c)),s&1024&&(Yc=!0);break;case 6:if(jt(t,e),Ot(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(he){Ge(e,e.return,he)}}break;case 3:if(Mo=null,c=dn,dn=Co(t.containerInfo),jt(t,e),dn=c,Ot(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Gl(t.containerInfo)}catch(he){Ge(e,e.return,he)}Yc&&(Yc=!1,Mm(e));break;case 4:s=dn,dn=Co(e.stateNode.containerInfo),jt(t,e),Ot(e),dn=s;break;case 12:jt(t,e),Ot(e);break;case 31:jt(t,e),Ot(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ro(e,s)));break;case 13:jt(t,e),Ot(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(uo=St()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ro(e,s)));break;case 22:c=e.memoizedState!==null;var N=n!==null&&n.memoizedState!==null,F=Dn,Z=rt;if(Dn=F||c,rt=Z||N,jt(t,e),rt=Z,Dn=F,Ot(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(n===null||N||Dn||rt||Xi(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){N=n=t;try{if(d=N.stateNode,c)y=d.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{S=N.stateNode;var te=N.memoizedProps.style,Y=te!=null&&te.hasOwnProperty("display")?te.display:null;S.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(he){Ge(N,N.return,he)}}}else if(t.tag===6){if(n===null){N=t;try{N.stateNode.nodeValue=c?"":N.memoizedProps}catch(he){Ge(N,N.return,he)}}}else if(t.tag===18){if(n===null){N=t;try{var q=N.stateNode;c?mp(q,!0):mp(N.stateNode,!1)}catch(he){Ge(N,N.return,he)}}}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}s&4&&(s=e.updateQueue,s!==null&&(n=s.retryQueue,n!==null&&(s.retryQueue=null,ro(e,n))));break;case 19:jt(t,e),Ot(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ro(e,s)));break;case 30:break;case 21:break;default:jt(t,e),Ot(e)}}function Ot(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(gm(s)){n=s;break}s=s.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var c=n.stateNode,d=Fc(e);oo(e,d,c);break;case 5:var y=n.stateNode;n.flags&32&&(fl(y,""),n.flags&=-33);var S=Fc(e);oo(e,S,y);break;case 3:case 4:var N=n.stateNode.containerInfo,F=Fc(e);Gc(e,F,N);break;default:throw Error(o(161))}}catch(Z){Ge(e,e.return,Z)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Mm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Mm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Hn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)vm(e,t.alternate,t),t=t.sibling}function Xi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:oi(4,t,t.return),Xi(t);break;case 1:gn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&mm(t,t.return,n),Xi(t);break;case 27:$a(t.stateNode);case 26:case 5:gn(t,t.return),Xi(t);break;case 22:t.memoizedState===null&&Xi(t);break;case 30:Xi(t);break;default:Xi(t)}e=e.sibling}}function Bn(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,d=t,y=d.flags;switch(d.tag){case 0:case 11:case 15:Bn(c,d,n),Da(4,d);break;case 1:if(Bn(c,d,n),s=d,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(F){Ge(s,s.return,F)}if(s=d,c=s.updateQueue,c!==null){var S=s.stateNode;try{var N=c.shared.hiddenCallbacks;if(N!==null)for(c.shared.hiddenCallbacks=null,c=0;c<N.length;c++)nh(N[c],S)}catch(F){Ge(s,s.return,F)}}n&&y&64&&hm(d),za(d,d.return);break;case 27:bm(d);case 26:case 5:Bn(c,d,n),n&&s===null&&y&4&&pm(d),za(d,d.return);break;case 12:Bn(c,d,n);break;case 31:Bn(c,d,n),n&&y&4&&Sm(c,d);break;case 13:Bn(c,d,n),n&&y&4&&Cm(c,d);break;case 22:d.memoizedState===null&&Bn(c,d,n),za(d,d.return);break;case 30:break;default:Bn(c,d,n)}t=t.sibling}}function $c(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&&Sa(n))}function qc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Sa(e))}function fn(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Am(e,t,n,s),t=t.sibling}function Am(e,t,n,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:fn(e,t,n,s),c&2048&&Da(9,t);break;case 1:fn(e,t,n,s);break;case 3:fn(e,t,n,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Sa(e)));break;case 12:if(c&2048){fn(e,t,n,s),e=t.stateNode;try{var d=t.memoizedProps,y=d.id,S=d.onPostCommit;typeof S=="function"&&S(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(N){Ge(t,t.return,N)}}else fn(e,t,n,s);break;case 31:fn(e,t,n,s);break;case 13:fn(e,t,n,s);break;case 23:break;case 22:d=t.stateNode,y=t.alternate,t.memoizedState!==null?d._visibility&2?fn(e,t,n,s):Ha(e,t):d._visibility&2?fn(e,t,n,s):(d._visibility|=2,_l(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&$c(y,t);break;case 24:fn(e,t,n,s),c&2048&&qc(t.alternate,t);break;default:fn(e,t,n,s)}}function _l(e,t,n,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,y=t,S=n,N=s,F=y.flags;switch(y.tag){case 0:case 11:case 15:_l(d,y,S,N,c),Da(8,y);break;case 23:break;case 22:var Z=y.stateNode;y.memoizedState!==null?Z._visibility&2?_l(d,y,S,N,c):Ha(d,y):(Z._visibility|=2,_l(d,y,S,N,c)),c&&F&2048&&$c(y.alternate,y);break;case 24:_l(d,y,S,N,c),c&&F&2048&&qc(y.alternate,y);break;default:_l(d,y,S,N,c)}t=t.sibling}}function Ha(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,s=t,c=s.flags;switch(s.tag){case 22:Ha(n,s),c&2048&&$c(s.alternate,s);break;case 24:Ha(n,s),c&2048&&qc(s.alternate,s);break;default:Ha(n,s)}t=t.sibling}}var Ba=8192;function jl(e,t,n){if(e.subtreeFlags&Ba)for(e=e.child;e!==null;)Em(e,t,n),e=e.sibling}function Em(e,t,n){switch(e.tag){case 26:jl(e,t,n),e.flags&Ba&&e.memoizedState!==null&&Xv(n,dn,e.memoizedState,e.memoizedProps);break;case 5:jl(e,t,n);break;case 3:case 4:var s=dn;dn=Co(e.stateNode.containerInfo),jl(e,t,n),dn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Ba,Ba=16777216,jl(e,t,n),Ba=s):jl(e,t,n));break;default:jl(e,t,n)}}function Nm(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 Ua(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];mt=s,Lm(s,e)}Nm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)km(e),e=e.sibling}function km(e){switch(e.tag){case 0:case 11:case 15:Ua(e),e.flags&2048&&oi(9,e,e.return);break;case 3:Ua(e);break;case 12:Ua(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,co(e)):Ua(e);break;default:Ua(e)}}function co(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];mt=s,Lm(s,e)}Nm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:oi(8,t,t.return),co(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,co(t));break;default:co(t)}e=e.sibling}}function Lm(e,t){for(;mt!==null;){var n=mt;switch(n.tag){case 0:case 11:case 15:oi(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var s=n.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Sa(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,mt=s;else e:for(n=e;mt!==null;){s=mt;var c=s.sibling,d=s.return;if(xm(s),s===n){mt=null;break e}if(c!==null){c.return=d,mt=c;break e}mt=d}}}var uv={getCacheForType:function(e){var t=yt(at),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return yt(at).controller.signal}},dv=typeof WeakMap=="function"?WeakMap:Map,Ie=0,Ve=null,je=null,De=0,Fe=0,Gt=null,ri=!1,Ol=!1,Vc=!1,Un=0,nt=0,ci=0,Qi=0,Pc=0,Yt=0,Dl=0,Ka=null,Dt=null,Xc=!1,uo=0,Rm=0,fo=1/0,ho=null,ui=null,dt=0,di=null,zl=null,Kn=0,Qc=0,Zc=null,_m=null,Ia=0,Wc=null;function $t(){return(Ie&2)!==0&&De!==0?De&-De:E.T!==null?lu():Vd()}function jm(){if(Yt===0)if((De&536870912)===0||He){var e=_i;_i<<=1,(_i&3932160)===0&&(_i=262144),Yt=e}else Yt=536870912;return e=It.current,e!==null&&(e.flags|=32),Yt}function zt(e,t,n){(e===Ve&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(Hl(e,0),fi(e,De,Yt,!1)),ra(e,n),((Ie&2)===0||e!==Ve)&&(e===Ve&&((Ie&2)===0&&(Qi|=n),nt===4&&fi(e,De,Yt,!1)),bn(e))}function Om(e,t,n){if((Ie&6)!==0)throw Error(o(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||oa(e,t),c=s?mv(e,t):eu(e,t,!0),d=s;do{if(c===0){Ol&&!s&&fi(e,t,0,!1);break}else{if(n=e.current.alternate,d&&!fv(n)){c=eu(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var S=e;c=Ka;var N=S.current.memoizedState.isDehydrated;if(N&&(Hl(S,y).flags|=256),y=eu(S,y,!1),y!==2){if(Vc&&!N){S.errorRecoveryDisabledLanes|=d,Qi|=d,c=4;break e}d=Dt,Dt=c,d!==null&&(Dt===null?Dt=d:Dt.push.apply(Dt,d))}c=y}if(d=!1,c!==2)continue}}if(c===1){Hl(e,0),fi(e,t,0,!0);break}e:{switch(s=e,d=c,d){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:fi(s,t,Yt,!ri);break e;case 2:Dt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=uo+300-St(),10<c)){if(fi(s,t,Yt,!ri),Ss(s,0,!0)!==0)break e;Kn=t,s.timeoutHandle=dp(Dm.bind(null,s,n,Dt,ho,Xc,t,Yt,Qi,Dl,ri,d,"Throttled",-0,0),c);break e}Dm(s,n,Dt,ho,Xc,t,Yt,Qi,Dl,ri,d,null,-0,0)}}break}while(!0);bn(e)}function Dm(e,t,n,s,c,d,y,S,N,F,Z,te,Y,q){if(e.timeoutHandle=-1,te=t.subtreeFlags,te&8192||(te&16785408)===16785408){te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Mn},Em(t,d,te);var he=(d&62914560)===d?uo-St():(d&4194048)===d?Rm-St():0;if(he=Qv(te,he),he!==null){Kn=d,e.cancelPendingCommit=he(Gm.bind(null,e,t,d,n,s,c,y,S,N,Z,te,null,Y,q)),fi(e,d,y,!F);return}}Gm(e,t,d,n,s,c,y,S,N)}function fv(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 s=0;s<n.length;s++){var c=n[s],d=c.getSnapshot;c=c.value;try{if(!Ut(d(),c))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 fi(e,t,n,s){t&=~Pc,t&=~Qi,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var d=31-Ct(c),y=1<<d;s[d]=-1,c&=~y}n!==0&&Yd(e,n,t)}function mo(){return(Ie&6)===0?(Fa(0),!1):!0}function Jc(){if(je!==null){if(Fe===0)var e=je.return;else e=je,kn=Ii=null,pc(e),El=null,Ta=0,e=je;for(;e!==null;)fm(e.alternate,e),e=e.return;je=null}}function Hl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,_v(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Kn=0,Jc(),Ve=e,je=n=En(e.current,null),De=t,Fe=0,Gt=null,ri=!1,Ol=oa(e,t),Vc=!1,Dl=Yt=Pc=Qi=ci=nt=0,Dt=Ka=null,Xc=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var c=31-Ct(s),d=1<<c;t|=e[c],s&=~d}return Un=t,Os(),n}function zm(e,t){Ne=null,E.H=_a,t===Al||t===Fs?(t=Wf(),Fe=3):t===ic?(t=Wf(),Fe=4):Fe=t===Rc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Gt=t,je===null&&(nt=1,no(e,Zt(t,e.current)))}function Hm(){var e=It.current;return e===null?!0:(De&4194048)===De?tn===null:(De&62914560)===De||(De&536870912)!==0?e===tn:!1}function Bm(){var e=E.H;return E.H=_a,e===null?_a:e}function Um(){var e=E.A;return E.A=uv,e}function po(){nt=4,ri||(De&4194048)!==De&&It.current!==null||(Ol=!0),(ci&134217727)===0&&(Qi&134217727)===0||Ve===null||fi(Ve,De,Yt,!1)}function eu(e,t,n){var s=Ie;Ie|=2;var c=Bm(),d=Um();(Ve!==e||De!==t)&&(ho=null,Hl(e,t)),t=!1;var y=nt;e:do try{if(Fe!==0&&je!==null){var S=je,N=Gt;switch(Fe){case 8:Jc(),y=6;break e;case 3:case 2:case 9:case 6:It.current===null&&(t=!0);var F=Fe;if(Fe=0,Gt=null,Bl(e,S,N,F),n&&Ol){y=0;break e}break;default:F=Fe,Fe=0,Gt=null,Bl(e,S,N,F)}}hv(),y=nt;break}catch(Z){zm(e,Z)}while(!0);return t&&e.shellSuspendCounter++,kn=Ii=null,Ie=s,E.H=c,E.A=d,je===null&&(Ve=null,De=0,Os()),y}function hv(){for(;je!==null;)Km(je)}function mv(e,t){var n=Ie;Ie|=2;var s=Bm(),c=Um();Ve!==e||De!==t?(ho=null,fo=St()+500,Hl(e,t)):Ol=oa(e,t);e:do try{if(Fe!==0&&je!==null){t=je;var d=Gt;t:switch(Fe){case 1:Fe=0,Gt=null,Bl(e,t,d,1);break;case 2:case 9:if(Qf(d)){Fe=0,Gt=null,Im(t);break}t=function(){Fe!==2&&Fe!==9||Ve!==e||(Fe=7),bn(e)},d.then(t,t);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:Qf(d)?(Fe=0,Gt=null,Im(t)):(Fe=0,Gt=null,Bl(e,t,d,7));break;case 5:var y=null;switch(je.tag){case 26:y=je.memoizedState;case 5:case 27:var S=je;if(y?Ap(y):S.stateNode.complete){Fe=0,Gt=null;var N=S.sibling;if(N!==null)je=N;else{var F=S.return;F!==null?(je=F,go(F)):je=null}break t}}Fe=0,Gt=null,Bl(e,t,d,5);break;case 6:Fe=0,Gt=null,Bl(e,t,d,6);break;case 8:Jc(),nt=6;break e;default:throw Error(o(462))}}pv();break}catch(Z){zm(e,Z)}while(!0);return kn=Ii=null,E.H=s,E.A=c,Ie=n,je!==null?0:(Ve=null,De=0,Os(),nt)}function pv(){for(;je!==null&&!ps();)Km(je)}function Km(e){var t=um(e.alternate,e,Un);e.memoizedProps=e.pendingProps,t===null?go(e):je=t}function Im(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=lm(n,t,t.pendingProps,t.type,void 0,De);break;case 11:t=lm(n,t,t.pendingProps,t.type.render,t.ref,De);break;case 5:pc(t);default:fm(n,t),t=je=Uf(t,Un),t=um(n,t,Un)}e.memoizedProps=e.pendingProps,t===null?go(e):je=t}function Bl(e,t,n,s){kn=Ii=null,pc(t),El=null,Ta=0;var c=t.return;try{if(iv(e,c,t,n,De)){nt=1,no(e,Zt(n,e.current)),je=null;return}}catch(d){if(c!==null)throw je=c,d;nt=1,no(e,Zt(n,e.current)),je=null;return}t.flags&32768?(He||s===1?e=!0:Ol||(De&536870912)!==0?e=!1:(ri=e=!0,(s===2||s===9||s===3||s===6)&&(s=It.current,s!==null&&s.tag===13&&(s.flags|=16384))),Fm(t,e)):go(t)}function go(e){var t=e;do{if((t.flags&32768)!==0){Fm(t,ri);return}e=t.return;var n=sv(t.alternate,t,Un);if(n!==null){je=n;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);nt===0&&(nt=5)}function Fm(e,t){do{var n=ov(e.alternate,e);if(n!==null){n.flags&=32767,je=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){je=e;return}je=e=n}while(e!==null);nt=6,je=null}function Gm(e,t,n,s,c,d,y,S,N){e.cancelPendingCommit=null;do bo();while(dt!==0);if((Ie&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(d=t.lanes|t.childLanes,d|=Fr,Py(e,n,d,y,S,N),e===Ve&&(je=Ve=null,De=0),zl=t,di=e,Kn=n,Qc=d,Zc=c,_m=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,vv(Li,function(){return Pm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=E.T,E.T=null,c=G.p,G.p=2,y=Ie,Ie|=4;try{rv(e,t,n)}finally{Ie=y,G.p=c,E.T=s}}dt=1,Ym(),$m(),qm()}}function Ym(){if(dt===1){dt=0;var e=di,t=zl,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=E.T,E.T=null;var s=G.p;G.p=2;var c=Ie;Ie|=4;try{Tm(t,e);var d=fu,y=Lf(e.containerInfo),S=d.focusedElem,N=d.selectionRange;if(y!==S&&S&&S.ownerDocument&&kf(S.ownerDocument.documentElement,S)){if(N!==null&&Hr(S)){var F=N.start,Z=N.end;if(Z===void 0&&(Z=F),"selectionStart"in S)S.selectionStart=F,S.selectionEnd=Math.min(Z,S.value.length);else{var te=S.ownerDocument||document,Y=te&&te.defaultView||window;if(Y.getSelection){var q=Y.getSelection(),he=S.textContent.length,Te=Math.min(N.start,he),qe=N.end===void 0?Te:Math.min(N.end,he);!q.extend&&Te>qe&&(y=qe,qe=Te,Te=y);var B=Nf(S,Te),j=Nf(S,qe);if(B&&j&&(q.rangeCount!==1||q.anchorNode!==B.node||q.anchorOffset!==B.offset||q.focusNode!==j.node||q.focusOffset!==j.offset)){var I=te.createRange();I.setStart(B.node,B.offset),q.removeAllRanges(),Te>qe?(q.addRange(I),q.extend(j.node,j.offset)):(I.setEnd(j.node,j.offset),q.addRange(I))}}}}for(te=[],q=S;q=q.parentNode;)q.nodeType===1&&te.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<te.length;S++){var ee=te[S];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}ko=!!du,fu=du=null}finally{Ie=c,G.p=s,E.T=n}}e.current=t,dt=2}}function $m(){if(dt===2){dt=0;var e=di,t=zl,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=E.T,E.T=null;var s=G.p;G.p=2;var c=Ie;Ie|=4;try{vm(e,t.alternate,t)}finally{Ie=c,G.p=s,E.T=n}}dt=3}}function qm(){if(dt===4||dt===3){dt=0,gs();var e=di,t=zl,n=Kn,s=_m;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?dt=5:(dt=0,zl=di=null,Vm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(ui=null),yr(n),t=t.stateNode,Mt&&typeof Mt.onCommitFiberRoot=="function")try{Mt.onCommitFiberRoot(Ri,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=E.T,c=G.p,G.p=2,E.T=null;try{for(var d=e.onRecoverableError,y=0;y<s.length;y++){var S=s[y];d(S.value,{componentStack:S.stack})}}finally{E.T=t,G.p=c}}(Kn&3)!==0&&bo(),bn(e),c=e.pendingLanes,(n&261930)!==0&&(c&42)!==0?e===Wc?Ia++:(Ia=0,Wc=e):Ia=0,Fa(0)}}function Vm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Sa(t)))}function bo(){return Ym(),$m(),qm(),Pm()}function Pm(){if(dt!==5)return!1;var e=di,t=Qc;Qc=0;var n=yr(Kn),s=E.T,c=G.p;try{G.p=32>n?32:n,E.T=null,n=Zc,Zc=null;var d=di,y=Kn;if(dt=0,zl=di=null,Kn=0,(Ie&6)!==0)throw Error(o(331));var S=Ie;if(Ie|=4,km(d.current),Am(d,d.current,y,n),Ie=S,Fa(0,!1),Mt&&typeof Mt.onPostCommitFiberRoot=="function")try{Mt.onPostCommitFiberRoot(Ri,d)}catch{}return!0}finally{G.p=c,E.T=s,Vm(e,t)}}function Xm(e,t,n){t=Zt(n,t),t=Lc(e.stateNode,t,2),e=li(e,t,2),e!==null&&(ra(e,2),bn(e))}function Ge(e,t,n){if(e.tag===3)Xm(e,e,n);else for(;t!==null;){if(t.tag===3){Xm(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(ui===null||!ui.has(s))){e=Zt(n,e),n=Qh(2),s=li(t,n,2),s!==null&&(Zh(n,s,t,e),ra(s,2),bn(s));break}}t=t.return}}function tu(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new dv;var c=new Set;s.set(t,c)}else c=s.get(t),c===void 0&&(c=new Set,s.set(t,c));c.has(n)||(Vc=!0,c.add(n),e=gv.bind(null,e,t,n),t.then(e,e))}function gv(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ve===e&&(De&n)===n&&(nt===4||nt===3&&(De&62914560)===De&&300>St()-uo?(Ie&2)===0&&Hl(e,0):Pc|=n,Dl===De&&(Dl=0)),bn(e)}function Qm(e,t){t===0&&(t=Gd()),e=Bi(e,t),e!==null&&(ra(e,t),bn(e))}function bv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Qm(e,n)}function yv(e,t){var n=0;switch(e.tag){case 31:case 13:var s=e.stateNode,c=e.memoizedState;c!==null&&(n=c.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(o(314))}s!==null&&s.delete(t),Qm(e,n)}function vv(e,t){return kt(e,t)}var yo=null,Ul=null,nu=!1,vo=!1,iu=!1,hi=0;function bn(e){e!==Ul&&e.next===null&&(Ul===null?yo=Ul=e:Ul=Ul.next=e),vo=!0,nu||(nu=!0,wv())}function Fa(e,t){if(!iu&&vo){iu=!0;do for(var n=!1,s=yo;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var d=0;else{var y=s.suspendedLanes,S=s.pingedLanes;d=(1<<31-Ct(42|e)+1)-1,d&=c&~(y&~S),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(n=!0,ep(s,d))}else d=De,d=Ss(s,s===Ve?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||oa(s,d)||(n=!0,ep(s,d));s=s.next}while(n);iu=!1}}function xv(){Zm()}function Zm(){vo=nu=!1;var e=0;hi!==0&&Rv()&&(e=hi);for(var t=St(),n=null,s=yo;s!==null;){var c=s.next,d=Wm(s,t);d===0?(s.next=null,n===null?yo=c:n.next=c,c===null&&(Ul=n)):(n=s,(e!==0||(d&3)!==0)&&(vo=!0)),s=c}dt!==0&&dt!==5||Fa(e),hi!==0&&(hi=0)}function Wm(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var y=31-Ct(d),S=1<<y,N=c[y];N===-1?((S&n)===0||(S&s)!==0)&&(c[y]=Vy(S,t)):N<=t&&(e.expiredLanes|=S),d&=~S}if(t=Ve,n=De,n=Ss(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Cn(s),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||oa(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&Cn(s),yr(n)){case 2:case 8:n=aa;break;case 32:n=Li;break;case 268435456:n=sa;break;default:n=Li}return s=Jm.bind(null,e),n=kt(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&Cn(s),e.callbackPriority=2,e.callbackNode=null,2}function Jm(e,t){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(bo()&&e.callbackNode!==n)return null;var s=De;return s=Ss(e,e===Ve?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Om(e,s,t),Wm(e,St()),e.callbackNode!=null&&e.callbackNode===n?Jm.bind(null,e):null)}function ep(e,t){if(bo())return null;Om(e,t,!0)}function wv(){jv(function(){(Ie&6)!==0?kt(la,xv):Zm()})}function lu(){if(hi===0){var e=Tl;e===0&&(e=Vt,Vt<<=1,(Vt&261888)===0&&(Vt=256)),hi=e}return hi}function tp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:As(""+e)}function np(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 Sv(e,t,n,s,c){if(t==="submit"&&n&&n.stateNode===c){var d=tp((c[Lt]||null).action),y=s.submitter;y&&(t=(t=y[Lt]||null)?tp(t.formAction):y.getAttribute("formAction"),t!==null&&(d=t,y=null));var S=new Ls("action","action",null,s,c);e.push({event:S,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(hi!==0){var N=y?np(c,y):new FormData(c);Tc(n,{pending:!0,data:N,method:c.method,action:d},null,N)}}else typeof d=="function"&&(S.preventDefault(),N=y?np(c,y):new FormData(c),Tc(n,{pending:!0,data:N,method:c.method,action:d},d,N))},currentTarget:c}]})}}for(var au=0;au<Ir.length;au++){var su=Ir[au],Cv=su.toLowerCase(),Tv=su[0].toUpperCase()+su.slice(1);un(Cv,"on"+Tv)}un(jf,"onAnimationEnd"),un(Of,"onAnimationIteration"),un(Df,"onAnimationStart"),un("dblclick","onDoubleClick"),un("focusin","onFocus"),un("focusout","onBlur"),un(K0,"onTransitionRun"),un(I0,"onTransitionStart"),un(F0,"onTransitionCancel"),un(zf,"onTransitionEnd"),ul("onMouseEnter",["mouseout","mouseover"]),ul("onMouseLeave",["mouseout","mouseover"]),ul("onPointerEnter",["pointerout","pointerover"]),ul("onPointerLeave",["pointerout","pointerover"]),Oi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Oi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Oi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Oi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Oi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Oi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ga="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(" "),Mv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ga));function ip(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],c=s.event;s=s.listeners;e:{var d=void 0;if(t)for(var y=s.length-1;0<=y;y--){var S=s[y],N=S.instance,F=S.currentTarget;if(S=S.listener,N!==d&&c.isPropagationStopped())break e;d=S,c.currentTarget=F;try{d(c)}catch(Z){js(Z)}c.currentTarget=null,d=N}else for(y=0;y<s.length;y++){if(S=s[y],N=S.instance,F=S.currentTarget,S=S.listener,N!==d&&c.isPropagationStopped())break e;d=S,c.currentTarget=F;try{d(c)}catch(Z){js(Z)}c.currentTarget=null,d=N}}}}function Oe(e,t){var n=t[vr];n===void 0&&(n=t[vr]=new Set);var s=e+"__bubble";n.has(s)||(lp(t,e,2,!1),n.add(s))}function ou(e,t,n){var s=0;t&&(s|=4),lp(n,e,s,t)}var xo="_reactListening"+Math.random().toString(36).slice(2);function ru(e){if(!e[xo]){e[xo]=!0,Qd.forEach(function(n){n!=="selectionchange"&&(Mv.has(n)||ou(n,!1,e),ou(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[xo]||(t[xo]=!0,ou("selectionchange",!1,t))}}function lp(e,t,n,s){switch(jp(t)){case 2:var c=Jv;break;case 8:c=ex;break;default:c=Cu}n=c.bind(null,t,n,e),c=void 0,!Nr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),s?c!==void 0?e.addEventListener(t,n,{capture:!0,passive:c}):e.addEventListener(t,n,!0):c!==void 0?e.addEventListener(t,n,{passive:c}):e.addEventListener(t,n,!1)}function cu(e,t,n,s,c){var d=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var y=s.tag;if(y===3||y===4){var S=s.stateNode.containerInfo;if(S===c)break;if(y===4)for(y=s.return;y!==null;){var N=y.tag;if((N===3||N===4)&&y.stateNode.containerInfo===c)return;y=y.return}for(;S!==null;){if(y=ol(S),y===null)return;if(N=y.tag,N===5||N===6||N===26||N===27){s=d=y;continue e}S=S.parentNode}}s=s.return}cf(function(){var F=d,Z=Ar(n),te=[];e:{var Y=Hf.get(e);if(Y!==void 0){var q=Ls,he=e;switch(e){case"keypress":if(Ns(n)===0)break e;case"keydown":case"keyup":q=y0;break;case"focusin":he="focus",q=_r;break;case"focusout":he="blur",q=_r;break;case"beforeblur":case"afterblur":q=_r;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":q=ff;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":q=s0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":q=w0;break;case jf:case Of:case Df:q=c0;break;case zf:q=C0;break;case"scroll":case"scrollend":q=l0;break;case"wheel":q=M0;break;case"copy":case"cut":case"paste":q=d0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":q=mf;break;case"toggle":case"beforetoggle":q=E0}var Te=(t&4)!==0,qe=!Te&&(e==="scroll"||e==="scrollend"),B=Te?Y!==null?Y+"Capture":null:Y;Te=[];for(var j=F,I;j!==null;){var ee=j;if(I=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||I===null||B===null||(ee=da(j,B),ee!=null&&Te.push(Ya(j,ee,I))),qe)break;j=j.return}0<Te.length&&(Y=new q(Y,he,null,n,Z),te.push({event:Y,listeners:Te}))}}if((t&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",q=e==="mouseout"||e==="pointerout",Y&&n!==Mr&&(he=n.relatedTarget||n.fromElement)&&(ol(he)||he[sl]))break e;if((q||Y)&&(Y=Z.window===Z?Z:(Y=Z.ownerDocument)?Y.defaultView||Y.parentWindow:window,q?(he=n.relatedTarget||n.toElement,q=F,he=he?ol(he):null,he!==null&&(qe=u(he),Te=he.tag,he!==qe||Te!==5&&Te!==27&&Te!==6)&&(he=null)):(q=null,he=F),q!==he)){if(Te=ff,ee="onMouseLeave",B="onMouseEnter",j="mouse",(e==="pointerout"||e==="pointerover")&&(Te=mf,ee="onPointerLeave",B="onPointerEnter",j="pointer"),qe=q==null?Y:ua(q),I=he==null?Y:ua(he),Y=new Te(ee,j+"leave",q,n,Z),Y.target=qe,Y.relatedTarget=I,ee=null,ol(Z)===F&&(Te=new Te(B,j+"enter",he,n,Z),Te.target=I,Te.relatedTarget=qe,ee=Te),qe=ee,q&&he)t:{for(Te=Av,B=q,j=he,I=0,ee=B;ee;ee=Te(ee))I++;ee=0;for(var Ce=j;Ce;Ce=Te(Ce))ee++;for(;0<I-ee;)B=Te(B),I--;for(;0<ee-I;)j=Te(j),ee--;for(;I--;){if(B===j||j!==null&&B===j.alternate){Te=B;break t}B=Te(B),j=Te(j)}Te=null}else Te=null;q!==null&&ap(te,Y,q,Te,!1),he!==null&&qe!==null&&ap(te,qe,he,Te,!0)}}e:{if(Y=F?ua(F):window,q=Y.nodeName&&Y.nodeName.toLowerCase(),q==="select"||q==="input"&&Y.type==="file")var Ue=Sf;else if(xf(Y))if(Cf)Ue=H0;else{Ue=D0;var be=O0}else q=Y.nodeName,!q||q.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?F&&Tr(F.elementType)&&(Ue=Sf):Ue=z0;if(Ue&&(Ue=Ue(e,F))){wf(te,Ue,n,Z);break e}be&&be(e,Y,F),e==="focusout"&&F&&Y.type==="number"&&F.memoizedProps.value!=null&&Cr(Y,"number",Y.value)}switch(be=F?ua(F):window,e){case"focusin":(xf(be)||be.contentEditable==="true")&&(gl=be,Br=F,va=null);break;case"focusout":va=Br=gl=null;break;case"mousedown":Ur=!0;break;case"contextmenu":case"mouseup":case"dragend":Ur=!1,Rf(te,n,Z);break;case"selectionchange":if(U0)break;case"keydown":case"keyup":Rf(te,n,Z)}var Re;if(Or)e:{switch(e){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else pl?yf(e,n)&&(ze="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(ze="onCompositionStart");ze&&(pf&&n.locale!=="ko"&&(pl||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&pl&&(Re=uf()):(Zn=Z,kr="value"in Zn?Zn.value:Zn.textContent,pl=!0)),be=wo(F,ze),0<be.length&&(ze=new hf(ze,e,null,n,Z),te.push({event:ze,listeners:be}),Re?ze.data=Re:(Re=vf(n),Re!==null&&(ze.data=Re)))),(Re=k0?L0(e,n):R0(e,n))&&(ze=wo(F,"onBeforeInput"),0<ze.length&&(be=new hf("onBeforeInput","beforeinput",null,n,Z),te.push({event:be,listeners:ze}),be.data=Re)),Sv(te,e,F,n,Z)}ip(te,t)})}function Ya(e,t,n){return{instance:e,listener:t,currentTarget:n}}function wo(e,t){for(var n=t+"Capture",s=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=da(e,n),c!=null&&s.unshift(Ya(e,c,d)),c=da(e,t),c!=null&&s.push(Ya(e,c,d))),e.tag===3)return s;e=e.return}return[]}function Av(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ap(e,t,n,s,c){for(var d=t._reactName,y=[];n!==null&&n!==s;){var S=n,N=S.alternate,F=S.stateNode;if(S=S.tag,N!==null&&N===s)break;S!==5&&S!==26&&S!==27||F===null||(N=F,c?(F=da(n,d),F!=null&&y.unshift(Ya(n,F,N))):c||(F=da(n,d),F!=null&&y.push(Ya(n,F,N)))),n=n.return}y.length!==0&&e.push({event:t,listeners:y})}var Ev=/\r\n?/g,Nv=/\u0000|\uFFFD/g;function sp(e){return(typeof e=="string"?e:""+e).replace(Ev,`
33
+ `).replace(Nv,"")}function op(e,t){return t=sp(t),sp(e)===t}function $e(e,t,n,s,c,d){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||fl(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&fl(e,""+s);break;case"className":Ts(e,"class",s);break;case"tabIndex":Ts(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Ts(e,n,s);break;case"style":of(e,s,d);break;case"data":if(t!=="object"){Ts(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=As(""+s),e.setAttribute(n,s);break;case"action":case"formAction":if(typeof s=="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 d=="function"&&(n==="formAction"?(t!=="input"&&$e(e,t,"name",c.name,c,null),$e(e,t,"formEncType",c.formEncType,c,null),$e(e,t,"formMethod",c.formMethod,c,null),$e(e,t,"formTarget",c.formTarget,c,null)):($e(e,t,"encType",c.encType,c,null),$e(e,t,"method",c.method,c,null),$e(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=As(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=Mn);break;case"onScroll":s!=null&&Oe("scroll",e);break;case"onScrollEnd":s!=null&&Oe("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(n=s.__html,n!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=n}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}n=As(""+s),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":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""+s):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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":s===!0?e.setAttribute(n,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,s):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(n,s):e.removeAttribute(n);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(n):e.setAttribute(n,s);break;case"popover":Oe("beforetoggle",e),Oe("toggle",e),Cs(e,"popover",s);break;case"xlinkActuate":Tn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Tn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Tn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Tn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Tn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Tn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Tn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Tn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Tn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Cs(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=n0.get(n)||n,Cs(e,n,s))}}function uu(e,t,n,s,c,d){switch(n){case"style":of(e,s,d);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(n=s.__html,n!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=n}}break;case"children":typeof s=="string"?fl(e,s):(typeof s=="number"||typeof s=="bigint")&&fl(e,""+s);break;case"onScroll":s!=null&&Oe("scroll",e);break;case"onScrollEnd":s!=null&&Oe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Mn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zd.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(c=n.endsWith("Capture"),t=n.slice(2,c?n.length-7:void 0),d=e[Lt]||null,d=d!=null?d[n]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof s=="function")){typeof d!="function"&&d!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,s,c);break e}n in e?e[n]=s:s===!0?e.setAttribute(n,""):Cs(e,n,s)}}}function xt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Oe("error",e),Oe("load",e);var s=!1,c=!1,d;for(d in n)if(n.hasOwnProperty(d)){var y=n[d];if(y!=null)switch(d){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:$e(e,t,d,y,n,null)}}c&&$e(e,t,"srcSet",n.srcSet,n,null),s&&$e(e,t,"src",n.src,n,null);return;case"input":Oe("invalid",e);var S=d=y=c=null,N=null,F=null;for(s in n)if(n.hasOwnProperty(s)){var Z=n[s];if(Z!=null)switch(s){case"name":c=Z;break;case"type":y=Z;break;case"checked":N=Z;break;case"defaultChecked":F=Z;break;case"value":d=Z;break;case"defaultValue":S=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(o(137,t));break;default:$e(e,t,s,Z,n,null)}}nf(e,d,S,N,F,y,c,!1);return;case"select":Oe("invalid",e),s=y=d=null;for(c in n)if(n.hasOwnProperty(c)&&(S=n[c],S!=null))switch(c){case"value":d=S;break;case"defaultValue":y=S;break;case"multiple":s=S;default:$e(e,t,c,S,n,null)}t=d,n=y,e.multiple=!!s,t!=null?dl(e,!!s,t,!1):n!=null&&dl(e,!!s,n,!0);return;case"textarea":Oe("invalid",e),d=c=s=null;for(y in n)if(n.hasOwnProperty(y)&&(S=n[y],S!=null))switch(y){case"value":s=S;break;case"defaultValue":c=S;break;case"children":d=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(o(91));break;default:$e(e,t,y,S,n,null)}af(e,s,c,d);return;case"option":for(N in n)if(n.hasOwnProperty(N)&&(s=n[N],s!=null))switch(N){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:$e(e,t,N,s,n,null)}return;case"dialog":Oe("beforetoggle",e),Oe("toggle",e),Oe("cancel",e),Oe("close",e);break;case"iframe":case"object":Oe("load",e);break;case"video":case"audio":for(s=0;s<Ga.length;s++)Oe(Ga[s],e);break;case"image":Oe("error",e),Oe("load",e);break;case"details":Oe("toggle",e);break;case"embed":case"source":case"link":Oe("error",e),Oe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(F in n)if(n.hasOwnProperty(F)&&(s=n[F],s!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:$e(e,t,F,s,n,null)}return;default:if(Tr(t)){for(Z in n)n.hasOwnProperty(Z)&&(s=n[Z],s!==void 0&&uu(e,t,Z,s,n,void 0));return}}for(S in n)n.hasOwnProperty(S)&&(s=n[S],s!=null&&$e(e,t,S,s,n,null))}function kv(e,t,n,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,y=null,S=null,N=null,F=null,Z=null;for(q in n){var te=n[q];if(n.hasOwnProperty(q)&&te!=null)switch(q){case"checked":break;case"value":break;case"defaultValue":N=te;default:s.hasOwnProperty(q)||$e(e,t,q,null,s,te)}}for(var Y in s){var q=s[Y];if(te=n[Y],s.hasOwnProperty(Y)&&(q!=null||te!=null))switch(Y){case"type":d=q;break;case"name":c=q;break;case"checked":F=q;break;case"defaultChecked":Z=q;break;case"value":y=q;break;case"defaultValue":S=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(o(137,t));break;default:q!==te&&$e(e,t,Y,q,s,te)}}Sr(e,y,S,N,F,Z,d,c);return;case"select":q=y=S=Y=null;for(d in n)if(N=n[d],n.hasOwnProperty(d)&&N!=null)switch(d){case"value":break;case"multiple":q=N;default:s.hasOwnProperty(d)||$e(e,t,d,null,s,N)}for(c in s)if(d=s[c],N=n[c],s.hasOwnProperty(c)&&(d!=null||N!=null))switch(c){case"value":Y=d;break;case"defaultValue":S=d;break;case"multiple":y=d;default:d!==N&&$e(e,t,c,d,s,N)}t=S,n=y,s=q,Y!=null?dl(e,!!n,Y,!1):!!s!=!!n&&(t!=null?dl(e,!!n,t,!0):dl(e,!!n,n?[]:"",!1));return;case"textarea":q=Y=null;for(S in n)if(c=n[S],n.hasOwnProperty(S)&&c!=null&&!s.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:$e(e,t,S,null,s,c)}for(y in s)if(c=s[y],d=n[y],s.hasOwnProperty(y)&&(c!=null||d!=null))switch(y){case"value":Y=c;break;case"defaultValue":q=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==d&&$e(e,t,y,c,s,d)}lf(e,Y,q);return;case"option":for(var he in n)if(Y=n[he],n.hasOwnProperty(he)&&Y!=null&&!s.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:$e(e,t,he,null,s,Y)}for(N in s)if(Y=s[N],q=n[N],s.hasOwnProperty(N)&&Y!==q&&(Y!=null||q!=null))switch(N){case"selected":e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:$e(e,t,N,Y,s,q)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Te in n)Y=n[Te],n.hasOwnProperty(Te)&&Y!=null&&!s.hasOwnProperty(Te)&&$e(e,t,Te,null,s,Y);for(F in s)if(Y=s[F],q=n[F],s.hasOwnProperty(F)&&Y!==q&&(Y!=null||q!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(o(137,t));break;default:$e(e,t,F,Y,s,q)}return;default:if(Tr(t)){for(var qe in n)Y=n[qe],n.hasOwnProperty(qe)&&Y!==void 0&&!s.hasOwnProperty(qe)&&uu(e,t,qe,void 0,s,Y);for(Z in s)Y=s[Z],q=n[Z],!s.hasOwnProperty(Z)||Y===q||Y===void 0&&q===void 0||uu(e,t,Z,Y,s,q);return}}for(var B in n)Y=n[B],n.hasOwnProperty(B)&&Y!=null&&!s.hasOwnProperty(B)&&$e(e,t,B,null,s,Y);for(te in s)Y=s[te],q=n[te],!s.hasOwnProperty(te)||Y===q||Y==null&&q==null||$e(e,t,te,Y,s,q)}function rp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Lv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),s=0;s<n.length;s++){var c=n[s],d=c.transferSize,y=c.initiatorType,S=c.duration;if(d&&S&&rp(y)){for(y=0,S=c.responseEnd,s+=1;s<n.length;s++){var N=n[s],F=N.startTime;if(F>S)break;var Z=N.transferSize,te=N.initiatorType;Z&&rp(te)&&(N=N.responseEnd,y+=Z*(N<S?1:(S-F)/(N-F)))}if(--s,t+=8*(d+y)/(c.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 du=null,fu=null;function So(e){return e.nodeType===9?e:e.ownerDocument}function cp(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 up(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 hu(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 mu=null;function Rv(){var e=window.event;return e&&e.type==="popstate"?e===mu?!1:(mu=e,!0):(mu=null,!1)}var dp=typeof setTimeout=="function"?setTimeout:void 0,_v=typeof clearTimeout=="function"?clearTimeout:void 0,fp=typeof Promise=="function"?Promise:void 0,jv=typeof queueMicrotask=="function"?queueMicrotask:typeof fp<"u"?function(e){return fp.resolve(null).then(e).catch(Ov)}:dp;function Ov(e){setTimeout(function(){throw e})}function mi(e){return e==="head"}function hp(e,t){var n=t,s=0;do{var c=n.nextSibling;if(e.removeChild(n),c&&c.nodeType===8)if(n=c.data,n==="/$"||n==="/&"){if(s===0){e.removeChild(c),Gl(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")$a(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,$a(n);for(var d=n.firstChild;d;){var y=d.nextSibling,S=d.nodeName;d[ca]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&d.rel.toLowerCase()==="stylesheet"||n.removeChild(d),d=y}}else n==="body"&&$a(e.ownerDocument.body);n=c}while(n);Gl(t)}function mp(e,t){var n=e;e=0;do{var s=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||""),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=s}while(n)}function pu(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":pu(n),xr(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Dv(e,t,n,s){for(;e.nodeType===1;){var c=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[ca])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=nn(e.nextSibling),e===null)break}return null}function zv(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=nn(e.nextSibling),e===null))return null;return e}function pp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=nn(e.nextSibling),e===null))return null;return e}function gu(e){return e.data==="$?"||e.data==="$~"}function bu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Hv(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var s=function(){t(),n.removeEventListener("DOMContentLoaded",s)};n.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function nn(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 yu=null;function gp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return nn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function bp(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 yp(e,t,n){switch(t=So(n),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function $a(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);xr(e)}var ln=new Map,vp=new Set;function Co(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var In=G.d;G.d={f:Bv,r:Uv,D:Kv,C:Iv,L:Fv,m:Gv,X:$v,S:Yv,M:qv};function Bv(){var e=In.f(),t=mo();return e||t}function Uv(e){var t=rl(e);t!==null&&t.tag===5&&t.type==="form"?zh(t):In.r(e)}var Kl=typeof document>"u"?null:document;function xp(e,t,n){var s=Kl;if(s&&typeof t=="string"&&t){var c=Xt(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof n=="string"&&(c+='[crossorigin="'+n+'"]'),vp.has(c)||(vp.add(c),e={rel:e,crossOrigin:n,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),xt(t,"link",e),ht(t),s.head.appendChild(t)))}}function Kv(e){In.D(e),xp("dns-prefetch",e,null)}function Iv(e,t){In.C(e,t),xp("preconnect",e,t)}function Fv(e,t,n){In.L(e,t,n);var s=Kl;if(s&&e&&t){var c='link[rel="preload"][as="'+Xt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(c+='[imagesrcset="'+Xt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(c+='[imagesizes="'+Xt(n.imageSizes)+'"]')):c+='[href="'+Xt(e)+'"]';var d=c;switch(t){case"style":d=Il(e);break;case"script":d=Fl(e)}ln.has(d)||(e=v({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ln.set(d,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(qa(d))||t==="script"&&s.querySelector(Va(d))||(t=s.createElement("link"),xt(t,"link",e),ht(t),s.head.appendChild(t)))}}function Gv(e,t){In.m(e,t);var n=Kl;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Xt(s)+'"][href="'+Xt(e)+'"]',d=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Fl(e)}if(!ln.has(d)&&(e=v({rel:"modulepreload",href:e},t),ln.set(d,e),n.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Va(d)))return}s=n.createElement("link"),xt(s,"link",e),ht(s),n.head.appendChild(s)}}}function Yv(e,t,n){In.S(e,t,n);var s=Kl;if(s&&e){var c=cl(s).hoistableStyles,d=Il(e);t=t||"default";var y=c.get(d);if(!y){var S={loading:0,preload:null};if(y=s.querySelector(qa(d)))S.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ln.get(d))&&vu(e,n);var N=y=s.createElement("link");ht(N),xt(N,"link",e),N._p=new Promise(function(F,Z){N.onload=F,N.onerror=Z}),N.addEventListener("load",function(){S.loading|=1}),N.addEventListener("error",function(){S.loading|=2}),S.loading|=4,To(y,t,s)}y={type:"stylesheet",instance:y,count:1,state:S},c.set(d,y)}}}function $v(e,t){In.X(e,t);var n=Kl;if(n&&e){var s=cl(n).hoistableScripts,c=Fl(e),d=s.get(c);d||(d=n.querySelector(Va(c)),d||(e=v({src:e,async:!0},t),(t=ln.get(c))&&xu(e,t),d=n.createElement("script"),ht(d),xt(d,"link",e),n.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function qv(e,t){In.M(e,t);var n=Kl;if(n&&e){var s=cl(n).hoistableScripts,c=Fl(e),d=s.get(c);d||(d=n.querySelector(Va(c)),d||(e=v({src:e,async:!0,type:"module"},t),(t=ln.get(c))&&xu(e,t),d=n.createElement("script"),ht(d),xt(d,"link",e),n.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function wp(e,t,n,s){var c=(c=we.current)?Co(c):null;if(!c)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Il(n.href),n=cl(c).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Il(n.href);var d=cl(c).hoistableStyles,y=d.get(e);if(y||(c=c.ownerDocument||c,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,y),(d=c.querySelector(qa(e)))&&!d._p&&(y.instance=d,y.state.loading=5),ln.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},ln.set(e,n),d||Vv(c,e,n,y.state))),t&&s===null)throw Error(o(528,""));return y}if(t&&s!==null)throw Error(o(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Fl(n),n=cl(c).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Il(e){return'href="'+Xt(e)+'"'}function qa(e){return'link[rel="stylesheet"]['+e+"]"}function Sp(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function Vv(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),xt(t,"link",n),ht(t),e.head.appendChild(t))}function Fl(e){return'[src="'+Xt(e)+'"]'}function Va(e){return"script[async]"+e}function Cp(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Xt(n.href)+'"]');if(s)return t.instance=s,ht(s),s;var c=v({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),ht(s),xt(s,"style",c),To(s,n.precedence,e),t.instance=s;case"stylesheet":c=Il(n.href);var d=e.querySelector(qa(c));if(d)return t.state.loading|=4,t.instance=d,ht(d),d;s=Sp(n),(c=ln.get(c))&&vu(s,c),d=(e.ownerDocument||e).createElement("link"),ht(d);var y=d;return y._p=new Promise(function(S,N){y.onload=S,y.onerror=N}),xt(d,"link",s),t.state.loading|=4,To(d,n.precedence,e),t.instance=d;case"script":return d=Fl(n.src),(c=e.querySelector(Va(d)))?(t.instance=c,ht(c),c):(s=n,(c=ln.get(d))&&(s=v({},n),xu(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),ht(c),xt(c,"link",s),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,To(s,n.precedence,e));return t.instance}function To(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,d=c,y=0;y<s.length;y++){var S=s[y];if(S.dataset.precedence===t)d=S;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function vu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function xu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Mo=null;function Tp(e,t,n){if(Mo===null){var s=new Map,c=Mo=new Map;c.set(n,s)}else c=Mo,s=c.get(n),s||(s=new Map,c.set(n,s));if(s.has(e))return s;for(s.set(e,null),n=n.getElementsByTagName(e),c=0;c<n.length;c++){var d=n[c];if(!(d[ca]||d[gt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var y=d.getAttribute(t)||"";y=e+y;var S=s.get(y);S?S.push(d):s.set(y,[d])}}return s}function Mp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Pv(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 Ap(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Xv(e,t,n,s){if(n.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var c=Il(s.href),d=t.querySelector(qa(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ao.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=d,ht(d);return}d=t.ownerDocument||t,s=Sp(s),(c=ln.get(c))&&vu(s,c),d=d.createElement("link"),ht(d);var y=d;y._p=new Promise(function(S,N){y.onload=S,y.onerror=N}),xt(d,"link",s),n.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Ao.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var wu=0;function Qv(e,t){return e.stylesheets&&e.count===0&&No(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&No(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&wu===0&&(wu=62500*Lv());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&No(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>wu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Ao(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)No(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Eo=null;function No(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Eo=new Map,t.forEach(Zv,e),Eo=null,Ao.call(e))}function Zv(e,t){if(!(t.state.loading&4)){var n=Eo.get(e);if(n)var s=n.get(null);else{n=new Map,Eo.set(e,n);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var y=c[d];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(n.set(y.dataset.precedence,y),s=y)}s&&n.set(null,s)}c=t.instance,y=c.getAttribute("data-precedence"),d=n.get(y)||s,d===s&&n.set(null,c),n.set(y,c),this.count++,s=Ao.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var Pa={$$typeof:O,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function Wv(e,t,n,s,c,d,y,S,N){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=gr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gr(0),this.hiddenUpdates=gr(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function Ep(e,t,n,s,c,d,y,S,N,F,Z,te){return e=new Wv(e,t,n,y,N,F,Z,te,S),t=1,d===!0&&(t|=24),d=Kt(3,null,null,t),e.current=d,d.stateNode=e,t=ec(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:s,isDehydrated:n,cache:t},lc(d),e}function Np(e){return e?(e=vl,e):vl}function kp(e,t,n,s,c,d){c=Np(c),s.context===null?s.context=c:s.pendingContext=c,s=ii(t),s.payload={element:n},d=d===void 0?null:d,d!==null&&(s.callback=d),n=li(e,s,t),n!==null&&(zt(n,e,t),Aa(n,e,t))}function Lp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Su(e,t){Lp(e,t),(e=e.alternate)&&Lp(e,t)}function Rp(e){if(e.tag===13||e.tag===31){var t=Bi(e,67108864);t!==null&&zt(t,e,67108864),Su(e,67108864)}}function _p(e){if(e.tag===13||e.tag===31){var t=$t();t=br(t);var n=Bi(e,t);n!==null&&zt(n,e,t),Su(e,t)}}var ko=!0;function Jv(e,t,n,s){var c=E.T;E.T=null;var d=G.p;try{G.p=2,Cu(e,t,n,s)}finally{G.p=d,E.T=c}}function ex(e,t,n,s){var c=E.T;E.T=null;var d=G.p;try{G.p=8,Cu(e,t,n,s)}finally{G.p=d,E.T=c}}function Cu(e,t,n,s){if(ko){var c=Tu(s);if(c===null)cu(e,t,s,Lo,n),Op(e,s);else if(nx(c,e,t,n,s))s.stopPropagation();else if(Op(e,s),t&4&&-1<tx.indexOf(e)){for(;c!==null;){var d=rl(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var y=ji(d.pendingLanes);if(y!==0){var S=d;for(S.pendingLanes|=2,S.entangledLanes|=2;y;){var N=1<<31-Ct(y);S.entanglements[1]|=N,y&=~N}bn(d),(Ie&6)===0&&(fo=St()+500,Fa(0))}}break;case 31:case 13:S=Bi(d,2),S!==null&&zt(S,d,2),mo(),Su(d,2)}if(d=Tu(s),d===null&&cu(e,t,s,Lo,n),d===c)break;c=d}c!==null&&s.stopPropagation()}else cu(e,t,s,null,n)}}function Tu(e){return e=Ar(e),Mu(e)}var Lo=null;function Mu(e){if(Lo=null,e=ol(e),e!==null){var t=u(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=h(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 Lo=e,null}function jp(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(bs()){case la:return 2;case aa:return 8;case Li:case ys:return 32;case sa:return 268435456;default:return 32}default:return 32}}var Au=!1,pi=null,gi=null,bi=null,Xa=new Map,Qa=new Map,yi=[],tx="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 Op(e,t){switch(e){case"focusin":case"focusout":pi=null;break;case"dragenter":case"dragleave":gi=null;break;case"mouseover":case"mouseout":bi=null;break;case"pointerover":case"pointerout":Xa.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qa.delete(t.pointerId)}}function Za(e,t,n,s,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:d,targetContainers:[c]},t!==null&&(t=rl(t),t!==null&&Rp(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function nx(e,t,n,s,c){switch(t){case"focusin":return pi=Za(pi,e,t,n,s,c),!0;case"dragenter":return gi=Za(gi,e,t,n,s,c),!0;case"mouseover":return bi=Za(bi,e,t,n,s,c),!0;case"pointerover":var d=c.pointerId;return Xa.set(d,Za(Xa.get(d)||null,e,t,n,s,c)),!0;case"gotpointercapture":return d=c.pointerId,Qa.set(d,Za(Qa.get(d)||null,e,t,n,s,c)),!0}return!1}function Dp(e){var t=ol(e.target);if(t!==null){var n=u(t);if(n!==null){if(t=n.tag,t===13){if(t=h(n),t!==null){e.blockedOn=t,Pd(e.priority,function(){_p(n)});return}}else if(t===31){if(t=p(n),t!==null){e.blockedOn=t,Pd(e.priority,function(){_p(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 Ro(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Tu(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Mr=s,n.target.dispatchEvent(s),Mr=null}else return t=rl(n),t!==null&&Rp(t),e.blockedOn=n,!1;t.shift()}return!0}function zp(e,t,n){Ro(e)&&n.delete(t)}function ix(){Au=!1,pi!==null&&Ro(pi)&&(pi=null),gi!==null&&Ro(gi)&&(gi=null),bi!==null&&Ro(bi)&&(bi=null),Xa.forEach(zp),Qa.forEach(zp)}function _o(e,t){e.blockedOn===t&&(e.blockedOn=null,Au||(Au=!0,l.unstable_scheduleCallback(l.unstable_NormalPriority,ix)))}var jo=null;function Hp(e){jo!==e&&(jo=e,l.unstable_scheduleCallback(l.unstable_NormalPriority,function(){jo===e&&(jo=null);for(var t=0;t<e.length;t+=3){var n=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(Mu(s||n)===null)continue;break}var d=rl(n);d!==null&&(e.splice(t,3),t-=3,Tc(d,{pending:!0,data:c,method:n.method,action:s},s,c))}}))}function Gl(e){function t(N){return _o(N,e)}pi!==null&&_o(pi,e),gi!==null&&_o(gi,e),bi!==null&&_o(bi,e),Xa.forEach(t),Qa.forEach(t);for(var n=0;n<yi.length;n++){var s=yi[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<yi.length&&(n=yi[0],n.blockedOn===null);)Dp(n),n.blockedOn===null&&yi.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(s=0;s<n.length;s+=3){var c=n[s],d=n[s+1],y=c[Lt]||null;if(typeof d=="function")y||Hp(n);else if(y){var S=null;if(d&&d.hasAttribute("formAction")){if(c=d,y=d[Lt]||null)S=y.formAction;else if(Mu(c)!==null)continue}else S=y.action;typeof S=="function"?n[s+1]=S:(n.splice(s,3),s-=3),Hp(n)}}}function Bp(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(y){return c=y})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(n,20)}function n(){if(!s&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Eu(e){this._internalRoot=e}Oo.prototype.render=Eu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current,s=$t();kp(n,s,e,t,null,null)},Oo.prototype.unmount=Eu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;kp(e.current,2,null,e,null,null),mo(),t[sl]=null}};function Oo(e){this._internalRoot=e}Oo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vd();e={blockedOn:null,target:e,priority:t};for(var n=0;n<yi.length&&t!==0&&t<yi[n].priority;n++);yi.splice(n,0,e),n===0&&Dp(e)}};var Up=i.version;if(Up!=="19.2.8")throw Error(o(527,Up,"19.2.8"));G.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var lx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Do=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Do.isDisabled&&Do.supportsFiber)try{Ri=Do.inject(lx),Mt=Do}catch{}}return Ja.createRoot=function(e,t){if(!r(e))throw Error(o(299));var n=!1,s="",c=qh,d=Vh,y=Ph;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=Ep(e,1,!1,null,null,n,s,null,c,d,y,Bp),e[sl]=t.current,ru(e),new Eu(t)},Ja.hydrateRoot=function(e,t,n){if(!r(e))throw Error(o(299));var s=!1,c="",d=qh,y=Vh,S=Ph,N=null;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(y=n.onCaughtError),n.onRecoverableError!==void 0&&(S=n.onRecoverableError),n.formState!==void 0&&(N=n.formState)),t=Ep(e,1,!0,t,n??null,s,c,N,d,y,S,Bp),t.context=Np(null),n=t.current,s=$t(),s=br(s),c=ii(s),c.callback=null,li(n,c,s),n=s,t.current.lanes=n,ra(t,n),bn(t),e[sl]=t.current,ru(e),new Oo(t)},Ja.version="19.2.8",Ja}var $p;function px(){if($p)return ku.exports;$p=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(i){console.error(i)}}return l(),ku.exports=mx(),ku.exports}var gx=px();const bx=lb(gx),on="/ws/client",sb={header:{appName:"Herdr",tagline:"remote terminal client",terminalTab:"Terminal",adminTab:"Admin",rttMs:"{rtt}ms",hostLabel:"Host",clientIdLabel:"ID:",copyClientIdTitle:"Click to copy Client ID",languageToggleTitle:"Switch language (EN / 中文)",pairingTitle:"Connection & pairing",settingsTitle:"Terminal settings",virtualKeyboardTitle:"Quick command helper",latencyTitle:"Round-trip latency (RTT)",mainNavigationAria:"Main Navigation",actionKeyboard:"cmd",actionPairing:"link",actionSettings:"cfg",languageShort:"en"},common:{connecting:"Connecting...",connected:"Connected",reconnecting:"Reconnecting...",disconnected:"Disconnected",error:"Error",save:"Save",cancel:"Cancel",close:"Close",done:"Done",retry:"Retry",connect:"Connect",disconnect:"Disconnect",copy:"Copy",copied:"Copied",loading:"Loading...",offline:"Offline",role:"Role",host:"Host",status:"Status",settings:"Settings",admin:"Admin",terminal:"Terminal",pairing:"Pairing",keyBar:"Key bar",quickInput:"Quick input",dismissNotification:"Dismiss notification",closeDialog:"Close dialog",clickToCopy:"Click to copy",controller:"Controller",viewer:"Viewer",live:"Live"},connection:{live:"Live",connecting:"Connecting",reconnecting:"Reconnecting",reconnectNow:"Reconnect now",error:"Error",offline:"Offline",connect:"Connect",retry:"Retry"},role:{controllerMode:"Controller mode active",viewerMode:"Viewer mode",controlActive:"Full Control",viewerReadOnly:"Viewer",viewerWithController:"Viewer (Active: {controllerId})",sharedControl:"Full control",sharedControlDesc:"Every paired window shares this terminal and may type into it.",sharedWindows:"{count} windows",thisWindow:"Window",claimControl:"Claim Control",claimControlTitle:"Claim terminal control",releaseControl:"Release",releaseControlTitle:"Switch to viewer mode",takeoverControl:"Takeover",takeoverControlTitle:"Take over control from {controllerId}",takeoverModalTitle:"Confirm Control Takeover",takeoverModalDesc:"Another client is controlling this terminal.",takeoverModalWarning:"Input focus will transfer to this window.",confirmTakeover:"Confirm Takeover"},statusBanner:{connecting:"Connecting to relay...",reconnectingDefault:"Connection lost. Reconnecting...",reconnectNow:"Reconnect Now",errorDefault:"Unable to connect to relay",disconnected:"Terminal disconnected"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ restart for {version}",toast:"herdr-remote {version} is out for this workstation",toastRestart:"herdr-remote {version} is installed; restart it to apply",title:"herdr-remote update",running:"Running",installed:"Installed",latest:"Latest",restartPending:"{version} is installed but not running yet. Restart herdr-remote on the workstation:",stepTui:'On the workstation, open herdr-remote (the TUI), go to "Language & about" and press Enter on the update row.',stepCli:"Or run on the workstation:",restartNote:"Restarting reconnects this window after a few seconds.",ignore:"Skip this version"},herdrLaunch:{title:"Herdr is not running",body:"Herdr is not running on {host}. Start it on that workstation?",scope:"Only this paired workstation's own Herdr starts, as that workstation's user. No other machine is touched.",start:"Start Herdr",starting:"Starting Herdr on {host}…",failedTitle:"Herdr did not start",timeout:"The workstation did not answer within 30 seconds. Its herdr-remote may be too old to start Herdr from a browser.",thisHost:"this workstation"},onboarding:{title:"Pair with Herdr Remote",subtitle:"Connect your mobile or browser to your local terminal session",description:"Control Herdr sessions from any browser or phone.",firstTimeSetup:"First-time Setup",authRequired:"Authorization Required",authRequiredDesc:"Pair your device or provide a valid access token.",step1Title:"Generate Pairing Code on Host",step1Desc:"Run on the host running Herdr:",step1TuiNote:"Interactive TUI config:",step2Title:"Enter 6-character Pairing Code",step2Placeholder:"e.g. 7X9K2A",step2Note:"Pairing code expires in 10 minutes; credentials are saved automatically.",connectAndPair:"Connect & Pair",connectingAndPairing:"Pairing with Relay...",advancedTitle:"Advanced Options",manualTokenLabel:"Authentication Token",manualTokenPlaceholder:"Optional token (skips pairing code)",wsEndpointLabel:"Relay WebSocket Endpoint",wsEndpointPlaceholder:"/ws/client or wss://your-relay-host/ws/client",clientIdLabel:"Device Client Identifier"},pairing:{title:"Relay Connection & Pairing",addTitle:"Add Herdr Instance",displayNameLabel:"Host Name",displayNamePlaceholder:"e.g. Workstation",displayNameHelp:"This name is stored only in this browser.",credentialsRequired:"Enter a pairing code or device token.",subtitle:"Manage WebSocket endpoints and credentials",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A1B2C3",pairCodeHelp:'Run "herdr-remote pair" on host.',tokenLabel:"Access Token",tokenNote:"(Device secret)",tokenPlaceholder:"Device token...",wsUrlLabel:"Relay WebSocket Endpoint URL",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:"Defaults to same-origin /ws/client",clientIdLabel:"Client Identifier",newIdButton:"New ID",regenerateClientIdTitle:"Regenerate client ID",autoReconnectLabel:"Auto-reconnect",autoReconnectDesc:"Automatically reconnect when disconnected",copyDirectLink:"Copy direct pairing link",saveAndConnect:"Save & Connect"},settings:{title:"Terminal Preferences",subtitle:"Interface, font, input and alerts",tabGeneral:"General",sectionInterface:"Interface",sectionFont:"Font",sectionInput:"Input",sectionAdmin:"Administration",toggleOn:"On",toggleOff:"Off",hostFontLabel:"Workstation font",adminEntry:"Relay dashboard",adminEntryHint:"Hosts, devices and traffic; needs the admin token",adminEntryOpen:"Open",tabVirtualKeys:"Virtual Keys",tabAgentKeymaps:"Agent Keys",fontFamilyLabel:"Monospace Font",fontSizeHint:"This window only",fontSizeLabel:"Terminal Text Size ({size}px)",predictiveEchoLabel:"Predictive Echo",predictiveEchoAuto:"Auto",predictiveEchoAlways:"Always On",predictiveEchoOff:"Off",predictiveEchoDesc:"Show typing before the echo returns on slow links",touchKeyToolbar:"Touch Key Toolbar",touchKeyToolbarDesc:"Modifier and arrow keys",touchHaptics:"Haptic Feedback",touchHapticsDesc:"Vibrate on key press",agentAlertsLabel:"Agent alerts",agentAlertBadge:"Title and icon badge",agentAlertBadgeDesc:"Count waiting and finished agents in the tab title",agentAlertVibrate:"Vibrate",agentAlertVibrateDesc:"When an agent waits or finishes (page on screen)",agentAlertSound:"Chime",agentAlertSoundDesc:"In the background; works after your next tap",agentAlertNotify:"System notification",agentAlertNotifyDesc:"In the background (HTTPS only)",languageLabel:"Language",resetDefaults:"Reset to Defaults",resetDefaultsToast:"Settings reset to defaults",fontSizeFollowHost:"Same size as the workstation terminal ({size}px)",fontSizeFollowHostUnknown:"Same size as the workstation terminal (not reported)",hostFontSync:"Sync host font",hostGlyphLine:"CJK: {family} · {status}",hostGlyphStatus:{none:"",checking:"Checking…",installed:"Installed on this device",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading common characters",ready:"{count} characters on this device; others load as they appear",failed:"Could not be loaded"},hostFontStatus:{none:"The workstation did not report its terminal font",checking:"Checking…",installed:"Installed on this device",loaded:"Loaded from the workstation",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading {percent}%",failed:"Could not be loaded",unavailable:"No font file to load; drawn by name where installed"}},agentKeymaps:{keymapLabel:"Keymap",auto:"Auto",shell:"Shell",agentGroup:"Agent",listGroup:"{profile} shortcuts",genericGroup:"General",profileRowLabel:"Agent to edit",settingsProfileLabel:"Agent profile",autoProfile:"Auto · {profile}",pinnedProfile:"Pinned · {profile}",barGroup:"Key bar",barHint:"Tap to choose which {profile} shortcuts appear on the key bar ({count} shown); base keys are on the Virtual Keys tab.",restoreBar:"Restore default keys",customizeBar:"Choose which shortcuts the key bar shows",customizeBarShort:"Edit",shortcutLabel:"Shortcut",comboPlaceholder:"e.g. ctrl+e or esc esc",invalidCombo:"Invalid shortcut: {error}",defaultCombo:"Default: {combo}",resetAction:"Reset",moveUp:"Move up",moveDown:"Move down",unverified:"Unverified",addCustom:"Custom key",customLabel:"Function name",customCombo:"Key combo",addAction:"Add custom key",restoreProfile:"Restore this agent defaults",removeCustom:"Remove custom key",configHint:"Agent config: {path}",noAgentActions:"No agent-specific shortcuts.",errors:{empty:"Enter at least one key.",tooManySteps:"A shortcut can have at most {count} steps.",invalidStepSyntax:"Step {step} has invalid syntax. Use ctrl+o or esc esc.",duplicateModifier:"Step {step} repeats {modifier}.",missingKey:"Step {step} needs a key after the modifiers.",multipleKeys:"Step {step} can have only one key.",unsupportedKey:"Step {step} does not support “{key}”."}},agentActions:{mode:"Mode",rewind:"Rewind",details:"Details",model:"Model",thinking:"Thinking",todos:"Tasks",background:"Background",editor:"Editor",history:"History",stash:"Stash",pasteImage:"Paste image",newline:"New line",interrupt:"Interrupt",editPrevious:"Edit previous",queue:"Queue prompt",copy:"Copy",clear:"Clear",yolo:"YOLO mode",expand:"Expand",undo:"Undo",agent:"Next agent",agentBack:"Previous agent",palette:"Command palette",recentModel:"Recent model",variant:"Model variant",newSession:"New session",sessions:"Sessions",thinkingMode:"Thinking mode",nextModel:"Next model",modelPicker:"Model picker",tools:"Tools",thinkingBlocks:"Thinking blocks",followup:"Follow-up",dequeue:"Remove from queue",plan:"Plan mode",temporaryModel:"Temporary model",expandAll:"Expand all",reasoning:"Reasoning effort",review:"Review",specMode:"Spec mode",autonomy:"Autonomy",undoPicker:"Undo picker",steer:"Steer",sidebar:"Sidebar",agents:"Agents",permissionMode:"Permission mode",bypass:"Bypass permissions",tasks:"Tasks",interject:"Interject",multiline:"Multiline input",shortcuts:"Shortcuts",approve:"Approve",eof:"End of input",suspend:"Suspend",startOfLine:"Line start",endOfLine:"Line end",killToEnd:"Delete to line end",agentSwap:"Switch agent",activity:"Activity",planAct:"Plan / Act",autoApprove:"Auto-approve",search:"Search"},virtualKeyboard:{collapseToolbar:"Collapse Toolbar",expandToolbar:"Expand Toolbar",helperTitle:"Quick Commands",closeHelper:"Close Helper",placeholder:"Type command and press Enter...",sendButton:"Send",clearInput:"Clear Input",customizeTitle:"Custom Key Toolbar",customizeDesc:"Reorder, enable, or disable keys for your toolbar.",enabledKeysCount:"{count} keys enabled",resetLayout:"Reset to Default",addKey:"Add Key",availableKeys:"Available Keys",moveUp:"Move Up",moveDown:"Move Down",enableKey:"Enable Key",disableKey:"Disable Key",deleteKeyTitle:"Remove Key",keyTypeModifier:"Modifier",keyTypeNav:"Navigation",keyTypeAction:"Action",keyTypeChord:"Chord",keyTypeFn:"Function",keyTypeSymbol:"Symbol",fnDrawerTitle:"Function Keys (F1-F12)",chordsDrawerTitle:"Control Chords (^C, ^D, ^Z)",symbolsDrawerTitle:"Symbols (~, |, /, \\)",touchKeyboardShortcuts:"Shortcuts Toolbar",ctrlCTitle:"Ctrl+C (SIGINT)",ctrlDTitle:"Ctrl+D (EOF)",ctrlZTitle:"Ctrl+Z (SIGTSTP)",ctrlLTitle:"Ctrl+L (Clear)",ctrlRTitle:"Ctrl+R (Search)",ctrlATitle:"Ctrl+A (Start of line)",ctrlETitle:"Ctrl+E (End of line)",ctrlKTitle:"Ctrl+K (Kill to end)",badgeSigint:"SIGINT",badgeEof:"EOF",badgeTstp:"SIGTSTP",badgeClear:"CLEAR",badgeSearch:"SEARCH",badgeStart:"START",badgeEnd:"END",badgeKill:"KILL",keyEnter:"Enter",uploadImage:"Upload Image",uploadImageTitle:"Select and upload image to terminal",image:"Image",uploadProgressReading:"Reading...",uploadProgressProcessing:"Compressing...",uploadProgressSending:"Uploading...",uploadProgressWaitingHost:"Waiting for host...",uploadProgressCompleted:"Completed",uploadProgressFailed:"Upload failed"},profiles:{title:"Herdr instances",switcherLabel:"Switch Herdr instance",current:"current",empty:"No paired Herdr instances yet.",addHost:"Add Herdr instance",rename:"Rename instance",remove:"Remove locally",removeConfirm:"Remove this saved connection from this browser?"},mobile:{sessionControls:"Session controls",closeSessionControls:"Close session controls",terminalControlAria:"Terminal control",inputControl:"Input control",settingsAria:"Terminal settings",pairingAria:"Connection & pairing",keybarAria:"Toggle key toolbar",quickInputAria:"Toggle quick commands",menu:"Menu",statusBarAria:"Session status bar"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"Connected to Herdr session.",windowAriaLabel:"Terminal Window",bufferAriaLabel:"Terminal Buffer",offlineStatusAria:"Offline Status",releaseControlAria:"Release Control",takeoverControlAria:"Takeover Control",claimControlAria:"Claim Control"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab (Claude Code: cycle modes)",ctrl:"Toggle Ctrl Lock",alt:"Toggle Alt Lock",shift:"Toggle Shift Lock",meta:"Meta / Cmd",enter:"Enter",backspace:"Backspace",delete:"Delete",left:"Left (←)",up:"Up (↑)",down:"Down (↓)",right:"Right (→)",home:"Home",end:"End",page_up:"Page Up",page_down:"Page Down",insert:"Insert",drawer_chords:"Ctrl Chords",drawer_agent:"Agent shortcuts",drawer_symbols:"Symbols",drawer_fn:"Function Keys (F1-F12)",ctrl_c:"Ctrl+C (SIGINT)",ctrl_d:"Ctrl+D (EOF)",ctrl_z:"Ctrl+Z (SIGTSTP)",ctrl_l:"Ctrl+L (Clear)",ctrl_a:"Ctrl+A (Start of line)",ctrl_e:"Ctrl+E (End of line)",ctrl_k:"Ctrl+K (Kill to end)",ctrl_r:"Ctrl+R (Search history)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"Pipe (|)",sym_tilde:"Tilde (~)",sym_slash:"Slash (/)",sym_backslash:"Backslash (\\)",sym_dash:"Dash (-)",sym_underscore:"Underscore (_)",sym_dollar:"Dollar ($)",sym_ampersand:"Ampersand (&)",sym_quote:'Quote (")',sym_backtick:"Backtick (`)"},admin:{returnToTerminal:"Return to Terminal",terminalShells:"terminal sessions",startedAt:"Started at {time}",acrossWindows:"across {count} windows",perSecond:"{value}/s",unitDay:"d",unitHour:"h",unitMinute:"m",unitSecond:"s",startedRecently:"Started recently",updatedAt:"Updated at {time}",autoRefresh:"Auto refresh",paused:"Paused",refreshNow:"Refresh",connectedHosts:"Connected Hosts",activeUsers:"Active Users",activePtys:"Active PTYs",activeController:"Active Controller",uptime:"Uptime",none:"None",noHost:"No host connected",tabOverview:"Overview",tabClients:"Clients ({count})",tabPtys:"PTY Sessions ({count})",tabDevices:"Paired Devices ({count})",hostsTitle:"Hosts ({count})",noHosts:"No hosts connected or paired",hostConnectedDevices:"{count} connected",hostPairedDevices:"{count} paired",hostStatusOnline:"Online",hostStatusBusy:"In use",hostStatusReconnecting:"Reconnecting",hostStatusOffline:"Offline",hostRosterOperatorOnly:"Device list is visible to the relay operator only.",connectedClientsTitle:"Connected Clients ({count})",noClients:"No clients connected",colClientId:"Client ID",colDevice:"Device",colLastSeen:"Last Seen",colActions:"Actions",unknownDevice:"Unknown Device",pairedDevicesTitle:"Paired Devices ({count})",noDevices:"No paired devices",revokeDevice:"Revoke",revokeConfirm:"Confirm Revocation",revokeFailed:"Revocation failed",colRole:"Role",colIp:"IP Address",colConnectedAt:"Connected At",colTraffic:"Traffic ↓in / ↑out",activePtysTitle:"Active PTY Sessions ({count})",noPtys:"No active PTY sessions",colPtyId:"PTY ID",colPid:"PID",colCommand:"Command",colGrid:"Grid",colCwd:"Working Directory",colViewers:"Windows",copiedJson:"Copied",unauthorizedTitle:"Unauthorized (401/403)",unauthorizedDesc:"GET /api/status requires an authorized device token.",pairingStepsTitle:"Device Pairing:",pairingStepsHelp:"Run pairing command on host to get a code, then enter it here.",enterPairCodeBtn:"Enter Pairing Code",retryFetchBtn:"Retry Status",errorConnecting:"Failed to fetch GET /api/status: {error}",loadingStatus:"Loading status from /api/status...",remoteRelayTitle:"Remote Relay Administration",remoteRelayNotice:"Connected to remote relay. For server metrics, access the operator dashboard.",remoteRelayEndpoint:"Remote WebSocket Endpoint:",remoteRelayAdminUrl:"Remote Admin URL:",openRemoteAdminBtn:"Open Remote Admin",relayAdminTitle:"Relay Operator Dashboard",relayAdminTokenLabel:"Relay Admin Token (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"Enter RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"RELAY_ADMIN_TOKEN is not configured on this relay.",relayAdminLoginBtn:"Verify & View Metrics",relayAdminAuthError:"Invalid or unauthorized admin token.",remoteRelayClientNotice:"Terminal client connection. For server metrics, use the operator dashboard.",openOperatorPortal:"Open Operator Dashboard",localWorkstationBadge:"Local Relay",modeLocal:"Local Mode",modeRemote:"Remote Mode",hintTabs:"switch tabs",hintRefresh:"refresh status",hintBack:"return to terminal",relJustNow:"just now",relMinutes:"{count}m ago",relHours:"{count}h ago",relDays:"{count}d ago",statInbound:"Inbound",statOutbound:"Outbound",statTotal:"{value} total",hostsOfflineSub:"{count} more offline",colHost:"Host",colStatus:"Status",deviceWindows:"{count} windows open",hostPtys:"{count} PTY",relayAdminPrompt:"Enter RELAY_ADMIN_TOKEN to see this relay's hosts, devices and traffic."},toasts:{connected:"Connected to relay",connectionError:"Connection error",controlGranted:"Control granted",pairedSuccess:"Paired successfully",sessionEnded:"Session ended",controlReleased:"Control released",viewerModeWarning:'In viewer mode. Click "Claim Control" first.',clientIdCopied:"Client ID copied: {id}",pairingLinkCopied:"Pairing link copied",switchedLanguage:"Language switched to {lang}",settingsReset:"Settings reset to default",fontReset:"Font reset to default",commandCopied:"Command copied",keyLayoutReset:"Key layout reset"},shortcuts:{title:"Shortcuts",help:"Active outside terminal input area:",terminalInputNote:"Terminal shortcuts pass directly to host PTY."},serverErrors:{auth_required:"Pairing required: enter a pairing code, or a device token that is still valid.",unauthorized:"This device is not authorised for that workstation.",host_offline:"The paired workstation is not connected to this relay.",host_disconnected:"The workstation disconnected.",stale_host:"The workstation stopped answering and was dropped.",too_many_clients:"That workstation has reached its window limit.",rate_limited:"Too many pairing attempts. Wait a minute and try again.",invalid_handshake:"The relay rejected the handshake. Reload the page.",device_revoked:"This device was revoked by the relay operator.",connection_closed:"Connection closed. Reconnecting…",connection_stale:"The connection went quiet while the page was away. Reconnecting…",connection_stalled:"Connecting took too long. Trying again…",connection_failed:"Could not open a connection to the relay.",host_reconnecting:"The Herdr host is reconnecting.",host_reconnect_timeout:"The Herdr host did not reconnect in time.",host_replaced:"The Herdr host connection was replaced.",slow_client:"This browser was disconnected because it could not keep up.",client_send_failed:"The relay could not send data to this browser.",too_many_hosts:"This relay has reached its host limit.",paste_file_unsupported:"Unsupported image format for paste.",paste_file_too_large:"Pasted image exceeds 3 MB limit.",paste_file_write_failed:"Failed to save pasted image on host.",paste_file_empty:"Pasted image payload is empty.",paste_file_corrupt:"Pasted image data is corrupt or does not match declared MIME.",viewer_mode:"Viewer mode cannot paste to terminal.",no_session:"Terminal session is not ready."},fontPresets:{host:"Workstation font (default)",system:"System monospace"},hostFont:{title:"Workstation terminal font",body:"The terminal on {host} uses {family}{detail}. This device does not have it.",bodyGlyphsOnly:"The terminal on {host} draws Chinese with {family}. This device does not have it.",glyphs:"Chinese in {family}: about 2 MB of common characters first; any other character loads the first time it appears.",glyphsAll:"{family} is too large to send whole: about 2 MB of common characters first; any other character loads the first time it appears.",detail:" ({detail})",detailSeparator:", ",download:"Load {count} font file(s), {size} in total. Downloaded once, then kept in this browser.",load:"Load font",decline:"Use this device’s fonts",loading:"Loading {received} of {total}",failed:"The font could not be loaded: {reason}",loaded:"Workstation font loaded",reasons:{host_font_unavailable:"the font changed on the workstation. Sync it again from Settings",host_font_timeout:"the workstation stopped answering",disconnected:"the connection dropped",font_api_unavailable:"this browser cannot load fonts",other:"the browser could not read the font file"}},agents:{title:"Agents on this workstation",blocked:"blocked",done:"done",working:"working",allIdle:"agents idle",notifyBlocked:"{count} agent(s) waiting for you",notifyDone:"{count} agent(s) finished"},clipboard:{openLink:"Open Link",openLinkFailed:"This link cannot be opened from the browser",copySelection:"Copy Selection",copyLine:"Copy Line",copyScreen:"Copy Screen",paste:"Paste",cancel:"Cancel",copied:"Copied to clipboard",copyFailed:"Failed to copy",pasteHint:"Long-press here to paste, then tap Send",pasteSend:"Send",pasteUnavailable:"Clipboard is empty or unavailable",pasteTitle:"Paste Content",pasted:"Pasted",chooseImage:"Choose Image",takePhoto:"Take Photo",imageTooLarge:"Image exceeds 3 MB limit and cannot be compressed further.",imageCompressedSize:"Compressed: {size}",fileEmpty:"File is empty.",decodeFailed:"Failed to decode image file.",unsupportedType:"Unsupported format. Only PNG, JPEG, WebP, and GIF are supported.",imageSectionTitle:"Image",textSectionTitle:"Text",imageCompressing:"Processing image...",removeImage:"Remove image"}},yx={header:{appName:"Herdr",tagline:"远程终端客户端",terminalTab:"终端",adminTab:"管理面板",rttMs:"{rtt}ms",hostLabel:"主机",clientIdLabel:"客户端 ID:",copyClientIdTitle:"点击复制客户端 ID",languageToggleTitle:"切换语言 (EN / 中文)",pairingTitle:"连接与配对",settingsTitle:"终端设置",virtualKeyboardTitle:"快捷命令",latencyTitle:"网络延迟 (RTT)",mainNavigationAria:"主导航菜单",actionKeyboard:"命令",actionPairing:"配对",actionSettings:"设置",languageShort:"中"},common:{connecting:"连接中...",connected:"已连接",reconnecting:"重连中...",disconnected:"已断开",error:"错误",save:"保存",cancel:"取消",close:"关闭",done:"完成",retry:"重试",connect:"连接",disconnect:"断开连接",copy:"复制",copied:"已复制",loading:"加载中...",offline:"离线",role:"角色",host:"主机",status:"连接状态",settings:"设置",admin:"管理面板",terminal:"终端",pairing:"配对",keyBar:"按键条",quickInput:"快捷输入",dismissNotification:"关闭通知",closeDialog:"关闭对话框",clickToCopy:"点击复制",controller:"控制端",viewer:"观察者",live:"运行中"},connection:{live:"在线",connecting:"连接中",reconnecting:"正在重连",reconnectNow:"立即重连",error:"连接错误",offline:"离线",connect:"发起连接",retry:"重试"},role:{controllerMode:"控制模式",viewerMode:"观察者模式",controlActive:"控制端",viewerReadOnly:"观察者",viewerWithController:"观察者(控制者: {controllerId})",sharedControl:"完全控制",sharedControlDesc:"所有已配对窗口共享同一个终端,均可输入。",sharedWindows:"{count} 个窗口",thisWindow:"本窗口",claimControl:"获取控制权",claimControlTitle:"获取终端控制权",releaseControl:"释放控制权",releaseControlTitle:"切回观察者模式",takeoverControl:"强占控制权",takeoverControlTitle:"从 {controllerId} 接管控制权",takeoverModalTitle:"确认接管终端控制权?",takeoverModalDesc:"当前已有其他客户端控制该终端。",takeoverModalWarning:"接管后输入焦点切换至当前窗口。",confirmTakeover:"确认接管"},statusBanner:{connecting:"连接 Relay 服务中...",reconnectingDefault:"连接断开,正在重连...",reconnectNow:"立即重连",errorDefault:"无法连接 Relay 服务",disconnected:"会话已断开"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ 重启以应用 {version}",toast:"宿主机的 herdr-remote 有新版本 {version}",toastRestart:"herdr-remote {version} 已安装,重启后生效",title:"herdr-remote 更新",running:"正在运行",installed:"已安装",latest:"最新版本",restartPending:"{version} 已安装但尚未运行。在宿主机上重启 herdr-remote:",stepTui:"在宿主机打开 herdr-remote(TUI),进入「语言与关于」,在更新一行按 Enter。",stepCli:"或在宿主机上执行:",restartNote:"重启后这个窗口会在几秒内自动重连。",ignore:"忽略此版本"},herdrLaunch:{title:"Herdr 未运行",body:"{host} 上没有正在运行的 Herdr。要在这台宿主机上启动吗?",scope:"只会以这台已配对宿主机自己的用户身份,启动它自己的 Herdr,不会碰其他任何机器。",start:"启动 Herdr",starting:"正在 {host} 上启动 Herdr…",failedTitle:"Herdr 没有启动",timeout:"宿主机 30 秒内没有回应。它的 herdr-remote 可能版本过旧,不支持从浏览器启动 Herdr。",thisHost:"这台宿主机"},onboarding:{title:"配对 Herdr Remote",subtitle:"连接手机或浏览器至本地终端会话",description:"在浏览器或移动设备中控制 Herdr 会话。",firstTimeSetup:"首次配对",authRequired:"需要认证",authRequiredDesc:"使用配对码配对设备,或提供有效访问令牌。",step1Title:"在 Herdr 宿主机生成配对码",step1Desc:"在运行 Herdr 的主机终端执行:",step1TuiNote:"交互式 TUI 配置:",step2Title:"输入 6 位配对码",step2Placeholder:"例如:7X9K2A",step2Note:"配对码 10 分钟内有效,连接后自动保存凭据。",connectAndPair:"连接并完成配对",connectingAndPairing:"配对中...",advancedTitle:"高级选项",manualTokenLabel:"认证 Token",manualTokenPlaceholder:"可选 Token(跳过配对码)",wsEndpointLabel:"Relay WebSocket 端点",wsEndpointPlaceholder:"/ws/client 或 wss://relay-host/ws/client",clientIdLabel:"客户端标识 (Client ID)"},pairing:{title:"Relay 连接与配对",addTitle:"添加 Herdr 实例",displayNameLabel:"主机名称",displayNamePlaceholder:"例如:工作电脑",displayNameHelp:"名称仅保存在此浏览器中。",credentialsRequired:"请输入配对码或设备令牌。",subtitle:"管理 WebSocket 服务端点与凭证",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A1B2C3",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',tokenLabel:"访问 Token",tokenNote:"(设备凭据)",tokenPlaceholder:"设备 Token...",wsUrlLabel:"Relay WebSocket 端点",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:'默认同源端点 "/ws/client"',clientIdLabel:"客户端标识",newIdButton:"生成新 ID",regenerateClientIdTitle:"重新生成客户端 ID",autoReconnectLabel:"掉线自动重连",autoReconnectDesc:"连接断开时自动尝试重连",copyDirectLink:"复制配对链接(含配对码)",saveAndConnect:"保存并连接"},settings:{title:"终端设置",subtitle:"界面、字体、输入与提醒",tabGeneral:"通用",sectionInterface:"界面",sectionFont:"字体",sectionInput:"输入",sectionAdmin:"管理",toggleOn:"开",toggleOff:"关",hostFontLabel:"宿主机字体",adminEntry:"Relay 管理面板",adminEntryHint:"主机、设备与流量;需要管理员令牌",adminEntryOpen:"打开",tabVirtualKeys:"虚拟按键",tabAgentKeymaps:"智能体按键",fontFamilyLabel:"等宽字体",fontSizeHint:"只影响当前窗口",fontSizeLabel:"终端字号 ({size}px)",predictiveEchoLabel:"预测回显",predictiveEchoAuto:"自动",predictiveEchoAlways:"始终开启",predictiveEchoOff:"关闭",predictiveEchoDesc:"高延迟时先显示输入,回显到达后校正",touchKeyToolbar:"底部触控按键条",touchKeyToolbarDesc:"修饰键与方向键",touchHaptics:"触控振动反馈",touchHapticsDesc:"按键时轻微震动",agentAlertsLabel:"智能体提醒",agentAlertBadge:"标题与图标角标",agentAlertBadgeDesc:"标签页标题显示等待与完成数",agentAlertVibrate:"震动",agentAlertVibrateDesc:"等待确认或完成时(页面在前台)",agentAlertSound:"提示音",agentAlertSoundDesc:"页面在后台时播放,下次点击后生效",agentAlertNotify:"系统通知",agentAlertNotifyDesc:"页面在后台时通知(仅 HTTPS)",languageLabel:"显示语言",resetDefaults:"恢复默认设置",resetDefaultsToast:"设置已恢复默认",fontSizeFollowHost:"与宿主机终端同字号({size}px)",fontSizeFollowHostUnknown:"与宿主机终端同字号(宿主机未报告)",hostFontSync:"同步宿主机字体",hostGlyphLine:"中文:{family} · {status}",hostGlyphStatus:{none:"",checking:"检查中…",installed:"本机已安装",available:"未加载",declined:"未加载,正在使用本机字体",loading:"正在加载常用字",ready:"本机已有 {count} 字,其余出现时自动补齐",failed:"加载失败"},hostFontStatus:{none:"宿主机未报告终端字体",checking:"检查中…",installed:"本机已安装",loaded:"已从宿主机加载",available:"未加载",declined:"未加载,正在使用本机字体",loading:"加载中 {percent}%",failed:"加载失败",unavailable:"没有可传输的字体文件,已安装该字体的设备按名称显示"}},agentKeymaps:{keymapLabel:"按键方案",auto:"自动",shell:"Shell",agentGroup:"智能体",listGroup:"{profile} 快捷键",genericGroup:"通用",profileRowLabel:"编辑的智能体",settingsProfileLabel:"智能体方案",autoProfile:"自动 · {profile}",pinnedProfile:"固定 · {profile}",barGroup:"按键栏显示",barHint:"点选要在按键栏显示的 {profile} 快捷键(已显示 {count} 个);ESC、方向键在「虚拟按键」页。",restoreBar:"恢复默认显示",customizeBar:"自定义按键栏显示哪些快捷键",customizeBarShort:"自定义",shortcutLabel:"快捷键",comboPlaceholder:"例如 ctrl+e 或 esc esc",invalidCombo:"快捷键无效:{error}",defaultCombo:"默认:{combo}",resetAction:"重置",moveUp:"上移",moveDown:"下移",unverified:"未验证",addCustom:"自定义按键",customLabel:"功能名称",customCombo:"按键组合",addAction:"添加自定义按键",restoreProfile:"恢复此智能体默认设置",removeCustom:"删除自定义按键",configHint:"智能体配置:{path}",noAgentActions:"此智能体没有专用快捷键。",errors:{empty:"至少输入一个按键。",tooManySteps:"快捷键最多包含 {count} 个步骤。",invalidStepSyntax:"第 {step} 步格式无效。可输入 ctrl+o 或 esc esc。",duplicateModifier:"第 {step} 步重复使用了 {modifier}。",missingKey:"第 {step} 步需要在修饰键后输入一个按键。",multipleKeys:"第 {step} 步只能包含一个按键。",unsupportedKey:"第 {step} 步不支持按键“{key}”。"}},agentActions:{mode:"模式",rewind:"回退",details:"详情",model:"模型",thinking:"思考",todos:"任务",background:"后台运行",editor:"编辑器",history:"历史",stash:"暂存",pasteImage:"粘贴图片",newline:"换行",interrupt:"中断",editPrevious:"编辑上一条",queue:"排队发送",copy:"复制",clear:"清屏",yolo:"YOLO 模式",expand:"展开",undo:"撤销",agent:"下一个智能体",agentBack:"上一个智能体",palette:"命令面板",recentModel:"最近模型",variant:"模型变体",newSession:"新会话",sessions:"会话列表",thinkingMode:"思考模式",nextModel:"下一个模型",modelPicker:"模型选择器",tools:"工具",thinkingBlocks:"思考内容",followup:"后续提问",dequeue:"移出队列",plan:"计划模式",temporaryModel:"临时模型",expandAll:"全部展开",reasoning:"推理强度",review:"代码审查",specMode:"规格模式",autonomy:"自主模式",undoPicker:"撤销菜单",steer:"引导",sidebar:"侧栏",agents:"智能体列表",permissionMode:"权限模式",bypass:"绕过权限",tasks:"任务",interject:"插话",multiline:"多行输入",shortcuts:"快捷键",approve:"批准",eof:"结束输入",suspend:"挂起",startOfLine:"行首",endOfLine:"行尾",killToEnd:"删除至行尾",agentSwap:"切换智能体",activity:"活动面板",planAct:"计划 / 执行",autoApprove:"自动批准",search:"搜索"},virtualKeyboard:{collapseToolbar:"收起按键栏",expandToolbar:"展开按键栏",helperTitle:"快捷命令",closeHelper:"关闭命令助手",placeholder:"输入终端命令并回车...",sendButton:"发送",clearInput:"清除输入内容",customizeTitle:"自定义虚拟按键",customizeDesc:"调整按键顺序与启禁用状态。",enabledKeysCount:"已启用 {count} 个按键",resetLayout:"恢复默认布局",addKey:"添加按键",availableKeys:"可选按键库",moveUp:"前移",moveDown:"后移",enableKey:"启用按键",disableKey:"禁用按键",deleteKeyTitle:"删除按键",keyTypeModifier:"修饰键",keyTypeNav:"导航键",keyTypeAction:"动作键",keyTypeChord:"组合键",keyTypeFn:"功能键",keyTypeSymbol:"符号",fnDrawerTitle:"功能键 (F1-F12)",chordsDrawerTitle:"控制组合键 (^C, ^D, ^Z)",symbolsDrawerTitle:"终端常用符号 (~, |, /, \\)",touchKeyboardShortcuts:"快捷键工具栏",ctrlCTitle:"Ctrl+C (中断)",ctrlDTitle:"Ctrl+D (退出)",ctrlZTitle:"Ctrl+Z (挂起)",ctrlLTitle:"Ctrl+L (清屏)",ctrlRTitle:"Ctrl+R (搜索)",ctrlATitle:"Ctrl+A (行首)",ctrlETitle:"Ctrl+E (行尾)",ctrlKTitle:"Ctrl+K (剪切)",badgeSigint:"中断",badgeEof:"退出",badgeTstp:"挂起",badgeClear:"清屏",badgeSearch:"搜索",badgeStart:"行首",badgeEnd:"行尾",badgeKill:"剪切",keyEnter:"回车",uploadImage:"上传图片",uploadImageTitle:"选择图片并上传至终端",image:"图片",uploadProgressReading:"读取中...",uploadProgressProcessing:"处理压缩中...",uploadProgressSending:"上传中...",uploadProgressWaitingHost:"等待工作站保存...",uploadProgressCompleted:"完成",uploadProgressFailed:"上传失败"},profiles:{title:"Herdr 实例",switcherLabel:"切换 Herdr 实例",current:"当前",empty:"还没有已配对的 Herdr 实例。",addHost:"添加 Herdr 实例",rename:"重命名实例",remove:"仅本地移除",removeConfirm:"确认从此浏览器移除已保存的连接?"},mobile:{sessionControls:"会话控制",closeSessionControls:"关闭会话控制面板",terminalControlAria:"终端控制权",inputControl:"输入控制权",settingsAria:"终端设置",pairingAria:"连接与配对设置",keybarAria:"切换触控按键条",quickInputAria:"切换快捷命令",menu:"菜单",statusBarAria:"会话状态栏"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"已连接至 Herdr 会话。",windowAriaLabel:"远程终端窗口",bufferAriaLabel:"xterm 终端缓冲区",offlineStatusAria:"离线状态",releaseControlAria:"释放终端控制权",takeoverControlAria:"强占终端控制权",claimControlAria:"获取终端控制权"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab(Claude Code 切换模式)",ctrl:"切换 Ctrl 锁定",alt:"切换 Alt 锁定",shift:"切换 Shift 锁定",meta:"Meta / 命令键",enter:"回车 (Enter)",backspace:"退格 (Backspace)",delete:"删除 (Delete)",left:"左箭头 (←)",up:"上箭头 (↑)",down:"下箭头 (↓)",right:"右箭头 (→)",home:"行首 (Home)",end:"行尾 (End)",page_up:"向上翻页 (Page Up)",page_down:"向下翻页 (Page Down)",insert:"插入 (Insert)",drawer_chords:"常用 Ctrl 组合键",drawer_agent:"智能体快捷键",drawer_symbols:"常用特殊符号",drawer_fn:"功能键 (F1-F12)",ctrl_c:"Ctrl+C (中断)",ctrl_d:"Ctrl+D (退出)",ctrl_z:"Ctrl+Z (挂起)",ctrl_l:"Ctrl+L (清屏)",ctrl_a:"Ctrl+A (行首)",ctrl_e:"Ctrl+E (行尾)",ctrl_k:"Ctrl+K (剪切)",ctrl_r:"Ctrl+R (历史搜索)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"管道符 (|)",sym_tilde:"波浪号 (~)",sym_slash:"正斜杠 (/)",sym_backslash:"反斜杠 (\\)",sym_dash:"连字符 (-)",sym_underscore:"下划线 (_)",sym_dollar:"美元符 ($)",sym_ampersand:"与符号 (&)",sym_quote:'双引号 (")',sym_backtick:"反引号 (`)"},admin:{returnToTerminal:"返回终端",terminalShells:"终端会话",startedAt:"启动于 {time}",acrossWindows:"共 {count} 个窗口",perSecond:"{value}/秒",unitDay:" 天",unitHour:" 小时",unitMinute:" 分",unitSecond:" 秒",startedRecently:"最近启动",updatedAt:"更新于 {time}",autoRefresh:"自动刷新",paused:"暂停刷新",refreshNow:"立即刷新",connectedHosts:"接入主机",activeUsers:"活跃用户",activePtys:"活动 PTY",activeController:"活跃控制者",uptime:"运行时间",none:"无",noHost:"未连接主机",tabOverview:"概览",tabClients:"客户端 ({count})",tabPtys:"PTY ({count})",tabDevices:"设备 ({count})",hostsTitle:"主机 ({count})",noHosts:"暂无接入或配对的主机",hostConnectedDevices:"{count} 台在线",hostPairedDevices:"{count} 台已配对",hostStatusOnline:"在线",hostStatusBusy:"使用中",hostStatusReconnecting:"重连中",hostStatusOffline:"离线",hostRosterOperatorOnly:"设备清单仅 Relay 操作员可见。",connectedClientsTitle:"已连接客户端 ({count})",noClients:"当前暂无客户端连接",colClientId:"客户端 ID",colDevice:"设备",colLastSeen:"最近活动",colActions:"操作",unknownDevice:"未知设备",pairedDevicesTitle:"已配对设备 ({count})",noDevices:"尚未配对任何设备",revokeDevice:"撤销",revokeConfirm:"确认撤销",revokeFailed:"撤销失败",colRole:"角色",colIp:"IP 地址",colConnectedAt:"连接于",colTraffic:"流量 ↓入 / ↑出",activePtysTitle:"活动 PTY 终端会话 ({count})",noPtys:"当前无活跃的 PTY 会话",colPtyId:"PTY 标识",colPid:"进程 PID",colCommand:"运行命令",colGrid:"网格规格",colCwd:"工作目录",colViewers:"窗口数",copiedJson:"已复制",unauthorizedTitle:"管理接口未授权 (401/403)",unauthorizedDesc:"访问 GET /api/status 需要已授权的设备 Token。",pairingStepsTitle:"设备配对指引:",pairingStepsHelp:"在主机运行配对命令获取配对码后输入。",enterPairCodeBtn:"输入配对码",retryFetchBtn:"重新获取状态",errorConnecting:"连接 GET /api/status 失败:{error}",loadingStatus:"正在加载系统状态...",remoteRelayTitle:"远程 Relay 服务管理",remoteRelayNotice:"当前连接至远程独立 Relay 服务。如需查看服务端指标,请使用操作员后台。",remoteRelayEndpoint:"远程端点:",remoteRelayAdminUrl:"远程后台地址:",openRemoteAdminBtn:"前往远程管理后台",relayAdminTitle:"Relay 操作员管理后台",relayAdminTokenLabel:"Relay 管理员令牌 (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"请输入 RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"该 Relay 服务未配置 RELAY_ADMIN_TOKEN。",relayAdminLoginBtn:"验证并查看服务端指标",relayAdminAuthError:"管理员令牌无效或未授权。",remoteRelayClientNotice:"当前为终端客户端连接。如需查看服务端指标,请访问操作员后台。",openOperatorPortal:"打开服务端管理后台",localWorkstationBadge:"本地宿主 Relay",modeLocal:"本地模式",modeRemote:"远程模式",hintTabs:"切换标签页",hintRefresh:"刷新状态",hintBack:"返回终端",relJustNow:"刚刚",relMinutes:"{count} 分钟前",relHours:"{count} 小时前",relDays:"{count} 天前",statInbound:"入站流量",statOutbound:"出站流量",statTotal:"累计 {value}",hostsOfflineSub:"另有 {count} 台离线",colHost:"主机",colStatus:"状态",deviceWindows:"{count} 个窗口在线",hostPtys:"PTY {count}",relayAdminPrompt:"输入 RELAY_ADMIN_TOKEN,查看本 Relay 的主机、设备与流量。"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"处于观察者模式,请先获取控制权",clientIdCopied:"客户端 ID 已复制: {id}",pairingLinkCopied:"配对链接已复制",switchedLanguage:"语言已切换为 {lang}",settingsReset:"设置已恢复默认",fontReset:"字体已恢复默认",commandCopied:"命令已复制",keyLayoutReset:"虚拟按键布局已恢复默认"},shortcuts:{title:"WebUI 快捷键",help:"以下快捷键仅在非终端输入区域生效:",terminalInputNote:"终端操作快捷键直接透传至宿主 PTY。"},serverErrors:{auth_required:"需要配对:请输入配对码,或填写仍然有效的设备令牌。",unauthorized:"该设备无权访问此工作站。",host_offline:"已配对的工作站未连接到该 relay。",host_disconnected:"工作站已断开连接。",stale_host:"工作站长时间无响应,已被断开。",too_many_clients:"该工作站的窗口数量已达上限。",rate_limited:"配对尝试过于频繁,请稍后再试。",invalid_handshake:"relay 拒绝了握手,请刷新页面。",device_revoked:"该设备已被 relay 管理员撤销。",connection_closed:"连接已断开,正在重连…",connection_stale:"页面回到前台时连接已无响应,正在重连…",connection_stalled:"连接超时,正在重试…",connection_failed:"无法建立到 relay 的连接。",host_reconnecting:"Herdr 主机正在重连。",host_reconnect_timeout:"Herdr 主机未能及时恢复连接。",host_replaced:"Herdr 主机连接已被替换。",slow_client:"由于浏览器处理速度过慢,连接已关闭。",client_send_failed:"Relay 无法向此浏览器发送数据。",too_many_hosts:"此 relay 已达到主机数量上限。",paste_file_unsupported:"不支持的粘贴图片格式。",paste_file_too_large:"粘贴图片超过 3 MB 上限。",paste_file_write_failed:"工作站保存图片失败。",paste_file_empty:"粘贴图片内容为空。",paste_file_corrupt:"粘贴图片数据损坏或与声明格式不符。",viewer_mode:"观察者模式无法粘贴到终端。",no_session:"终端会话未准备就绪。"},fontPresets:{host:"宿主机终端字体(默认)",system:"系统等宽字体"},hostFont:{title:"宿主机终端字体",body:"{host} 的终端使用 {family}{detail}。这台设备没有安装该字体。",bodyGlyphsOnly:"{host} 的终端显示中文用 {family},这台设备没有安装该字体。",glyphs:"中文使用 {family}:先下载常用字约 2 MB,其余的字第一次出现时再补。",glyphsAll:"{family} 太大,不整包传输:先下载常用字符约 2 MB,其余字符第一次出现时再补。",detail:"({detail})",detailSeparator:",",download:"加载 {count} 个字体文件,共 {size}。只下载一次,之后保存在本浏览器。",load:"加载字体",decline:"使用本机字体",loading:"正在加载 {received} / {total}",failed:"字体加载失败:{reason}",loaded:"宿主机字体已加载",reasons:{host_font_unavailable:"宿主机上的字体已变化,请在设置里重新同步",host_font_timeout:"宿主机没有响应",disconnected:"连接已断开",font_api_unavailable:"此浏览器不支持加载字体",other:"浏览器无法解析该字体文件"}},agents:{title:"本工作站的智能体",blocked:"待确认",done:"已完成",working:"运行中",allIdle:"智能体空闲",notifyBlocked:"{count} 个智能体在等你确认",notifyDone:"{count} 个智能体已完成"},clipboard:{openLink:"打开链接",openLinkFailed:"该链接无法在浏览器中打开",copySelection:"复制选中",copyLine:"复制本行",copyScreen:"复制整屏",paste:"粘贴",cancel:"取消",copied:"已复制到剪贴板",copyFailed:"复制失败",pasteHint:"长按此处粘贴,然后按发送",pasteSend:"发送",pasteUnavailable:"剪贴板为空或不可用",pasteTitle:"粘贴内容",pasted:"已粘贴",chooseImage:"选择图片",takePhoto:"拍照",imageTooLarge:"图片超过 3 MB 限制且无法进一步压缩。",imageCompressedSize:"压缩后大小:{size}",fileEmpty:"文件内容为空。",decodeFailed:"无法解析图片文件。",unsupportedType:"不支持的图片格式,仅支持 PNG、JPEG、WebP 和 GIF。",imageSectionTitle:"图片",textSectionTitle:"文本",imageCompressing:"正在处理图片...",removeImage:"移除图片"}},_u={en:sb,zh:yx};function Cd(l,i,a){const o=_u[l]||_u.en,r=i.split(".");let u=o;for(const h of r)if(u&&typeof u=="object"&&h in u)u=u[h];else{let p=_u.en;for(const m of r)if(p&&typeof p=="object"&&m in p)p=p[m];else return i;u=p;break}if(typeof u!="string")return i;if(a){let h=u;for(const[p,m]of Object.entries(a))h=h.replaceAll(`{${p}}`,String(m));return h}return u}function ju(l){return typeof l=="string"&&Object.hasOwn(sb.serverErrors,l)}const oe={ESC:"\x1B",TAB:" ",SHIFT_TAB:"\x1B[Z",ENTER:"\r",BACKSPACE:"",UP:"\x1B[A",DOWN:"\x1B[B",RIGHT:"\x1B[C",LEFT:"\x1B[D",HOME:"\x1B[H",END:"\x1B[F",PAGE_UP:"\x1B[5~",PAGE_DOWN:"\x1B[6~",INSERT:"\x1B[2~",DELETE:"\x1B[3~",CTRL_C:"",CTRL_D:"",CTRL_Z:"",CTRL_L:"\f",CTRL_A:"",CTRL_E:"",CTRL_K:"\v",CTRL_R:"",CTRL_W:"",CTRL_U:"",CTRL_X:"",CTRL_N:"",CTRL_P:"",F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F5:"\x1B[15~",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~",F11:"\x1B[23~",F12:"\x1B[24~"},vx=new TextEncoder;function Td(l){return vx.encode(l)}function ob(l){if(!l||l.length===0)return"";const a=l.toUpperCase().charCodeAt(0);return a>=65&&a<=90?String.fromCharCode(a-64):l==="@"||l===" "?"\0":l==="["?"\x1B":l==="\\"?"":l==="]"?"":l==="^"?"":l==="_"?"":l==="?"?"":l}function xx(l){return`\x1B${l}`}function qp({ctrl:l,alt:i,shift:a}){return 1+(a?1:0)+(i?2:0)+(l?4:0)}const rb=/^\x1b[[O]([ABCDHF])$/,cb=/^\x1bO([PQRS])$/,ub=/^\x1b\[(\d+)~$/;function tr(l,i){const{ctrl:a=!1,alt:o=!1,shift:r=!1}=i;if(!a&&!o&&!r)return l;const u=qp(i),h=o&&!a&&!r,p=rb.exec(l);if(p)return`\x1B[1;${u}${p[1]}`;const m=cb.exec(l);if(m)return`\x1B[1;${u}${m[1]}`;const g=ub.exec(l);if(g)return`\x1B[${g[1]};${u}~`;switch(l){case oe.TAB:return r&&!a&&!o?oe.SHIFT_TAB:h?`\x1B${l}`:`\x1B[9;${u}u`;case oe.SHIFT_TAB:return!a&&!o?l:`\x1B[9;${qp({...i,shift:!0})}u`;case oe.ENTER:return h?`\x1B${l}`:`\x1B[13;${u}u`;case oe.BACKSPACE:return a&&!o&&!r?"\b":h?`\x1B${l}`:`\x1B[127;${u}u`;case oe.ESC:return h?`\x1B${l}`:`\x1B[27;${u}u`}let b=l;return r&&l.length===1&&!a&&(b=l.toUpperCase()),a&&(b=ob(b)),o&&(b=xx(b)),b}function wx(l){return[...l].length===1?!0:rb.test(l)||cb.test(l)||ub.test(l)||l===oe.SHIFT_TAB}class vn extends Error{constructor(a,o={}){super(a);W(this,"code");W(this,"params");this.name="KeyComboError",this.code=a,this.params=o}}const Sx={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},Vp={esc:oe.ESC,tab:oe.TAB,enter:oe.ENTER,backspace:oe.BACKSPACE,delete:oe.DELETE,left:oe.LEFT,right:oe.RIGHT,up:oe.UP,down:oe.DOWN,home:oe.HOME,end:oe.END,pageup:oe.PAGE_UP,pagedown:oe.PAGE_DOWN,insert:oe.INSERT,space:" ","+":"+"},Cx={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},Tx={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function db(l,i){const a=l.toLowerCase().split("+");if(a.some(m=>!m))throw new vn("invalidStepSyntax",{step:i+1});const o={};let r;for(const m of a)if(m==="ctrl"||m==="control"){if(o.ctrl)throw new vn("duplicateModifier",{step:i+1,modifier:"Ctrl"});o.ctrl=!0}else if(m==="alt"||m==="option"){if(o.alt)throw new vn("duplicateModifier",{step:i+1,modifier:"Alt"});o.alt=!0}else if(m==="shift"){if(o.shift)throw new vn("duplicateModifier",{step:i+1,modifier:"Shift"});o.shift=!0}else if(r===void 0)r=m;else throw new vn("multipleKeys",{step:i+1});if(!r)throw new vn("missingKey",{step:i+1});const u=Sx[r]||r,h=/^f(?:[1-9]|1[0-2])$/.exec(u);let p;if(h)p=oe[u.toUpperCase()];else if(Object.hasOwn(Vp,u))p=Vp[u];else if([...u].length===1&&/^[\x21-\x7e]$/.test(u))p=u;else throw new vn("unsupportedKey",{step:i+1,key:u});return{key:p,keyName:u,modifiers:o,sequence:Ax(p,u,o)}}function Mx(l){return 1+(l.shift?1:0)+(l.alt?2:0)+(l.ctrl?4:0)}function Pp(l,i){const a=[...l][0].codePointAt(0);return a===void 0?"":`\x1B[${a};${Mx(i)}u`}function Ax(l,i,a){if(!a.ctrl)return tr(l,a);if(i.length===1&&/^[\x20-\x7e]$/.test(i)){const o=i.toLowerCase();if(a.alt||a.shift||o==="m"||o==="i")return Pp(o,a);if(o==="-"||o==="/"||o==="_")return"";const r=ob(o);return r!==o?r:Pp(o,a)}return tr(l,a)}function xn(l){if(typeof l!="string"||!l.trim())throw new vn("empty");const i=l.trim().split(/\s+/);if(i.length>8)throw new vn("tooManySteps",{count:8});return i.map((a,o)=>db(a,o).sequence)}function is(l){const i=l.trim().split(/\s+/);return i.length>1&&i.every(a=>["esc","escape"].includes(a.toLowerCase()))?`ESC${Tx[i.length]||` ×${i.length}`}`:i.map((a,o)=>{const{keyName:r,modifiers:u}=db(a,o),h=Cx[r]||(/^f\d+$/.test(r),r.toUpperCase());return u.ctrl&&u.alt&&u.shift?`Ctrl+Alt+⇧${h}`:u.ctrl&&u.alt?`Ctrl+Alt+${h}`:u.ctrl&&u.shift?`^⇧${h}`:u.ctrl?`^${h}`:u.alt&&u.shift?`Alt+⇧${h}`:u.alt?`Alt+${h}`:u.shift?`⇧${h}`:h}).join(" ")}const H=(l,i,a,o=!0)=>({id:l,labelKey:i,combo:a,verified:o}),fb={claude:{id:"claude",name:"Claude Code",shortName:"Claude",configHint:"~/.claude/keybindings.json",bar:["mode","rewind","details","model"],actions:[H("mode","mode","shift+tab"),H("rewind","rewind","esc esc"),H("details","details","ctrl+o"),H("model","model","alt+p"),H("thinking","thinking","alt+t"),H("todos","todos","ctrl+t"),H("background","background","ctrl+b"),H("editor","editor","ctrl+g"),H("history","history","ctrl+r"),H("stash","stash","ctrl+s"),H("pasteImage","pasteImage","ctrl+v"),H("newline","newline","ctrl+j"),H("interrupt","interrupt","esc")]},codex:{id:"codex",name:"Codex",shortName:"Codex",configHint:"~/.codex/config.toml [tui.keymap]",bar:["mode","editPrevious","details"],actions:[H("mode","mode","shift+tab"),H("editPrevious","editPrevious","esc esc"),H("details","details","ctrl+t"),H("queue","queue","tab"),H("history","history","ctrl+r"),H("copy","copy","ctrl+o"),H("editor","editor","ctrl+g"),H("newline","newline","ctrl+j"),H("clear","clear","ctrl+l"),H("interrupt","interrupt","esc")]},gemini:{id:"gemini",name:"Gemini CLI",shortName:"Gemini",configHint:"~/.gemini/keybindings.json",bar:["mode","yolo","rewind"],actions:[H("mode","mode","shift+tab"),H("yolo","yolo","ctrl+y"),H("rewind","rewind","esc esc"),H("todos","todos","ctrl+t"),H("expand","expand","ctrl+o"),H("background","background","ctrl+b"),H("editor","editor","ctrl+g"),H("history","history","ctrl+r"),H("undo","undo","ctrl+z"),H("newline","newline","ctrl+j"),H("interrupt","interrupt","esc")]},qwen:{id:"qwen",name:"Qwen Code",shortName:"Qwen",bar:["mode","history"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","esc"),H("history","history","ctrl+r"),H("newline","newline","ctrl+j"),H("todos","todos","ctrl+t",!1),H("rewind","rewind","esc esc",!1)]},opencode:{id:"opencode",name:"OpenCode",shortName:"OpenCode",configHint:"tui.json keybinds",bar:["palette","model","sessions"],actions:[H("agent","agent","tab"),H("agentBack","agentBack","shift+tab"),H("interrupt","interrupt","esc"),H("palette","palette","ctrl+p"),H("model","model","ctrl+x m"),H("recentModel","recentModel","f2"),H("variant","variant","ctrl+t"),H("newSession","newSession","ctrl+x n"),H("sessions","sessions","ctrl+x l"),H("undo","undo","ctrl+x u"),H("editor","editor","ctrl+x e"),H("newline","newline","ctrl+j")]},kilo:{id:"kilo",name:"Kilo Code",shortName:"Kilo",configHint:"~/.config/kilo/tui.jsonc",bar:["palette","model","sessions"],actions:[H("agent","agent","tab",!1),H("agentBack","agentBack","shift+tab",!1),H("interrupt","interrupt","esc"),H("palette","palette","ctrl+p"),H("model","model","ctrl+x m"),H("recentModel","recentModel","f2"),H("variant","variant","ctrl+t"),H("newSession","newSession","ctrl+x n"),H("sessions","sessions","ctrl+x l"),H("undo","undo","ctrl+x u"),H("editor","editor","ctrl+x e"),H("newline","newline","ctrl+j")]},pi:{id:"pi",name:"Pi",shortName:"Pi",configHint:"~/.pi/agent/keybindings.json",bar:["thinkingMode","modelPicker","tools"],actions:[H("thinkingMode","thinkingMode","shift+tab"),H("interrupt","interrupt","esc"),H("nextModel","nextModel","ctrl+p"),H("modelPicker","modelPicker","ctrl+l"),H("tools","tools","ctrl+o"),H("thinkingBlocks","thinkingBlocks","ctrl+t"),H("editor","editor","ctrl+g"),H("followup","followup","alt+enter"),H("dequeue","dequeue","alt+up"),H("newline","newline","shift+enter")]},omp:{id:"omp",name:"Oh My Pi",shortName:"OMP",configHint:"~/.omp/agent/keybindings.yml",bar:["thinkingMode","plan","model"],actions:[H("thinkingMode","thinkingMode","shift+tab"),H("plan","plan","alt+shift+p"),H("model","model","alt+m"),H("temporaryModel","temporaryModel","alt+p"),H("nextModel","nextModel","ctrl+p"),H("tools","tools","ctrl+o"),H("thinking","thinking","ctrl+t"),H("history","history","ctrl+r"),H("editor","editor","ctrl+g"),H("followup","followup","ctrl+enter"),H("interrupt","interrupt","esc")]},copilot:{id:"copilot",name:"GitHub Copilot",shortName:"Copilot",bar:["mode","expand","reasoning"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","esc"),H("expand","expand","ctrl+o"),H("expandAll","expandAll","ctrl+e"),H("reasoning","reasoning","ctrl+t"),H("editor","editor","ctrl+g"),H("clear","clear","ctrl+l")]},cursor:{id:"cursor",name:"Cursor",shortName:"Cursor",bar:["mode","review"],actions:[H("mode","mode","shift+tab"),H("review","review","ctrl+r"),H("newline","newline","ctrl+j"),H("interrupt","interrupt","esc",!1)]},droid:{id:"droid",name:"Factory Droid",shortName:"Droid",configHint:"In-app settings",bar:["specMode","autonomy"],actions:[H("specMode","specMode","shift+tab"),H("autonomy","autonomy","ctrl+l"),H("details","details","ctrl+o",!1),H("queue","queue","ctrl+enter"),H("interrupt","interrupt","esc",!1)]},kimi:{id:"kimi",name:"Kimi Code",shortName:"Kimi",bar:["plan","undoPicker","expand"],actions:[H("plan","plan","shift+tab"),H("interrupt","interrupt","esc"),H("undoPicker","undoPicker","esc esc"),H("expand","expand","ctrl+o"),H("editor","editor","ctrl+g"),H("steer","steer","ctrl+s"),H("undo","undo","ctrl+-"),H("newline","newline","ctrl+j"),H("pasteImage","pasteImage","ctrl+v")]},amp:{id:"amp",name:"Amp",shortName:"Amp",bar:["palette","reasoning","mode"],actions:[H("palette","palette","ctrl+o"),H("reasoning","reasoning","alt+d"),H("mode","mode","ctrl+s",!1),H("editor","editor","ctrl+g"),H("history","history","ctrl+r"),H("sidebar","sidebar","ctrl+backslash"),H("pasteImage","pasteImage","ctrl+v"),H("interrupt","interrupt","esc",!1)]},hermes:{id:"hermes",name:"Hermes",shortName:"Hermes",bar:["interrupt","agents","sessions"],actions:[H("interrupt","interrupt","ctrl+c"),H("newline","newline","ctrl+j"),H("editor","editor","ctrl+g"),H("agents","agents","ctrl+t"),H("sessions","sessions","ctrl+x")]},qodercli:{id:"qodercli",name:"Qoder CLI",shortName:"Qoder",configHint:"/shortcuts in-app",bar:["permissionMode","bypass","tasks","interrupt"],actions:[H("permissionMode","permissionMode","shift+tab"),H("bypass","bypass","ctrl+y"),H("tasks","tasks","ctrl+t"),H("editor","editor","ctrl+x"),H("history","history","ctrl+r"),H("queue","queue","ctrl+enter"),H("newline","newline","ctrl+j"),H("pasteImage","pasteImage","alt+v"),H("interrupt","interrupt","ctrl+c")]},devin:{id:"devin",name:"Devin",shortName:"Devin",configHint:"~/.config/devin/config.json keymap",bar:["mode","thinking","interrupt"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","ctrl+c"),H("thinking","thinking","alt+t"),H("newline","newline","ctrl+j"),H("pasteImage","pasteImage","ctrl+v")]},grok:{id:"grok",name:"Grok CLI",shortName:"Grok",bar:["mode","rewind","interrupt"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","ctrl+c"),H("rewind","rewind","esc esc"),H("interject","interject","ctrl+enter"),H("multiline","multiline","ctrl+m"),H("newline","newline","alt+enter"),H("shortcuts","shortcuts","ctrl+.")]},agy:{id:"agy",name:"Antigravity",shortName:"Antigravity",configHint:"~/.gemini/antigravity-cli/keybindings.json",bar:["mode","approve","interrupt"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","ctrl+c"),H("background","background","ctrl+b"),H("approve","approve","ctrl+k"),H("clear","clear","esc esc")]},mastracode:{id:"mastracode",name:"MastraCode",shortName:"MastraCode",bar:["interrupt","thinking","expand"],actions:[H("interrupt","interrupt","ctrl+c"),H("thinking","thinking","ctrl+t"),H("expand","expand","ctrl+e"),H("followup","followup","ctrl+f")]},letta:{id:"letta",name:"Letta Code",shortName:"Letta",bar:["permissionMode"],actions:[H("permissionMode","permissionMode","shift+tab"),H("interrupt","interrupt","esc",!1)]},kiro:{id:"kiro",name:"Kiro CLI",shortName:"Kiro",configHint:"kiro-cli settings chat.keybindings.*",bar:["agentSwap","details","steer"],actions:[H("agentSwap","agentSwap","shift+tab"),H("interrupt","interrupt","esc"),H("details","details","ctrl+t"),H("steer","steer","ctrl+s"),H("expand","expand","ctrl+o"),H("activity","activity","ctrl+x"),H("newline","newline","ctrl+j")]},cline:{id:"cline",name:"Cline",shortName:"Cline",bar:["autoApprove"],actions:[H("planAct","planAct","tab"),H("autoApprove","autoApprove","shift+tab"),H("interrupt","interrupt","esc",!1)]},maki:{id:"maki",name:"Maki",shortName:"Maki",bar:["rewind","search"],actions:[H("rewind","rewind","esc esc"),H("search","search","ctrl+f"),H("interrupt","interrupt","esc",!1)]},muse:{id:"muse",name:"Muse",shortName:"Muse",configHint:"/keymap in-app",bar:["queue","interruptCtrl"],actions:[H("interrupt","interrupt","esc"),H("queue","queue","alt+enter"),H("interruptCtrl","interrupt","ctrl+c")]},shell:{id:"shell",name:"Shell",shortName:"Shell",actions:[]}},el=fb,Ex=Object.keys(fb),Xp={pi:"pi",claude:"claude","claude-code":"claude",codex:"codex",gemini:"gemini",cursor:"cursor","cursor-agent":"cursor",devin:"devin","devin-cli":"devin","devin cli":"devin",agy:"agy",antigravity:"agy","antigravity-cli":"agy",cline:"cline",".cline":"cline",omp:"omp",mastracode:"mastracode","mastra-code":"mastracode","mastra code":"mastracode",opencode:"opencode",opencode2:"opencode","open-code":"opencode",copilot:"copilot","github-copilot":"copilot",ghcs:"copilot",kimi:"kimi","kimi-code":"kimi","kimi code":"kimi",kiro:"kiro","kiro-cli":"kiro",droid:"droid",amp:"amp","amp-local":"amp",grok:"grok","grok-build":"grok",hermes:"hermes","hermes-agent":"hermes",kilo:"kilo","kilo-code":"kilo","kilo code":"kilo",qodercli:"qodercli",qoderclicn:"qodercli",qoder:"qodercli",qodercn:"qodercli",qwen:"qwen","qwen-code":"qwen","qwen code":"qwen",letta:"letta","letta-code":"letta","letta code":"letta",maki:"maki",muse:"muse","muse-code":"muse","muse-cli":"muse",shell:"shell"};function Nx(l){return l&&l.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function Qp(l){const i=Nx(l);return Xp[i]?Xp[i]:/^muse-bin-\d/.test(i)?"muse":null}function kx(l,i="auto"){return i&&i!=="auto"?Qp(i)||"shell":Qp(l)||"shell"}const Lx=[H("genericCtrlC","interrupt","ctrl+c"),H("genericCtrlD","eof","ctrl+d"),H("genericCtrlZ","suspend","ctrl+z"),H("genericCtrlL","clear","ctrl+l"),H("genericCtrlR","history","ctrl+r"),H("genericCtrlA","startOfLine","ctrl+a"),H("genericCtrlE","endOfLine","ctrl+e"),H("genericCtrlK","killToEnd","ctrl+k")],Rx=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],_x=["genericCtrlC"];function jx(l,i){var r,u;const a=l.map(h=>{var g;const p=(g=i==null?void 0:i.actions)==null?void 0:g[h.id];let m=typeof(p==null?void 0:p.keys)=="string"?p.keys:h.combo;try{xn(m)}catch{m=h.combo}return{...h,defaultCombo:h.combo,combo:m,hidden:typeof(p==null?void 0:p.hidden)=="boolean"?p.hidden:h.defaultHidden===!0,custom:!1}}),o=new Set(a.map(h=>h.id));for(const h of(i==null?void 0:i.custom)||[]){if(!h||typeof h.id!="string"||o.has(h.id))continue;const p=h.keys;try{xn(p)}catch{continue}a.push({id:h.id,labelKey:"custom",defaultCombo:p,combo:p,verified:!0,hidden:((u=(r=i==null?void 0:i.actions)==null?void 0:r[h.id])==null?void 0:u.hidden)===!0,custom:!0,customLabel:h.label}),o.add(h.id)}if(Array.isArray(i==null?void 0:i.order)){const h=new Map(i.order.map((p,m)=>[p,m]));a.sort((p,m)=>(h.get(p.id)??Number.MAX_SAFE_INTEGER)-(h.get(m.id)??Number.MAX_SAFE_INTEGER))}return a}function Ox(l,i){const a=new Set(l.map(o=>o.combo.trim().toLowerCase()));return i.filter(o=>!a.has(o.combo.trim().toLowerCase()))}const as=l=>l.id.startsWith("generic");function hb(l,i){const a=el[l],o=new Set([...a.bar||[],...l==="shell"?Rx:_x]),r=[...a.actions,...Lx].map(u=>({...u,defaultHidden:!o.has(u.id)}));return jx(r,i)}function mb(l,i){const a=hb(l,i),o=a.filter(u=>!as(u)),r=new Set(Ox(o,a.filter(as)));return a.filter(u=>!as(u)||r.has(u))}function Dx(l,i){const a=mb(l,i).filter(o=>!o.hidden);return{agentActions:a.filter(o=>!as(o)),genericActions:a.filter(as)}}function zx(l){const i={};for(const[a,o]of Object.entries(l.actions||{})){const r={...o};delete r.hidden,Object.keys(r).length>0&&(i[a]=r)}return{...l,actions:i}}function pb(l){if(!l||typeof l!="object"||Array.isArray(l))return{};const i=Object.create(null);for(const[a,o]of Object.entries(l).slice(0,32)){if(!/^[a-z][a-z0-9_-]{0,31}$/i.test(a)||["__proto__","constructor","prototype"].includes(a)||!o||typeof o!="object"||Array.isArray(o))continue;const r=o,u={};if(Array.isArray(r.order)&&(u.order=[...new Set(r.order.filter(h=>typeof h=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(h)))].slice(0,256)),r.actions&&typeof r.actions=="object"&&!Array.isArray(r.actions)){const h=Object.create(null);for(const[p,m]of Object.entries(r.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(p)||!m||typeof m!="object"||Array.isArray(m))continue;const g=m,b={};if(typeof g.keys=="string"&&g.keys.trim()){const v=g.keys.trim().slice(0,80);try{xn(v),b.keys=v}catch{}}typeof g.hidden=="boolean"&&(b.hidden=g.hidden),Object.keys(b).length>0&&(h[p]=b)}u.actions=h}if(Array.isArray(r.custom)){const h=new Set;u.custom=r.custom.slice(0,64).flatMap(p=>{if(!p||typeof p!="object"||Array.isArray(p))return[];const m=p;if(typeof m.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(m.id)||["__proto__","constructor","prototype"].includes(m.id)||h.has(m.id))return[];if(typeof m.label!="string"||!m.label.trim()||typeof m.keys!="string"||!m.keys.trim())return[];const g=m.keys.trim().slice(0,80);try{xn(g)}catch{return[]}return h.add(m.id),[{id:m.id,label:m.label.trim().slice(0,64),keys:g}]})}i[a]=u}return i}const Hx=10,Bx=24,ss=15,nr=13,Md=640;function Ux(){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 Zl()<Md}function Zl(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function ed(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function Wl(l,i=ss){const a=typeof l=="number"?l:Number(l);return!Number.isFinite(a)||a<=0?i:Math.min(Bx,Math.max(Hx,Math.round(a)))}function Zp(l,i=Zl()){if(i<Md){const o=Wl(l,nr);return Math.min(15,Math.max(12,o))}return Wl(l,ss)}const Wp="#11111b",Kx=['"Symbols Nerd Font Mono"','"Sarasa Mono SC"','"Noto Sans Mono CJK SC"','"Noto Sans Mono CJK TC"','"Microsoft YaHei Mono"','"PingFang SC"',"monospace"],ir=["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"'],td=[{id:"host",name:"Host terminal font",faces:[]},{id:"system",name:"System monospace",faces:ir},{id:"jetbrains-mono",name:"JetBrains Mono",faces:['"JetBrains Mono"','"Herdr JetBrains Mono"']},{id:"fira-code",name:"Fira Code",faces:['"Fira Code"','"Herdr Fira Code"']},{id:"cascadia-code",name:"Cascadia Code",faces:['"Cascadia Code"','"Herdr Cascadia Code"']},{id:"source-code-pro",name:"Source Code Pro",faces:['"Source Code Pro"','"Herdr Source Code Pro"']},{id:"ibm-plex-mono",name:"IBM Plex Mono",faces:['"IBM Plex Mono"','"Herdr IBM Plex Mono"']}],gb="host",Ix='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',Fx='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',Gx="JetBrains Mono, Menlo, Monaco, Consolas, monospace",Yx={[Ix]:"host",[Fx]:"host",[Gx]:"host",'SFMono-Regular, Menlo, Monaco, "Symbols Nerd Font Mono", monospace':"system",'Consolas, "Lucida Console", "Symbols Nerd Font Mono", monospace':"system",'"Liberation Mono", "DejaVu Sans Mono", "Symbols Nerd Font Mono", monospace':"system",'"Courier New", Courier, "Symbols Nerd Font Mono", monospace':"system",'"Fira Code", "Symbols Nerd Font Mono", monospace':"fira-code"};function Ou(l){return typeof l!="string"||!l.trim()?gb:Yx[l]??l}const $x=[[/^jetbrains\s*mono/i,'"Herdr JetBrains Mono"'],[/^fira\s*code/i,'"Herdr Fira Code"'],[/^(cascadia\s*(code|mono)|caskaydia\s*(cove|mono))/i,'"Herdr Cascadia Code"'],[/^(source\s*code\s*pro|sauce\s*code\s*pro)/i,'"Herdr Source Code Pro"'],[/^(ibm\s*plex\s*mono|blex\s*mono)/i,'"Herdr IBM Plex Mono"']];function qx(l){const i=$x.find(([a])=>a.test(l.trim()));return i?i[1]:null}function es(l){return`"${l.replace(/["\\]/g,"")}"`}function nd(l){return[...new Set([...l,...Kx])].join(", ")}const Vx=nd(ir);function Px(l,i){const a=typeof l=="string"?l.trim():"";if(!a||a==="host"){if(!(i!=null&&i.family))return Vx;const u=[],h=i.glyphs;(h==null?void 0:h.scope)==="all"&&h.alias&&u.push(es(h.alias)),i.alias&&u.push(es(i.alias)),u.push(es(i.family));const p=qx(i.family);return p&&u.push(p),(h==null?void 0:h.scope)==="cjk"&&(h.alias&&u.push(es(h.alias)),u.push(es(h.family))),nd([...u,...ir])}const o=td.find(u=>u.id===a);if(o)return nd([...o.faces,...ir]);if(a.includes("Symbols Nerd Font"))return a;if(/^['"]?monospace['"]?$/i.test(a))return'"Symbols Nerd Font Mono", monospace';const r=/,\s*['"]?monospace['"]?\s*$/i;return r.test(a)?a.replace(r,', "Symbols Nerd Font Mono", monospace'):`${a}, "Symbols Nerd Font Mono", monospace`}function Xx(l){if(!l)return null;const i={};return l.background&&(i.background=l.background,i.cursorAccent=l.background),l.foreground&&(i.foreground=l.foreground),l.cursor&&(i.cursor=l.cursor),l.ansi&&Object.assign(i,l.ansi),Object.keys(i).length===0?null:i}function bb(){if(typeof document>"u")return;const l=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",l==null||l.setAttribute("content",Wp),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=Wp}const pt={settings:"herdr_remote_settings_v1",sessionView:"herdr_remote_session_view_v1",ignoredUpdate:"herdr_remote_ignored_update_v1",hostFontConsent:"herdr_remote_host_font_consent_v1",rendererProbe:"herdr_remote_renderer_probe_v3"},id={local:{},session:{}};function Ai(l,i){if(typeof window>"u")return id[l][i]||null;try{return(l==="local"?window.localStorage:window.sessionStorage).getItem(i)}catch{return id[l][i]||null}}function wn(l,i,a){if(id[l][i]=a,!(typeof window>"u"))try{(l==="local"?window.localStorage:window.sessionStorage).setItem(i,a)}catch(o){console.warn(`Failed to write to ${l}Storage:`,o)}}const Jp=["啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆","榜膀绑棒磅蚌镑傍谤苞胞包褒剥薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁","便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍","舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称","城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤","垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮怠耽担丹单郸掸胆旦氮","但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟","蝶迭谍叠丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅","俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿","愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感","秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤","姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍","旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖弧虎唬护互沪","户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸","击圾基机畸稽积箕肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰","奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节","桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎","就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤","靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊","辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐痢立","粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫","馏留刘瘤流柳六龙聋咙笼窿隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落","洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥","米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜","纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕","呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬篇偏片","骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣","讫掐恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷","秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉","柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢","捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓","逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕","朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔獭挞蹋踏胎苔抬台","泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳","贴铁帖厅听烃汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完","碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬","屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔","舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣","辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡","殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶摇尧遥窑","谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音","阴姻吟银淫寅饮尹引隐印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔","隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载","再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐","账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨","纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑住注祝驻抓爪拽专砖转撰赚篆桩","庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"," 、。〃〄々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〡〢〣〤〥〦〧〨〩〪〭〮〯〫〬〰〱〲〳〴〵〶〷〸〹〺〻〼〽〾〿!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¬ ̄¦¥₩"].join(""),Du=256*1024,Qx=2,Zx={regular:{weight:"400",style:"normal"},bold:{weight:"700",style:"normal"},italic:{weight:"400",style:"italic"},boldItalic:{weight:"700",style:"italic"}};function Zi(l){return l?[l.family,...l.faces.map(i=>i.sha256),...(l.subsets||[]).map(i=>i.sha256)].join("|"):null}function eg(l){const i=l==null?void 0:l.faces.find(a=>a.style==="regular");return i?`Herdr Host ${i.sha256.slice(0,12)}`:null}function tg(l){return l?l.faces.reduce((i,a)=>i+a.bytes,0):0}function zu(l){return l>=1024*1024?`${(l/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(l/1024))} KB`}function Wx(l){if(typeof document>"u")return!1;let i=null;try{i=document.createElement("canvas").getContext("2d")}catch{return!1}if(!i)return!1;const a="mmmmmmmmmmlli10OQ@#WWww";for(const o of["serif","sans-serif"]){i.font=`72px ${o}`;const r=i.measureText(a).width;if(i.font=`72px "${l}", ${o}`,i.measureText(a).width!==r)return!0}return!1}const Jx="herdr-remote-fonts",Jl="faces",ea="subsets",yb=new Map,ld=new Map;function cr(){return new Promise(l=>{if(typeof indexedDB>"u"){l(null);return}try{const i=indexedDB.open(Jx,2);i.onupgradeneeded=()=>{i.result.objectStoreNames.contains(Jl)||i.result.createObjectStore(Jl),i.result.objectStoreNames.contains(ea)||i.result.createObjectStore(ea)},i.onsuccess=()=>l(i.result),i.onerror=()=>l(null),i.onblocked=()=>l(null)}catch{l(null)}})}async function ew(l){const i=yb.get(l);if(i)return i;const a=await cr();return a?new Promise(o=>{try{const r=a.transaction(Jl,"readonly").objectStore(Jl).get(l);r.onsuccess=()=>{const u=r.result;o(u instanceof ArrayBuffer?u:null)},r.onerror=()=>o(null)}catch{o(null)}finally{a.close()}}):null}async function tw(l,i){yb.set(l,i);const a=await cr();a&&await new Promise(o=>{try{const r=a.transaction(Jl,"readwrite");r.objectStore(Jl).put(i,l),r.oncomplete=()=>o(),r.onerror=()=>o(),r.onabort=()=>o()}catch{o()}finally{a.close()}})}async function nw(l){const i=await cr();return i?new Promise(a=>{try{const o=IDBKeyRange.bound(`${l}:`,`${l}:￿`),r=i.transaction(ea,"readonly").objectStore(ea).getAll(o);r.onsuccess=()=>{const u=Array.isArray(r.result)?r.result:[];a(u.filter(h=>h&&h.data instanceof ArrayBuffer&&Array.isArray(h.codepoints)))},r.onerror=()=>a([])}catch{a([])}finally{i.close()}}):ld.get(l)??[]}async function iw(l,i){ld.set(l,[...ld.get(l)??[],i]);const a=await cr();a&&await new Promise(o=>{try{const r=a.transaction(ea,"readwrite");r.objectStore(ea).put(i,`${l}:${i.subsetSha}`),r.oncomplete=()=>o(),r.onerror=()=>o(),r.onabort=()=>o()}catch{o()}finally{a.close()}})}function Hu(l){return l?`Herdr Glyphs ${l.sha256.slice(0,12)}`:null}function lw(l){return l>=11904&&l<=12255||l>=12288&&l<=13311||l>=13312&&l<=19903||l>=19968&&l<=40959||l>=44032&&l<=55215||l>=63744&&l<=64255||l>=65072&&l<=65103||l>=65280&&l<=65519||l>=131072&&l<=201551}function vb(l,i){return i<32||i>=127&&i<160||i>=9472&&i<=9631?!1:l==="all"||lw(i)}function aw(l){const i=[...new Set(l)].sort((o,r)=>o-r),a=[];for(let o=0;o<i.length;o+=1){const r=i[o];let u=r;for(;o+1<i.length&&i[o+1]===u+1;)u=i[o+1],o+=1;const h=p=>p.toString(16).toUpperCase();a.push(r===u?`U+${h(r)}`:`U+${h(r)}-${h(u)}`)}return a.join(", ")}async function sw(l,i){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const a=new FontFace(l,i.data,{weight:"400",style:"normal",unicodeRange:aw(i.codepoints)});document.fonts.add(await a.load())}const ad=new Set;function ow(l){return!!(l&&ad.has(l))}async function rw(l,i){if(ad.has(l))return;if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const a=await Promise.all(i.map(({face:o,data:r})=>new FontFace(l,r,Zx[o.style]).load()));for(const o of a)document.fonts.add(o);ad.add(l)}function ng(l){const i=atob(l),a=new Uint8Array(i.length);for(let o=0;o<i.length;o+=1)a[o]=i.charCodeAt(o);return a}async function xb(l,i,a){const o=Math.ceil(l.bytes/Du),r=new Uint8Array(l.bytes);let u=0;const h=async()=>{for(;u<o;){const p=u;u+=1;const m=await i(l.sha256,p),g=p*Du,b=Math.min(Du,l.bytes-g);if(m.length!==b)throw new Error("host_font_corrupt");r.set(m,g),a(m.length)}};return await Promise.all(Array.from({length:Math.min(Qx,o)},h)),r.buffer}function wb(){try{const l=JSON.parse(Ai("local",pt.hostFontConsent)||"{}");return l&&typeof l=="object"&&!Array.isArray(l)?l:{}}catch{return{}}}function ig(l,i){const a=wb()[l];return a&&a.fingerprint===i?a.decision:null}function lg(l,i,a){const o=wb();o[l]={fingerprint:i,decision:a},wn("local",pt.hostFontConsent,JSON.stringify(o))}const Sb={source:null,status:"none",alias:null,covered:0},Bu={font:null,status:"none",alias:null,receivedBytes:0,totalBytes:0,error:null,glyphs:Sb,interactive:!1,glyphRevision:0},cw=String.fromCodePoint(...Array.from({length:95},(l,i)=>32+i),...Array.from({length:96},(l,i)=>160+i),...Array.from({length:112},(l,i)=>8192+i));function ag(l){const i=(l==null?void 0:l.subsets)??[];return i.find(a=>a.scope==="all")??i.find(a=>a.scope==="cjk")??null}function uw(l,i){const a=new Set;for(const o of l){const r=o.codePointAt(0);vb(i,r)&&a.add(r)}return[...a]}const sg=3e4;function dw(l){const i=C.useRef(new Map),a=C.useRef(new Map),o=C.useRef(new Map),r=C.useCallback(p=>{for(const m of[i.current,a.current]){for(const g of m.values())clearTimeout(g.timer),g.reject(new Error(p));m.clear()}},[]),u=C.useCallback((p,m)=>new Promise((g,b)=>{if(!l){b(new Error("disconnected"));return}const v=`${p}:${m}`,w=setTimeout(()=>{i.current.delete(v),b(new Error("host_font_timeout"))},sg);i.current.set(v,{resolve:g,reject:b,timer:w}),l.sendHostFontChunkRequest(p,m)}),[l]),h=C.useCallback((p,m,g)=>new Promise((b,v)=>{if(!l){v(new Error("disconnected"));return}const w=Math.random().toString(36).slice(2,12),x=setTimeout(()=>{a.current.delete(w),v(new Error("host_font_timeout"))},sg);a.current.set(w,{resolve:T=>b({...T,codepoints:m}),reject:v,timer:x}),o.current.set(w,g),l.sendHostFontSubsetRequest(p.sha256,String.fromCodePoint(...m),w)}),[l]);return C.useEffect(()=>{if(!l)return;const p=i.current,m=a.current,g=l.on("hostFontChunk",x=>{const T=`${x.sha256}:${x.index}`,M=p.get(T);if(M){p.delete(T),clearTimeout(M.timer);try{M.resolve(ng(x.dataBase64))}catch{M.reject(new Error("host_font_corrupt"))}}}),b=l.on("hostFontSubset",x=>{const T=m.get(x.requestId);if(!T)return;m.delete(x.requestId),clearTimeout(T.timer);const M=o.current.get(x.requestId)??(()=>{});if(o.current.delete(x.requestId),x.dataBase64!==void 0){try{const R=ng(x.dataBase64);M(R.length,R.length),T.resolve({subsetSha:x.subsetSha,data:R.buffer,codepoints:[]})}catch{T.reject(new Error("host_font_corrupt"))}return}M(0,x.bytes);const A={bytes:x.bytes,sha256:x.subsetSha};xb(A,u,R=>M(R,x.bytes)).then(R=>T.resolve({subsetSha:x.subsetSha,data:R,codepoints:[]})).catch(R=>T.reject(R instanceof Error?R:new Error("host_font_failed")))}),v=l.on("error",x=>{(x.code==="host_font_unavailable"||x.code==="host_font_subset_failed")&&r(String(x.code))}),w=l.on("stateChange",x=>{x!=="connected"&&r("disconnected")});return()=>{g(),b(),v(),w(),r("disconnected")}},[l,r,u]),{requestChunk:u,requestSubset:h,rejectPending:r}}const fw=15e3,hw=80,mw=2e3;function pw(l,i={}){const[a,o]=C.useState(Bu),r=C.useRef(a);r.current=a;const u=C.useRef(i);u.current=i;const h=C.useRef(0),p=C.useRef(0),m=C.useRef(new Set),g=C.useRef(new Set),b=C.useRef(new Set),v=C.useRef(null),{requestChunk:w,requestSubset:x,rejectPending:T}=dw(l),M=C.useCallback(()=>({isInstalled:u.current.isInstalled??Wx,readCached:u.current.readCached??ew,writeCached:u.current.writeCached??tw,register:u.current.register??rw,isRegistered:u.current.isRegistered??ow,readSubsets:u.current.readSubsets??nw,writeSubset:u.current.writeSubset??iw,registerGlyphs:u.current.registerGlyphs??sw}),[]),A=C.useCallback(()=>(l==null?void 0:l.getHostId())||"default",[l]),R=C.useCallback((K,J)=>{K===h.current&&o(V=>({...V,glyphs:{...V.glyphs,...J}}))},[]),k=C.useCallback(async(K,J,V)=>{const{registerGlyphs:X}=M();for(const ie of V){if(await X(J,ie),K!==h.current)return;for(const ue of ie.codepoints)m.current.add(ue)}K!==h.current||!V.length||o(ie=>({...ie,glyphs:{...ie.glyphs,alias:J,covered:m.current.size},glyphRevision:ie.glyphRevision+1}))},[M]),O=C.useCallback(async(K,J,V)=>{const X=Hu(J),ie=J.scope==="all"?cw+Jp:Jp,ue=uw(ie,J.scope).filter(E=>!m.current.has(E));if(!ue.length)return;for(const E of ue)g.current.add(E);const U=await x(J,ue,V);K===h.current&&(await M().writeSubset(J.sha256,U),await k(K,X,[U]))},[x,M,k]),$=C.useCallback(async(K,{interactive:J=!0}={})=>{const V=K??r.current.font,X=Zi(V);if(!V||!X)return;const ie=r.current,ue=Zi(ie.font)===X;if(ue&&(ie.status==="loading"||ie.glyphs.status==="loading"))return;const U=h.current,{isInstalled:E,isRegistered:G,readCached:P,writeCached:le,register:Q}=M();lg(A(),X,"accepted");const xe=eg(V),ye=ag(V),ve=!!(xe&&!G(xe)&&!E(V.family)),me=ue?ie.glyphs:{...Sb,source:ye},de=!!(ye&&!["installed","ready","none"].includes(me.status));let we=ve?tg(V):0,se=0;const Se=()=>{U===h.current&&o(ae=>({...ae,receivedBytes:se,totalBytes:we}))};if(o(ae=>({...ae,font:V,interactive:J,receivedBytes:0,totalBytes:we,error:null,status:ve?"loading":ae.status,glyphs:de?{...me,status:"loading"}:me})),ve&&xe)try{const ae=[];for(const pe of V.faces){let Ee=await P(pe.sha256);if(Ee?(se+=pe.bytes,Se()):(Ee=await xb(pe,w,Be=>{se+=Be,Se()}),await le(pe.sha256,Ee)),U!==h.current)return;ae.push({face:pe,data:Ee})}if(await Q(xe,ae),U!==h.current)return;o(pe=>({...pe,status:"loaded",alias:xe}))}catch(ae){if(U!==h.current)return;const pe=ae instanceof Error&&ae.message?ae.message:"host_font_failed";o(Ee=>({...Ee,status:"failed",alias:null,error:pe}))}if(de&&ye){let ae=0;try{await O(U,ye,(pe,Ee)=>{Ee&&!ae&&(ae=Ee,we+=Ee),se+=pe,Se()}),R(U,{status:"ready"})}catch(pe){if(U!==h.current)return;const Ee=pe instanceof Error&&pe.message?pe.message:"host_font_failed";o(Be=>({...Be,error:Be.error??Ee,glyphs:{...Be.glyphs,status:"failed"}}))}}},[w,O,M,A,R]),_=C.useCallback(async K=>{const J=Zi(K)!==Zi(r.current.font);J&&(T("superseded"),m.current=new Set,g.current=new Set,b.current=new Set);const V=++h.current;if(!K){o(Bu);return}const{isInstalled:X,readCached:ie,register:ue,isRegistered:U,readSubsets:E}=M(),G=eg(K),P=Zi(K),le=ag(K);let Q="checking";G&&U(G)?Q="loaded":X(K.family)?Q="installed":G||(Q="unavailable");let xe="checking";if(le?(le.scope==="cjk"?X(le.family):Q==="installed")&&(xe="installed"):xe="none",o(de=>({...Bu,font:K,status:Q==="checking"?"checking":Q,alias:Q==="loaded"?G:null,totalBytes:tg(K),glyphs:{source:le,status:xe,alias:J?null:de.glyphs.alias,covered:m.current.size},glyphRevision:de.glyphRevision})),Q==="checking"&&G){const de=await Promise.all(K.faces.map(we=>ie(we.sha256)));if(V!==h.current)return;if(Q="needs",de.every(Boolean))try{if(await ue(G,K.faces.map((we,se)=>({face:we,data:de[se]}))),V!==h.current)return;Q="loaded",o(we=>({...we,status:"loaded",alias:G}))}catch{}}if(xe==="checking"&&le){const de=await E(le.sha256);if(V!==h.current)return;if(de.length)try{await k(V,Hu(le),de),xe="cached"}catch{xe="needs"}else xe="needs";if(V!==h.current)return}const ye=ig(A(),P),ve=ye==="accepted"||xe==="cached"||Date.now()<p.current;if(xe==="cached"&&(xe="ready",R(V,{status:"ready"}),O(V,le,()=>{}).catch(()=>{})),Q!=="needs"&&xe!=="needs")return;if(ve){$(K,{interactive:!1});return}const me=ye==="declined"?"declined":"available";o(de=>({...de,status:Q==="needs"?me:de.status,glyphs:xe==="needs"?{...de.glyphs,status:me}:de.glyphs}))},[$,T,A,R,O,M,k]),z=C.useCallback(()=>{const K=Zi(r.current.font);K&&lg(A(),K,"declined"),o(J=>({...J,interactive:!1,status:["available","failed"].includes(J.status)?"declined":J.status,glyphs:["available","failed"].includes(J.glyphs.status)?{...J.glyphs,status:"declined"}:J.glyphs}))},[A]),L=C.useCallback(()=>{p.current=Date.now()+fw,l==null||l.sendHostFontRefresh();const K=r.current,J=["available","declined","failed"];K.font&&(J.includes(K.status)||J.includes(K.glyphs.status))&&$(K.font,{interactive:!1})},[l,$]),D=C.useCallback(K=>{const{glyphs:J}=r.current;if(J.status!=="ready"||!J.source)return;const V=J.source;for(const X of K){const ie=X.codePointAt(0);ie<128&&V.scope!=="all"||vb(V.scope,ie)&&(m.current.has(ie)||g.current.has(ie)||b.current.add(ie))}!b.current.size||v.current||(v.current=setTimeout(()=>{v.current=null;const X=h.current,ie=[...b.current].slice(0,mw);for(const ue of ie)b.current.delete(ue),g.current.add(ue);(async()=>{const ue=await x(V,ie,()=>{});X===h.current&&(await M().writeSubset(V.sha256,ue),await k(X,Hu(V),[ue]))})().catch(()=>{})},hw))},[x,M,k]);return C.useEffect(()=>{if(!l)return;const K=l.on("terminalFont",J=>{_(J)});return()=>{K(),v.current&&clearTimeout(v.current),v.current=null}},[l,_]),C.useEffect(()=>{const K=J=>{if(J.key!==pt.hostFontConsent)return;const V=r.current,X=Zi(V.font),ie=V.status==="available"||V.glyphs.status==="available";if(!X||!ie)return;const ue=ig(A(),X);ue==="accepted"?$(V.font,{interactive:!1}):ue==="declined"&&z()};return window.addEventListener("storage",K),()=>window.removeEventListener("storage",K)},[$,z,A]),{hostFont:a,loadHostFont:$,declineHostFont:z,syncHostFont:L,ensureHostGlyphs:D}}function gw(l,i=window,a=document){const o=g=>{var b;((b=i.navigator)==null?void 0:b.onLine)!==!1&&l.wake(g)},r=()=>{a.visibilityState==="visible"&&o("visible")},u=()=>o("pageshow"),h=()=>o("online"),p=()=>o("focus"),m=()=>o("resume");return a.addEventListener("visibilitychange",r),a.addEventListener("resume",m),i.addEventListener("pageshow",u),i.addEventListener("online",h),i.addEventListener("focus",p),()=>{a.removeEventListener("visibilitychange",r),a.removeEventListener("resume",m),i.removeEventListener("pageshow",u),i.removeEventListener("online",h),i.removeEventListener("focus",p)}}function zo(l){return{wsUrl:l.wsUrl,token:l.token||void 0,pairCode:l.pairCode||void 0,clientId:l.clientId,autoReconnect:l.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}const bw={connectionState:"disconnected",role:"viewer",hostPalette:null,rttMs:null,sharedWindowCount:1,terminalResetVersion:0,agentStatus:null,lastPairedAt:null},og={role:"viewer",controllerId:void 0,hostname:void 0,hostPalette:null,rttMs:null,sharedWindowCount:1};function yw(l,i){switch(i.type){case"stateChange":return{...l,connectionState:i.state,stateCode:i.code,stateDetail:i.detail,agentStatus:i.state==="connected"?l.agentStatus:null};case"ready":{const{message:a}=i;return{...l,terminalResetVersion:l.terminalResetVersion+(i.resetTerminal?1:0),role:a.role,controllerId:a.controllerId,hostId:a.hostId,hostname:a.hostname,assignedClientId:a.clientId||l.assignedClientId,hostPalette:a.terminalPalette||null}}case"hostReconnecting":return{...l,...og,stateCode:i.code,stateDetail:i.detail};case"sessionRestarted":return{...l,hostname:i.hostname,hostPalette:i.palette||null,terminalResetVersion:l.terminalResetVersion+1};case"roleChange":return{...l,role:i.role,controllerId:i.controllerId,hostId:i.hostId||l.hostId,assignedClientId:i.assignedClientId||l.assignedClientId};case"controlGranted":return{...l,role:"controller"};case"paired":return{...l,lastPairedAt:i.at};case"rtt":return{...l,rttMs:i.rttMs};case"peerCount":return{...l,sharedWindowCount:Math.max(1,i.count)};case"sessionReady":return{...l,connectionState:"connected"};case"agentStatus":return{...l,agentStatus:i.status};case"reset":return{...l,...og,hostId:void 0,assignedClientId:void 0,terminalResetVersion:l.terminalResetVersion+(i.resetTerminal?1:0)}}}const vw=3e4;function xw(l,i){const[a,o]=C.useState(null),r=C.useRef(null),u=C.useRef(null),h=C.useCallback(b=>{(b==null?void 0:b.phase)!=="starting"&&u.current&&(clearTimeout(u.current),u.current=null),r.current=b,o(b)},[]),p=C.useCallback(()=>{const b=l.current;b&&(h({phase:"starting"}),b.sendHerdrStart(),u.current=setTimeout(()=>{var v;u.current=null,((v=r.current)==null?void 0:v.phase)==="starting"&&h({phase:"failed",message:i.current("herdrLaunch.timeout")})},vw))},[l,i,h]),m=C.useCallback(b=>{var v;return b.code==="herdr_not_running"?(((v=r.current)==null?void 0:v.phase)!=="starting"&&h({phase:"stopped"}),!0):b.code==="herdr_start_failed"&&r.current?(h({phase:"failed",message:b.message||""}),!0):!1},[h]),g=C.useCallback(()=>h(null),[h]);return C.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]),{herdrLaunch:a,startHerdr:p,handleLaunchError:m,forgetHerdrLaunch:g}}class ww{constructor(){W(this,"listeners",{stateChange:new Set,roleChange:new Set,ready:new Set,paired:new Set,controlState:new Set,sessionReady:new Set,exit:new Set,controlGranted:new Set,peerCount:new Set,hostReconnecting:new Set,sessionRestarted:new Set,error:new Set,binaryData:new Set,rttUpdate:new Set,pasteFileReady:new Set,agentStatus:new Set,updateStatus:new Set,terminalFont:new Set,hostFontChunk:new Set,hostFontSubset:new Set})}on(i,a){return this.listeners[i].add(a),()=>{this.listeners[i].delete(a)}}emit(i,...a){this.listeners[i].forEach(r=>{try{r(...a)}catch(u){console.error(`Error in event listener for ${i}:`,u)}})}}const Cb=27,Tb=91,Sw=60,rg=59,Mb=77,Ab=48,Cw=57,Tw=64,Mw=-30,Uu=32,cg=255;function Eb(l){return Number.isInteger(l)&&(l&Mw)===Tw}function Aw(l){return l>=Ab&&l<=Cw}function Ku(l,i){let a=i,o=0;for(;a<l.length&&Aw(l[a]);){if(o=o*10+(l[a]-Ab),o>65535)return null;a+=1}return a===i?null:{value:o,next:a}}function Ew(l,i){if(l[i]!==Cb||l[i+1]!==Tb||l[i+2]!==Sw)return-1;const a=Ku(l,i+3);if(!a||!Eb(a.value)||l[a.next]!==rg)return-1;const o=Ku(l,a.next+1);if(!o||l[o.next]!==rg)return-1;const r=Ku(l,o.next+1);return!r||l[r.next]!==Mb?-1:r.next+1}function Nw(l,i){if(l[i]!==Cb||l[i+1]!==Tb||l[i+2]!==Mb||i+6>l.length)return-1;const a=l[i+3]-Uu,o=l[i+4],r=l[i+5];return!Eb(a)||o<Uu||o>cg||r<Uu||r>cg?-1:i+6}function lr(l){if(!l)return!1;const i=l instanceof Uint8Array?l:new Uint8Array(l);if(i.length===0)return!1;let a=0;for(;a<i.length;){const o=Ew(i,a);if(o>a){a=o;continue}const r=Nw(i,a);if(r>a){a=r;continue}return!1}return!0}class kw{constructor(i){W(this,"segments",[]);W(this,"flushScheduled",!1);this.getSocket=i}push(i){const a=i instanceof Uint8Array?i:new Uint8Array(i);a.length!==0&&(this.segments.push(a),this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flush())))}flush(){if(this.flushScheduled=!1,this.segments.length===0)return;let i=this.segments;this.segments=[];const a=this.getSocket();if(a&&(a.bufferedAmount??0)>256*1024&&(i=i.filter(r=>!lr(r))),i.length===0)return;let o;if(i.length===1)o=i[0];else{let r=0;for(let h=0;h<i.length;h++)r+=i[h].byteLength;o=new Uint8Array(r);let u=0;for(let h=0;h<i.length;h++)o.set(i[h],u),u+=i[h].byteLength}a&&a.readyState===WebSocket.OPEN&&a.send(o)}clear(){this.segments=[],this.flushScheduled=!1}}const Lw=3e3,Rw=1e4,_w=1500;class jw extends ww{constructor(a){super();W(this,"ws",null);W(this,"config");W(this,"state","disconnected");W(this,"reconnectAttempts",0);W(this,"reconnectTimer",null);W(this,"pingTimer",null);W(this,"pingTimestamp",null);W(this,"lastInboundAt",0);W(this,"pingSentAt",null);W(this,"connectStartedAt",0);W(this,"lastWakeConnectAt",0);W(this,"probeTimer",null);W(this,"rejectedByRelay",!1);W(this,"isManuallyClosed",!1);W(this,"authFailureDetail",null);W(this,"authFailureCode",null);W(this,"temporaryFailureCode",null);W(this,"input",new kw(()=>this.ws));W(this,"terminalCols",80);W(this,"terminalRows",24);this.config={...a}}updateConfig(a){this.config={...this.config,...a}}getConfig(){return{...this.config}}getState(){return this.state}setState(a,o,r){this.state!==a&&(this.state=a,this.emit("stateChange",a,o,r))}connect(a){if(a&&(this.terminalCols=a.cols,this.terminalRows=a.rows),!(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))){this.teardownSocket(1e3,"Replaced by a new connection"),this.isManuallyClosed=!1,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.rejectedByRelay=!1,this.clearTimers(),this.setState("connecting");try{const o=Ow(this.config.wsUrl),r=new WebSocket(o);this.ws=r,this.connectStartedAt=Date.now(),r.binaryType="arraybuffer",r.onopen=()=>{this.isStaleSocket(r)||this.handleOpen()},r.onmessage=u=>{this.isStaleSocket(r)||this.handleMessage(u)},r.onerror=u=>{this.isStaleSocket(r)||this.handleError(u)},r.onclose=u=>{this.isStaleSocket(r)||this.handleClose(u)}}catch(o){this.setState("error",o instanceof Error?o.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(a){return this.ws!==a}teardownSocket(a=1e3,o="Client closed the connection"){this.input.clear();const r=this.ws;if(r){this.ws=null,r.onopen=null,r.onmessage=null,r.onerror=null,r.onclose=null;try{(r.readyState===WebSocket.OPEN||r.readyState===WebSocket.CONNECTING)&&r.close(a,o)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.input.clear(),this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(a){this.updateConfig(a),this.clearTimers(),this.teardownSocket(1e3,"Reconnecting with new credentials"),this.isManuallyClosed=!1,this.reconnectAttempts=0,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.connect()}wake(a){if(this.isManuallyClosed||!this.config.autoReconnect||this.authFailureDetail||this.rejectedByRelay)return;const o=Date.now(),r=this.ws;if(!r){if(o-this.lastWakeConnectAt<_w)return;this.lastWakeConnectAt=o,this.reconnectAttempts=0,this.connect();return}if(r.readyState===WebSocket.CONNECTING){o-this.connectStartedAt>Rw&&this.dropStaleSocket("connection_stalled");return}r.readyState===WebSocket.OPEN&&o-this.lastInboundAt>this.pingIntervalMs()+2e3&&this.probeLiveness()}pingIntervalMs(){return this.config.pingIntervalMs||1e4}probeLiveness(){const a=this.ws;if(!a||a.readyState!==WebSocket.OPEN||this.probeTimer)return;const o=Date.now();this.sendPing(),this.probeTimer=setTimeout(()=>{this.probeTimer=null,this.ws===a&&this.lastInboundAt<o&&this.dropStaleSocket("connection_stale")},Lw)}dropStaleSocket(a){this.clearTimers(),this.teardownSocket(4e3,"Connection went silent"),this.setState("reconnecting","The connection went silent. Reconnecting...",a),this.reconnectAttempts=0,this.lastWakeConnectAt=Date.now(),this.connect()}handleOpen(){this.lastInboundAt=Date.now(),this.sendHello(),this.startHeartbeat()}async handleMessage(a){if(this.lastInboundAt=Date.now(),typeof a.data=="string")try{const o=JSON.parse(a.data);o.type==="pong"?this.handlePong():this.handleServerMessage(o)}catch(o){console.warn("Received unparseable text frame from server:",o)}else if(a.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(a.data));else if(typeof Blob<"u"&&a.data instanceof Blob)try{const o=await a.data.arrayBuffer();this.emit("binaryData",new Uint8Array(o))}catch(o){console.error("Failed to convert Blob to ArrayBuffer:",o)}}handlePong(){if(this.pingTimestamp){const a=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(a))}}handleError(a){console.error("WebSocket error:",a),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(a){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(a.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",a.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(a.code===1008){this.rejectedByRelay=!0,this.setState("error",a.reason||"The relay rejected the connection",String(a.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${a.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${a.reason||a.code}`,"connection_closed")}scheduleReconnect(){if(this.isManuallyClosed||!this.config.autoReconnect)return;if(this.config.maxReconnectAttempts>0&&this.reconnectAttempts>=this.config.maxReconnectAttempts){this.setState("error","Max reconnect attempts reached");return}this.reconnectAttempts++;const a=this.config.reconnectIntervalMs||2e3,r=Math.min(3e4,Math.floor(a*1.5**(this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},r)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const a=this.pingIntervalMs();this.pingSentAt=null,this.pingTimer=setInterval(()=>{if(!(!this.ws||this.ws.readyState!==WebSocket.OPEN)){if(this.pingSentAt!==null&&this.lastInboundAt<this.pingSentAt&&Date.now()-this.pingSentAt>=a){this.probeLiveness();return}this.sendPing()}},a)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=null),this.probeTimer&&(clearTimeout(this.probeTimer),this.probeTimer=null)}sendPing(){this.pingTimestamp=performance.now(),this.pingSentAt=Date.now();const a={type:"ping"};this.sendJson(a)}sendJson(a){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(a))}sendInput(a){this.input.push(a)}flushInput(){this.input.flush()}sendBinary(a){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(a)}sendText(a){const o=Td(a);this.sendInput(o)}}function Ow(l){if(/^wss?:\/\//i.test(l))return l;if(/^https?:\/\//i.test(l)){const i=new URL(l);return i.protocol=i.protocol==="https:"?"wss:":"ws:",(!i.pathname||i.pathname==="/")&&(i.pathname=on),i.toString()}if(typeof window<"u"&&window.location){const a=window.location.protocol==="https:"?"wss:":"ws:",o=window.location.host,r=l.startsWith("/")?l:`/${l}`;return`${a}//${o}${r}`}return"ws://127.0.0.1:8787/ws/client"}class Dw extends jw{constructor(){super(...arguments);W(this,"currentRole","viewer");W(this,"controllerId");W(this,"hostId");W(this,"assignedClientId")}getRole(){return this.currentRole}getControllerId(){return this.controllerId}getHostId(){return this.hostId}getAssignedClientId(){return this.assignedClientId}handleServerMessage(a){switch(a.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=a.role,this.controllerId=a.controllerId,this.hostId=a.hostId,this.assignedClientId=a.clientId,this.emit("ready",a),this.emit("roleChange",a.role,a.controllerId,a.hostId,a.clientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount),this.emit("terminalFont",a.terminalFont??null);break}case"paired":{this.emit("paired",{token:a.token,deviceId:a.deviceId,hostId:a.hostId,expiresAt:a.expiresAt});break}case"control_state":{this.currentRole=a.role,this.controllerId=a.controllerId,this.emit("controlState",a.role,a.controllerId),this.emit("roleChange",a.role,a.controllerId,this.hostId,this.assignedClientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",a.code||"host_reconnecting"),this.emit("hostReconnecting",a.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",a.cols,a.rows,a.terminalPalette,a.hostname),this.emit("terminalFont",a.terminalFont??null);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",a);break}case"exit":{this.emit("exit",a.code,a.reason);break}case"control_granted":{this.currentRole="controller",this.controllerId=this.assignedClientId||this.config.clientId,this.emit("controlGranted"),this.emit("roleChange","controller",this.controllerId,this.hostId,this.assignedClientId);break}case"error":{a.code==="host_offline"||a.code==="host_reconnecting"||a.code==="host_reconnect_timeout"||a.code==="rate_limited"?(this.temporaryFailureCode=String(a.code),this.setState("reconnecting",a.message,String(a.code))):(a.code==="auth_required"||a.code==="unauthorized"||a.code==="device_revoked"||a.code==="invalid_handshake"||a.code==="too_many_hosts"||a.code===401||a.code===403)&&(this.authFailureDetail=a.message,this.authFailureCode=String(a.code),this.setState("error",a.message,this.authFailureCode)),this.emit("error",{code:a.code,message:a.message});break}case"paste_file_ready":{this.emit("pasteFileReady",a.path);break}case"agent_status":{this.emit("agentStatus",a);break}case"update_status":{this.emit("updateStatus",a);break}case"terminal_font":{this.emit("terminalFont",a.terminalFont??null);break}case"host_font_chunk":{this.emit("hostFontChunk",a);break}case"host_font_subset_ready":{this.emit("hostFontSubset",a);break}}}sendHello(){const a={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(a.token=this.config.token),this.config.pairCode&&(a.pairCode=this.config.pairCode),this.sendJson(a)}claimControl(a=!1){const o={type:"claim_control",...a?{force:!0}:{}};this.sendJson(o)}releaseControl(){const a={type:"release_control"};this.sendJson(a)}sendResize(a,o){this.terminalCols=a,this.terminalRows=o;const r={type:"resize",cols:a,rows:o};this.sendJson(r)}sendPasteFile(a,o){this.sendJson({type:"paste_file",mime:a,dataBase64:o})}sendHostFontChunkRequest(a,o){this.sendJson({type:"host_font_chunk_request",sha256:a,index:o})}sendHostFontSubsetRequest(a,o,r){this.sendJson({type:"host_font_subset_request",sha256:a,text:o,requestId:r})}sendHostFontRefresh(){this.sendJson({type:"host_font_refresh"})}sendHerdrStart(){this.sendJson({type:"herdr_start"})}}function zw(l,i,a){const o=C.useRef(a);if(o.current=a,!l.current){const r=new Dw(i());for(const u of Object.keys(a)){const h=(...p)=>{var m,g;return(g=(m=o.current)[u])==null?void 0:g.call(m,...p)};r.on(u,h)}l.current=r}return l.current}const Hw=3*1024*1024,Nb=1568,Bw=[.85,.7,.55,.4],Ho={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function Uw(l,i,a=Nb){if(l<=0||i<=0)return{width:Math.max(1,l),height:Math.max(1,i)};const o=Math.max(l,i);if(o<=a)return{width:l,height:i};const r=a/o;return{width:Math.max(1,Math.round(l*r)),height:Math.max(1,Math.round(i*r))}}function Kw(l){if(typeof l!="string"||l.length===0)return 0;const i=l.length;let a=0;l.endsWith("==")?a=2:l.endsWith("=")&&(a=1);const o=Math.floor(i*3/4)-a;return Number.isFinite(o)&&o>0?o:0}function Iw(l){return l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/(1024*1024)).toFixed(1)} MB`}async function Fw(l){if(typeof createImageBitmap=="function")try{const i=await createImageBitmap(l,{imageOrientation:"from-image"});return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{try{const i=await createImageBitmap(l);return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{}}return new Promise((i,a)=>{if(typeof Image>"u")return a(new Error("Image decoding not supported in this environment"));const o=new Image,r=URL.createObjectURL(l);o.onload=()=>{i({source:o,width:o.naturalWidth||o.width,height:o.naturalHeight||o.height,cleanup:()=>{try{URL.revokeObjectURL(r)}catch{}}})},o.onerror=()=>{try{URL.revokeObjectURL(r)}catch{}a(new Error("Failed to decode image source"))},o.src=r})}async function kb(l,i=Nb,a=Hw){var r;if(!l||l.size===0||l.type&&!l.type.startsWith("image/"))return null;let o;try{o=await Fw(l)}catch(u){return console.warn("Failed to decode image for paste:",u),null}try{const{width:u,height:h}=Uw(o.width,o.height,i),p=document.createElement("canvas");p.width=u,p.height=h;const m=p.getContext("2d");if(!m)return null;m.drawImage(o.source,0,0,u,h);let g="image/webp";try{p.toDataURL("image/webp",.85).startsWith("data:image/webp")||(g="image/jpeg")}catch{g="image/jpeg"}for(const b of Bw){let v;try{v=p.toDataURL(g,b)}catch{continue}if(!(v!=null&&v.startsWith("data:")))continue;const w=v.indexOf(","),x=w!==-1?v.slice(w+1):"",T=Kw(x);if(T<=a)return{mime:g,dataBase64:x,dataUrl:v,byteLength:T,width:u,height:h}}return null}finally{(r=o.cleanup)==null||r.call(o)}}const Gw=3e4,Yw=1200;function $w({adapterRef:l,role:i,connectionState:a,warnViewerMode:o,addToast:r,t:u,sendPasteFile:h}){const[p,m]=C.useState(Ho),g=C.useRef(null),b=C.useRef(0),v=C.useRef(null),w=C.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null)},[]),x=C.useCallback(()=>{w(),g.current=null,m(Ho)},[w]),T=C.useCallback(()=>{g.current!==null&&x()},[x]),M=C.useCallback(()=>{const R=g.current;R!==null&&(w(),m({active:!0,phase:"completed",ratio:1,percent:100,statusText:u("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{g.current===R&&(g.current=null,m(Ho))},Yw))},[w,u]);C.useEffect(()=>{a!=="connected"&&T()},[a,T]),C.useEffect(()=>w,[w]);const A=C.useCallback(async R=>{if(i!=="controller")return o(),!1;if(!l.current||a!=="connected")return r("error",u("serverErrors.host_offline")),!1;if(g.current!==null)return!1;const k=++b.current;g.current=k,w();const O=_=>(_&&r("error",_),g.current=null,m(Ho),!1),$="dataBase64"in R&&typeof R.dataBase64=="string";try{let _;if($)_=R;else{const L=R;if(m({active:!0,phase:"reading",ratio:.1,percent:10,statusText:u("virtualKeyboard.uploadProgressReading")}),!L||L.size===0)return O(u("clipboard.fileEmpty"));if(L.type&&!L.type.startsWith("image/"))return O(u("clipboard.unsupportedType"));m({active:!0,phase:"processing",ratio:.35,percent:35,statusText:u("virtualKeyboard.uploadProgressProcessing")});const D=await kb(L);if(g.current!==k)return!1;if(!D)return O(u("clipboard.imageTooLarge"));_=D,m({active:!0,phase:"processing",ratio:.6,percent:60,statusText:u("virtualKeyboard.uploadProgressProcessing")})}m({active:!0,phase:"sending",ratio:.75,percent:75,statusText:u("virtualKeyboard.uploadProgressSending")});const z=h(_.mime,_.dataBase64);return g.current!==k?!1:z?(m({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:u("virtualKeyboard.uploadProgressWaitingHost")}),v.current=setTimeout(()=>{g.current===k&&O(u("serverErrors.paste_file_write_failed"))},Gw),!0):O()}catch(_){return console.error("Failed to process/upload image:",_),g.current===k&&O(u("clipboard.imageTooLarge")),!1}},[l,i,a,o,r,u,h,w]);return{uploadProgress:p,uploadImage:A,resetUploadProgress:x,abortUpload:T,completeUpload:M}}const qw=4096,Vw=8*1024*1024;function Pw(){const l=C.useRef(null),i=C.useRef([]),a=C.useRef(0),o=C.useCallback(m=>{for(i.current.push(m),a.current+=m.byteLength;i.current.length>qw||a.current>Vw;){const g=i.current.shift();if(!g)break;a.current-=g.byteLength}},[]),r=C.useCallback(m=>{const g=l.current;if(g)try{g(m);return}catch(b){console.debug("Terminal output sink threw, buffering chunk instead:",b)}o(m)},[o]),u=C.useCallback(m=>{l.current=m;const g=i.current;i.current=[],a.current=0;for(let b=0;b<g.length;b++)try{m(g[b])}catch(v){console.debug("Terminal sink threw while flushing, re-buffering the tail:",v);for(let w=b;w<g.length;w++)o(g[w]);break}return()=>{l.current===m&&(l.current=null)}},[o]),h=C.useCallback(()=>i.current.length,[]),p=C.useCallback(()=>{i.current=[],a.current=0},[]);return{receiveOutput:r,subscribeToOutput:u,getPendingOutputChunkCount:h,clearPendingOutput:p}}const Lb=64,os=4096;function Ad(){const l=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${l}`}function Xw(l,i){return(typeof l=="string"?l.trim().slice(0,Lb):"")||i}function ar(l,i){if(!l||typeof l!="object"||Array.isArray(l))return null;const a=l,o=typeof a.wsUrl=="string"?a.wsUrl.trim().slice(0,2048):"",r=typeof a.token=="string"?a.token.slice(0,os):"",u=typeof a.pairCode=="string"?a.pairCode.trim().toUpperCase().slice(0,32):"";if(!o||!o.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(o)||!r&&!u)return null;const h=Date.now(),p=typeof a.id=="string"&&a.id.length>0?a.id.slice(0,128):Ad(),m=typeof a.hostname=="string"&&a.hostname.trim()?a.hostname.trim().slice(0,Lb):`Herdr ${i+1}`;return{id:p,displayName:Xw(a.displayName,m),wsUrl:o,token:r,...u?{pairCode:u}:{},...typeof a.hostId=="string"&&a.hostId.trim()?{hostId:a.hostId.trim().slice(0,128)}:{},...typeof a.hostname=="string"&&a.hostname.trim()?{hostname:a.hostname.trim().slice(0,128)}:{},...typeof a.deviceId=="string"&&a.deviceId.trim()?{deviceId:a.deviceId.trim().slice(0,128)}:{},autoReconnect:a.autoReconnect!==!1,createdAt:Number.isFinite(a.createdAt)?Number(a.createdAt):h,lastUsedAt:Number.isFinite(a.lastUsedAt)?Number(a.lastUsedAt):h}}function ug(l,i=0){const a=ar({...l,id:l.id||Ad()},i);if(!a)throw new Error("a connection profile requires a relay URL and token or pairing code");return a}function dg(l){let i=l.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const a=new URL(l.wsUrl,window.location.origin);a.protocol=a.protocol==="wss:"?"https:":"http:",a.pathname=a.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",a.search="",a.hash="",i=a.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${i}::${l.hostId||""}`}function Rb(l){var u;const i=[];if((Array.isArray(l.profiles)?l.profiles.slice(0,64):[]).forEach((h,p)=>{const m=ar(h,p);m&&!i.some(g=>g.id===m.id)&&i.push(m)}),i.length===0&&(typeof l.token=="string"&&l.token||typeof l.pairCode=="string"&&l.pairCode)){const h=ar({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof l.wsUrl=="string"&&l.wsUrl.trim()?l.wsUrl:on,token:l.token||"",pairCode:l.pairCode||"",autoReconnect:l.autoReconnect!==!1},0);h&&i.push(h)}const o=typeof l.activeProfileId=="string"?l.activeProfileId:"",r=i.some(h=>h.id===o)?o:((u=i[0])==null?void 0:u.id)||"";return{profiles:i,activeProfileId:r}}const _b=[{id:"esc",label:"ESC",code:oe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:oe.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:oe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:oe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:oe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:oe.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"drawer_symbols",label:"~|/",code:"",type:"drawer",enabled:!0,drawerType:"symbols",title:"Special Symbols"},{id:"drawer_fn",label:"Fn",code:"",type:"drawer",enabled:!0,drawerType:"fn",title:"Function Keys (F1-F12)"},{id:"enter",label:"Enter",code:oe.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],Qw=[{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:oe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:oe.TAB,type:"key",enabled:!0,title:"Tab"},{id:"shift_tab",label:"⇧TAB",code:oe.SHIFT_TAB,type:"key",enabled:!0,title:"Shift+Tab"},{id:"enter",label:"Enter",code:oe.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:oe.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:oe.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:oe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:oe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:oe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:oe.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:oe.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:oe.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:oe.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:oe.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:oe.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:oe.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:oe.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:oe.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:oe.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:oe.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:oe.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:oe.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:oe.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:oe.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:oe.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:oe.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:oe.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:oe.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:oe.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:oe.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:oe.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:oe.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:oe.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:oe.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:oe.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 rs(){return JSON.parse(JSON.stringify(_b))}const Zw=[["esc","tab","shift_tab","ctrl","alt","left","up","down","right","drawer_chords","drawer_symbols","drawer_fn","enter"],["esc","tab","ctrl","alt","left","up","down","right","enter","drawer_chords","drawer_symbols","drawer_fn"],["esc","tab","ctrl","alt","left","up","down","right","drawer_chords","drawer_symbols","drawer_fn","enter"],["esc","tab","ctrl","alt","left","up","down","right","drawer_agent","drawer_symbols","drawer_fn","enter"]];function Ww(l){return Zw.some(i=>l.length===i.length&&l.every((a,o)=>a.id===i[o]&&a.enabled!==!1))}function Jw(l){if(!Array.isArray(l)||l.length===0)return rs();const i=l.filter(a=>typeof a=="object"&&a!==null&&typeof a.id=="string"&&typeof a.label=="string"&&typeof a.code=="string");return Ww(i)?rs():i.filter(a=>a.id!=="drawer_agent")}function sd(l,i){if(i){const a=`keyTitles.${l.id}`,o=i(a);if(o&&o!==a)return o}return l.title||l.label}const fg="herdr-remote.ignoredUpdate";function e1(){const l=Ai("local",pt.ignoredUpdate);if(l!==null)return l;const i=Ai("local",fg);if(i===null)return null;jb(i);try{window.localStorage.removeItem(fg)}catch{}return i}function jb(l){wn("local",pt.ignoredUpdate,l)}function t1(){return`client-${Math.random().toString(36).substring(2,8)}`}function Ob(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function Db(){const l=typeof window<"u"&&window.innerWidth<640;return{wsUrl:on,token:"",pairCode:"",clientId:t1(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:l?nr:ss,fontSizeFollowsHost:!0,fontFamily:gb,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:Ob(),virtualKeys:rs(),agentKeymaps:{},adminToken:"",adminTokens:{}}}const n1=["wsUrl","token","pairCode","clientId","autoReconnect","language","agentKeymaps"],i1=["wsUrl","token","pairCode","autoReconnect"],Ed=["fontSize","fontSizeFollowsHost","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify","adminToken","adminTokens"],l1=Ed.filter(l=>l!=="adminToken"&&l!=="adminTokens"),hg=["theme","colorMode"];function od(l){const i=l;if(!hg.some(r=>i[r]!==void 0))return{data:l,changed:!1};const o={...i};for(const r of hg)delete o[r];return{data:o,changed:!0}}function zb(l){if(!l||typeof l!="object"||Array.isArray(l))return{};const i={};for(const[a,o]of Object.entries(l).slice(0,32))typeof o!="string"||o.length===0||(i[a.slice(0,512)]=o.slice(0,os));return i}function Nd(){const l=Db();if(typeof window>"u")return l;let i={};const a=Ai("local",pt.settings);if(a)try{i=JSON.parse(a)}catch(X){console.warn("Failed to parse localStorage settings:",X)}const o=od(i);o.changed&&(i=o.data,wn("local",pt.settings,JSON.stringify(i)));let r=null;const u=Ai("session",pt.sessionView);if(u)try{r=JSON.parse(u)}catch(X){console.warn("Failed to parse sessionStorage settings:",X)}if(!r){const X={};for(const ie of Ed)i[ie]!==void 0&&(X[ie]=i[ie]);r=X,wn("session",pt.sessionView,JSON.stringify(r))}const h=Ou(r.fontFamily??i.fontFamily??l.fontFamily),p=window.innerWidth<640?nr:ss,m=r.fontSize??i.fontSize??l.fontSize,g=Wl(m,p),b=r.fontSizeFollowsHost??i.fontSizeFollowsHost,v=typeof b=="boolean"?b:m===void 0||g===ss||g===nr,w=r.virtualKeys??i.virtualKeys??l.virtualKeys,x=Jw(w),T=i.language??l.language,M=T==="zh"||T==="en"?T:Ob(),A=Rb(i),R=A.profiles.find(X=>X.id===A.activeProfileId),k=od(r);k.changed&&(r=k.data,wn("session",pt.sessionView,JSON.stringify(r)));const O=r.toolbarVisible??i.toolbarVisible??l.toolbarVisible,$=r.toolbarPosition??i.toolbarPosition??l.toolbarPosition,_=r.vibrateOnKeyPress??i.vibrateOnKeyPress??l.vibrateOnKeyPress,z=X=>{const ie=r[X]??i[X];return typeof ie=="boolean"?ie:l[X]},L=(r==null?void 0:r.predictiveEcho)??(i==null?void 0:i.predictiveEcho)??l.predictiveEcho,D=L==="always"||L==="off"||L==="auto"?L:"auto",K=typeof r.adminToken=="string"?r.adminToken.slice(0,os):typeof i.adminToken=="string"?i.adminToken.slice(0,os):l.adminToken,J=zb(r.adminTokens),V={...l,...i,...r,wsUrl:(R==null?void 0:R.wsUrl)||(typeof i.wsUrl=="string"?i.wsUrl:l.wsUrl),token:(R==null?void 0:R.token)||"",pairCode:(R==null?void 0:R.pairCode)||"",autoReconnect:(R==null?void 0:R.autoReconnect)??l.autoReconnect,profiles:A.profiles,activeProfileId:A.activeProfileId,clientId:typeof i.clientId=="string"&&i.clientId.trim()?i.clientId.trim().slice(0,128):l.clientId,fontFamily:h,fontSize:g,fontSizeFollowsHost:v,toolbarVisible:O,toolbarPosition:$,vibrateOnKeyPress:_,predictiveEcho:D,virtualKeys:x,agentKeymaps:pb(i.agentKeymaps),agentAlertBadge:z("agentAlertBadge"),agentAlertSound:z("agentAlertSound"),agentAlertVibrate:z("agentAlertVibrate"),agentAlertNotify:z("agentAlertNotify"),language:M,adminToken:K,adminTokens:J};return typeof i.fontFamily=="string"&&Ou(i.fontFamily)!==i.fontFamily&&(i.fontFamily=Ou(i.fontFamily),wn("local",pt.settings,JSON.stringify(i))),V}function xi(l){var w;const a={...Nd(),...l};a.agentKeymaps=pb(a.agentKeymaps),a.adminTokens=zb(a.adminTokens),typeof a.adminToken=="string"&&(a.adminToken=a.adminToken.slice(0,os)),l.fontSize!==void 0&&(a.fontSize=Wl(l.fontSize)),l.predictiveEcho!==void 0&&(l.predictiveEcho==="auto"||l.predictiveEcho==="always"||l.predictiveEcho==="off"?a.predictiveEcho=l.predictiveEcho:a.predictiveEcho="auto");const o=Rb(a);let r=o.profiles,u=o.activeProfileId;if(i1.some(x=>l[x]!==void 0)){const x=r.findIndex(A=>A.id===u),T=x>=0?{...r[x]}:{id:Ad(),displayName:`Herdr ${r.length+1}`,wsUrl:a.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};T.wsUrl=a.wsUrl,T.token=a.token,T.pairCode=a.pairCode||void 0,T.autoReconnect=a.autoReconnect,T.lastUsedAt=Date.now();const M=ar(T,Math.max(x,0));M?x>=0?r[x]=M:(r.push(M),u=M.id):x>=0&&(r=r.filter(A=>A.id!==u),u=((w=r[0])==null?void 0:w.id)||"")}r.length>0&&!r.some(x=>x.id===u)&&(u=r[0].id);const p=r.find(x=>x.id===u);a.profiles=r,a.activeProfileId=u,a.wsUrl=(p==null?void 0:p.wsUrl)||a.wsUrl||on,a.token=(p==null?void 0:p.token)||"",a.pairCode=(p==null?void 0:p.pairCode)||"",a.autoReconnect=(p==null?void 0:p.autoReconnect)??a.autoReconnect;const m=Ai("local",pt.settings);let g={};if(m)try{g=JSON.parse(m)}catch{}g=od(g).data;for(const x of n1)a[x]!==void 0&&(g[x]=a[x]);g.profiles=r,g.activeProfileId=u,wn("local",pt.settings,JSON.stringify(g));const b=Ai("session",pt.sessionView);let v={};if(b)try{v=JSON.parse(b)}catch{}for(const x of Ed)a[x]!==void 0&&(v[x]=a[x]);wn("session",pt.sessionView,JSON.stringify(v));for(const x of l1)a[x]!==void 0&&(g[x]=a[x]);return wn("local",pt.settings,JSON.stringify(g)),a}function a1(l){const[i,a]=C.useState(Nd),o=C.useRef(i);o.current=i;const r=C.useRef(l);r.current=l;const u=C.useCallback(x=>{const T=xi(x);o.current=T,a(T)},[]),h=C.useCallback(x=>{o.current=x,a(x)},[]),p=C.useCallback(x=>{const T=o.current,M=ug({...x,wsUrl:x.wsUrl||on,token:x.token||"",displayName:x.displayName||`Herdr ${T.profiles.length+1}`,autoReconnect:x.autoReconnect!==!1},T.profiles.length),A=xi({profiles:[...T.profiles,M],activeProfileId:M.id,wsUrl:M.wsUrl,token:M.token,pairCode:M.pairCode||"",autoReconnect:M.autoReconnect});h(A),r.current(A)},[h]),m=C.useCallback(x=>{const T=o.current,M=T.profiles.find(R=>R.id===x);if(!M||M.id===T.activeProfileId)return;const A=xi({activeProfileId:M.id,wsUrl:M.wsUrl,token:M.token,pairCode:M.pairCode||"",autoReconnect:M.autoReconnect,profiles:T.profiles.map(R=>R.id===M.id?{...R,lastUsedAt:Date.now()}:R)});h(A),r.current(A)},[h]),g=C.useCallback((x,T)=>{const M=o.current;if(!M.profiles.find(O=>O.id===x))return;const R=T.trim().slice(0,64);if(!R)return;const k=xi({profiles:M.profiles.map(O=>O.id===x?{...O,displayName:R}:O)});h(k)},[h]),b=C.useCallback(x=>{const T=o.current;if(!T.profiles.some(k=>k.id===x))return;const M=T.profiles.filter(k=>k.id!==x),A=M.find(k=>k.id===T.activeProfileId)||M[0],R=xi(A?{profiles:M,activeProfileId:A.id,wsUrl:A.wsUrl,token:A.token,pairCode:A.pairCode||"",autoReconnect:A.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:on,token:"",pairCode:""});h(R),x===T.activeProfileId&&r.current(R)},[h]),v=C.useCallback(x=>{const T=o.current,M=T.profiles.find(D=>D.id===T.activeProfileId),A=x.hostId?dg({wsUrl:T.wsUrl,hostId:x.hostId}):null,R=A?T.profiles.findIndex(D=>dg(D)===A):-1,k=R>=0?R:Math.max(0,T.profiles.findIndex(D=>D.id===T.activeProfileId)),$={...T.profiles[k]||M||ug({wsUrl:T.wsUrl||on,token:"",pairCode:T.pairCode||"PENDING",displayName:`Herdr ${T.profiles.length+1}`},T.profiles.length),token:x.token,pairCode:void 0,...x.hostId?{hostId:x.hostId}:{},...x.deviceId?{deviceId:x.deviceId}:{},lastUsedAt:Date.now()};let _=[...T.profiles];k>=0&&k<_.length?_[k]=$:_.push($);const z=M==null?void 0:M.id;_=_.filter((D,K)=>K===k||D.id===$.id?!0:!(R>=0&&z&&D.id===z));const L=xi({profiles:_,activeProfileId:$.id,wsUrl:$.wsUrl,token:$.token,pairCode:"",autoReconnect:$.autoReconnect});return h(L),L},[h]),w=C.useCallback(x=>{const T=o.current,M=T.profiles.find(O=>O.id===T.activeProfileId);if(!M||!x.hostId&&!x.hostname)return;const A=/^Herdr \d+$/.test(M.displayName),R={...M,...x.hostId?{hostId:x.hostId}:{},...x.hostname?{hostname:x.hostname}:{},...x.hostname&&A?{displayName:x.hostname}:{}},k=xi({profiles:T.profiles.map(O=>O.id===M.id?R:O)});h(k)},[h]);return{settings:i,updateSettings:u,addProfileAndConnect:p,switchProfile:m,renameProfile:g,removeProfile:b,savePairedProfile:v,noteReadyProfile:w}}const Bo={ctrl:!1,alt:!1,shift:!1};function s1({adapterRef:l,role:i,addToast:a,tRef:o}){const[r,u]=C.useState({cols:80,rows:24}),h=C.useRef(r);h.current=r;const p=C.useRef(new Set),m=C.useRef(new Set),g=C.useRef(!0);C.useEffect(()=>{i==="controller"&&(g.current=!0)},[i]);const b=C.useCallback(()=>{g.current&&(g.current=!1,a("warning",o.current("toasts.viewerModeWarning")))},[a,o]),v=C.useCallback(L=>{if(i!=="controller"){b();return}const D=l.current;if(!D)return;const K=Td(L);for(const J of m.current)try{J(K)}catch(V){console.debug("Key input observer threw:",V)}D.sendInput(K)},[l,i,b]),w=C.useCallback(L=>(m.current.add(L),()=>{m.current.delete(L)}),[]),[x,T]=C.useState(Bo),M=C.useRef(Bo),A=C.useCallback(L=>{const D={...M.current,[L]:!M.current[L]};M.current=D,T(D)},[]),R=C.useCallback(()=>{const L=M.current;return!L.ctrl&&!L.alt&&!L.shift?null:(M.current=Bo,T(Bo),L)},[]),k=C.useCallback(L=>{var D;i!=="controller"&&!lr(L)||(D=l.current)==null||D.sendInput(L)},[l,i]),O=C.useCallback((L,D)=>{var K;h.current={cols:L,rows:D},u({cols:L,rows:D}),(K=l.current)==null||K.sendResize(L,D)},[l]),$=C.useCallback((L,D)=>i!=="controller"?(b(),!1):l.current?(l.current.sendPasteFile(L,D),!0):!1,[l,i,b]),_=C.useCallback(L=>(p.current.add(L),()=>{p.current.delete(L)}),[]),z=C.useCallback(L=>{for(const D of p.current)try{D(L)}catch(K){console.error("Error in pasteFileReady listener:",K)}},[]);return{terminalDimensions:r,dimensionsRef:h,warnViewerMode:b,sendKey:v,observeKeyInput:w,modifierLatch:x,toggleModifierLatch:A,consumeModifierLatch:R,sendBinary:k,sendResize:O,sendPasteFile:$,subscribeToPasteFileReady:_,notifyPasteFileReady:z}}const o1=4e3,r1=3;function c1(){const[l,i]=C.useState([]),a=C.useRef([]),o=C.useRef(new Map),r=C.useCallback(p=>{a.current=p,i(p)},[]),u=C.useCallback(p=>{const m=o.current.get(p);m&&(clearTimeout(m),o.current.delete(p)),r(a.current.filter(g=>g.id!==p))},[r]),h=C.useCallback((p,m)=>{const g=Date.now(),b=a.current,v=b.find(M=>M.type===p&&M.message===m),w=v?v.id:`${g}-${Math.random().toString(36).substring(2,6)}`;let x;if(v)x=b.map(M=>M.id===w?{...M,count:M.count+1,timestamp:g}:M);else for(x=[...b,{id:w,type:p,message:m,timestamp:g,count:1}];x.length>r1;){const[M,...A]=x,R=o.current.get(M.id);R&&(clearTimeout(R),o.current.delete(M.id)),x=A}r(x);const T=o.current.get(w);T&&clearTimeout(T),o.current.set(w,setTimeout(()=>u(w),o1))},[r,u]);return C.useEffect(()=>{const p=o.current;return()=>{for(const m of p.values())clearTimeout(m);p.clear()}},[]),{toasts:l,addToast:h,removeToast:u}}function u1(l,i){const[a,o]=C.useState(null),[r,u]=C.useState(e1),h=C.useRef(r),p=C.useRef(new Set),m=C.useCallback(v=>{h.current=v,u(v),jb(v)},[]),g=C.useCallback(v=>{if(o(v),!v.updateAvailable||h.current===v.latest)return;const w=`${v.latest}:${v.restartPending?"restart":"update"}`;p.current.has(w)||(p.current.add(w),l("info",v.restartPending?i.current("update.toastRestart",{version:v.latest}):i.current("update.toast",{version:v.latest})))},[l,i]),b=C.useCallback(()=>o(null),[]);return{updateStatus:a,ignoredUpdate:r,ignoreUpdate:m,receiveUpdateStatus:g,forgetUpdateStatus:b}}const Hb=C.createContext(null),Bb=C.createContext(null),Ub=C.createContext(null),Kb=C.createContext(null),Ib=C.createContext(null),d1=({children:l})=>{var cn,Ct;const[i,a]=C.useReducer(yw,bw),o=C.useRef(null),r=C.useRef(!1);C.useEffect(()=>{bb()},[]);const{receiveOutput:u,subscribeToOutput:h,getPendingOutputChunkCount:p,clearPendingOutput:m}=Pw(),{toasts:g,addToast:b,removeToast:v}=c1(),w=C.useCallback(()=>{m(),a({type:"reset",resetTerminal:!0})},[m]),{settings:x,updateSettings:T,addProfileAndConnect:M,switchProfile:A,renameProfile:R,removeProfile:k,savePairedProfile:O,noteReadyProfile:$}=a1(ge=>{var We;w(),(We=o.current)==null||We.reconnectWith(zo(ge))}),_=C.useCallback((ge,We)=>Cd(x.language,ge,We),[x.language]),z=C.useRef(_);z.current=_;const{herdrLaunch:L,startHerdr:D,handleLaunchError:K,forgetHerdrLaunch:J}=xw(o,z),{updateStatus:V,ignoredUpdate:X,ignoreUpdate:ie,receiveUpdateStatus:ue,forgetUpdateStatus:U}=u1(b,z),E=s1({adapterRef:o,role:i.role,addToast:b,tRef:z}),{uploadProgress:G,uploadImage:P,resetUploadProgress:le,abortUpload:Q,completeUpload:xe}=$w({adapterRef:o,role:i.role,connectionState:i.connectionState,warnViewerMode:E.warnViewerMode,addToast:b,t:_,sendPasteFile:E.sendPasteFile}),ye=zw(o,()=>zo(x),{stateChange:(ge,We,qt)=>{const Vt=ju(qt)?_(`serverErrors.${qt}`):We;a({type:"stateChange",state:ge,detail:Vt,code:qt}),ge==="connected"?b("success",_("toasts.connected")):ge==="error"&&b("error",Vt||_("toasts.connectionError")),ge!=="connected"&&J()},ready:ge=>{const We=r.current;We&&m(),r.current=!0,J(),U(),a({type:"ready",message:ge,resetTerminal:We}),$(ge)},hostReconnecting:ge=>{a({type:"hostReconnecting",code:ge||"host_reconnecting",detail:_(`serverErrors.${ju(ge)?ge:"host_reconnecting"}`)}),m()},sessionRestarted:(ge,We,qt,Vt)=>{var _i;m(),a({type:"sessionRestarted",hostname:Vt,palette:qt}),$({hostId:(_i=o.current)==null?void 0:_i.getHostId(),hostname:Vt})},roleChange:(ge,We,qt,Vt)=>{a({type:"roleChange",role:ge,controllerId:We,hostId:qt,assignedClientId:Vt})},controlGranted:()=>{a({type:"controlGranted"}),b("success",_("toasts.controlGranted"))},paired:ge=>{var qt;const We=O(ge);b("success",_("toasts.pairedSuccess")),a({type:"paired",at:Date.now()}),(qt=o.current)==null||qt.reconnectWith(zo(We))},exit:(ge,We)=>{b("info",`${_("toasts.sessionEnded")}${We?`: ${We}`:""}${ge!=null?` (${ge})`:""}`)},error:ge=>{if(K(ge)||ge.code==="host_font_unavailable")return;Q();const We=ju(ge.code)?_(`serverErrors.${ge.code}`):ge.message||`[${ge.code}]`;b("error",We)},pasteFileReady:ge=>{xe(),E.notifyPasteFileReady(ge)},rttUpdate:ge=>a({type:"rtt",rttMs:ge}),peerCount:ge=>a({type:"peerCount",count:ge}),sessionReady:()=>{a({type:"sessionReady"}),J()},agentStatus:ge=>a({type:"agentStatus",status:ge}),updateStatus:ue,binaryData:u}),ve=x.profiles.find(ge=>ge.id===x.activeProfileId),{hostFont:me,loadHostFont:de,declineHostFont:we,syncHostFont:se,ensureHostGlyphs:Se}=pw(ye),ae=C.useCallback(()=>{de()},[de]),pe=Px(x.fontFamily,me.font?{family:me.font.family,alias:me.status==="loaded"?me.alias:null,glyphs:me.glyphs.source?{family:me.glyphs.source.family,scope:me.glyphs.source.scope,alias:me.glyphs.alias}:null}:null),Ee=x.fontSizeFollowsHost&&((cn=me.font)!=null&&cn.sizePx)?Wl(me.font.sizePx,x.fontSize):x.fontSize;C.useEffect(()=>{document.documentElement.style.setProperty("--tui-font",pe)},[pe]),C.useEffect(()=>{var ge;(ge=o.current)==null||ge.updateConfig(zo(x))},[x]),C.useEffect(()=>{const ge=o.current;return ge?gw(ge):void 0},[]);const{dimensionsRef:Be}=E,re=C.useCallback(ge=>{o.current&&(ge&&o.current.updateConfig(ge),o.current.connect(Be.current))},[Be]),Ae=C.useCallback(()=>{var ge;(ge=o.current)==null||ge.disconnect()},[]),Pe=C.useCallback((ge=!1)=>{var We;(We=o.current)==null||We.claimControl(ge)},[]),wt=C.useCallback(()=>{var ge;(ge=o.current)==null||ge.releaseControl()},[]),Nt=C.useCallback(ge=>T({language:ge}),[T]),Pn=kx((Ct=i.agentStatus)==null?void 0:Ct.focusedAgent,"auto"),Xn=C.useMemo(()=>({settings:x,updateSettings:T,language:x.language,setLanguage:Nt,t:_,profiles:x.profiles,activeProfileId:x.activeProfileId,activeProfile:ve,switchProfile:A,addProfileAndConnect:M,renameProfile:R,removeProfile:k,hostFont:me,loadHostFont:ae,declineHostFont:we,syncHostFont:se,ensureHostGlyphs:Se,terminalFontFamily:pe,terminalFontSize:Ee}),[x,T,Nt,_,ve,A,M,R,k,me,ae,we,se,Se,pe,Ee]),kt=C.useMemo(()=>({...i,isController:i.role==="controller",agentProfile:Pn,adapter:ye,connect:re,disconnect:Ae,claimControl:Pe,releaseControl:wt,herdrLaunch:L,startHerdr:D,updateStatus:V,ignoredUpdate:X,ignoreUpdate:ie}),[i,Pn,ye,re,Ae,Pe,wt,L,D,V,X,ie]),Cn=C.useMemo(()=>({toasts:g,addToast:b,removeToast:v}),[g,b,v]),{terminalDimensions:ps,sendKey:gs,observeKeyInput:St,modifierLatch:bs,toggleModifierLatch:la,consumeModifierLatch:aa,sendBinary:Li,sendResize:ys,warnViewerMode:sa,sendPasteFile:vs,subscribeToPasteFileReady:xs}=E,Ri=C.useMemo(()=>({terminalDimensions:ps,sendKey:gs,observeKeyInput:St,modifierLatch:bs,toggleModifierLatch:la,consumeModifierLatch:aa,sendBinary:Li,sendResize:ys,warnViewerMode:sa,sendPasteFile:vs,subscribeToPasteFileReady:xs,subscribeToOutput:h,getPendingOutputChunkCount:p}),[ps,gs,St,bs,la,aa,Li,ys,sa,vs,xs,h,p]),Mt=C.useMemo(()=>({uploadProgress:G,uploadImage:P,resetUploadProgress:le}),[G,P,le]);return f.jsx(Hb.Provider,{value:Xn,children:f.jsx(Bb.Provider,{value:kt,children:f.jsx(Ub.Provider,{value:Cn,children:f.jsx(Kb.Provider,{value:Ri,children:f.jsx(Ib.Provider,{value:Mt,children:l})})})})})};function fs(l,i){const a=C.useContext(l);if(!a)throw new Error(`${i} must be used within a TerminalProvider`);return a}const Le=()=>fs(Hb,"useSettings"),et=()=>fs(Bb,"useConnection"),rn=()=>fs(Ub,"useToasts"),hs=()=>fs(Kb,"useTerminalIO"),ur=()=>fs(Ib,"useUpload");function cs(l){var i,a;return l?{blocked:((i=l.counts)==null?void 0:i.blocked)??0,done:((a=l.counts)==null?void 0:a.done)??0}:null}function f1(l){return l?l.blocked>0?"blocked":l.done>0?"done":null:null}function h1(l){if(!l)return"";const i=[];return l.blocked>0&&i.push(`${l.blocked}⚠`),l.done>0&&i.push(`${l.done}✓`),i.length>0?`(${i.join(" ")})`:""}function m1(l,i){if(!l||!i)return null;const a=new Map(l.agents.map(h=>[h.paneId,h.status]));let o=null;for(const h of i.agents)if(!(h.status!=="blocked"&&h.status!=="done")&&a.get(h.paneId)!==h.status){if(h.status==="blocked")return"blocked";o="done"}const r=cs(l),u=cs(i);return u.blocked>r.blocked?"blocked":(!o&&u.done>r.done&&(o="done"),o)}const p1={blocked:"%23f9e2af",done:"%23a6e3a1"};function g1(l){return`<circle cx='19' cy='5' r='4.5' fill='${p1[l]}' stroke='%2311111b' stroke-width='1.5'/>`}function b1(l,i){return!i||!l.includes("</svg>")?l:l.replace("</svg>",`${g1(i)}</svg>`)}function mg(l,i=document){const a=i.querySelector('link[rel~="icon"]');if(!a)return;a.dataset.baseHref===void 0&&(a.dataset.baseHref=a.getAttribute("href")??"");const o=b1(a.dataset.baseHref,l);a.getAttribute("href")!==o&&a.setAttribute("href",o)}let an=null;function y1(){if(typeof window>"u")return null;const l=window;return l.AudioContext??l.webkitAudioContext??null}function Fb(){const l=y1();if(l)try{an=an??new l,an.state==="suspended"&&an.resume()}catch{an=null}}function v1(l=window){const i=()=>{Fb(),a()},a=()=>{l.removeEventListener("pointerdown",i),l.removeEventListener("keydown",i)};return l.addEventListener("pointerdown",i),l.addEventListener("keydown",i),a}const x1={blocked:[880,660],done:[660,880]};function Gb(l){if((an==null?void 0:an.state)==="running")try{const i=an.currentTime;x1[l].forEach((a,o)=>{const r=an.createOscillator(),u=an.createGain(),h=i+o*.11;r.type="sine",r.frequency.value=a,u.gain.setValueAtTime(1e-4,h),u.gain.exponentialRampToValueAtTime(.06,h+.01),u.gain.exponentialRampToValueAtTime(1e-4,h+.09),r.connect(u),u.connect(an.destination),r.start(h),r.stop(h+.1)})}catch{}}const w1=15e3,S1={blocked:[70,50,70],done:[40]};function C1(){const{settings:l,t:i}=Le(),{agentStatus:a}=et(),o=C.useRef(l);o.current=l;const r=C.useRef(i);r.current=i;const u=C.useRef(null),h=C.useRef(Number.NEGATIVE_INFINITY);C.useEffect(()=>{mg(l.agentAlertBadge?f1(cs(a)):null)},[a,l.agentAlertBadge]),C.useEffect(()=>()=>mg(null),[]),C.useEffect(()=>{if(!(!l.agentAlertSound||typeof window>"u"))return v1(window)},[l.agentAlertSound]),C.useEffect(()=>{const p=u.current;u.current=a;const m=m1(p,a);if(!m)return;const g=Date.now();if(g-h.current<w1)return;h.current=g;const b=o.current,v=typeof document<"u"&&document.visibilityState==="hidden",w=v||typeof document<"u"&&!document.hasFocus();if(b.agentAlertVibrate&&!v&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(S1[m])}catch{}if(b.agentAlertSound&&w&&Gb(m),b.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const x=cs(a),T=m==="blocked"?r.current("agents.notifyBlocked",{count:x.blocked}):r.current("agents.notifyDone",{count:x.done});try{new Notification("Herdr Remote",{body:T,tag:"herdr-agents"})}catch{}}},[a])}function Yb(l){var i,a,o="";if(typeof l=="string"||typeof l=="number")o+=l;else if(typeof l=="object")if(Array.isArray(l)){var r=l.length;for(i=0;i<r;i++)l[i]&&(a=Yb(l[i]))&&(o&&(o+=" "),o+=a)}else for(a in l)l[a]&&(o&&(o+=" "),o+=a);return o}function T1(){for(var l,i,a=0,o="",r=arguments.length;a<r;a++)(l=arguments[a])&&(i=Yb(l))&&(o&&(o+=" "),o+=i);return o}const M1=(l,i)=>{const a=new Array(l.length+i.length);for(let o=0;o<l.length;o++)a[o]=l[o];for(let o=0;o<i.length;o++)a[l.length+o]=i[o];return a},A1=(l,i)=>({classGroupId:l,validator:i}),$b=(l=new Map,i=null,a)=>({nextPart:l,validators:i,classGroupId:a}),sr="-",pg=[],E1="arbitrary..",N1=l=>{const i=L1(l),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=l;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return k1(h);const p=h.split(sr),m=p[0]===""&&p.length>1?1:0;return qb(p,m,i)},getConflictingClassGroupIds:(h,p)=>{if(p){const m=o[h],g=a[h];return m?g?M1(g,m):m:g||pg}return a[h]||pg}}},qb=(l,i,a)=>{if(l.length-i===0)return a.classGroupId;const r=l[i],u=a.nextPart.get(r);if(u){const g=qb(l,i+1,u);if(g)return g}const h=a.validators;if(h===null)return;const p=i===0?l.join(sr):l.slice(i).join(sr),m=h.length;for(let g=0;g<m;g++){const b=h[g];if(b.validator(p))return b.classGroupId}},k1=l=>l.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const i=l.slice(1,-1),a=i.indexOf(":"),o=i.slice(0,a);return o?E1+o:void 0})(),L1=l=>{const{theme:i,classGroups:a}=l;return R1(a,i)},R1=(l,i)=>{const a=$b();for(const o in l){const r=l[o];kd(r,a,o,i)}return a},kd=(l,i,a,o)=>{const r=l.length;for(let u=0;u<r;u++){const h=l[u];_1(h,i,a,o)}},_1=(l,i,a,o)=>{if(typeof l=="string"){j1(l,i,a);return}if(typeof l=="function"){O1(l,i,a,o);return}D1(l,i,a,o)},j1=(l,i,a)=>{const o=l===""?i:Vb(i,l);o.classGroupId=a},O1=(l,i,a,o)=>{if(z1(l)){kd(l(o),i,a,o);return}i.validators===null&&(i.validators=[]),i.validators.push(A1(a,l))},D1=(l,i,a,o)=>{const r=Object.entries(l),u=r.length;for(let h=0;h<u;h++){const[p,m]=r[h];kd(m,Vb(i,p),a,o)}},Vb=(l,i)=>{let a=l;const o=i.split(sr),r=o.length;for(let u=0;u<r;u++){const h=o[u];let p=a.nextPart.get(h);p||(p=$b(),a.nextPart.set(h,p)),a=p}return a},z1=l=>"isThemeGetter"in l&&l.isThemeGetter===!0,H1=l=>{if(l<1)return{get:()=>{},set:()=>{}};let i=0,a=Object.create(null),o=Object.create(null);const r=(u,h)=>{a[u]=h,i++,i>l&&(i=0,o=a,a=Object.create(null))};return{get(u){let h=a[u];if(h!==void 0)return h;if((h=o[u])!==void 0)return r(u,h),h},set(u,h){u in a?a[u]=h:r(u,h)}}},rd="!",gg=":",B1=[],bg=(l,i,a,o,r)=>({modifiers:l,hasImportantModifier:i,baseClassName:a,maybePostfixModifierPosition:o,isExternal:r}),U1=l=>{const{prefix:i,experimentalParseClassName:a}=l;let o=r=>{const u=[];let h=0,p=0,m=0,g;const b=r.length;for(let M=0;M<b;M++){const A=r[M];if(h===0&&p===0){if(A===gg){u.push(r.slice(m,M)),m=M+1;continue}if(A==="/"){g=M;continue}}A==="["?h++:A==="]"?h--:A==="("?p++:A===")"&&p--}const v=u.length===0?r:r.slice(m);let w=v,x=!1;v.endsWith(rd)?(w=v.slice(0,-1),x=!0):v.startsWith(rd)&&(w=v.slice(1),x=!0);const T=g&&g>m?g-m:void 0;return bg(u,x,w,T)};if(i){const r=i+gg,u=o;o=h=>h.startsWith(r)?u(h.slice(r.length)):bg(B1,!1,h,void 0,!0)}if(a){const r=o;o=u=>a({className:u,parseClassName:r})}return o},K1=l=>{const i=new Map;return l.orderSensitiveModifiers.forEach((a,o)=>{i.set(a,1e6+o)}),a=>{const o=[];let r=[];for(let u=0;u<a.length;u++){const h=a[u],p=h[0]==="[",m=i.has(h);p||m?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(h)):r.push(h)}return r.length>0&&(r.sort(),o.push(...r)),o}},I1=l=>({cache:H1(l.cacheSize),parseClassName:U1(l),sortModifiers:K1(l),postfixLookupClassGroupIds:F1(l),...N1(l)}),F1=l=>{const i=Object.create(null),a=l.postfixLookupClassGroups;if(a)for(let o=0;o<a.length;o++)i[a[o]]=!0;return i},G1=/\s+/,Y1=(l,i)=>{const{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:u,postfixLookupClassGroupIds:h}=i,p=[],m=l.trim().split(G1);let g="";for(let b=m.length-1;b>=0;b-=1){const v=m[b],{isExternal:w,modifiers:x,hasImportantModifier:T,baseClassName:M,maybePostfixModifierPosition:A}=a(v);if(w){g=v+(g.length>0?" "+g:g);continue}let R=!!A,k;if(R){const L=M.substring(0,A);k=o(L);const D=k&&h[k]?o(M):void 0;D&&D!==k&&(k=D,R=!1)}else k=o(M);if(!k){if(!R){g=v+(g.length>0?" "+g:g);continue}if(k=o(M),!k){g=v+(g.length>0?" "+g:g);continue}R=!1}const O=x.length===0?"":x.length===1?x[0]:u(x).join(":"),$=T?O+rd:O,_=$+k;if(p.indexOf(_)>-1)continue;p.push(_);const z=r(k,R);for(let L=0;L<z.length;++L){const D=z[L];p.push($+D)}g=v+(g.length>0?" "+g:g)}return g},$1=(...l)=>{let i=0,a,o,r="";for(;i<l.length;)(a=l[i++])&&(o=Pb(a))&&(r&&(r+=" "),r+=o);return r},Pb=l=>{if(typeof l=="string")return l;let i,a="";for(let o=0;o<l.length;o++)l[o]&&(i=Pb(l[o]))&&(a&&(a+=" "),a+=i);return a},yg=(l,...i)=>{let a,o,r,u;const h=m=>{const g=i.reduce((b,v)=>v(b),l());return a=I1(g),o=a.cache.get,r=a.cache.set,u=p,p(m)},p=m=>{const g=o(m);if(g)return g;const b=Y1(m,a);return r(m,b),b};return u=h,(...m)=>u($1(...m))},q1=[],ft=l=>{const i=a=>a[l]||q1;return i.isThemeGetter=!0,i},Xb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Qb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,V1=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,P1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,X1=/\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$/,Q1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Z1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,W1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wi=l=>V1.test(l),_e=l=>!!l&&!Number.isNaN(Number(l)),yn=l=>!!l&&Number.isInteger(Number(l)),Iu=l=>l.endsWith("%")&&_e(l.slice(0,-1)),Fn=l=>P1.test(l),Zb=()=>!0,J1=l=>X1.test(l)&&!Q1.test(l),Ld=()=>!1,eS=l=>Z1.test(l),tS=l=>W1.test(l),nS=l=>!ce(l)&&!fe(l),iS=l=>l.startsWith("@container")&&(l[10]==="/"&&l[11]!==void 0||l[11]==="s"&&l[16]!==void 0&&l.startsWith("-size/",10)||l[11]==="n"&&l[18]!==void 0&&l.startsWith("-normal/",10)),lS=l=>ki(l,ey,Ld),ce=l=>Xb.test(l),Wi=l=>ki(l,ty,J1),vg=l=>ki(l,fS,_e),aS=l=>ki(l,iy,Zb),sS=l=>ki(l,ny,Ld),xg=l=>ki(l,Wb,Ld),oS=l=>ki(l,Jb,tS),Uo=l=>ki(l,ly,eS),fe=l=>Qb.test(l),ts=l=>al(l,ty),rS=l=>al(l,ny),wg=l=>al(l,Wb),cS=l=>al(l,ey),uS=l=>al(l,Jb),Ko=l=>al(l,ly,!0),dS=l=>al(l,iy,!0),ki=(l,i,a)=>{const o=Xb.exec(l);return o?o[1]?i(o[1]):a(o[2]):!1},al=(l,i,a=!1)=>{const o=Qb.exec(l);return o?o[1]?i(o[1]):a:!1},Wb=l=>l==="position"||l==="percentage",Jb=l=>l==="image"||l==="url",ey=l=>l==="length"||l==="size"||l==="bg-size",ty=l=>l==="length",fS=l=>l==="number",ny=l=>l==="family-name",iy=l=>l==="number"||l==="weight",ly=l=>l==="shadow",Sg=()=>{const l=ft("color"),i=ft("font"),a=ft("text"),o=ft("font-weight"),r=ft("tracking"),u=ft("leading"),h=ft("breakpoint"),p=ft("container"),m=ft("spacing"),g=ft("radius"),b=ft("shadow"),v=ft("inset-shadow"),w=ft("text-shadow"),x=ft("drop-shadow"),T=ft("blur"),M=ft("perspective"),A=ft("aspect"),R=ft("ease"),k=ft("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...$(),fe,ce],z=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],D=()=>[fe,ce,m],K=()=>[wi,"full","auto",...D()],J=()=>[yn,"none","subgrid",fe,ce],V=()=>["auto",{span:["full",yn,fe,ce]},yn,fe,ce],X=()=>[yn,"auto",fe,ce],ie=()=>["auto","min","max","fr",fe,ce],ue=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],E=()=>["auto",...D()],G=()=>[wi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],P=()=>[wi,"screen","full","dvw","lvw","svw","min","max","fit",...D()],le=()=>[wi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],Q=()=>[l,fe,ce],xe=()=>[...$(),wg,xg,{position:[fe,ce]}],ye=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ve=()=>["auto","cover","contain",cS,lS,{size:[fe,ce]}],me=()=>[Iu,ts,Wi],de=()=>["","none","full",g,fe,ce],we=()=>["",_e,ts,Wi],se=()=>["solid","dashed","dotted","double"],Se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[_e,Iu,wg,xg],pe=()=>["","none",T,fe,ce],Ee=()=>["none",_e,fe,ce],Be=()=>["none",_e,fe,ce],re=()=>[_e,fe,ce],Ae=()=>[wi,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fn],breakpoint:[Fn],color:[Zb],container:[Fn],"drop-shadow":[Fn],ease:["in","out","in-out"],font:[nS],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fn],shadow:[Fn],spacing:["px",_e],text:[Fn],"text-shadow":[Fn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wi,ce,fe,A]}],container:["container"],"container-type":[{"@container":["","normal","size",fe,ce]}],"container-named":[iS],columns:[{columns:[_e,ce,fe,p]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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:_()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:K()}],"inset-x":[{"inset-x":K()}],"inset-y":[{"inset-y":K()}],start:[{"inset-s":K(),start:K()}],end:[{"inset-e":K(),end:K()}],"inset-bs":[{"inset-bs":K()}],"inset-be":[{"inset-be":K()}],top:[{top:K()}],right:[{right:K()}],bottom:[{bottom:K()}],left:[{left:K()}],visibility:["visible","invisible","collapse"],z:[{z:[yn,"auto",fe,ce]}],basis:[{basis:[wi,"full","auto",p,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[_e,wi,"auto","initial","none",ce]}],grow:[{grow:["",_e,fe,ce]}],shrink:[{shrink:["",_e,fe,ce]}],order:[{order:[yn,"first","last","none",fe,ce]}],"grid-cols":[{"grid-cols":J()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":J()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...ue(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...ue()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":ue()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pbs:[{pbs:D()}],pbe:[{pbe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mbs:[{mbs:E()}],mbe:[{mbe:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:G()}],"inline-size":[{inline:["auto",...P()]}],"min-inline-size":[{"min-inline":["auto",...P()]}],"max-inline-size":[{"max-inline":["none",...P()]}],"block-size":[{block:["auto",...le()]}],"min-block-size":[{"min-block":["auto",...le()]}],"max-block-size":[{"max-block":["none",...le()]}],w:[{w:[p,"screen",...G()]}],"min-w":[{"min-w":[p,"screen","none",...G()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[h]},...G()]}],h:[{h:["screen","lh",...G()]}],"min-h":[{"min-h":["screen","lh","none",...G()]}],"max-h":[{"max-h":["screen","lh",...G()]}],"font-size":[{text:["base",a,ts,Wi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,dS,aS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Iu,ce]}],"font-family":[{font:[rS,sS,i]}],"font-features":[{"font-features":[ce]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,fe,ce]}],"line-clamp":[{"line-clamp":[_e,"none",fe,vg]}],leading:[{leading:[u,...D()]}],"list-image":[{"list-image":["none",fe,ce]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",fe,ce]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Q()}],"text-color":[{text:Q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[_e,"from-font","auto",fe,Wi]}],"text-decoration-color":[{decoration:Q()}],"underline-offset":[{"underline-offset":[_e,"auto",fe,ce]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"tab-size":[{tab:[yn,fe,ce]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fe,ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",fe,ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:xe()}],"bg-repeat":[{bg:ye()}],"bg-size":[{bg:ve()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},yn,fe,ce],radial:["",fe,ce],conic:[yn,fe,ce]},uS,oS]}],"bg-color":[{bg:Q()}],"gradient-from-pos":[{from:me()}],"gradient-via-pos":[{via:me()}],"gradient-to-pos":[{to:me()}],"gradient-from":[{from:Q()}],"gradient-via":[{via:Q()}],"gradient-to":[{to:Q()}],rounded:[{rounded:de()}],"rounded-s":[{"rounded-s":de()}],"rounded-e":[{"rounded-e":de()}],"rounded-t":[{"rounded-t":de()}],"rounded-r":[{"rounded-r":de()}],"rounded-b":[{"rounded-b":de()}],"rounded-l":[{"rounded-l":de()}],"rounded-ss":[{"rounded-ss":de()}],"rounded-se":[{"rounded-se":de()}],"rounded-ee":[{"rounded-ee":de()}],"rounded-es":[{"rounded-es":de()}],"rounded-tl":[{"rounded-tl":de()}],"rounded-tr":[{"rounded-tr":de()}],"rounded-br":[{"rounded-br":de()}],"rounded-bl":[{"rounded-bl":de()}],"border-w":[{border:we()}],"border-w-x":[{"border-x":we()}],"border-w-y":[{"border-y":we()}],"border-w-s":[{"border-s":we()}],"border-w-e":[{"border-e":we()}],"border-w-bs":[{"border-bs":we()}],"border-w-be":[{"border-be":we()}],"border-w-t":[{"border-t":we()}],"border-w-r":[{"border-r":we()}],"border-w-b":[{"border-b":we()}],"border-w-l":[{"border-l":we()}],"divide-x":[{"divide-x":we()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":we()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:Q()}],"border-color-x":[{"border-x":Q()}],"border-color-y":[{"border-y":Q()}],"border-color-s":[{"border-s":Q()}],"border-color-e":[{"border-e":Q()}],"border-color-bs":[{"border-bs":Q()}],"border-color-be":[{"border-be":Q()}],"border-color-t":[{"border-t":Q()}],"border-color-r":[{"border-r":Q()}],"border-color-b":[{"border-b":Q()}],"border-color-l":[{"border-l":Q()}],"divide-color":[{divide:Q()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[_e,fe,ce]}],"outline-w":[{outline:["",_e,ts,Wi]}],"outline-color":[{outline:Q()}],shadow:[{shadow:["","none",b,Ko,Uo]}],"shadow-color":[{shadow:Q()}],"inset-shadow":[{"inset-shadow":["none",v,Ko,Uo]}],"inset-shadow-color":[{"inset-shadow":Q()}],"ring-w":[{ring:we()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Q()}],"ring-offset-w":[{"ring-offset":[_e,Wi]}],"ring-offset-color":[{"ring-offset":Q()}],"inset-ring-w":[{"inset-ring":we()}],"inset-ring-color":[{"inset-ring":Q()}],"text-shadow":[{"text-shadow":["none",w,Ko,Uo]}],"text-shadow-color":[{"text-shadow":Q()}],opacity:[{opacity:[_e,fe,ce]}],"mix-blend":[{"mix-blend":[...Se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Se()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[_e]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":Q()}],"mask-image-linear-to-color":[{"mask-linear-to":Q()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":Q()}],"mask-image-t-to-color":[{"mask-t-to":Q()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":Q()}],"mask-image-r-to-color":[{"mask-r-to":Q()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":Q()}],"mask-image-b-to-color":[{"mask-b-to":Q()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":Q()}],"mask-image-l-to-color":[{"mask-l-to":Q()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":Q()}],"mask-image-x-to-color":[{"mask-x-to":Q()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":Q()}],"mask-image-y-to-color":[{"mask-y-to":Q()}],"mask-image-radial":[{"mask-radial":[fe,ce]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":Q()}],"mask-image-radial-to-color":[{"mask-radial-to":Q()}],"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":$()}],"mask-image-conic-pos":[{"mask-conic":[_e]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":Q()}],"mask-image-conic-to-color":[{"mask-conic-to":Q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:xe()}],"mask-repeat":[{mask:ye()}],"mask-size":[{mask:ve()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",fe,ce]}],filter:[{filter:["","none",fe,ce]}],blur:[{blur:pe()}],brightness:[{brightness:[_e,fe,ce]}],contrast:[{contrast:[_e,fe,ce]}],"drop-shadow":[{"drop-shadow":["","none",x,Ko,Uo]}],"drop-shadow-color":[{"drop-shadow":Q()}],grayscale:[{grayscale:["",_e,fe,ce]}],"hue-rotate":[{"hue-rotate":[_e,fe,ce]}],invert:[{invert:["",_e,fe,ce]}],saturate:[{saturate:[_e,fe,ce]}],sepia:[{sepia:["",_e,fe,ce]}],"backdrop-filter":[{"backdrop-filter":["","none",fe,ce]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[_e,fe,ce]}],"backdrop-contrast":[{"backdrop-contrast":[_e,fe,ce]}],"backdrop-grayscale":[{"backdrop-grayscale":["",_e,fe,ce]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[_e,fe,ce]}],"backdrop-invert":[{"backdrop-invert":["",_e,fe,ce]}],"backdrop-opacity":[{"backdrop-opacity":[_e,fe,ce]}],"backdrop-saturate":[{"backdrop-saturate":[_e,fe,ce]}],"backdrop-sepia":[{"backdrop-sepia":["",_e,fe,ce]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",fe,ce]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[_e,"initial",fe,ce]}],ease:[{ease:["linear","initial",R,fe,ce]}],delay:[{delay:[_e,fe,ce]}],animate:[{animate:["none",k,fe,ce]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[M,fe,ce]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:Be()}],"scale-x":[{"scale-x":Be()}],"scale-y":[{"scale-y":Be()}],"scale-z":[{"scale-z":Be()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[fe,ce,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ae()}],"translate-x":[{"translate-x":Ae()}],"translate-y":[{"translate-y":Ae()}],"translate-z":[{"translate-z":Ae()}],"translate-none":["translate-none"],zoom:[{zoom:[yn,fe,ce]}],accent:[{accent:Q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",fe,ce]}],"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":Q()}],"scrollbar-track-color":[{"scrollbar-track":Q()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mbs":[{"scroll-mbs":D()}],"scroll-mbe":[{"scroll-mbe":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pbs":[{"scroll-pbs":D()}],"scroll-pbe":[{"scroll-pbe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",fe,ce]}],fill:[{fill:["none",...Q()]}],"stroke-w":[{stroke:[_e,ts,Wi,vg]}],stroke:[{stroke:["none",...Q()]}],"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"]}},hS=(l,{cacheSize:i,prefix:a,experimentalParseClassName:o,extend:r={},override:u={}})=>(Vl(l,"cacheSize",i),Vl(l,"prefix",a),Vl(l,"experimentalParseClassName",o),Io(l.theme,u.theme),Io(l.classGroups,u.classGroups),Io(l.conflictingClassGroups,u.conflictingClassGroups),Io(l.conflictingClassGroupModifiers,u.conflictingClassGroupModifiers),Vl(l,"postfixLookupClassGroups",u.postfixLookupClassGroups),Vl(l,"orderSensitiveModifiers",u.orderSensitiveModifiers),Fo(l.theme,r.theme),Fo(l.classGroups,r.classGroups),Fo(l.conflictingClassGroups,r.conflictingClassGroups),Fo(l.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),cd(l,r,"postfixLookupClassGroups"),cd(l,r,"orderSensitiveModifiers"),l),Vl=(l,i,a)=>{a!==void 0&&(l[i]=a)},Io=(l,i)=>{if(i)for(const a in i)Vl(l,a,i[a])},Fo=(l,i)=>{if(i)for(const a in i)cd(l,i,a)},cd=(l,i,a)=>{const o=i[a];o!==void 0&&(l[a]=l[a]?l[a].concat(o):o)},mS=(l,...i)=>typeof l=="function"?yg(Sg,l,...i):yg(()=>hS(Sg(),l),...i),pS=mS({extend:{classGroups:{"font-size":[{text:["tui","tui-sm","tui-lg"]}]}}});function ne(...l){return pS(T1(l))}const ke={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},sn={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"}},ia={ok:sn.ok.text,warn:sn.warn.text,bad:sn.bad.text,idle:sn.idle.text,accent:sn.accent.text,alt:sn.alt.text,info:sn.info.text},Bt=({level:l,className:i})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none leading-none",ia[l],i),children:l==="idle"?ke.off:ke.on}),Rd=({className:l})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none text-tui-faint",l),children:ke.dot}),ay={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"},Tt=({title:l,aside:i,tone:a="accent",className:o,bodyClassName:r,children:u,...h})=>f.jsxs("fieldset",{className:ne("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",l?"px-3 pb-3 pt-1":"p-3",o),...h,children:[l?f.jsx("legend",{className:ne("flex items-center gap-2 text-tui font-bold",ia[a]),children:f.jsx("span",{children:l})}):null,i?f.jsx("span",{className:"pointer-events-none absolute -top-[10px] right-2 max-w-[60%] truncate bg-tui-base px-1 text-tui-sm text-tui-faint",children:i}):null,f.jsx("div",{className:ne("min-w-0",r),children:u})]}),Ci=({label:l,labelWidth:i=16,className:a,children:o})=>f.jsxs("div",{className:ne("flex items-baseline gap-2 text-tui",a),children:[f.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${i}ch`},title:typeof l=="string"?l:void 0,children:l}),f.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:o})]}),gS=({className:l,label:i})=>i?f.jsxs("div",{className:ne("flex items-center gap-2",l),children:[f.jsx("span",{className:"h-px w-3 bg-tui-border-dim","aria-hidden":"true"}),f.jsx("span",{className:"text-tui-sm text-tui-faint",children:i}),f.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):f.jsx("div",{className:ne("h-px w-full bg-tui-border-dim",l),"aria-hidden":"true"}),Mi=({tone:l="accent",className:i,children:a,action:o})=>{const r=l==="ok"?ke.check:l==="bad"?ke.cross:l==="warn"?ke.warn:"›",u=sn[l].edgeL;return f.jsxs("div",{className:ne("flex items-start gap-2 border border-tui-border-dim border-l-2 bg-tui-mantle px-2 py-1.5 text-tui",u,i),children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",ia[l]),children:r}),f.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:a}),o?f.jsx("div",{className:"shrink-0",children:o}):null]})},bS={default:"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",primary:"border-tui-accent text-tui-accent hover:bg-tui-accent hover:text-tui-crust active:bg-tui-accent-dim",danger:"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust active:bg-tui-bad",warn:"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust active:bg-tui-warn",ghost:"border-transparent text-tui-muted hover:text-tui-accent hover:border-tui-border active:bg-tui-selection disabled:border-transparent"},Me=({variant:l="default",brackets:i=!0,glyph:a,block:o=!1,className:r,children:u,type:h="button",...p})=>f.jsxs("button",{type:h,className:ne("tui-focusable inline-flex select-none items-center justify-center gap-1.5 border bg-transparent px-2 py-0.5 text-tui font-medium transition-colors","disabled:cursor-not-allowed disabled:border-tui-border-dim disabled:text-tui-faint disabled:hover:bg-transparent",bS[l],o&&"w-full",r),...p,children:[i?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,a?f.jsx("span",{"aria-hidden":"true",className:"leading-none",children:a}):null,f.jsx("span",{className:"truncate",children:u}),i?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),_d=({tone:l="accent",dot:i=!1,className:a,children:o})=>f.jsxs("span",{className:ne("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",ia[l],a),children:[i?f.jsx(Bt,{level:l}):null,o]}),jd=({tabs:l,activeId:i,onSelect:a,ariaLabel:o,className:r,labelClassName:u})=>f.jsx("nav",{className:ne("flex items-center gap-2",r),"aria-label":o,children:l.map((h,p)=>{const m=h.id===i;return f.jsxs(Vn.Fragment,{children:[p>0?f.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:ke.tabDivider}):null,f.jsxs("button",{type:"button",onClick:()=>a(h.id),"aria-current":m?"page":void 0,"aria-label":h.ariaLabel??h.label,title:h.title,className:ne("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",m?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[h.index!==void 0?f.jsx("span",{"aria-hidden":"true",className:ne("text-tui-faint",m&&"text-tui-accent"),children:h.index}):null,f.jsx("span",{"aria-hidden":"true",className:ne("ml-1",u),children:h.label})]})]},h.id)})}),sy=({hints:l,className:i})=>f.jsx("div",{className:ne("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",i),children:l.map(a=>f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("kbd",{className:"border border-tui-border-dim px-1 not-italic text-tui-muted",children:a.keys}),f.jsx("span",{children:a.action})]},`${a.keys} ${a.action}`))}),oy=({active:l=!1,className:i,children:a})=>f.jsx("span",{className:ne("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",l?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",i),children:a}),Gn=({htmlFor:l,hint:i,className:a,children:o})=>f.jsxs("label",{htmlFor:l,className:ne("block text-tui-sm font-bold text-tui-muted",a),children:[o,i?f.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:i}):null]}),Et=Vn.forwardRef(({className:l,...i},a)=>f.jsx("input",{ref:a,className:ne("tui-input w-full px-2 py-1 text-tui",l),...i}));Et.displayName="Input";const dr=Vn.forwardRef(({className:l,children:i,...a},o)=>f.jsx("select",{ref:o,className:ne("tui-input w-full px-2 py-1 text-tui",l),...a,children:i}));dr.displayName="Select";const yS=({checked:l,onChange:i,disabled:a=!1,label:o,description:r,className:u,id:h})=>f.jsxs("label",{className:ne("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",a&&"cursor-not-allowed opacity-60",u),children:[f.jsx("input",{id:h,type:"checkbox",className:"sr-only",checked:l,disabled:a,onChange:p=>i(p.target.checked)}),f.jsx("span",{"aria-hidden":"true",className:ne("mt-px shrink-0 font-bold leading-tight",l?"text-tui-ok":"text-tui-faint",!a&&"group-hover:text-tui-accent"),children:l?"[x]":"[ ]"}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:ne("block",l?"text-tui-text":"text-tui-muted"),children:o}),r?f.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:r}):null]})]}),fr="h-8",hn=({title:l,aside:i,className:a,children:o})=>f.jsxs("section",{className:ne("min-w-0",a),children:[f.jsxs("div",{className:"flex min-h-[var(--tui-row)] items-center gap-2 border-b border-tui-border pb-1",children:[f.jsx("h3",{className:"text-tui font-bold text-tui-accent",children:l}),i?f.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:i}):null]}),f.jsx("div",{className:"divide-y divide-tui-border-dim",children:o})]}),Ht=({label:l,hint:i,htmlFor:a,control:o,className:r})=>f.jsxs("div",{className:ne("flex flex-col gap-1 py-1.5 sm:flex-row sm:items-center sm:gap-4",r),children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[a?f.jsx("label",{htmlFor:a,className:"block text-tui text-tui-text",children:l}):f.jsx("span",{className:"block text-tui text-tui-text",children:l}),i?f.jsx("span",{className:"block text-tui-sm leading-snug text-tui-faint",children:i}):null]}),f.jsx("div",{className:"w-full shrink-0 sm:w-[20rem]",children:o})]}),ud="flex min-w-0 cursor-pointer select-none items-center justify-center px-1 text-tui transition-colors has-[:focus-visible]:outline has-[:focus-visible]:outline-1 has-[:focus-visible]:-outline-offset-2 has-[:focus-visible]:outline-tui-text",dd="text-tui-muted hover:bg-tui-selection hover:text-tui-text";function Cg({name:l,value:i,options:a,onChange:o,tone:r="accent",className:u,"aria-label":h}){return f.jsx("div",{role:"radiogroup","aria-label":h,className:ne("grid w-full border border-tui-border bg-tui-mantle",fr,u),style:{gridTemplateColumns:`repeat(${a.length}, minmax(max-content, 1fr))`},children:a.map((p,m)=>{const g=p.value===i;return f.jsxs("label",{className:ne(ud,m>0&&"border-l border-tui-border",g?ne(ay[r],"font-bold text-tui-crust"):dd),children:[f.jsx("input",{type:"radio",name:l,value:p.value,className:"sr-only",checked:g,onChange:()=>o(p.value)}),f.jsx("span",{className:"whitespace-nowrap",children:p.label})]},p.value)})})}const Si=({checked:l,onChange:i,label:a,offLabel:o,onLabel:r,disabled:u=!1,className:h})=>{const p=m=>g=>{g.preventDefault(),!(u||m===l)&&i(m)};return f.jsxs("label",{className:ne("grid w-full grid-cols-2 border border-tui-border bg-tui-mantle has-[:focus-visible]:outline has-[:focus-visible]:outline-1 has-[:focus-visible]:outline-tui-accent",fr,u&&"cursor-not-allowed opacity-60",h),children:[f.jsx("input",{type:"checkbox",className:"sr-only","aria-label":a,checked:l,disabled:u,onChange:m=>i(m.target.checked)}),f.jsx("span",{"aria-hidden":"true",onClick:p(!1),className:ne(ud,l?dd:"bg-tui-selection font-bold text-tui-text"),children:o}),f.jsx("span",{"aria-hidden":"true",onClick:p(!0),className:ne(ud,"border-l border-tui-border",l?"bg-tui-ok font-bold text-tui-crust":dd),children:r})]})},nl=({variant:l="neutral",className:i,type:a="button",children:o,...r})=>f.jsx("button",{type:a,className:ne("tui-focusable inline-flex h-7 w-7 shrink-0 select-none items-center justify-center border border-transparent text-tui transition-colors","disabled:cursor-not-allowed disabled:text-tui-border disabled:hover:border-transparent disabled:hover:bg-transparent",l==="danger"?"text-tui-bad hover:border-tui-bad":"text-tui-muted hover:border-tui-border hover:text-tui-accent",i),...r,children:o}),vS=({value:l,width:i=20,tone:a="accent",className:o})=>{const r=Number.isFinite(l)?Math.min(1,Math.max(0,l)):0,u=Math.round(r*i);return f.jsxs("span",{className:ne("inline-flex select-none whitespace-pre font-mono leading-none",o),role:"presentation",children:[f.jsx("span",{className:ia[a],children:ke.meterFull.repeat(u)}),f.jsx("span",{className:"text-tui-border",children:ke.meterEmpty.repeat(Math.max(0,i-u))})]})},xS=({ratio:l,label:i,tone:a="accent",className:o,...r})=>{const u=Number.isFinite(l)?Math.min(1,Math.max(0,l)):0;return f.jsxs("div",{className:ne("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",o),role:"progressbar","aria-valuenow":Math.round(u*100),"aria-valuemin":0,"aria-valuemax":100,...r,children:[f.jsx("div",{className:ne("absolute inset-y-0 left-0",ay[a]),style:{width:`${u*100}%`},"aria-hidden":"true"}),i!==void 0?f.jsx("span",{className:"absolute inset-0 flex items-center justify-center whitespace-nowrap px-1 text-tui font-bold text-tui-text mix-blend-difference",children:i}):null]})},Yl=({label:l,value:i,sub:a,tone:o,title:r,className:u})=>f.jsxs("div",{className:ne("min-w-0 border border-tui-border bg-tui-base px-2.5 py-1.5",u),title:r,children:[f.jsx("div",{className:"truncate text-tui-sm text-tui-muted",children:l}),f.jsx("div",{className:ne("truncate text-tui-lg font-bold",o?ia[o]:"text-tui-text"),children:i}),f.jsx("div",{className:"truncate text-tui-sm text-tui-faint",children:a||" "})]}),Tg=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],il=({className:l,label:i})=>{const[a,o]=Vn.useState(0);return Vn.useEffect(()=>{const r=setInterval(()=>o(u=>(u+1)%Tg.length),90);return()=>clearInterval(r)},[]),f.jsxs("span",{className:ne("inline-flex items-center gap-1.5",l),role:"status",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:Tg[a]}),i?f.jsx("span",{children:i}):null]})};function Od({columns:l,items:i,rowKey:a,empty:o,className:r}){return i.length===0?f.jsx("div",{className:ne("px-1 py-4 text-center text-tui text-tui-faint",r),children:o}):f.jsx("div",{className:ne("w-full overflow-x-auto",r),children:f.jsxs("table",{className:"w-full border-collapse text-tui",children:[f.jsx("thead",{children:f.jsx("tr",{className:"border-b border-tui-border",children:l.map(u=>f.jsx("th",{scope:"col",style:u.width?{width:`${u.width}ch`}:void 0,className:ne("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",u.align==="right"?"text-right":"text-left",u.className),children:u.header},u.key))})}),f.jsx("tbody",{children:i.map((u,h)=>f.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:l.map(p=>f.jsx("td",{className:ne("px-2 py-1 align-top text-tui-text",p.align==="right"?"text-right":"text-left",p.className),children:p.render(u,h)},p.key))},a(u,h)))})]})})}var wS=ab();const hr=({isOpen:l,onClose:i,title:a,subtitle:o,closeLabel:r,footer:u,hints:h,size:p="md",fixedHeight:m=!1,className:g,children:b})=>{if(!l)return null;const v=p==="sm"?"max-w-md":p==="lg"?"max-w-3xl":"max-w-xl",w=`tui-modal-${a.replace(/\s+/g,"-").toLowerCase()}`,x=f.jsx("div",{className:"fixed inset-0 inset-x-0 z-50 flex items-center justify-center overflow-hidden bg-tui-crust/85 p-3 sm:p-6",style:{height:"var(--app-height, 100dvh)",width:"100vw"},role:"dialog","aria-modal":"true","aria-labelledby":w,onMouseDown:T=>{T.target===T.currentTarget&&i()},children:f.jsxs("div",{className:ne("relative flex max-h-full w-full flex-col border border-tui-border bg-tui-base",v,m&&"h-[46rem]",g),children:[f.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-tui-border bg-tui-mantle px-3 py-1.5",children:[f.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2",children:[f.jsx("h2",{id:w,className:"break-words text-tui font-bold text-tui-accent",children:a}),o?f.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint",children:o}):null]}),f.jsx(Me,{variant:"ghost",onClick:i,"aria-label":r,title:r,children:"esc"})]}),f.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-3",children:b}),u||h?f.jsxs("footer",{className:"flex shrink-0 flex-wrap items-center justify-between gap-2 border-t border-tui-border bg-tui-mantle px-3 py-1.5",children:[h?f.jsx(sy,{hints:h}):f.jsx("span",{}),u?f.jsx("div",{className:"flex items-center gap-2",children:u}):null]}):null]})});return typeof document>"u"?x:wS.createPortal(x,document.body)},fd=({items:l,className:i})=>{const a=l.filter(Boolean);return f.jsx("span",{className:ne("flex min-w-0 items-center gap-1.5",i),children:a.map((o,r)=>f.jsxs(Vn.Fragment,{children:[r>0?f.jsx(Rd,{className:"shrink-0"}):null,o]},r))})},ry=({left:l,right:i,className:a})=>f.jsxs("footer",{className:ne("relative flex h-[var(--tui-row)] w-full shrink-0 items-center justify-between gap-3 overflow-visible border-t border-tui-border bg-tui-mantle px-2 text-tui-sm",a),children:[f.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:l}),f.jsx("div",{className:"flex shrink-0 items-center gap-3",children:i})]}),SS=({name:l,tagline:i,aside:a,tabs:o,activeTabId:r,onSelectTab:u,tabsAriaLabel:h,toolbarStart:p,toolbarAside:m,hints:g,footerAside:b,bodyClassName:v,className:w,children:x})=>{const T=!!(o&&o.length>0&&r!==void 0&&u);return f.jsxs("div",{className:ne("flex h-full min-h-0 w-full flex-col bg-tui-crust",w),children:[l?f.jsxs("div",{className:"flex h-[var(--tui-row)] shrink-0 items-center justify-between gap-3 overflow-hidden border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[f.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[f.jsx("span",{className:"shrink-0 font-bold text-tui-accent",children:l}),i?f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:i}):null]}),a?f.jsx("span",{className:"flex shrink-0 items-center gap-2",children:a}):null]}):null,T||p||m?f.jsxs("div",{className:"flex min-h-[var(--tui-row)] shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border bg-tui-mantle px-2 py-1",children:[p?f.jsx("div",{className:"flex shrink-0 items-center",children:p}):null,T?f.jsx("div",{className:"scrollbar-none order-last min-w-0 basis-full overflow-x-auto sm:order-none sm:basis-auto",children:f.jsx(jd,{tabs:o,activeId:r,onSelect:u,ariaLabel:h,className:"gap-3"})}):null,m?f.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:m}):null]}):null,f.jsx("div",{className:ne("min-h-0 flex-1 overflow-y-auto p-2",v),children:x}),g||b?f.jsx(ry,{left:g?f.jsx(sy,{hints:g}):null,right:b}):null]})},Go="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",Yo="text-tui-muted hover:border-tui-border hover:text-tui-accent",CS="border-tui-accent bg-tui-accent text-tui-crust",TS=({currentView:l,onNavigate:i,onOpenPairing:a,onOpenSettings:o,onToggleVirtualKeyboard:r,isVirtualKeyboardOpen:u})=>{const{language:h,setLanguage:p,t:m}=Le(),{addToast:g}=rn(),b=()=>{const w=h==="zh"?"en":"zh";p(w),g("info",Cd(w,"toasts.switchedLanguage",{lang:w==="zh"?"简体中文":"English"}))},v=[{id:"terminal",label:m("header.terminalTab"),index:1,ariaLabel:m("header.terminalTab")},...l==="admin"?[{id:"admin",label:m("header.adminTab"),index:2,ariaLabel:m("header.adminTab")}]:[]];return f.jsx("header",{className:"z-30 w-full shrink-0 select-none overflow-hidden border-b border-tui-border bg-tui-mantle px-2 pt-[max(env(safe-area-inset-top,0px),0.125rem)]",children:f.jsxs("div",{className:"scrollbar-none flex min-h-[var(--tui-row)] items-center gap-2 overflow-x-auto text-tui",children:[f.jsxs("span",{className:"flex shrink-0 items-baseline gap-2",children:[f.jsx("span",{className:"font-bold text-tui-accent",children:"herdr-remote"}),f.jsx("span",{className:"hidden text-tui-sm text-tui-faint sm:inline",children:m("header.tagline")})]}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsx(jd,{tabs:v,activeId:l,onSelect:w=>i(w),ariaLabel:m("header.mainNavigationAria"),className:"shrink-0 gap-3"}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[f.jsx("button",{type:"button",onClick:b,className:ne(Go,Yo),title:m("header.languageToggleTitle"),"aria-label":m("header.languageToggleTitle"),children:m("header.languageShort")}),l==="terminal"&&f.jsx("button",{type:"button",onClick:r,className:ne(Go,u?CS:Yo),title:m("header.virtualKeyboardTitle"),"aria-label":m("header.virtualKeyboardTitle"),children:m("header.actionKeyboard")}),f.jsx("button",{type:"button",onClick:a,className:ne(Go,Yo),title:m("header.pairingTitle"),"aria-label":m("header.pairingTitle"),children:m("header.actionPairing")}),f.jsx("button",{type:"button",onClick:o,className:ne(Go,Yo),title:m("header.settingsTitle"),"aria-label":m("header.settingsTitle"),children:m("header.actionSettings")})]})]})})},$o=({tone:l,glyph:i,message:a,assertive:o=!1,action:r})=>f.jsxs("aside",{className:ne("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",sn[l].edgeB),"aria-live":o?"assertive":"polite",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",sn[l].text),children:i}),f.jsx("span",{className:"truncate text-tui-text",children:a})]}),r]}),MS=()=>{const{settings:l,t:i}=Le(),{connectionState:a,stateDetail:o,connect:r}=et();return a==="connected"||!l.token&&!l.pairCode&&a==="disconnected"?null:a==="connecting"?f.jsx($o,{tone:"accent",glyph:f.jsx(il,{}),message:i("statusBanner.connecting")}):a==="reconnecting"?f.jsx($o,{tone:"warn",glyph:f.jsx(il,{}),assertive:!0,message:o||i("statusBanner.reconnectingDefault"),action:f.jsx(Me,{variant:"warn",onClick:()=>r(),className:"shrink-0",children:i("statusBanner.reconnectNow")})}):a==="error"?f.jsx($o,{tone:"bad",glyph:ke.cross,assertive:!0,message:o||i("statusBanner.errorDefault"),action:f.jsx(Me,{variant:"danger",onClick:()=>r(),className:"shrink-0",children:i("common.retry")})}):a==="disconnected"?f.jsx($o,{tone:"idle",glyph:ke.off,message:i("statusBanner.disconnected"),action:f.jsx(Me,{variant:"primary",onClick:()=>r(),className:"shrink-0",children:i("common.connect")})}):null},Fu="Herdr Remote",Mg=80,AS=/[\u0000-\u001F\u007F-\u009F]/g;function hd(l){if(typeof l!="string")return"";const i=l.replace(AS," ").replace(/\s+/g," ").trim();return i.length<=Mg?i:`${i.slice(0,Mg-1).trimEnd()}…`}function ES(l,i,a){const o=h1(a??null),r=o?`${o} `:"",u=hd(l);if(u)return`${r}${u} · ${Fu}`;const h=hd(i);return h?`${r}${h} · ${Fu}`:`${r}${Fu}`}function NS(l,i,a){const o=ES(l,i,a);return typeof document<"u"&&(document.title=o),o}const kS=new Set(["http:","https:","mailto:"]),Gu=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,LS=/[.,;:!?'"]+$/,Ag=8;function Dd(l){return/^www\./i.test(l)?`https://${l}`:l}function RS(l){const i=(r,u)=>r.split(u).length-1;let a=l.replace(LS,"");const o=[["(",")"],["[","]"],["{","}"]];for(const[r,u]of o)for(;a.endsWith(u)&&i(a,u)>i(a,r);)a=a.slice(0,-1);return a}function cy(l){if(typeof l!="string"||l.length===0)return!1;try{return kS.has(new URL(Dd(l)).protocol)}catch{return!1}}function _S(l,i){if(typeof l!="string"||i<0)return null;Gu.lastIndex=0;for(let a=Gu.exec(l);a;a=Gu.exec(l)){const o=RS(a[0]);if(!o)continue;const r=a.index,u=r+o.length;if(i>=r&&i<u&&cy(o))return o}return null}function jS(l,i,a){var p;const o=(p=l==null?void 0:l.buffer)==null?void 0:p.active;if(!o||typeof o.getLine!="function"||!o.getLine(a))return null;let r=a;for(let m=0;m<Ag;m+=1){const g=o.getLine(r);if(!(g!=null&&g.isWrapped)||r===0)break;r-=1}let u="",h=-1;for(let m=r;m<r+Ag;m+=1){const g=o.getLine(m);if(!g||m>r&&!g.isWrapped)break;m===a&&(h=u.length+i),u+=g.translateToString(!1)}return h<0?null:{text:u,index:h}}function OS(l,i,a){const o=jS(l,i,a);return o?_S(o.text,o.index):null}function DS(l){try{const i=new URL(Dd(l));return i.host||i.pathname}catch{return""}}function md(l){return!cy(l)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(Dd(l),"_blank","noopener,noreferrer"),!0)}async function zd(l){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(l),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let i=null,a=null,o=null;try{if(i=document.createElement("textarea"),i.style.userSelect="text",i.style.webkitUserSelect="text",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="1px",i.style.height="1px",i.style.padding="0",i.style.border="none",i.style.outline="none",i.style.boxShadow="none",i.style.background="transparent",i.style.opacity="0",i.style.fontSize="16px",i.setAttribute("readonly",""),i.setAttribute("aria-hidden","true"),i.value=l,typeof window<"u"&&typeof window.getSelection=="function"&&(o=window.getSelection(),o&&o.rangeCount>0&&(a=o.getRangeAt(0))),document.body.appendChild(i),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const h=document.createRange();h.selectNodeContents(i),o&&(o.removeAllRanges(),o.addRange(h)),i.setSelectionRange(0,l.length)}else i.focus({preventScroll:!0}),i.select();if(document.execCommand("copy"))return"exec"}catch{}finally{i!=null&&i.parentNode&&i.parentNode.removeChild(i),o&&(o.removeAllRanges(),a&&o.addRange(a))}}return"failed"}async function zS(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.readText();return!i||i.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:i}}catch(i){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(i==null?void 0:i.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function HS(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.read();if(!i||i.length===0)return{ok:!1,reason:"empty"};for(const a of i){const o=a.types.find(r=>r.startsWith("image/"));if(o){const r=await a.getType(o);if(r&&r.size>0)return{ok:!0,blob:r}}}return{ok:!1,reason:"empty"}}catch(i){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const a=i==null?void 0:i.name;return a==="SecurityError"?{ok:!1,reason:"insecure"}:a==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function uy(l){const i=l.clipboardData;if(!i)return null;if(i.files&&i.files.length>0)for(let a=0;a<i.files.length;a++){const o=i.files[a];if(o!=null&&o.type.startsWith("image/"))return o}if(i.items&&i.items.length>0)for(let a=0;a<i.items.length;a++){const o=i.items[a];if(o!=null&&o.type.startsWith("image/")){const r=o.getAsFile();if(r)return r}}return null}function BS(l){if(!l||l.length===0)return null;for(let i=0;i<l.length;i++){const a=l[i];if(a&&(a.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(a.name)))return a}return null}const US=({isOpen:l,onClose:i,onSend:a,onSendImage:o})=>{const{t:r}=Le(),{addToast:u}=rn(),[h,p]=C.useState(""),[m,g]=C.useState(null),[b,v]=C.useState(!1),w=C.useRef(null),x=C.useRef(null),T=C.useRef(null);C.useEffect(()=>{l&&(p(""),g(null),v(!1),w.current&&(w.current.value=""),x.current&&(x.current.value=""))},[l]);const M=async z=>{if(z.size===0){u("error",r("clipboard.fileEmpty"));return}v(!0);try{const L=await kb(z);L?(g(L),p("")):u("error",r("clipboard.imageTooLarge"))}catch(L){console.error("Failed to process image:",L),u("error",r("clipboard.imageTooLarge"))}finally{v(!1)}},A=async z=>{const L=uy(z);L&&(z.preventDefault(),await M(L))},R=async z=>{const L=BS(z.target.files);z.target.value="",L&&await M(L)},k=z=>{const L=z.target.value;p(L),L&&m&&g(null)},O=()=>{g(null),w.current&&(w.current.value=""),x.current&&(x.current.value="")},$=()=>{m?(o==null||o(m),i()):h.trim()&&(a(h),i())},_=!!(h.trim()||m);return f.jsx(hr,{isOpen:l,onClose:i,title:r("clipboard.pasteTitle"),closeLabel:r("clipboard.cancel"),size:"sm",footer:f.jsxs("div",{className:"flex items-center justify-end gap-2",children:[f.jsx(Me,{variant:"ghost",onClick:i,children:r("clipboard.cancel")}),f.jsx(Me,{variant:"primary",onClick:$,disabled:!_||b,children:r("clipboard.pasteSend")})]}),children:f.jsxs("div",{className:"flex flex-col gap-3 p-3 font-mono select-text",children:[f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsx("label",{htmlFor:"paste-fallback-input",className:"text-tui-sm text-tui-muted font-sans font-medium",children:r("clipboard.pasteHint")}),f.jsx("textarea",{ref:T,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:r("clipboard.pasteHint"),value:h,onChange:k,onPaste:A,disabled:!!m||b,className:"tui-input min-h-[90px] w-full resize-none p-2 text-tui font-mono rounded border border-tui-border bg-tui-bg focus:outline-none focus:ring-1 focus:ring-tui-accent disabled:opacity-50"})]}),f.jsxs("div",{className:"relative my-1",children:[f.jsx("div",{className:"absolute inset-0 flex items-center",children:f.jsx("div",{className:"w-full border-t border-tui-border"})}),f.jsx("div",{className:"relative flex justify-center text-tui-xs uppercase",children:f.jsx("span",{className:"bg-tui-bg px-2 text-tui-muted font-sans",children:r("clipboard.imageSectionTitle")})})]}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx("input",{ref:w,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:R}),f.jsx("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:R}),m?f.jsxs("div",{className:"flex flex-col items-center gap-2 p-3 border border-tui-border bg-tui-bg rounded",children:[f.jsx("img",{src:m.dataUrl,alt:"Pasted preview","data-testid":"pasted-image-preview",className:"max-h-40 max-w-full object-contain rounded border border-tui-border"}),f.jsxs("div",{className:"flex items-center justify-between w-full text-tui-xs text-tui-muted pt-1",children:[f.jsx("span",{children:r("clipboard.imageCompressedSize",{size:Iw(m.byteLength)})}),f.jsx(Me,{variant:"ghost",onClick:O,"aria-label":r("clipboard.removeImage"),children:r("clipboard.cancel")})]})]}):f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Me,{variant:"default",onClick:()=>{var z;return(z=w.current)==null?void 0:z.click()},disabled:b||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.chooseImage"),children:r("clipboard.chooseImage")}),f.jsx(Me,{variant:"default",onClick:()=>{var z;return(z=x.current)==null?void 0:z.click()},disabled:b||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.takePhoto"),children:r("clipboard.takePhoto")})]}),b&&f.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:f.jsx("span",{children:r("clipboard.imageCompressing")})})]})]})})},$l="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",ql="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",KS=({anchorPoint:l,hasSelection:i,isController:a,vibrateOnKeyPress:o=!1,linkUrl:r=null,onOpenLink:u,onCopySelection:h,onCopyLine:p,onCopyScreen:m,onPaste:g,onClose:b})=>{const{t:v}=Le(),w=C.useRef(null),[x,T]=C.useState(null);C.useEffect(()=>{if(o&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[o]),C.useLayoutEffect(()=>{const k=w.current;if(!(k!=null&&k.parentElement))return;const O=k.parentElement.getBoundingClientRect(),$=k.getBoundingClientRect(),_=$.width||208,z=$.height||220,L=O.width,D=O.height;let K=l.x-_/2;K=Math.max(8,Math.min(Math.max(8,L-_-8),K));let J=l.y-z-8;J<8&&(J=l.y+8),J=Math.max(8,Math.min(Math.max(8,D-z-8),J)),T({x:K,y:J})},[l.x,l.y,i,a,r]);const M=Math.max(8,l.x-104),A=Math.max(8,l.y-200),R={position:"absolute",left:`${x?x.x:M}px`,top:`${x?x.y:A}px`,visibility:x?"visible":"hidden"};return f.jsx("div",{ref:w,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:R,onMouseDown:k=>k.stopPropagation(),onTouchStart:k=>k.stopPropagation(),onPointerDown:k=>k.stopPropagation(),children:f.jsxs(Tt,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[r&&u&&f.jsxs("button",{type:"button",role:"menuitem",className:ne($l,ql),onClick:()=>{u(r),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.openLink")}),f.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:DS(r)})]}),i&&f.jsxs("button",{type:"button",role:"menuitem",className:ne($l,ql),onClick:()=>{h(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copySelection")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne($l,ql),onClick:()=>{p(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyLine")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne($l,ql),onClick:()=>{m(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyScreen")})]}),a&&f.jsxs("button",{type:"button",role:"menuitem",className:ne($l,ql),onClick:()=>{g(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.paste")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne($l,ql),onClick:b,children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.cancel")})]})]})})},IS={state:"idle",deltaY:0,lines:0,viewportY:null,scrollTop:null,scrollHeight:null,clientHeight:null,moved:!1,focused:!1,bufferType:null,baseY:null,cursorY:null,hasScrollback:null,mouseTracking:!1,scrollMode:"none",scrollCalls:0,lastScrollLines:null,lastInputEvent:"",pointerEvents:0,touchEvents:0};function FS(){return typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1"}function GS(l){const i=C.useRef([]),[a,o]=C.useState({framesPerSec:0,bytesPerSec:0}),r=C.useCallback(h=>{const p=h-1e3,m=i.current;for(;m.length>0&&m[0].time<p;)m.shift()},[]);C.useEffect(()=>{if(!l)return;const h=setInterval(()=>{r(performance.now());let p=0;for(const m of i.current)p+=m.bytes;o({framesPerSec:i.current.length,bytesPerSec:p})},1e3);return()=>clearInterval(h)},[l,r]);const u=C.useCallback(h=>{const p=performance.now();i.current.push({time:p,bytes:h}),r(p)},[r]);return{metrics:a,record:u}}function YS(l){return l?`${l.kind} row ${l.row} cols ${l.startCol}-${l.endCol} caret ${l.caretCol}`:"none"}function $S(l){var o;const i=(o=l==null?void 0:l.canvas)==null?void 0:o.stats;if(!i)return`paint: ${(l==null?void 0:l.kind)??"-"} renderer
34
34
  `;const a=i.lastInputToPaintMs!==null?`${i.lastInputToPaintMs.toFixed(1)}ms`:"-";return`paint: ${i.lastPaintMs.toFixed(2)}ms cells: ${i.lastCells} frames: ${i.frames} held: ${i.heldFrames} key→paint: ${a}
35
- `}function $S(l){const i=(l==null?void 0:l.getTrace())??[];return i.length===0?"trace: -":`trace:
35
+ `}function qS(l){const i=(l==null?void 0:l.getTrace())??[];return i.length===0?"trace: -":`trace:
36
36
  ${i.slice(-6).map(a=>` ${a.event}${a.count>1?` ×${a.count}`:""}`).join(`
37
- `)}`}const qS=({debug:l,rttMs:i,metrics:a,rendererKind:o,predictiveEcho:r,predictor:u,field:h,renderer:p})=>{const m=u==null?void 0:u.getEchoSrttMs();return f.jsxs("pre",{"data-testid":"terminal-touch-debug",className:"pointer-events-none absolute left-1 top-1 z-50 border border-tui-border bg-tui-crust/90 px-2 py-1 font-mono text-tui-sm leading-relaxed text-tui-muted","aria-hidden":"true",children:[`gesture: ${l.state}
37
+ `)}`}const VS=({debug:l,rttMs:i,metrics:a,rendererKind:o,predictiveEcho:r,predictor:u,field:h,renderer:p})=>{const m=u==null?void 0:u.getEchoSrttMs();return f.jsxs("pre",{"data-testid":"terminal-touch-debug",className:"pointer-events-none absolute left-1 top-1 z-50 border border-tui-border bg-tui-crust/90 px-2 py-1 font-mono text-tui-sm leading-relaxed text-tui-muted","aria-hidden":"true",children:[`gesture: ${l.state}
38
38
  `,`deltaY: ${l.deltaY} lines: ${l.lines}
39
39
  `,`viewportY: ${l.viewportY??"-"} focus: ${l.focused}
40
40
  `,`buffer: ${l.bufferType??"-"} base: ${l.baseY??"-"} cursor: ${l.cursorY??"-"} scrollback: ${l.hasScrollback??"-"}
@@ -43,11 +43,11 @@ ${i.slice(-6).map(a=>` ${a.event}${a.count>1?` ×${a.count}`:""}`).join(`
43
43
  `,`event: ${l.lastInputEvent||"-"} pointer: ${l.pointerEvents} touch: ${l.touchEvents}
44
44
  `,`rtt: ${i!==null?`${i}ms`:"-"} frames/s: ${a.framesPerSec} bytes/s: ${a.bytesPerSec} renderer: ${o??"-"}
45
45
  `,`prediction: ${(u==null?void 0:u.getState())??"-"} mode: ${r} pending: ${(u==null?void 0:u.getVisiblePredictions().length)??0} srtt: ${m!=null?`${Math.round(m)}ms`:"-"}
46
- `,`field: ${GS(h)} mismatches: ${(u==null?void 0:u.getMismatchCount())??0}
47
- `,YS(p),$S(u)]})};function Yn(l){const i=C.useRef(l);return i.current=l,i}function VS(l){const i=Yn(l),{termRef:a,subscribeToPasteFileReady:o}=l,[r,u]=C.useState(!1),h=C.useCallback((v,w)=>{i.current.onPaste(),v.paste(w),i.current.addToast("success",i.current.t("clipboard.pasted"))},[i]),p=C.useCallback(()=>{const v=a.current;return v?i.current.isController?v:(i.current.warnViewerMode(),null):null},[a,i]),m=C.useCallback(async()=>{const v=p();if(v){try{const w=await zS();if(w.ok){await i.current.uploadImage(w.blob);return}}catch{}try{const w=await DS();if(w.ok){h(v,w.text);return}else if(w.reason==="empty"){i.current.addToast("info",i.current.t("clipboard.pasteUnavailable"));return}}catch{}u(!0)}},[p,h,i]),g=C.useCallback(v=>{const w=p();w&&h(w,v)},[p,h]),b=C.useCallback(v=>{p()&&i.current.uploadImage(v)},[p,i]);return C.useEffect(()=>o(v=>{const w=a.current;w&&h(w,v)}),[o,a,h]),{isPasteFallbackOpen:r,closePasteFallback:()=>u(!1),handlePaste:m,handleFallbackPasteSend:g,handleFallbackImageSend:b}}const Jo=new Set(["│","┃","║","▐","▕","▏","▌"]),or=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),PS=new Set(["╭","┌","┏","╔"]),XS=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),QS=new Set(["╮","┐","┓","╗"]),ZS=new Set(["╰","└","┗","╚"]),WS=new Set(["╯","┘","┛","╝"]),Yu=new Set(["─","━","═","╌","┄"]),JS=new Set(["❯","›",">","!"]),Mg=new Set(["$","#","%",">","❯","›","➜","λ","»"]);function Ql(l){return l===""||l===" "||l===" "}class eC{constructor(i){W(this,"cell");W(this,"top");W(this,"bottom");var a;this.screen=i,this.cell=(a=i.getNullCell)==null?void 0:a.call(i),this.top=i.baseY,this.bottom=i.baseY+i.rows-1}get cols(){return this.screen.cols}at(i,a){var o;if(!(i<this.top||i>this.bottom||a<0||a>=this.screen.cols))return(o=this.screen.getLine(i))==null?void 0:o.getCell(a,this.cell)}char(i,a){var o;return((o=this.at(i,a))==null?void 0:o.getChars())??""}dim(i,a){var o,r;return!!((r=(o=this.at(i,a))==null?void 0:o.isDim)!=null&&r.call(o))}text(i,a,o){var r;return i<this.top||i>this.bottom?"":((r=this.screen.getLine(i))==null?void 0:r.translateToString(!0,a,o))??""}isEdge(i,a){if(!Jo.has(this.char(i,a)))return!1;const o=this.char(i-1,a),r=this.char(i+1,a);return Jo.has(o)||or.has(o)||Jo.has(r)||or.has(r)}blankOrDim(i,a,o){var r;for(let u=a;u<o;u++){const h=this.at(i,u);if(h&&!Ql(h.getChars())&&!((r=h.isDim)!=null&&r.call(h)))return!1}return!0}}function tC(l,i,a){if(l.isEdge(i,a))return null;let o=0;for(let u=a-1;u>=0;u--)if(l.isEdge(i,u)){o=u+1;break}let r=l.cols;for(let u=a+1;u<l.cols;u++)if(l.isEdge(i,u)){r=u;break}return o<r?{start:o,end:r}:null}const pd=8,nC=12,Ag=2,Eg=1,iC=4,lC=3,Ng=/-- INSERT --/,aC=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,sC=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,oC=/^\s*\d+[.)]\s/;function kg(l,i,a){if(!Yu.has(l.char(i,a.start))||!Yu.has(l.char(i,a.end-1))||or.has(l.char(i,a.start-1)))return!1;const o=a.end-a.start;let r=0;for(let u=a.start;u<a.end;u++)if(Yu.has(l.char(i,u)))r++;else if(u-a.start-r>o*.1)return!1;return r>=o*.9}function ta(l){return`${l.start}-${l.end}`}function dy(l,i,a){if(a.start===0)return l.top;for(let o=i-1;o>=l.top;o--)if(XS.has(l.char(o,a.start-1)))return o;return l.top}function rC(l,i,a){const o=a.start-1,r=a.end,{row:u}=i;if(o<0||r>=l.cols)return null;const h=l.char(u,o);if(!Jo.has(h)||l.char(u,r)!==h)return null;let p=u-1;for(;p>=l.top&&l.char(p,o)===h;)p--;let m=u+1;for(;m<=l.bottom&&l.char(m,o)===h;)m++;if(m-p-1>pd||!PS.has(l.char(p,o))||!QS.has(l.char(p,r))||!ZS.has(l.char(m,o))||!WS.has(l.char(m,r))||l.dim(u,o))return null;const g=a.start+Eg,b=a.end-Eg;return i.col<g||i.col>=b?null:{kind:"frame",key:`frame:${ta(a)}`,region:ta(a),layout:`${p}`,row:u,caretCol:i.col,startCol:g,endCol:b,empty:p+2===m&&i.col===g&&l.blankOrDim(u,g,b),agentLike:!0,vimInsert:null,modal:!1}}function cC(l,i,a){const{row:o}=i;let r=-1;for(let b=o-1;b>=Math.max(l.top,o-pd);b--)if(kg(l,b,a)){r=b;break}if(r<0)return null;let u=-1;for(let b=o+1;b<=Math.min(l.bottom,o+pd);b++)if(kg(l,b,a)){u=b;break}if(u<0)return null;const h=r+1;let p=-1;for(let b=a.start;b<Math.min(a.end,a.start+3);b++){const v=l.char(h,b);if(!Ql(v)){JS.has(v)&&Ql(l.char(h,b+1))&&(p=b);break}}if(p<0||l.dim(h,p)||oC.test(l.text(h,p+1,a.end)))return null;for(let b=h+1;b<u;b++)for(let v=a.start;v<a.start+Ag;v++)if(!Ql(l.char(b,v)))return null;let m="";for(let b=u+1;b<=Math.min(l.bottom,u+nC)&&!or.has(l.char(b,a.start-1));b++)m+=`${l.text(b,a.start,a.end)}
48
- `;if(sC.test(m)||aC.test(m))return null;const g=o===h?p+2:a.start+Ag;return i.col<g||i.col>=a.end?null:{kind:"rule",key:`rule:${ta(a)}:${dy(l,r,a)}`,region:ta(a),layout:`${r}`,row:o,caretCol:i.col,startCol:g,endCol:a.end,empty:u-r===2&&i.col===g&&l.blankOrDim(o,g,a.end),agentLike:!0,vimInsert:Ng.test(m),modal:Ng.test(m)}}function uC(l,i,a){if(i.hidden)return null;const{row:o,col:r}=i;for(let u=r-2;u>=a.start;u--)if(!(!Mg.has(l.char(o,u))||!Ql(l.char(o,u+1))))return l.dim(o,u)?null:Lg(l,i,a,o,u+2,u===a.start);for(let u=o-1;u>=Math.max(l.top,o-lC);u--){let h=a.end-1;for(;h>=a.start&&Ql(l.char(u,h));)h--;if(h>=a.end-1-iC&&Mg.has(l.char(u,h)))return l.dim(u,h)?null:Lg(l,i,a,u,a.start,!1);if(h<a.end-1)return null}return null}function Lg(l,i,a,o,r,u){const h=i.row===o?r:a.start;return i.col<h||i.col>=a.end?null:{kind:"prompt",key:`prompt:${ta(a)}:${dy(l,o,a)}`,region:ta(a),layout:`${o}`,row:i.row,caretCol:i.col,startCol:h,endCol:a.end,empty:i.row===o&&i.col===h&&l.blankOrDim(i.row,h,a.end),agentLike:u,vimInsert:null,modal:!1}}function dC(l,i){const a=new eC(l);if(i.row<a.top||i.row>a.bottom||i.col<0||i.col>=l.cols)return null;const o=tC(a,i.row,i.col);return o?rC(a,i,o)??cC(a,i,o)??uC(a,i,o):null}class fC{constructor(){W(this,"insertSeen",new Set)}detect(i,a){const o=dC(i,a);return!o||o.vimInsert===null?o:o.vimInsert?(this.insertSeen.add(o.region),o):this.insertSeen.has(o.region)?null:o}reset(){this.insertSeen.clear()}}class hC{constructor(i){W(this,"tracker",new fC);W(this,"cached");W(this,"lastComplete",null);W(this,"detect",()=>{var i,a;if((a=(i=this.options).isSynchronizing)!=null&&a.call(i))return this.lastComplete;if(this.cached===void 0){const o=this.options.getScreen(),r=this.options.getCursor();this.cached=o&&r?this.tracker.detect(o,r):null,this.lastComplete=this.cached}return this.cached});this.options=i}invalidate(){this.cached=void 0}reset(){this.tracker.reset(),this.cached=void 0,this.lastComplete=null}}var ct=(l=>(l[l.CODEPOINT_MASK=2097151]="CODEPOINT_MASK",l[l.IS_COMBINED_MASK=2097152]="IS_COMBINED_MASK",l[l.WIDTH_SHIFT=22]="WIDTH_SHIFT",l))(ct||{}),Ze=(l=>(l[l.PCOLOR_MASK=255]="PCOLOR_MASK",l[l.CM_MASK=50331648]="CM_MASK",l[l.CM_DEFAULT=0]="CM_DEFAULT",l[l.CM_P16=16777216]="CM_P16",l[l.CM_P256=33554432]="CM_P256",l[l.CM_RGB=50331648]="CM_RGB",l[l.RGB_MASK=16777215]="RGB_MASK",l))(Ze||{}),ut=(l=>(l[l.INVERSE=67108864]="INVERSE",l[l.BOLD=134217728]="BOLD",l[l.UNDERLINE=268435456]="UNDERLINE",l[l.BLINK=536870912]="BLINK",l[l.INVISIBLE=1073741824]="INVISIBLE",l[l.STRIKETHROUGH=2147483648]="STRIKETHROUGH",l))(ut||{}),Ai=(l=>(l[l.ITALIC=67108864]="ITALIC",l[l.DIM=134217728]="DIM",l[l.HAS_EXTENDED=268435456]="HAS_EXTENDED",l[l.PROTECTED=536870912]="PROTECTED",l[l.OVERLINE=1073741824]="OVERLINE",l))(Ai||{}),Vl=(l=>(l[l.NONE=0]="NONE",l[l.SINGLE=1]="SINGLE",l[l.DOUBLE=2]="DOUBLE",l[l.CURLY=3]="CURLY",l[l.DOTTED=4]="DOTTED",l[l.DASHED=5]="DASHED",l))(Vl||{});function mC(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const fy={fg:0,bg:0,ext:0};function hy(l){return l.bg&268435456&&l.extended?l.extended.ext>>>0:0}function pC(l){return l>>>26&7}function gC(l){return l&67108863}function bC(l,i){const a=l.codePointAt(0)??0;return l.length>0&&String.fromCodePoint(a).length===l.length?{content:a|i<<22,combinedData:""}:{content:2097152|i<<22,combinedData:l}}function my(l){const i=l;return!i||typeof i.fg!="number"||typeof i.bg!="number"?null:{fg:i.fg>>>0,bg:i.bg>>>0,ext:hy(i)}}class yC{constructor(i){W(this,"items",[]);W(this,"target",null);W(this,"provider",()=>this.paint());this.options=i}attach(i){var a;this.target!==i&&((a=this.target)==null||a.setOverlayProvider(null),this.target=i,i==null||i.setOverlayProvider(this.provider))}sync(i){var a;i.length===0&&this.items.length===0||(this.items=i,(a=this.target)==null||a.invalidateOverlay())}clear(){var i;this.items.length!==0&&(this.items=[],(i=this.target)==null||i.invalidateOverlay())}hasItems(){return this.items.length>0}dispose(){this.attach(null),this.items=[]}paint(){if(this.items.length===0)return null;const i=this.options.getTerminal(),a=i==null?void 0:i.buffer.active;if(!i||!a)return null;const o=[],r=this.options.isCursorHidden(),u=a.baseY+a.cursorY,h=a.cursorX,p=gd(i,u,h),m=r&&!!p&&py(p);let g;for(const b of this.items)switch(b.kind){case"char":o.push({row:b.row,col:b.col,chars:b.char,width:b.width,style:b.style??wC(i,b.row,b.col)});break;case"erase":o.push({row:b.row,col:b.col,chars:" ",width:b.width,style:xC(b.style??gd(i,b.row,b.col)??fy)});break;case"mask":m&&b.row===u&&b.col===h&&o.push({row:b.row,col:b.col,chars:b.char,width:1,style:b.style??vC(p)});break;case"caret":r?m&&o.push({row:b.row,col:b.col,chars:b.char,width:1,style:p}):g={row:b.row,col:b.col};break}return g===void 0?{cells:o}:{cells:o,cursor:g}}}function gd(l,i,a){var o;return a<0||a>=l.cols?null:my((o=l.buffer.active.getLine(i))==null?void 0:o.getCell(a))}function py(l){return(l.fg&ut.INVERSE)!==0||(l.bg&Ze.CM_MASK)!==Ze.CM_DEFAULT}function vC(l){return{fg:l.fg&~ut.INVERSE,bg:l.bg&~(Ze.CM_MASK|Ze.RGB_MASK),ext:l.ext}}function xC(l){return{fg:l.fg&ut.INVERSE?l.fg&(ut.INVERSE|Ze.CM_MASK|Ze.RGB_MASK):0,bg:l.bg&(Ze.CM_MASK|Ze.RGB_MASK),ext:0}}function wC(l,i,a){const o=gd(l,i,a-1);return o&&!py(o)&&!(o.bg&Ai.DIM)?o:fy}const gy="\x1B",SC=/^\x1b\[[IO]/,by=/^\x1b\[<(\d+);\d+;\d+[Mm]/,CC=/^\x1b\[M[\s\S]{3}/,TC=[/^\x1b\[\?[\d;]*c/,/^\x1b\[>[\d;]*c/,/^\x1b\[\d+;\d+R/,/^\x1b\[\?\d+;\d+R/,/^\x1b\[\d+n/,/^\x1b\[\?[\d;]*\$y/,/^\x1b\[[\d;]*t/,/^\x1b\[\?\d+u/,/^\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/,/^\x1bP[\s\S]*?\x1b\\/],MC=/^\x1b\[1;[2-8]R/;function Rg(l){if(MC.test(l))return 0;const i=SC.exec(l);if(i)return i[0].length;const a=by.exec(l);if(a){const o=Number(a[1]);return(o&32)!==0&&(o&3)===3&&(o&64)===0?a[0].length:0}for(const o of TC){const r=o.exec(l);if(r)return r[0].length}return 0}function yy(l){if(!l.startsWith(gy))return"keys";if(by.test(l)||CC.test(l)){let a=l;for(;a.length>0;){const o=Rg(a);if(o===0)return"pointer";a=a.slice(o)}return"passive"}let i=l;for(;i.length>0;){const a=Rg(i);if(a===0)return"keys";i=i.slice(a)}return"passive"}function AC(l){return l===gy}function $n(l){return l===""||l===" "?" ":l}function EC(l,i,a,o=64){var h;const r=l.buffer.active.getLine(i),u=[];for(let p=a-1;p>=0&&u.length<o;p--){const m=r==null?void 0:r.getCell(p);if(!m)break;((h=m.getWidth)==null?void 0:h.call(m))!==0&&u.unshift($n(m.getChars()))}return u}function NC(l,i){for(let a=Math.min(l.length,i.length);a>0;a--){let o=!0;for(let r=0;r<a&&o;r++)o=i[i.length-a+r]===$n(l[r]);if(o)return a}return 0}function kC(l){const i=l.buffer.active;return{key:"legacy",row:i.baseY+i.cursorY,caretCol:i.cursorX,startCol:i.cursorX,endCol:l.cols,empty:!1,agentLike:!1}}function LC(l,{style:i,predictedCursor:a,field:o,runStartedEmpty:r,active:u}){var x,T,M,A,R;const h=l.map(k=>{const O={row:k.row,col:k.col,char:k.cancelled?" ":k.char,width:k.width,kind:k.cancelled?"erase":k.kind};return i&&(O.style=i),O}),p=l[l.length-1],m=a??{row:p.row,col:p.kind==="erase"||p.cancelled?p.col:p.col+p.width},g=(k,O)=>h.some($=>$.row===k&&$.col<=O&&O<$.col+$.width),b=l.some(k=>k.kind==="char"&&!k.cancelled);if(u&&o&&r&&b&&o.agentLike&&m.row===o.row){const k=u.getLine(m.row);for(let O=m.col;O<o.endCol;O++){if(g(m.row,O)||$n(((x=k==null?void 0:k.getCell(O))==null?void 0:x.getChars())??"")===" ")continue;const $={row:m.row,col:O,char:" ",width:1,kind:"erase"};i&&($.style=i),h.push($)}}if(u){const k={row:u.baseY+u.cursorY,col:u.cursorX};if(!g(k.row,k.col)&&(k.row!==m.row||k.col!==m.col)){const O=((M=(T=u.getLine(k.row))==null?void 0:T.getCell(k.col))==null?void 0:M.getChars())??"",$={row:k.row,col:k.col,char:$n(O),width:1,kind:"mask"};i&&($.style=i),h.push($)}}const v=h.find(k=>k.row===m.row&&k.col===m.col&&k.kind!=="mask"),w=v?v.char:$n(((R=(A=u==null?void 0:u.getLine(m.row))==null?void 0:A.getCell(m.col))==null?void 0:R.getChars())??"");return h.push({row:m.row,col:m.col,char:w,width:1,kind:"caret"}),h}const RC=[[12288,12329],[12334,12335],[12337,12348],[12350,12350],[12353,12438],[12443,12543],[13312,19903],[19968,40959],[44032,55203],[63744,64255],[65281,65376],[65504,65510],[131072,196605],[196608,262141]];function vy(l){if(l>=32&&l<=126)return 1;if(l<12288)return 0;for(const[i,a]of RC){if(l<i)return 0;if(l<=a)return 2}return 0}const _g=8,_C=1500,jC=4e3,OC=20;class DC{constructor(i){W(this,"getTerminal");W(this,"getFieldOption");W(this,"charWidth");W(this,"now");W(this,"textDecoder",new TextDecoder("utf-8"));W(this,"confidentKeys",new Set);W(this,"fieldStyles",new Map);W(this,"field",null);W(this,"runStartedEmpty",!1);W(this,"predictions",[]);W(this,"predictedCursor",null);W(this,"srtt",null);W(this,"isSuppressed",!1);W(this,"suppressCursor",null);W(this,"suppressSentAt",0);W(this,"inFlight",[]);W(this,"inFlightUnknown",!1);W(this,"runInFlight",[]);W(this,"probationRun",!1);W(this,"runSent",[]);W(this,"lastSentUndrawn",!1);W(this,"awaitingPrefixCommand",!1);W(this,"mismatches",0);W(this,"trace",[]);this.getTerminal=i.getTerminal,this.getFieldOption=i.getField,this.charWidth=i.charWidth,this.now=i.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}updateSuppression(i){if(!this.isSuppressed)return;if(this.predictions.some(o=>o.frozenFrom)){this.suppressSentAt=this.now();return}!!i&&!!this.suppressCursor&&(i.row!==this.suppressCursor.row||i.col!==this.suppressCursor.col)?this.liftSuppression():this.stillSuppressed()}reset(i,a){var u;this.predictions=[],this.predictedCursor=null;const o=typeof a=="boolean"?a:(a==null?void 0:a.suppress)??!0,r=typeof a=="object"&&(a==null?void 0:a.demote)===!0;if(this.note(`reset: ${i??"unspecified"}`),r){const h=this.field??((u=this.getFieldOption)==null?void 0:u.call(this))??null;h&&this.confidentKeys.delete(h.key)}if(this.forgetInFlight(),o){this.isSuppressed=!0,this.suppressSentAt=this.now();const h=this.getTerminal();h?this.suppressCursor={row:h.buffer.active.baseY+h.buffer.active.cursorY,col:h.buffer.active.cursorX}:this.suppressCursor=null}else this.isSuppressed=!1,this.suppressCursor=null}forgetConfidence(){this.confidentKeys.clear(),this.fieldStyles.clear(),this.field=null}getState(){return this.field&&this.confidentKeys.has(this.field.key)?"confident":"tentative"}getField(){return this.field}getMismatchCount(){return this.mismatches}getEchoSrttMs(){return this.srtt}getTrace(){return this.trace}visiblePredictions(){const i=this.getState()==="confident";return this.predictions.filter(a=>a.frozenFrom?a.shownWhenFrozen:i&&!a.probation)}freeze(i,a={}){var m;const o=this.getTerminal(),r=o?{row:o.buffer.active.baseY+o.buffer.active.cursorY,col:o.buffer.active.cursorX}:null,u=this.getState()==="confident";this.predictions=this.predictions.filter(g=>!g.cancelled);for(const g of this.predictions)g.frozenFrom||(g.frozenFrom=r??{row:g.row,col:g.col},g.shownWhenFrozen=u&&!g.probation);const h=this.predictedCursor?{...this.predictedCursor}:r,p=this.inFlight.length>0||this.inFlightUnknown||this.lastSentUndrawn||this.probationRun&&this.runSent.length===0;if(this.predictedCursor=null,this.note(`freeze: ${i}${a.demote?" (demote)":""}`),a.demote){const g=this.field??((m=this.getFieldOption)==null?void 0:m.call(this))??null;g&&this.confidentKeys.delete(g.key)}this.isSuppressed=!0,this.suppressSentAt=this.now(),this.suppressCursor=h,this.forgetInFlight(),this.inFlightUnknown=p}forgetInFlight(){this.inFlight=[],this.inFlightUnknown=!1,this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.lastSentUndrawn=!1}suppressTimeout(){return Math.max(300,(this.srtt??300)*1.5)}predictionTimeout(){return Math.min(jC,Math.max(_C,(this.srtt??0)*4))}stillSuppressed(){return this.isSuppressed?this.now()-this.suppressSentAt>=this.suppressTimeout()?(this.liftSuppression(),!1):!0:!1}liftSuppression(){this.isSuppressed=!1,this.suppressCursor=null}assumedWidth(i){var o;const a=(o=this.charWidth)==null?void 0:o.call(this,i);return a===0||a===1||a===2?a:1}coveredByPrediction(i,a){return this.predictions.some(o=>(o.echoed||o.cancelled||o.kind==="erase"&&!o.frozenFrom)&&o.row===i&&o.col<=a&&a<o.col+o.width)}ensureField(i){if(this.predictedCursor&&this.field)return this.field;const a=this.getFieldOption?this.getFieldOption():kC(i);if(!a)return null;let o=a.caretCol,r=[],u=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){r=this.inFlight.slice(NC(this.inFlight,EC(i,a.row,o)));for(const h of r){const p=h.codePointAt(0)??0;o+=vy(p)||this.assumedWidth(p)}u=r.length>0}return this.inFlight=[],this.inFlightUnknown=!1,this.field=a,this.runStartedEmpty=a.empty&&r.length===0,this.predictions=this.predictions.filter(h=>h.frozenFrom),this.predictedCursor={row:a.row,col:o},this.runInFlight=r,this.probationRun=u,this.runSent=[],a}confirm(i,a){if(this.updateSrtt(Math.max(0,this.now()-i.sentAt)),a&&!i.frozenFrom&&this.markConfident(a.key),i.probation&&i.kind==="char"){for(const o of this.predictions)o.probation=void 0;this.probationRun=!1,this.runInFlight=[],this.runSent=[]}}learnStyle(i,a){const o=my(a);if(o)for(this.fieldStyles.delete(i),this.fieldStyles.set(i,o);this.fieldStyles.size>_g;){const r=this.fieldStyles.keys().next().value;if(r===void 0)break;this.fieldStyles.delete(r)}}markConfident(i){for(this.confidentKeys.delete(i),this.confidentKeys.add(i);this.confidentKeys.size>_g;){const a=this.confidentKeys.values().next().value;if(a===void 0)break;this.confidentKeys.delete(a)}}mismatch(i){this.mismatches++,this.note(`mismatch: ${i}`),this.predictions=[],this.predictedCursor=null,this.field&&this.confidentKeys.delete(this.field.key),this.isSuppressed=!1,this.suppressCursor=null}note(i){const a=this.trace[this.trace.length-1];if(a&&a.event===i){a.count++,a.at=this.now();return}this.trace.push({at:this.now(),event:i,count:1}),this.trace.length>OC&&this.trace.shift()}pruneExpired(){if(this.predictions.length===0)return;const i=this.now(),a=this.predictionTimeout(),o=this.predictions.filter(r=>i-r.sentAt<=a);o.length!==this.predictions.length&&(this.note("expired without an echo"),this.predictions=o,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(i){this.srtt===null?this.srtt=i:this.srtt=this.srtt*.8+i*.2}}const zC="?!#";class HC extends DC{handlePrintable(i,a,o){var T;const r=this.ensureField(o);if(!r||!this.predictedCursor)return this.note("refused: caret is not in an input field"),!1;const u=this.predictedCursor,h=this.predictions.every(M=>M.frozenFrom||M.cancelled)&&u.col===r.caretCol;if(r.agentLike&&r.empty&&h&&zC.includes(i))return this.freeze("agent mode switch"),!1;if(u.col+a>r.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const p=(T=o.buffer.active.getLine(u.row))==null?void 0:T.getCell(u.col),m=[$n(p?p.getChars():"")],g=this.predictions.findIndex(M=>M.kind==="erase"&&!M.frozenFrom&&M.row===u.row&&M.col===u.col);let b;g>=0&&([b]=this.predictions.splice(g,1),m.push(...b.before," "));for(const M of this.predictions)M.cancelled&&M.row===u.row&&M.col===u.col&&m.push(M.char);const v=o.buffer.active,w=v.baseY+v.cursorY,x=w>u.row||w===u.row&&v.cursorX>u.col;return this.predictions.push({row:u.row,col:u.col,char:i,width:a,kind:"char",before:m,sentAt:this.now(),replaces:b,probation:this.probationRun||void 0,behindCaret:x||void 0}),this.probationRun&&this.runSent.push(i),this.lastSentUndrawn=!1,u.col+=a,!0}skipUnpredictable(i,a,o){const r=this.ensureField(o),u=this.predictedCursor;if(!r||!u)return this.note("refused: caret is not in an input field"),!1;const h=this.assumedWidth(a);return u.col+h>r.endCol-1?(this.freeze("cursor would reach the edge of the field"),!1):(this.probationRun||(this.probationRun=!0,this.runSent=[]),this.runSent.push(i),this.lastSentUndrawn=!0,u.col+=h,this.note("width unknown: guessing"),!0)}handleBackspace(i){var o,r,u;let a;for(let h=this.predictions.length-1;h>=0&&!a;h--)this.predictions[h].cancelled||(a=this.predictions[h]);if(this.predictedCursor&&a&&!a.frozenFrom&&!a.echoed&&a.kind==="char"&&a.row===this.predictedCursor.row&&a.col+a.width===this.predictedCursor.col)return a.cancelled=!0,a.probation&&this.runSent.pop(),this.predictedCursor.col=a.col,a.replaces&&(this.predictions.splice(this.predictions.indexOf(a),0,a.replaces),a.replaces=void 0),!0;if(this.stillSuppressed())this.inFlightUnknown=!0;else{const h=this.ensureField(i),p=this.predictedCursor;if(h&&p){const m=i.buffer.active.getLine(p.row),g=m==null?void 0:m.getCell(p.col-1),b=g&&((o=g.getWidth)==null?void 0:o.call(g))===0?2:1,v=p.col-b;let w=!0;for(let T=p.col;T<h.endCol&&w;T++)w=this.coveredByPrediction(p.row,T)||$n(((r=m==null?void 0:m.getCell(T))==null?void 0:r.getChars())??"")===" ";const x=$n(((u=m==null?void 0:m.getCell(v))==null?void 0:u.getChars())??"");if(v>h.startCol&&w&&x!==" ")return this.predictions=this.predictions.filter(T=>!(T.echoed&&T.row===p.row&&T.col+T.width>v)),this.predictions.push({row:p.row,col:v,char:" ",width:b,kind:"erase",before:[x],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,p.col=v,!0}}return this.freeze("backspace into server content"),!1}}const BC=2;class UC extends HC{handleUserInput(i){var h;if(this.pruneExpired(),i.length===0)return;const a=this.textDecoder.decode(i,{stream:!1});if(!a)return;const o=yy(a);if(o==="passive")return;if(o==="pointer"){this.freeze("pointer");return}if(this.awaitingPrefixCommand){this.awaitingPrefixCommand=!1,this.freeze("Herdr prefix command",{demote:!0});return}if(AC(a)){const p=this.field??((h=this.getFieldOption)==null?void 0:h.call(this))??null;this.freeze("escape",{demote:(p==null?void 0:p.modal)!==!1});return}const r=this.getTerminal();if(!r){this.reset("terminal unavailable",!0);return}const u=Array.from(a);for(let p=0;p<u.length;p++){const m=u[p],g=m.codePointAt(0);if(g===void 0)continue;if(g===BC){this.awaitingPrefixCommand=!0,this.freeze("Herdr prefix",{demote:!0});return}if(g===27||g===9||g===10||g===13||g<32&&g!==8){this.freeze("control or escape sequence");return}if(g===8||g===127){if(!this.handleBackspace(r)){p<u.length-1&&(this.inFlightUnknown=!0);return}continue}if(this.stillSuppressed()){this.inFlight.push(m),this.note("refused: waiting for the caret to move");continue}const b=vy(g);if(b===0){if(!this.skipUnpredictable(m,g,r)){p<u.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(m,b,r)){p<u.length-1&&(this.inFlightUnknown=!0);return}}}onServerOutput(){const i=this.getTerminal(),a=i?{row:i.buffer.active.baseY+i.buffer.active.cursorY,col:i.buffer.active.cursorX}:null;this.pruneExpired(),i&&a&&this.predictions.length>0&&this.settle(i,a),this.updateSuppression(a)}settle(i,a){var h,p;const o=this.field;if(this.getFieldOption){const m=this.getFieldOption();if(!m||m.key!==(o==null?void 0:o.key)){if(this.predictions.every(g=>g.frozenFrom||g.echoed||g.cancelled)){this.predictions=[],this.predictedCursor=null;return}this.mismatch("field changed");return}if(m.layout!==o.layout){this.predictions=[],this.predictedCursor=null,this.field=m,this.note("layout changed");return}}let r=[],u=!1;for(const m of this.predictions){if(m.cancelled){if(!u){const M=a.row>m.row||a.row===m.row&&a.col>=m.col+m.width;if(M||(m.behindCaret=void 0),m.passed&&!M)continue;M&&!m.behindCaret&&(m.passed=!0)}r.push(m),u=!0;continue}const g=(h=i.buffer.active.getLine(m.row))==null?void 0:h.getCell(m.col),b=$n(g?g.getChars():""),v=m.kind==="char"?b===m.char&&(m.width===1||(((p=g==null?void 0:g.getWidth)==null?void 0:p.call(g))??2)===2):b===" ",w=m.before.includes(b);m.behindCaret&&(a.row<m.row||a.row===m.row&&a.col<=m.col)&&(m.behindCaret=void 0);const x=m.kind==="char"?(a.row>m.row||a.row===m.row&&a.col>=m.col+m.width)&&!(m.behindCaret&&w):a.row<m.row||a.row===m.row&&a.col<=m.col,T=m.kind==="char"&&b===m.char&&!v;if(u&&!m.frozenFrom){if(!v||w){r.push(m);continue}r=r.filter(M=>!M.cancelled),u=!1}if(!(m.echoed&&!v))if(v&&(x||!w)){if(m.echoed||this.confirm(m,o),x){m.kind==="char"&&o&&!m.frozenFrom&&this.learnStyle(o.key,g);continue}m.echoed=!0,r.push(m)}else if(m.frozenFrom){const M=m.frozenFrom,A=m.kind==="erase"||a.col>=M.col;!x&&a.row===M.row&&A?r.push(m):x&&m.probation&&(this.inFlightUnknown=!0)}else if(!x&&!T)r.push(m);else if(m.probation){this.note("probation guess dropped"),this.predictions.some(M=>!M.frozenFrom&&M.kind==="erase")&&(this.inFlightUnknown=!0),this.inFlight=[...this.runInFlight,...this.runSent,...this.inFlight],this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.predictions=this.predictions.filter(M=>M.frozenFrom),this.predictedCursor=null;return}else{this.mismatch(`cell shows ${JSON.stringify(b)} for ${JSON.stringify(m.char)}`);return}}this.predictions=r,r.length===0&&(this.predictedCursor=null,this.probationRun&&(this.inFlightUnknown=!0))}getVisiblePredictions(){return this.pruneExpired(),this.visiblePredictions().filter(i=>!i.echoed&&!i.cancelled).map(i=>({row:i.row,col:i.col,char:i.char}))}getOverlayItems(){var a;this.pruneExpired();const i=this.visiblePredictions();return i.length===0?[]:LC(i,{style:this.field?this.fieldStyles.get(this.field.key):void 0,predictedCursor:this.predictedCursor,field:this.field,runStartedEmpty:this.runStartedEmpty,active:(a=this.getTerminal())==null?void 0:a.buffer.active})}}const KC=25,IC=2026,FC=1e3;function GC(l,i=()=>performance.now()){let a=!1,o=null;const r=new Set,u=b=>(r.add(b),{dispose:()=>void r.delete(b)}),h=()=>{a=!1,o=null},p=l.parser;if(!p||typeof p.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:u,reset:h,dispose:()=>{}};const m=b=>v=>{for(const w of v.flat())if(w===KC&&(a=!b),w===IC){const x=!b&&o!==null;if(o=b?i():null,x)for(const T of[...r])T()}return!1},g=[p.registerCsiHandler({prefix:"?",final:"h"},m(!0)),p.registerCsiHandler({prefix:"?",final:"l"},m(!1)),p.registerCsiHandler({intermediates:"!",final:"p"},()=>(h(),!1))];return typeof p.registerEscHandler=="function"&&g.push(p.registerEscHandler({final:"c"},()=>(h(),!1))),{isCursorHidden:()=>a,isSynchronizing:()=>o!==null&&i()-o<FC,onSyncEnd:u,reset:h,dispose:()=>{for(const b of g)b.dispose();r.clear()}}}const YC=40;function $C(l,i){return l==="off"?!1:l==="always"?!0:i!==null&&i>YC}function qC(l,i){var p;const a=GC(l),o=new hC({getScreen:()=>{const m=i();if(!m)return null;const g=m.buffer.active;return{cols:m.cols,rows:m.rows,baseY:g.baseY,getLine:b=>g.getLine(b),getNullCell:typeof g.getNullCell=="function"?()=>g.getNullCell():void 0}},getCursor:()=>{var g;const m=(g=i())==null?void 0:g.buffer.active;return m?{row:m.baseY+m.cursorY,col:m.cursorX,hidden:a.isCursorHidden()}:null},isSynchronizing:a.isSynchronizing}),r=(p=l._core)==null?void 0:p.unicodeService,u=new UC({getTerminal:i,getField:o.detect,charWidth:typeof(r==null?void 0:r.wcwidth)=="function"?m=>r.wcwidth(m):void 0}),h=new yC({getTerminal:i,isCursorHidden:()=>a.isCursorHidden()});return{screenState:a,fieldProbe:o,predictor:u,overlay:h}}function VC({termRef:l,rendererRef:i,mode:a,connectionState:o,observeKeyInput:r}){const u=C.useRef(null),h=C.useRef(null),p=C.useRef(null),m=Yn(a),g=C.useCallback(()=>{const M=u.current,A=h.current;if(!(!M||!A)){if(!$C(m.current,M.getEchoSrttMs())){A.clear();return}A.sync(M.getOverlayItems())}},[m]),b=C.useCallback(M=>{var A,R,k,O;(A=u.current)==null||A.reset(M),(R=u.current)==null||R.forgetConfidence(),(k=p.current)==null||k.reset(),(O=h.current)==null||O.clear()},[]),v=C.useCallback(M=>{var A,R;(A=u.current)==null||A.reset(M),(R=h.current)==null||R.clear()},[]),w=C.useCallback(M=>{var A,R,k;(A=u.current)==null||A.handleUserInput(M),g(),(k=(R=i.current)==null?void 0:R.canvas)==null||k.markInput()},[g,i]),x=C.useCallback(M=>{const A=qC(M,()=>l.current);return p.current=A.fieldProbe,u.current=A.predictor,h.current=A.overlay,A},[l]),T=C.useCallback(()=>{var M;(M=h.current)==null||M.dispose(),h.current=null,u.current=null,p.current=null},[]);return C.useEffect(()=>r(w),[r,w]),C.useEffect(()=>{g()},[a,g]),C.useEffect(()=>{b("connectionState")},[o,b]),{predictorRef:u,overlayRef:h,fieldProbeRef:p,attach:x,detach:T,sync:g,forget:b,discard:v,onUserInput:w}}const PC=20,XC=6,QC=500,ZC=300,na=13,xy=.602,wy=1.3;function Gn(l,i){return Number.isFinite(l)&&l>0?l:i}function jg(l,i,a){return Math.min(a,Math.max(i,l))}function Sy(l){const{width:i,height:a,cellWidth:o,cellHeight:r,minCols:u=PC,minRows:h=XC,maxCols:p=QC,maxRows:m=ZC}=l,g=Gn(o,na*xy),b=Gn(r,na*wy);return{cols:jg(Math.floor(Gn(i,0)/g),u,p),rows:jg(Math.floor(Gn(a,0)/b),h,m)}}function il(l,i=na){var o,r,u;if(l)try{const h=l._core,p=(u=(r=(o=h==null?void 0:h._renderService)==null?void 0:o.dimensions)==null?void 0:r.css)==null?void 0:u.cell;if(p!=null&&p.width&&p.width>0&&p.height&&p.height>0)return{cellWidth:p.width,cellHeight:p.height,measured:!0}}catch{}const a=Gn(i,na);return{cellWidth:Math.round(a*xy*100)/100,cellHeight:Math.round(a*wy*100)/100,measured:!1}}function WC(l){var o;const i=(o=l==null?void 0:l.querySelector)==null?void 0:o.call(l,".xterm-viewport");if(!i)return 0;const a=(i.offsetWidth||0)-(i.clientWidth||0);return Number.isFinite(a)&&a>0?a:0}function bd(l,i,a){if(!l)return{width:i,height:a};let o=0,r=0;if(typeof l.getBoundingClientRect=="function"){const u=l.getBoundingClientRect();o=(u==null?void 0:u.width)||0,r=(u==null?void 0:u.height)||0}return{width:Gn(o,Gn(l.clientWidth,i)),height:Gn(r,Gn(l.clientHeight,a))}}function Cy(l,i,a,o){const r=Number.isFinite(o)&&o>.01?o:1;return{clientX:a.left+(l-a.left)/r,clientY:a.top+(i-a.top)/r}}function Og(l,i){const a=typeof window<"u"?window:void 0,o=a&&typeof a.devicePixelRatio=="number"&&a.devicePixelRatio>0?a.devicePixelRatio:1,r=a!=null&&a.visualViewport&&typeof a.visualViewport.scale=="number"&&a.visualViewport.scale>0?a.visualViewport.scale:1,u=Math.max(0,l.width),h=Math.max(0,l.height),p=Math.round(u*o*100)/100,m=Math.round(h*o*100)/100;return{dpr:o,scale:r,cssWidth:u,cssHeight:h,physicalWidth:p,physicalHeight:m}}function JC(l){const{lastSnapshot:i,currentSnapshot:a,physicalTolerancePx:o=6}=l;if(!i)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const r=Math.abs(a.scale-i.scale)>.01,u=Math.abs(a.scale-1)>.01;if(r||u)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(a.dpr-i.dpr)>.01){const g=Math.abs(a.physicalWidth-i.physicalWidth),b=Math.abs(a.physicalHeight-i.physicalHeight);if(g<=o&&b<=o)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const p=Math.abs(a.cssWidth-i.cssWidth),m=Math.abs(a.cssHeight-i.cssHeight);return p<1&&m<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const eT=250;function tT({termRef:l,containerRef:i,frameRef:a,surfaceRef:o,currentScaleRef:r,rendererRef:u,initialBannerWrittenRef:h,isActiveRef:p,sendResize:m,onResized:g}){const b=Yn(m),v=Yn(g),w=C.useRef({cols:0,rows:0}),x=C.useRef(null),T=C.useRef(null),M=C.useRef(null),A=C.useRef(null),R=C.useRef({width:0,height:0}),k=C.useRef(null),O=C.useRef(!1),$=C.useCallback((V,X)=>{!Number.isFinite(V)||!Number.isFinite(X)||V<=0||X<=0||V===w.current.cols&&X===w.current.rows||(x.current={cols:V,rows:X},!T.current&&(T.current=setTimeout(()=>{T.current=null;const ie=x.current;x.current=null,ie&&(ie.cols===w.current.cols&&ie.rows===w.current.rows||(w.current=ie,b.current(ie.cols,ie.rows),v.current()))},eT)))},[b,v]),_=C.useCallback((V=!1)=>{var ve;const X=l.current,ie=i.current,ue=o.current,U=a.current;if(!X||!ie||!ue||!U)return;const E=bd(ie,Zl(),ed());if(E.width<=0||E.height<=0)return;U.style.width="100%",U.style.height="100%",ue.style.width="100%",ue.style.height="100%",ue.style.transform="none",ue.style.transformOrigin="top left",r.current=1;const G=Og(E),P=JC({lastSnapshot:k.current,currentSnapshot:G});if(P.isVisualZoom&&!V){k.current=G;try{X.refresh(0,Math.max(0,X.rows-1))}catch{}return}if(P.shouldIgnore&&!V)return;k.current=G;const le=il(X,na),Q=Sy({width:E.width-WC(ue),height:E.height,cellWidth:le.cellWidth,cellHeight:le.cellHeight}),xe=Math.abs(E.width-R.current.width)>1||Math.abs(E.height-R.current.height)>1;if(X.cols!==Q.cols||X.rows!==Q.rows)try{X.resize(Q.cols,Q.rows)}catch(me){console.debug("Error resizing terminal grid:",me)}h.current&&!O.current&&(xe||X.cols!==Q.cols||X.rows!==Q.rows)&&(O.current=!0,(ve=u.current)==null||ve.verify());const ye=Q.cols!==w.current.cols||Q.rows!==w.current.rows;p.current&&(xe||V||ye)&&(R.current={width:E.width,height:E.height},$(Q.cols,Q.rows));try{X.refresh(0,Math.max(0,X.rows-1))}catch{}},[l,i,o,a,r,u,h,p,$]),z=C.useRef(_);z.current=_;const L=C.useCallback(()=>{if(M.current===null){if(typeof requestAnimationFrame!="function"){z.current();return}M.current=requestAnimationFrame(()=>{M.current=null,z.current()})}},[]),D=C.useCallback((V=30)=>{A.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(A.current),A.current=null);let X=0;const ie=()=>{A.current=null,X++;const ue=X>=V;z.current(!0),!ue&&X<2&&typeof requestAnimationFrame=="function"&&(A.current=requestAnimationFrame(ie))};typeof requestAnimationFrame=="function"?A.current=requestAnimationFrame(ie):ie()},[]),K=C.useCallback(V=>{R.current={width:V.width,height:V.height},k.current=Og(V)},[]),J=C.useCallback(()=>{T.current&&(clearTimeout(T.current),T.current=null),M.current!==null&&(cancelAnimationFrame(M.current),M.current=null),A.current!==null&&(cancelAnimationFrame(A.current),A.current=null)},[]);return{requestFit:L,scheduleBoundedFit:D,seedFit:K,cancelPendingFits:J}}const nT=" ()[]{}'\"\\`";function iT(l,i,a,o=1){var A,R;if(!((A=i==null?void 0:i.buffer)!=null&&A.active)||i.cols<=0||i.rows<=0)return null;const r=a||((R=i.element)==null?void 0:R.querySelector(".xterm-screen"))||i.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const u=r.getBoundingClientRect(),h=Cy(l.clientX,l.clientY,u,o),p=il(i);if(p.cellWidth<=0||p.cellHeight<=0)return null;const m=Math.max(1,u.width||i.cols*p.cellWidth),g=Math.max(1,u.height||i.rows*p.cellHeight),b=Math.max(0,Math.min(m-1,h.clientX-u.left)),v=Math.max(0,Math.min(g-1,h.clientY-u.top)),w=Math.max(0,Math.min(i.cols-1,Math.floor(b/p.cellWidth))),x=Math.max(0,Math.min(i.rows-1,Math.floor(v/p.cellHeight))),M=(i.buffer.active.viewportY??0)+x;return{col:w,bufferRow:M}}function lT(l,i){if(!l||l.length===0||l==="\0")return!0;for(const a of l)if(a==="\0"||/\s/.test(a)||i.includes(a))return!0;return!1}function aT(l,i,a){var w,x;if(!((w=l==null?void 0:l.buffer)!=null&&w.active)||i<0||i>=l.cols)return null;const o=l.buffer.active.getLine(a);if(!o)return null;const r=((x=l.options)==null?void 0:x.wordSeparator)??nT,u=new Array(l.cols).fill(null),h=Math.min(l.cols,o.length);let p=0;for(;p<h;){const T=o.getCell(p);if(!T){u[p]={startCol:p,endCol:p+1,isSeparator:!0},p++;continue}const M=T.getWidth();if(M===0){u[p]||(u[p]={startCol:p,endCol:p+1,isSeparator:!0}),p++;continue}const A=T.getChars(),R=lT(A,r),k=Math.min(l.cols,p+M),O={startCol:p,endCol:k,isSeparator:R};for(let $=p;$<k;$++)u[$]=O;p+=Math.max(1,M)}for(let T=h;T<l.cols;T++)u[T]||(u[T]={startCol:T,endCol:T+1,isSeparator:!0});const m=u[i];if(!m||m.isSeparator)return null;let g=m.startCol;for(;g>0;){const T=u[g-1];if(T&&!T.isSeparator)g=T.startCol;else break}let b=m.endCol;for(;b<l.cols;){const T=u[b];if(T&&!T.isSeparator)b=T.endCol;else break}const v=b-g;return v<=0?null:{startCol:g,length:v}}function sT(l){var u;if(!((u=l==null?void 0:l.buffer)!=null&&u.active))return"";const i=l.buffer.active,a=i.viewportY??0,o=l.rows,r=[];for(let h=0;h<o;h++){const p=i.getLine(a+h);r.push(p?p.translateToString(!0):"")}for(;r.length>0&&r[r.length-1]==="";)r.pop();return r.join(`
49
- `)}const Dg=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),oT=.6,rT=new Set(["─","━","═","┄","┅","┈","┉","-"]),cT=.8;function $u(l,i){if(!l)return!1;let a=0;const o=Math.min(i,l.length);for(let r=0;r<o;r++){const u=l.getCell(r);if(u){const h=u.getChars();h&&rT.has(h)&&a++}}return a>=Math.max(5,Math.min(i*.25,10))}function qu(l,i,a){var x;if(!((x=l==null?void 0:l.buffer)!=null&&x.active)||l.cols<=0)return{startCol:0,endCol:0};const o=l.buffer.active,r=l.cols,u=Math.max(0,Math.min(r-1,i)),h=o.viewportY??0,p=l.rows>0?l.rows:1,m=new Int32Array(r);let g=0;for(let T=0;T<p;T++){const M=o.getLine(h+T);if(g++,!M)continue;const A=Math.min(r,M.length);for(let R=0;R<A;R++){const k=M.getCell(R);if(k){const O=k.getChars();O&&Dg.has(O)&&m[R]++}}}if(g===0)return{startCol:0,endCol:r-1};const b=g*oT,v=T=>m[T]>=b;let w=!1;for(let T=0;T<r;T++)if(v(T)){w=!0;break}if(w){if(v(u))return{startCol:u,endCol:u};let T=-1;for(let A=u-1;A>=0;A--)if(v(A)){T=A;break}let M=r;for(let A=u+1;A<r;A++)if(v(A)){M=A;break}return{startCol:T+1,endCol:M-1}}if(a!==void 0){const T=Math.max(h,Math.min(h+p-1,a)),M=o.getLine(T);if(!$u(M,r)){let A=h;for(let O=T-1;O>=h;O--)if($u(o.getLine(O),r)){A=O+1;break}let R=h+p-1;for(let O=T+1;O<=h+p-1;O++)if($u(o.getLine(O),r)){R=O-1;break}const k=R-A+1;if(k>=2){const O=new Int32Array(r);for(let L=A;L<=R;L++){const D=o.getLine(L);if(!D)continue;const K=Math.min(r,D.length);for(let J=0;J<K;J++){const V=D.getCell(J);if(V){const X=V.getChars();X&&Dg.has(X)&&O[J]++}}}const $=k*cT,_=L=>O[L]>=$;let z=!1;for(let L=0;L<r;L++)if(_(L)){z=!0;break}if(z){if(_(u))return{startCol:u,endCol:u};let L=-1;for(let K=u-1;K>=0;K--)if(_(K)){L=K;break}let D=r;for(let K=u+1;K<r;K++)if(_(K)){D=K;break}return{startCol:L+1,endCol:D-1}}}}}return{startCol:0,endCol:r-1}}function zg(l,i){const a=Math.min(l.startCol,l.endCol),o=Math.max(l.startCol,l.endCol),r=Math.min(l.startRow,l.endRow),u=Math.max(l.startRow,l.endRow);return{startCol:Math.max(i.startCol,Math.min(i.endCol,a)),endCol:Math.max(i.startCol,Math.min(i.endCol,o)),startRow:r,endRow:u}}function Hg(l,i){var g;if(!((g=l==null?void 0:l.buffer)!=null&&g.active)||l.cols<=0)return"";const a=l.buffer.active,o=l.cols,r=Math.min(i.startRow,i.endRow),u=Math.max(i.startRow,i.endRow),h=Math.max(0,Math.min(i.startCol,i.endCol)),p=Math.min(o-1,Math.max(i.startCol,i.endCol));if(h>p||r>u)return"";const m=[];for(let b=r;b<=u;b++){const v=a.getLine(b);if(!v){m.push("");continue}const w=v.translateToString(!0,h,p+1);m.push(w.trimEnd())}return m.join(`
50
- `)}function uT({termRef:l,surfaceRef:i,mainRef:a,currentScaleRef:o,addToast:r,t:u}){const h=Yn(r),p=Yn(u),[m,g]=C.useState(null),b=C.useRef(null);b.current=m;const[v,w]=C.useState(null),x=C.useRef(null);x.current=v;const[T,M]=C.useState(""),A=C.useRef("");A.current=T;const[R,k]=C.useState(!1),O=C.useRef(!1);O.current=R;const $=C.useRef(!1),[_,z]=C.useState(0),L=C.useRef(0),D=C.useRef(null),K=C.useRef(null),J=C.useRef(null),V=C.useRef(null),X=C.useCallback(se=>{var pe;const Se=l.current;if(!Se)return null;const ae=((pe=i.current)==null?void 0:pe.querySelector(".xterm-screen"))||i.current;return iT(se,Se,ae,o.current)},[l,i,o]),ie=C.useCallback(se=>{const Se=l.current,ae=X(se);return!Se||!ae?null:jS(Se,ae.col,ae.bufferRow)},[l,X]),ue=C.useCallback((se,Se)=>{w(Se),M(Hg(se,Se)),k(!0)},[]),U=C.useCallback(()=>{w(null),M(""),k(!1),J.current=null,V.current=null},[]),E=C.useCallback(()=>{g(null),b.current=null,w(null),x.current=null,M(""),A.current="",k(!1),D.current=null,K.current=null},[]),G=C.useCallback(se=>{const Se=l.current;if(!Se)return;const ae=X(se),pe=ae?aT(Se,ae.col,ae.bufferRow):null;if(ae&&pe){J.current=ae;const Ee=qu(Se,ae.col,ae.bufferRow);V.current=Ee;const Be={startCol:pe.startCol,endCol:pe.startCol+pe.length-1,startRow:ae.bufferRow,endRow:ae.bufferRow};ue(Se,zg(Be,Ee))}else U();D.current=se,K.current=null},[l,X,ue,U]),P=C.useCallback(se=>{const Se=l.current,ae=J.current;if(!Se||!ae)return;K.current=se;const pe=X(se);if(!pe)return;const Ee=V.current??qu(Se,ae.col,ae.bufferRow),Be={startCol:Math.min(ae.col,pe.col),endCol:Math.max(ae.col,pe.col),startRow:Math.min(ae.bufferRow,pe.bufferRow),endRow:Math.max(ae.bufferRow,pe.bufferRow)};ue(Se,zg(Be,Ee))},[l,X,ue]),le=C.useCallback(()=>{const se=K.current??D.current;if(!se||!a.current)return;const Se=a.current.getBoundingClientRect(),ae=se.clientX-Se.left,pe=se.clientY-Se.top,Ee=ie(se);g({x:ae,y:pe,link:Ee}),b.current={x:ae,y:pe,link:Ee}},[a,ie]),Q=C.useCallback(async se=>{await Od(se)==="failed"?h.current("error",p.current("clipboard.copyFailed")):h.current("success",p.current("clipboard.copied"))},[h,p]),xe=C.useCallback(async()=>{const se=A.current;se&&await Q(se)},[Q]),ye=C.useCallback(async()=>{var Ee,Be,re,Ae;const se=l.current,Se=(Ee=se==null?void 0:se.buffer)==null?void 0:Ee.active;if(!se||!Se)return;const ae=((Be=x.current)==null?void 0:Be.startRow)??((re=J.current)==null?void 0:re.bufferRow)??Se.viewportY,pe=V.current??qu(se,((Ae=J.current)==null?void 0:Ae.col)??0,ae);await Q(Hg(se,{startCol:pe.startCol,endCol:pe.endCol,startRow:ae,endRow:ae}))},[l,Q]),ve=C.useCallback(async()=>{const se=l.current;se&&await Q(sT(se))},[l,Q]),me=C.useCallback((se,Se,ae)=>{const pe=se.buffer.active.viewportY??0;pe!==L.current&&(L.current=pe,z(pe));const Ee=x.current;if(Ee&&O.current){const Be=Ee.startRow-pe,re=Ee.endRow-pe;$.current&&Se<=re&&ae>=Be&&(k(!1),$.current=!1)}else $.current=!1},[]),de=C.useCallback(se=>{const Se=se.buffer.active.viewportY??0;L.current=Se,z(Se)},[]),we=C.useCallback(()=>{$.current=!0},[]);return{selectionMenu:m,selectionRect:v,selectionSnapshot:T,isHighlightVisible:R,viewportY:_,hasOpenMenu:()=>b.current!==null,clearSelection:E,handleLongPress:G,handleSelectionExtend:P,openMenuAtGesture:le,handleCopySelection:xe,handleCopyLine:ye,handleCopyScreen:ve,onTerminalRender:me,onTerminalScroll:de,onTerminalContentChanged:we}}const dT=({term:l,surface:i,main:a,rect:o,viewportY:r})=>{if(!l||!a)return null;const u=il(l);if(u.cellWidth<=0||u.cellHeight<=0)return null;const h=(i==null?void 0:i.querySelector(".xterm-screen"))||i;if(!h)return null;const p=h.getBoundingClientRect(),m=a.getBoundingClientRect(),g=o.startRow-r;if(o.endRow-r<0||g>=l.rows)return null;const v=p.top-m.top+g*u.cellHeight,w=p.left-m.left+o.startCol*u.cellWidth,x=(o.endCol-o.startCol+1)*u.cellWidth,T=(o.endRow-o.startRow+1)*u.cellHeight;return f.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${v}px`,left:`${w}px`,width:`${x}px`,height:`${T}px`}})},qo=new Map;function Ty(l){let i=qo.get(l);return i===void 0&&(i=`#${(l&Ze.RGB_MASK).toString(16).padStart(6,"0")}`,qo.size>4096&&qo.clear(),qo.set(l,i)),i}function My(l,i,a){var o;switch(l&Ze.CM_MASK){case Ze.CM_P16:case Ze.CM_P256:return((o=i.ansi[l&Ze.PCOLOR_MASK])==null?void 0:o.css)??a;case Ze.CM_RGB:return Ty(l&Ze.RGB_MASK);default:return a}}function Bg(l,i,a,o){var v;const r=(l&ut.INVERSE)!==0,u=r?i:l,h=r?l:i;let p;const m=u&Ze.CM_MASK;if(m===Ze.CM_P16||m===Ze.CM_P256){let w=u&Ze.PCOLOR_MASK;o&&l&ut.BOLD&&w<8&&(w+=8),p=((v=a.ansi[w])==null?void 0:v.css)??a.foreground.css}else m===Ze.CM_RGB?p=Ty(u&Ze.RGB_MASK):p=r?a.background.css:a.foreground.css;const g=h&Ze.CM_MASK,b=g===Ze.CM_DEFAULT?r?a.foreground.css:a.background.css:My(h,a,a.background.css);return{fg:p,bg:b,bgIsDefault:!r&&g===Ze.CM_DEFAULT}}function er(l){return(l&ut.BOLD)!==0}function Vu(l){return(l&Ai.ITALIC)!==0}function yd(l){return(l&Ai.DIM)!==0}function Vo(l){return(l&ut.INVISIBLE)!==0}const fT=600;var Pl=(l=>(l[l.NONE=0]="NONE",l[l.BLOCK=1]="BLOCK",l[l.BAR=2]="BAR",l[l.UNDERLINE=3]="UNDERLINE",l[l.OUTLINE=4]="OUTLINE",l))(Pl||{});function Ug(l){switch(l){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function hT(l,i,a,o,r,u,{css:h,dpr:p,cursorWidth:m}){switch(l.save(),l.fillStyle=h,l.strokeStyle=h,u){case 2:l.fillRect(a,o,Math.max(1,Math.round(m*p)),i.cell.height);break;case 3:l.fillRect(a,o+i.cell.height-Math.max(1,Math.round(p))-1,r,Math.max(1,Math.round(p)));break;case 4:{const g=Math.max(1,Math.round(p));l.lineWidth=g,l.strokeRect(a+g/2,o+g/2,r-g,i.cell.height-g);break}}l.restore()}function mT(l,i,a,o,r){let u,h;if(a&&a.cursor!==void 0){if(a.cursor===null)return null;u=a.cursor.row,h=a.cursor.col}else{if(!l.coreService.isCursorInitialized||l.coreService.isCursorHidden)return null;u=i.ybase+i.y,h=i.x}const p=u-i.ydisp;if(p<0||p>=o.rows)return null;const m=Math.min(Math.max(0,h),o.cols-1),g=l.optionsService.rawOptions;let b;if(l._coreBrowserService.isFocused)r?b=0:b=Ug(g.cursorStyle||"block");else{const v=g.cursorInactiveStyle??"outline";b=v==="none"?0:Ug(v)}return b===0?null:{x:m,y:p,shape:b}}class pT{constructor(i){W(this,"timer",null);W(this,"visible",!0);this.onToggle=i}get running(){return this.timer!==null}get hidden(){return this.timer!==null&&!this.visible}start(){this.stop(),this.timer=setInterval(()=>{this.visible=!this.visible,this.onToggle()},fT)}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.visible=!0}}/**
46
+ `,`field: ${YS(h)} mismatches: ${(u==null?void 0:u.getMismatchCount())??0}
47
+ `,$S(p),qS(u)]})};function $n(l){const i=C.useRef(l);return i.current=l,i}function PS(l){const i=$n(l),{termRef:a,subscribeToPasteFileReady:o}=l,[r,u]=C.useState(!1),h=C.useCallback((v,w)=>{i.current.onPaste(),v.paste(w),i.current.addToast("success",i.current.t("clipboard.pasted"))},[i]),p=C.useCallback(()=>{const v=a.current;return v?i.current.isController?v:(i.current.warnViewerMode(),null):null},[a,i]),m=C.useCallback(async()=>{const v=p();if(v){try{const w=await HS();if(w.ok){await i.current.uploadImage(w.blob);return}}catch{}try{const w=await zS();if(w.ok){h(v,w.text);return}else if(w.reason==="empty"){i.current.addToast("info",i.current.t("clipboard.pasteUnavailable"));return}}catch{}u(!0)}},[p,h,i]),g=C.useCallback(v=>{const w=p();w&&h(w,v)},[p,h]),b=C.useCallback(v=>{p()&&i.current.uploadImage(v)},[p,i]);return C.useEffect(()=>o(v=>{const w=a.current;w&&h(w,v)}),[o,a,h]),{isPasteFallbackOpen:r,closePasteFallback:()=>u(!1),handlePaste:m,handleFallbackPasteSend:g,handleFallbackImageSend:b}}const Jo=new Set(["│","┃","║","▐","▕","▏","▌"]),or=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),XS=new Set(["╭","┌","┏","╔"]),QS=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),ZS=new Set(["╮","┐","┓","╗"]),WS=new Set(["╰","└","┗","╚"]),JS=new Set(["╯","┘","┛","╝"]),Yu=new Set(["─","━","═","╌","┄"]),dy=new Set(["❯","›",">","!"]),Eg=new Set(["$","#","%",">","❯","›","➜","λ","»"]);function Sn(l){return l===""||l===" "||l===" "}class eC{constructor(i){W(this,"cell");W(this,"top");W(this,"bottom");var a;this.screen=i,this.cell=(a=i.getNullCell)==null?void 0:a.call(i),this.top=i.baseY,this.bottom=i.baseY+i.rows-1}get cols(){return this.screen.cols}at(i,a){var o;if(!(i<this.top||i>this.bottom||a<0||a>=this.screen.cols))return(o=this.screen.getLine(i))==null?void 0:o.getCell(a,this.cell)}char(i,a){var o;return((o=this.at(i,a))==null?void 0:o.getChars())??""}dim(i,a){var o,r;return!!((r=(o=this.at(i,a))==null?void 0:o.isDim)!=null&&r.call(o))}text(i,a,o){var r;return i<this.top||i>this.bottom?"":((r=this.screen.getLine(i))==null?void 0:r.translateToString(!0,a,o))??""}isEdge(i,a){if(!Jo.has(this.char(i,a)))return!1;const o=this.char(i-1,a),r=this.char(i+1,a);return Jo.has(o)||or.has(o)||Jo.has(r)||or.has(r)}blankOrDim(i,a,o){var r;for(let u=a;u<o;u++){const h=this.at(i,u);if(h&&!Sn(h.getChars())&&!((r=h.isDim)!=null&&r.call(h)))return!1}return!0}}function tC(l,i,a){if(l.isEdge(i,a))return null;let o=0;for(let u=a-1;u>=0;u--)if(l.isEdge(i,u)){o=u+1;break}let r=l.cols;for(let u=a+1;u<l.cols;u++)if(l.isEdge(i,u)){r=u;break}return o<r?{start:o,end:r}:null}const pd=8,nC=12,gd=2,Ng=1,iC=4,lC=3,aC=20,kg=/-- INSERT --/,sC=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,oC=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,rC=/^\s*\d+[.)]\s/;function Lg(l,i,a){if(!Yu.has(l.char(i,a.start))||!Yu.has(l.char(i,a.end-1))||or.has(l.char(i,a.start-1)))return!1;const o=a.end-a.start;let r=0;for(let u=a.start;u<a.end;u++)if(Yu.has(l.char(i,u)))r++;else if(u-a.start-r>o*.1)return!1;return r>=o*.9}function ta(l){return`${l.start}-${l.end}`}function fy(l,i,a){if(a.start===0)return l.top;for(let o=i-1;o>=l.top;o--)if(QS.has(l.char(o,a.start-1)))return o;return l.top}function cC(l,i,a){const o=a.start-1,r=a.end,{row:u}=i;if(o<0||r>=l.cols)return null;const h=l.char(u,o);if(!Jo.has(h)||l.char(u,r)!==h)return null;let p=u-1;for(;p>=l.top&&l.char(p,o)===h;)p--;let m=u+1;for(;m<=l.bottom&&l.char(m,o)===h;)m++;if(m-p-1>pd||!XS.has(l.char(p,o))||!ZS.has(l.char(p,r))||!WS.has(l.char(m,o))||!JS.has(l.char(m,r))||l.dim(u,o))return null;const g=a.start+Ng,b=a.end-Ng;return i.col<g||i.col>=b?null:{kind:"frame",key:`frame:${ta(a)}`,region:ta(a),layout:`${p}`,row:u,caretCol:i.col,startCol:g,endCol:b,empty:p+2===m&&i.col===g&&l.blankOrDim(u,g,b),agentLike:!0,vimInsert:null,modal:!1,midWord:!1}}function uC(l,i,a){const{row:o}=i;let r=-1;for(let b=o-1;b>=Math.max(l.top,o-pd);b--)if(Lg(l,b,a)){r=b;break}if(r<0)return null;let u=-1;for(let b=o+1;b<=Math.min(l.bottom,o+pd);b++)if(Lg(l,b,a)){u=b;break}if(u<0)return null;const h=r+1;let p=-1;for(let b=a.start;b<Math.min(a.end,a.start+3);b++){const v=l.char(h,b);if(!Sn(v)){dy.has(v)&&Sn(l.char(h,b+1))&&(p=b);break}}if(p<0||l.dim(h,p)||rC.test(l.text(h,p+1,a.end)))return null;for(let b=h+1;b<u;b++)for(let v=a.start;v<a.start+gd;v++)if(!Sn(l.char(b,v)))return null;let m="";for(let b=u+1;b<=Math.min(l.bottom,u+nC)&&!or.has(l.char(b,a.start-1));b++)m+=`${l.text(b,a.start,a.end)}
48
+ `;if(oC.test(m)||sC.test(m))return null;const g=o===h?p+2:a.start+gd;return i.col<g||i.col>=a.end?null:{kind:"rule",key:`rule:${ta(a)}:${fy(l,r,a)}`,region:ta(a),layout:`${r}`,row:o,caretCol:i.col,startCol:g,endCol:a.end,empty:u-r===2&&i.col===g&&l.blankOrDim(o,g,a.end),agentLike:!0,vimInsert:kg.test(m),modal:kg.test(m),midWord:!1}}function dC(l,i,a){if(i.hidden)return null;const{row:o,col:r}=i,u=fC(l,i,a);if(u!==void 0)return u;for(let h=r-2;h>=a.start;h--)if(!(!Eg.has(l.char(o,h))||!Sn(l.char(o,h+1))))return l.dim(o,h)?null:bd(l,i,a,o,h+2,h===a.start);for(let h=o-1;h>=Math.max(l.top,o-lC);h--){let p=a.end-1;for(;p>=a.start&&Sn(l.char(h,p));)p--;if(p>=a.end-1-iC&&Eg.has(l.char(h,p)))return l.dim(h,p)?null:bd(l,i,a,h,a.start,!1);if(p<a.end-1)return null}return null}function fC(l,i,a){const{row:o}=i,r=a.start+gd,u=h=>Sn(l.char(h,a.start))&&Sn(l.char(h,a.start+1));if(u(o))for(let h=o-1;h>=Math.max(l.top,o-aC);h--){if(dy.has(l.char(h,a.start))&&Sn(l.char(h,a.start+1)))return l.dim(h,a.start)?null:bd(l,i,a,h,r,!0,r);if(!u(h)||l.blankOrDim(h,r,a.end))return}}function bd(l,i,a,o,r,u,h=a.start){const p=i.row===o?r:h;if(i.col<p||i.col>=a.end)return null;const m=a.end-2,g=i.row>o&&h>a.start&&i.col===p&&!Sn(l.char(i.row-1,m));return{kind:"prompt",key:`prompt:${ta(a)}:${fy(l,o,a)}`,region:ta(a),layout:`${o}`,row:i.row,caretCol:i.col,startCol:p,endCol:a.end,empty:i.row===o&&i.col===p&&l.blankOrDim(i.row,p,a.end),agentLike:u,vimInsert:null,modal:!1,midWord:g}}function hC(l,i){const a=new eC(l);if(i.row<a.top||i.row>a.bottom||i.col<0||i.col>=l.cols)return null;const o=tC(a,i.row,i.col);return o?cC(a,i,o)??uC(a,i,o)??dC(a,i,o):null}class mC{constructor(){W(this,"insertSeen",new Set)}detect(i,a){const o=hC(i,a);return!o||o.vimInsert===null?o:o.vimInsert?(this.insertSeen.add(o.region),o):this.insertSeen.has(o.region)?null:o}reset(){this.insertSeen.clear()}}class pC{constructor(i){W(this,"tracker",new mC);W(this,"cached");W(this,"lastComplete",null);W(this,"detect",()=>{var i,a;if((a=(i=this.options).isSynchronizing)!=null&&a.call(i))return this.lastComplete;if(this.cached===void 0){const o=this.options.getScreen(),r=this.options.getCursor();this.cached=o&&r?this.tracker.detect(o,r):null,this.lastComplete=this.cached}return this.cached});this.options=i}invalidate(){this.cached=void 0}reset(){this.tracker.reset(),this.cached=void 0,this.lastComplete=null}}var ct=(l=>(l[l.CODEPOINT_MASK=2097151]="CODEPOINT_MASK",l[l.IS_COMBINED_MASK=2097152]="IS_COMBINED_MASK",l[l.WIDTH_SHIFT=22]="WIDTH_SHIFT",l))(ct||{}),Ze=(l=>(l[l.PCOLOR_MASK=255]="PCOLOR_MASK",l[l.CM_MASK=50331648]="CM_MASK",l[l.CM_DEFAULT=0]="CM_DEFAULT",l[l.CM_P16=16777216]="CM_P16",l[l.CM_P256=33554432]="CM_P256",l[l.CM_RGB=50331648]="CM_RGB",l[l.RGB_MASK=16777215]="RGB_MASK",l))(Ze||{}),ut=(l=>(l[l.INVERSE=67108864]="INVERSE",l[l.BOLD=134217728]="BOLD",l[l.UNDERLINE=268435456]="UNDERLINE",l[l.BLINK=536870912]="BLINK",l[l.INVISIBLE=1073741824]="INVISIBLE",l[l.STRIKETHROUGH=2147483648]="STRIKETHROUGH",l))(ut||{}),Ei=(l=>(l[l.ITALIC=67108864]="ITALIC",l[l.DIM=134217728]="DIM",l[l.HAS_EXTENDED=268435456]="HAS_EXTENDED",l[l.PROTECTED=536870912]="PROTECTED",l[l.OVERLINE=1073741824]="OVERLINE",l))(Ei||{}),Pl=(l=>(l[l.NONE=0]="NONE",l[l.SINGLE=1]="SINGLE",l[l.DOUBLE=2]="DOUBLE",l[l.CURLY=3]="CURLY",l[l.DOTTED=4]="DOTTED",l[l.DASHED=5]="DASHED",l))(Pl||{});function gC(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const hy={fg:0,bg:0,ext:0};function my(l){return l.bg&268435456&&l.extended?l.extended.ext>>>0:0}function bC(l){return l>>>26&7}function yC(l){return l&67108863}function vC(l,i){const a=l.codePointAt(0)??0;return l.length>0&&String.fromCodePoint(a).length===l.length?{content:a|i<<22,combinedData:""}:{content:2097152|i<<22,combinedData:l}}function py(l){const i=l;return!i||typeof i.fg!="number"||typeof i.bg!="number"?null:{fg:i.fg>>>0,bg:i.bg>>>0,ext:my(i)}}class xC{constructor(i){W(this,"items",[]);W(this,"target",null);W(this,"provider",()=>this.paint());this.options=i}attach(i){var a;this.target!==i&&((a=this.target)==null||a.setOverlayProvider(null),this.target=i,i==null||i.setOverlayProvider(this.provider))}sync(i){var a;i.length===0&&this.items.length===0||(this.items=i,(a=this.target)==null||a.invalidateOverlay())}clear(){var i;this.items.length!==0&&(this.items=[],(i=this.target)==null||i.invalidateOverlay())}hasItems(){return this.items.length>0}dispose(){this.attach(null),this.items=[]}paint(){if(this.items.length===0)return null;const i=this.options.getTerminal(),a=i==null?void 0:i.buffer.active;if(!i||!a)return null;const o=[],r=this.options.isCursorHidden(),u=a.baseY+a.cursorY,h=a.cursorX,p=yd(i,u,h),m=r&&!!p&&gy(p);let g;for(const b of this.items)switch(b.kind){case"char":o.push({row:b.row,col:b.col,chars:b.char,width:b.width,style:b.style??CC(i,b.row,b.col)});break;case"erase":o.push({row:b.row,col:b.col,chars:" ",width:b.width,style:SC(b.style??yd(i,b.row,b.col)??hy)});break;case"mask":m&&b.row===u&&b.col===h&&o.push({row:b.row,col:b.col,chars:b.char,width:1,style:b.style??wC(p)});break;case"caret":r?m&&o.push({row:b.row,col:b.col,chars:b.char,width:1,style:p}):g={row:b.row,col:b.col};break}return g===void 0?{cells:o}:{cells:o,cursor:g}}}function yd(l,i,a){var o;return a<0||a>=l.cols?null:py((o=l.buffer.active.getLine(i))==null?void 0:o.getCell(a))}function gy(l){return(l.fg&ut.INVERSE)!==0||(l.bg&Ze.CM_MASK)!==Ze.CM_DEFAULT}function wC(l){return{fg:l.fg&~ut.INVERSE,bg:l.bg&~(Ze.CM_MASK|Ze.RGB_MASK),ext:l.ext}}function SC(l){return{fg:l.fg&ut.INVERSE?l.fg&(ut.INVERSE|Ze.CM_MASK|Ze.RGB_MASK):0,bg:l.bg&(Ze.CM_MASK|Ze.RGB_MASK),ext:0}}function CC(l,i,a){const o=yd(l,i,a-1);return o&&!gy(o)&&!(o.bg&Ei.DIM)?o:hy}const by="\x1B",TC=/^\x1b\[[IO]/,yy=/^\x1b\[<(\d+);\d+;\d+[Mm]/,MC=/^\x1b\[M[\s\S]{3}/,AC=[/^\x1b\[\?[\d;]*c/,/^\x1b\[>[\d;]*c/,/^\x1b\[\d+;\d+R/,/^\x1b\[\?\d+;\d+R/,/^\x1b\[\d+n/,/^\x1b\[\?[\d;]*\$y/,/^\x1b\[[\d;]*t/,/^\x1b\[\?\d+u/,/^\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/,/^\x1bP[\s\S]*?\x1b\\/],EC=/^\x1b\[1;[2-8]R/;function Rg(l){if(EC.test(l))return 0;const i=TC.exec(l);if(i)return i[0].length;const a=yy.exec(l);if(a){const o=Number(a[1]);return(o&32)!==0&&(o&3)===3&&(o&64)===0?a[0].length:0}for(const o of AC){const r=o.exec(l);if(r)return r[0].length}return 0}function vy(l){if(!l.startsWith(by))return"keys";if(yy.test(l)||MC.test(l)){let a=l;for(;a.length>0;){const o=Rg(a);if(o===0)return"pointer";a=a.slice(o)}return"passive"}let i=l;for(;i.length>0;){const a=Rg(i);if(a===0)return"keys";i=i.slice(a)}return"passive"}function NC(l){return l===by}function qn(l){return l===""||l===" "?" ":l}function kC(l,i,a,o=64){var h;const r=l.buffer.active.getLine(i),u=[];for(let p=a-1;p>=0&&u.length<o;p--){const m=r==null?void 0:r.getCell(p);if(!m)break;((h=m.getWidth)==null?void 0:h.call(m))!==0&&u.unshift(qn(m.getChars()))}return u}function LC(l,i){for(let a=Math.min(l.length,i.length);a>0;a--){let o=!0;for(let r=0;r<a&&o;r++)o=i[i.length-a+r]===qn(l[r]);if(o)return a}return 0}function RC(l){const i=l.buffer.active;return{key:"legacy",row:i.baseY+i.cursorY,caretCol:i.cursorX,startCol:i.cursorX,endCol:l.cols,empty:!1,agentLike:!1}}function _C(l,{style:i,predictedCursor:a,field:o,runStartedEmpty:r,active:u}){var x,T,M,A,R;const h=l.map(k=>{const O={row:k.row,col:k.col,char:k.cancelled?" ":k.char,width:k.width,kind:k.cancelled?"erase":k.kind};return i&&(O.style=i),O}),p=l[l.length-1],m=a??{row:p.row,col:p.kind==="erase"||p.cancelled?p.col:p.col+p.width},g=(k,O)=>h.some($=>$.row===k&&$.col<=O&&O<$.col+$.width),b=l.some(k=>k.kind==="char"&&!k.cancelled);if(u&&o&&r&&b&&o.agentLike&&m.row===o.row){const k=u.getLine(m.row);for(let O=m.col;O<o.endCol;O++){if(g(m.row,O)||qn(((x=k==null?void 0:k.getCell(O))==null?void 0:x.getChars())??"")===" ")continue;const $={row:m.row,col:O,char:" ",width:1,kind:"erase"};i&&($.style=i),h.push($)}}if(u){const k={row:u.baseY+u.cursorY,col:u.cursorX};if(!g(k.row,k.col)&&(k.row!==m.row||k.col!==m.col)){const O=((M=(T=u.getLine(k.row))==null?void 0:T.getCell(k.col))==null?void 0:M.getChars())??"",$={row:k.row,col:k.col,char:qn(O),width:1,kind:"mask"};i&&($.style=i),h.push($)}}const v=h.find(k=>k.row===m.row&&k.col===m.col&&k.kind!=="mask"),w=v?v.char:qn(((R=(A=u==null?void 0:u.getLine(m.row))==null?void 0:A.getCell(m.col))==null?void 0:R.getChars())??"");return h.push({row:m.row,col:m.col,char:w,width:1,kind:"caret"}),h}const jC=[[12288,12329],[12334,12335],[12337,12348],[12350,12350],[12353,12438],[12443,12543],[13312,19903],[19968,40959],[44032,55203],[63744,64255],[65281,65376],[65504,65510],[131072,196605],[196608,262141]];function xy(l){if(l>=32&&l<=126)return 1;if(l<12288)return 0;for(const[i,a]of jC){if(l<i)return 0;if(l<=a)return 2}return 0}const _g=8,OC=1500,DC=4e3,zC=20;class HC{constructor(i){W(this,"getTerminal");W(this,"getFieldOption");W(this,"charWidth");W(this,"now");W(this,"textDecoder",new TextDecoder("utf-8"));W(this,"confidentKeys",new Set);W(this,"fieldStyles",new Map);W(this,"field",null);W(this,"runStartedEmpty",!1);W(this,"predictions",[]);W(this,"predictedCursor",null);W(this,"srtt",null);W(this,"isSuppressed",!1);W(this,"suppressCursor",null);W(this,"suppressSentAt",0);W(this,"inFlight",[]);W(this,"inFlightUnknown",!1);W(this,"runInFlight",[]);W(this,"probationRun",!1);W(this,"runSent",[]);W(this,"lastSentUndrawn",!1);W(this,"awaitingPrefixCommand",!1);W(this,"mismatches",0);W(this,"trace",[]);this.getTerminal=i.getTerminal,this.getFieldOption=i.getField,this.charWidth=i.charWidth,this.now=i.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}updateSuppression(i){if(!this.isSuppressed)return;if(this.predictions.some(o=>o.frozenFrom)){this.suppressSentAt=this.now();return}!!i&&!!this.suppressCursor&&(i.row!==this.suppressCursor.row||i.col!==this.suppressCursor.col)?this.liftSuppression():this.stillSuppressed()}reset(i,a){var u;this.predictions=[],this.predictedCursor=null;const o=typeof a=="boolean"?a:(a==null?void 0:a.suppress)??!0,r=typeof a=="object"&&(a==null?void 0:a.demote)===!0;if(this.note(`reset: ${i??"unspecified"}`),r){const h=this.field??((u=this.getFieldOption)==null?void 0:u.call(this))??null;h&&this.confidentKeys.delete(h.key)}if(this.forgetInFlight(),o){this.isSuppressed=!0,this.suppressSentAt=this.now();const h=this.getTerminal();h?this.suppressCursor={row:h.buffer.active.baseY+h.buffer.active.cursorY,col:h.buffer.active.cursorX}:this.suppressCursor=null}else this.isSuppressed=!1,this.suppressCursor=null}forgetConfidence(){this.confidentKeys.clear(),this.fieldStyles.clear(),this.field=null}getState(){return this.field&&this.confidentKeys.has(this.field.key)?"confident":"tentative"}getField(){return this.field}getMismatchCount(){return this.mismatches}getEchoSrttMs(){return this.srtt}getTrace(){return this.trace}visiblePredictions(){const i=this.getState()==="confident";return this.predictions.filter(a=>a.frozenFrom?a.shownWhenFrozen:i&&!a.probation)}freeze(i,a={}){var m;const o=this.getTerminal(),r=o?{row:o.buffer.active.baseY+o.buffer.active.cursorY,col:o.buffer.active.cursorX}:null,u=this.getState()==="confident";this.predictions=this.predictions.filter(g=>!g.cancelled);for(const g of this.predictions)g.frozenFrom||(g.frozenFrom=r??{row:g.row,col:g.col},g.shownWhenFrozen=u&&!g.probation);const h=this.predictedCursor?{...this.predictedCursor}:r,p=this.inFlight.length>0||this.inFlightUnknown||this.lastSentUndrawn||this.probationRun&&this.runSent.length===0;if(this.predictedCursor=null,this.note(`freeze: ${i}${a.demote?" (demote)":""}`),a.demote){const g=this.field??((m=this.getFieldOption)==null?void 0:m.call(this))??null;g&&this.confidentKeys.delete(g.key)}this.isSuppressed=!0,this.suppressSentAt=this.now(),this.suppressCursor=h,this.forgetInFlight(),this.inFlightUnknown=p}forgetInFlight(){this.inFlight=[],this.inFlightUnknown=!1,this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.lastSentUndrawn=!1}suppressTimeout(){return Math.max(300,(this.srtt??300)*1.5)}predictionTimeout(){return Math.min(DC,Math.max(OC,(this.srtt??0)*4))}stillSuppressed(){return this.isSuppressed?this.now()-this.suppressSentAt>=this.suppressTimeout()?(this.liftSuppression(),!1):!0:!1}liftSuppression(){this.isSuppressed=!1,this.suppressCursor=null}assumedWidth(i){var o;const a=(o=this.charWidth)==null?void 0:o.call(this,i);return a===0||a===1||a===2?a:1}coveredByPrediction(i,a){return this.predictions.some(o=>(o.echoed||o.cancelled||o.kind==="erase"&&!o.frozenFrom)&&o.row===i&&o.col<=a&&a<o.col+o.width)}ensureField(i){if(this.predictedCursor&&this.field)return this.field;const a=this.getFieldOption?this.getFieldOption():RC(i);if(!a)return null;let o=a.caretCol,r=[],u=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){r=this.inFlight.slice(LC(this.inFlight,kC(i,a.row,o)));for(const h of r){const p=h.codePointAt(0)??0;o+=xy(p)||this.assumedWidth(p)}u=r.length>0}return this.inFlight=[],this.inFlightUnknown=!1,this.field=a,this.runStartedEmpty=a.empty&&r.length===0,this.predictions=this.predictions.filter(h=>h.frozenFrom),this.predictedCursor={row:a.row,col:o},this.runInFlight=r,this.probationRun=u,this.runSent=[],a}confirm(i,a){if(this.updateSrtt(Math.max(0,this.now()-i.sentAt)),a&&!i.frozenFrom&&this.markConfident(a.key),i.probation&&i.kind==="char"){for(const o of this.predictions)o.probation=void 0;this.probationRun=!1,this.runInFlight=[],this.runSent=[]}}learnStyle(i,a){const o=py(a);if(o)for(this.fieldStyles.delete(i),this.fieldStyles.set(i,o);this.fieldStyles.size>_g;){const r=this.fieldStyles.keys().next().value;if(r===void 0)break;this.fieldStyles.delete(r)}}markConfident(i){for(this.confidentKeys.delete(i),this.confidentKeys.add(i);this.confidentKeys.size>_g;){const a=this.confidentKeys.values().next().value;if(a===void 0)break;this.confidentKeys.delete(a)}}mismatch(i){this.mismatches++,this.note(`mismatch: ${i}`),this.predictions=[],this.predictedCursor=null,this.field&&this.confidentKeys.delete(this.field.key),this.isSuppressed=!1,this.suppressCursor=null}note(i){const a=this.trace[this.trace.length-1];if(a&&a.event===i){a.count++,a.at=this.now();return}this.trace.push({at:this.now(),event:i,count:1}),this.trace.length>zC&&this.trace.shift()}pruneExpired(){if(this.predictions.length===0)return;const i=this.now(),a=this.predictionTimeout(),o=this.predictions.filter(r=>i-r.sentAt<=a);o.length!==this.predictions.length&&(this.note("expired without an echo"),this.predictions=o,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(i){this.srtt===null?this.srtt=i:this.srtt=this.srtt*.8+i*.2}}const BC="?!#";class UC extends HC{handlePrintable(i,a,o){var T;const r=this.ensureField(o);if(!r||!this.predictedCursor)return this.note("refused: caret is not in an input field"),!1;const u=this.predictedCursor,h=this.predictions.every(M=>M.frozenFrom||M.cancelled)&&u.col===r.caretCol;if(r.agentLike&&r.empty&&h&&BC.includes(i))return this.freeze("agent mode switch"),!1;if(r.midWord&&h)return this.freeze("the word above may move down"),!1;if(u.col+a>r.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const p=(T=o.buffer.active.getLine(u.row))==null?void 0:T.getCell(u.col),m=[qn(p?p.getChars():"")],g=this.predictions.findIndex(M=>M.kind==="erase"&&!M.frozenFrom&&M.row===u.row&&M.col===u.col);let b;g>=0&&([b]=this.predictions.splice(g,1),m.push(...b.before," "));for(const M of this.predictions)M.cancelled&&M.row===u.row&&M.col===u.col&&m.push(M.char);const v=o.buffer.active,w=v.baseY+v.cursorY,x=w>u.row||w===u.row&&v.cursorX>u.col;return this.predictions.push({row:u.row,col:u.col,char:i,width:a,kind:"char",before:m,sentAt:this.now(),replaces:b,probation:this.probationRun||void 0,behindCaret:x||void 0}),this.probationRun&&this.runSent.push(i),this.lastSentUndrawn=!1,u.col+=a,!0}skipUnpredictable(i,a,o){const r=this.ensureField(o),u=this.predictedCursor;if(!r||!u)return this.note("refused: caret is not in an input field"),!1;const h=this.assumedWidth(a);return u.col+h>r.endCol-1?(this.freeze("cursor would reach the edge of the field"),!1):(this.probationRun||(this.probationRun=!0,this.runSent=[]),this.runSent.push(i),this.lastSentUndrawn=!0,u.col+=h,this.note("width unknown: guessing"),!0)}handleBackspace(i){var o,r,u;let a;for(let h=this.predictions.length-1;h>=0&&!a;h--)this.predictions[h].cancelled||(a=this.predictions[h]);if(this.predictedCursor&&a&&!a.frozenFrom&&!a.echoed&&a.kind==="char"&&a.row===this.predictedCursor.row&&a.col+a.width===this.predictedCursor.col)return a.cancelled=!0,a.probation&&this.runSent.pop(),this.predictedCursor.col=a.col,a.replaces&&(this.predictions.splice(this.predictions.indexOf(a),0,a.replaces),a.replaces=void 0),!0;if(this.stillSuppressed())this.inFlightUnknown=!0;else{const h=this.ensureField(i),p=this.predictedCursor;if(h&&p){const m=i.buffer.active.getLine(p.row),g=m==null?void 0:m.getCell(p.col-1),b=g&&((o=g.getWidth)==null?void 0:o.call(g))===0?2:1,v=p.col-b;let w=!0;for(let T=p.col;T<h.endCol&&w;T++)w=this.coveredByPrediction(p.row,T)||qn(((r=m==null?void 0:m.getCell(T))==null?void 0:r.getChars())??"")===" ";const x=qn(((u=m==null?void 0:m.getCell(v))==null?void 0:u.getChars())??"");if(v>h.startCol&&w&&x!==" ")return this.predictions=this.predictions.filter(T=>!(T.echoed&&T.row===p.row&&T.col+T.width>v)),this.predictions.push({row:p.row,col:v,char:" ",width:b,kind:"erase",before:[x],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,p.col=v,!0}}return this.freeze("backspace into server content"),!1}}const KC=2;class IC extends UC{handleUserInput(i){var h;if(this.pruneExpired(),i.length===0)return;const a=this.textDecoder.decode(i,{stream:!1});if(!a)return;const o=vy(a);if(o==="passive")return;if(o==="pointer"){this.freeze("pointer");return}if(this.awaitingPrefixCommand){this.awaitingPrefixCommand=!1,this.freeze("Herdr prefix command",{demote:!0});return}if(NC(a)){const p=this.field??((h=this.getFieldOption)==null?void 0:h.call(this))??null;this.freeze("escape",{demote:(p==null?void 0:p.modal)!==!1});return}const r=this.getTerminal();if(!r){this.reset("terminal unavailable",!0);return}const u=Array.from(a);for(let p=0;p<u.length;p++){const m=u[p],g=m.codePointAt(0);if(g===void 0)continue;if(g===KC){this.awaitingPrefixCommand=!0,this.freeze("Herdr prefix",{demote:!0});return}if(g===27||g===9||g===10||g===13||g<32&&g!==8){this.freeze("control or escape sequence");return}if(g===8||g===127){if(!this.handleBackspace(r)){p<u.length-1&&(this.inFlightUnknown=!0);return}continue}if(this.stillSuppressed()){this.inFlight.push(m),this.note("refused: waiting for the caret to move");continue}const b=xy(g);if(b===0){if(!this.skipUnpredictable(m,g,r)){p<u.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(m,b,r)){p<u.length-1&&(this.inFlightUnknown=!0);return}}}onServerOutput(){const i=this.getTerminal(),a=i?{row:i.buffer.active.baseY+i.buffer.active.cursorY,col:i.buffer.active.cursorX}:null;this.pruneExpired(),i&&a&&this.predictions.length>0&&this.settle(i,a),this.updateSuppression(a)}settle(i,a){var h,p;const o=this.field;if(this.getFieldOption){const m=this.getFieldOption();if(!m||m.key!==(o==null?void 0:o.key)){if(this.predictions.every(g=>g.frozenFrom||g.echoed||g.cancelled)){this.predictions=[],this.predictedCursor=null;return}this.mismatch("field changed");return}if(m.layout!==o.layout){this.predictions=[],this.predictedCursor=null,this.field=m,this.note("layout changed");return}}let r=[],u=!1;for(const m of this.predictions){if(m.cancelled){if(!u){const M=a.row>m.row||a.row===m.row&&a.col>=m.col+m.width;if(M||(m.behindCaret=void 0),m.passed&&!M)continue;M&&!m.behindCaret&&(m.passed=!0)}r.push(m),u=!0;continue}const g=(h=i.buffer.active.getLine(m.row))==null?void 0:h.getCell(m.col),b=qn(g?g.getChars():""),v=m.kind==="char"?b===m.char&&(m.width===1||(((p=g==null?void 0:g.getWidth)==null?void 0:p.call(g))??2)===2):b===" ",w=m.before.includes(b);m.behindCaret&&(a.row<m.row||a.row===m.row&&a.col<=m.col)&&(m.behindCaret=void 0);const x=m.kind==="char"?(a.row>m.row||a.row===m.row&&a.col>=m.col+m.width)&&!(m.behindCaret&&w):a.row<m.row||a.row===m.row&&a.col<=m.col,T=m.kind==="char"&&b===m.char&&!v;if(u&&!m.frozenFrom){if(!v||w){r.push(m);continue}r=r.filter(M=>!M.cancelled),u=!1}if(!(m.echoed&&!v))if(v&&(x||!w)){if(m.echoed||this.confirm(m,o),x){m.kind==="char"&&o&&!m.frozenFrom&&this.learnStyle(o.key,g);continue}m.echoed=!0,r.push(m)}else if(m.frozenFrom){const M=m.frozenFrom,A=m.kind==="erase"||a.col>=M.col;!x&&a.row===M.row&&A?r.push(m):x&&m.probation&&(this.inFlightUnknown=!0)}else if(!x&&!T)r.push(m);else if(m.probation){this.note("probation guess dropped"),this.predictions.some(M=>!M.frozenFrom&&M.kind==="erase")&&(this.inFlightUnknown=!0),this.inFlight=[...this.runInFlight,...this.runSent,...this.inFlight],this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.predictions=this.predictions.filter(M=>M.frozenFrom),this.predictedCursor=null;return}else{this.mismatch(`cell shows ${JSON.stringify(b)} for ${JSON.stringify(m.char)}`);return}}this.predictions=r,r.length===0&&(this.predictedCursor=null,this.probationRun&&(this.inFlightUnknown=!0))}getVisiblePredictions(){return this.pruneExpired(),this.visiblePredictions().filter(i=>!i.echoed&&!i.cancelled).map(i=>({row:i.row,col:i.col,char:i.char}))}getOverlayItems(){var a;this.pruneExpired();const i=this.visiblePredictions();return i.length===0?[]:_C(i,{style:this.field?this.fieldStyles.get(this.field.key):void 0,predictedCursor:this.predictedCursor,field:this.field,runStartedEmpty:this.runStartedEmpty,active:(a=this.getTerminal())==null?void 0:a.buffer.active})}}const FC=25,GC=2026,YC=1e3;function $C(l,i=()=>performance.now()){let a=!1,o=null;const r=new Set,u=b=>(r.add(b),{dispose:()=>void r.delete(b)}),h=()=>{a=!1,o=null},p=l.parser;if(!p||typeof p.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:u,reset:h,dispose:()=>{}};const m=b=>v=>{for(const w of v.flat())if(w===FC&&(a=!b),w===GC){const x=!b&&o!==null;if(o=b?i():null,x)for(const T of[...r])T()}return!1},g=[p.registerCsiHandler({prefix:"?",final:"h"},m(!0)),p.registerCsiHandler({prefix:"?",final:"l"},m(!1)),p.registerCsiHandler({intermediates:"!",final:"p"},()=>(h(),!1))];return typeof p.registerEscHandler=="function"&&g.push(p.registerEscHandler({final:"c"},()=>(h(),!1))),{isCursorHidden:()=>a,isSynchronizing:()=>o!==null&&i()-o<YC,onSyncEnd:u,reset:h,dispose:()=>{for(const b of g)b.dispose();r.clear()}}}const qC=40;function VC(l,i){return l==="off"?!1:l==="always"?!0:i!==null&&i>qC}function PC(l,i){var p;const a=$C(l),o=new pC({getScreen:()=>{const m=i();if(!m)return null;const g=m.buffer.active;return{cols:m.cols,rows:m.rows,baseY:g.baseY,getLine:b=>g.getLine(b),getNullCell:typeof g.getNullCell=="function"?()=>g.getNullCell():void 0}},getCursor:()=>{var g;const m=(g=i())==null?void 0:g.buffer.active;return m?{row:m.baseY+m.cursorY,col:m.cursorX,hidden:a.isCursorHidden()}:null},isSynchronizing:a.isSynchronizing}),r=(p=l._core)==null?void 0:p.unicodeService,u=new IC({getTerminal:i,getField:o.detect,charWidth:typeof(r==null?void 0:r.wcwidth)=="function"?m=>r.wcwidth(m):void 0}),h=new xC({getTerminal:i,isCursorHidden:()=>a.isCursorHidden()});return{screenState:a,fieldProbe:o,predictor:u,overlay:h}}function XC({termRef:l,rendererRef:i,mode:a,connectionState:o,observeKeyInput:r}){const u=C.useRef(null),h=C.useRef(null),p=C.useRef(null),m=$n(a),g=C.useCallback(()=>{const M=u.current,A=h.current;if(!(!M||!A)){if(!VC(m.current,M.getEchoSrttMs())){A.clear();return}A.sync(M.getOverlayItems())}},[m]),b=C.useCallback(M=>{var A,R,k,O;(A=u.current)==null||A.reset(M),(R=u.current)==null||R.forgetConfidence(),(k=p.current)==null||k.reset(),(O=h.current)==null||O.clear()},[]),v=C.useCallback(M=>{var A,R;(A=u.current)==null||A.reset(M),(R=h.current)==null||R.clear()},[]),w=C.useCallback(M=>{var A,R,k;(A=u.current)==null||A.handleUserInput(M),g(),(k=(R=i.current)==null?void 0:R.canvas)==null||k.markInput()},[g,i]),x=C.useCallback(M=>{const A=PC(M,()=>l.current);return p.current=A.fieldProbe,u.current=A.predictor,h.current=A.overlay,A},[l]),T=C.useCallback(()=>{var M;(M=h.current)==null||M.dispose(),h.current=null,u.current=null,p.current=null},[]);return C.useEffect(()=>r(w),[r,w]),C.useEffect(()=>{g()},[a,g]),C.useEffect(()=>{b("connectionState")},[o,b]),{predictorRef:u,overlayRef:h,fieldProbeRef:p,attach:x,detach:T,sync:g,forget:b,discard:v,onUserInput:w}}const QC=20,ZC=6,WC=500,JC=300,na=13,wy=.602,Sy=1.3;function Yn(l,i){return Number.isFinite(l)&&l>0?l:i}function jg(l,i,a){return Math.min(a,Math.max(i,l))}function Cy(l){const{width:i,height:a,cellWidth:o,cellHeight:r,minCols:u=QC,minRows:h=ZC,maxCols:p=WC,maxRows:m=JC}=l,g=Yn(o,na*wy),b=Yn(r,na*Sy);return{cols:jg(Math.floor(Yn(i,0)/g),u,p),rows:jg(Math.floor(Yn(a,0)/b),h,m)}}function ll(l,i=na){var o,r,u;if(l)try{const h=l._core,p=(u=(r=(o=h==null?void 0:h._renderService)==null?void 0:o.dimensions)==null?void 0:r.css)==null?void 0:u.cell;if(p!=null&&p.width&&p.width>0&&p.height&&p.height>0)return{cellWidth:p.width,cellHeight:p.height,measured:!0}}catch{}const a=Yn(i,na);return{cellWidth:Math.round(a*wy*100)/100,cellHeight:Math.round(a*Sy*100)/100,measured:!1}}function eT(l){var o;const i=(o=l==null?void 0:l.querySelector)==null?void 0:o.call(l,".xterm-viewport");if(!i)return 0;const a=(i.offsetWidth||0)-(i.clientWidth||0);return Number.isFinite(a)&&a>0?a:0}function vd(l,i,a){if(!l)return{width:i,height:a};let o=0,r=0;if(typeof l.getBoundingClientRect=="function"){const u=l.getBoundingClientRect();o=(u==null?void 0:u.width)||0,r=(u==null?void 0:u.height)||0}return{width:Yn(o,Yn(l.clientWidth,i)),height:Yn(r,Yn(l.clientHeight,a))}}function Ty(l,i,a,o){const r=Number.isFinite(o)&&o>.01?o:1;return{clientX:a.left+(l-a.left)/r,clientY:a.top+(i-a.top)/r}}function Og(l,i){const a=typeof window<"u"?window:void 0,o=a&&typeof a.devicePixelRatio=="number"&&a.devicePixelRatio>0?a.devicePixelRatio:1,r=a!=null&&a.visualViewport&&typeof a.visualViewport.scale=="number"&&a.visualViewport.scale>0?a.visualViewport.scale:1,u=Math.max(0,l.width),h=Math.max(0,l.height),p=Math.round(u*o*100)/100,m=Math.round(h*o*100)/100;return{dpr:o,scale:r,cssWidth:u,cssHeight:h,physicalWidth:p,physicalHeight:m}}function tT(l){const{lastSnapshot:i,currentSnapshot:a,physicalTolerancePx:o=6}=l;if(!i)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const r=Math.abs(a.scale-i.scale)>.01,u=Math.abs(a.scale-1)>.01;if(r||u)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(a.dpr-i.dpr)>.01){const g=Math.abs(a.physicalWidth-i.physicalWidth),b=Math.abs(a.physicalHeight-i.physicalHeight);if(g<=o&&b<=o)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const p=Math.abs(a.cssWidth-i.cssWidth),m=Math.abs(a.cssHeight-i.cssHeight);return p<1&&m<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const nT=250;function iT({termRef:l,containerRef:i,frameRef:a,surfaceRef:o,currentScaleRef:r,rendererRef:u,initialBannerWrittenRef:h,isActiveRef:p,sendResize:m,onResized:g}){const b=$n(m),v=$n(g),w=C.useRef({cols:0,rows:0}),x=C.useRef(null),T=C.useRef(null),M=C.useRef(null),A=C.useRef(null),R=C.useRef({width:0,height:0}),k=C.useRef(null),O=C.useRef(!1),$=C.useCallback((V,X)=>{!Number.isFinite(V)||!Number.isFinite(X)||V<=0||X<=0||V===w.current.cols&&X===w.current.rows||(x.current={cols:V,rows:X},!T.current&&(T.current=setTimeout(()=>{T.current=null;const ie=x.current;x.current=null,ie&&(ie.cols===w.current.cols&&ie.rows===w.current.rows||(w.current=ie,b.current(ie.cols,ie.rows),v.current()))},nT)))},[b,v]),_=C.useCallback((V=!1)=>{var ve;const X=l.current,ie=i.current,ue=o.current,U=a.current;if(!X||!ie||!ue||!U)return;const E=vd(ie,Zl(),ed());if(E.width<=0||E.height<=0)return;U.style.width="100%",U.style.height="100%",ue.style.width="100%",ue.style.height="100%",ue.style.transform="none",ue.style.transformOrigin="top left",r.current=1;const G=Og(E),P=tT({lastSnapshot:k.current,currentSnapshot:G});if(P.isVisualZoom&&!V){k.current=G;try{X.refresh(0,Math.max(0,X.rows-1))}catch{}return}if(P.shouldIgnore&&!V)return;k.current=G;const le=ll(X,na),Q=Cy({width:E.width-eT(ue),height:E.height,cellWidth:le.cellWidth,cellHeight:le.cellHeight}),xe=Math.abs(E.width-R.current.width)>1||Math.abs(E.height-R.current.height)>1;if(X.cols!==Q.cols||X.rows!==Q.rows)try{X.resize(Q.cols,Q.rows)}catch(me){console.debug("Error resizing terminal grid:",me)}h.current&&!O.current&&(xe||X.cols!==Q.cols||X.rows!==Q.rows)&&(O.current=!0,(ve=u.current)==null||ve.verify());const ye=Q.cols!==w.current.cols||Q.rows!==w.current.rows;p.current&&(xe||V||ye)&&(R.current={width:E.width,height:E.height},$(Q.cols,Q.rows));try{X.refresh(0,Math.max(0,X.rows-1))}catch{}},[l,i,o,a,r,u,h,p,$]),z=C.useRef(_);z.current=_;const L=C.useCallback(()=>{if(M.current===null){if(typeof requestAnimationFrame!="function"){z.current();return}M.current=requestAnimationFrame(()=>{M.current=null,z.current()})}},[]),D=C.useCallback((V=30)=>{A.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(A.current),A.current=null);let X=0;const ie=()=>{A.current=null,X++;const ue=X>=V;z.current(!0),!ue&&X<2&&typeof requestAnimationFrame=="function"&&(A.current=requestAnimationFrame(ie))};typeof requestAnimationFrame=="function"?A.current=requestAnimationFrame(ie):ie()},[]),K=C.useCallback(V=>{R.current={width:V.width,height:V.height},k.current=Og(V)},[]),J=C.useCallback(()=>{T.current&&(clearTimeout(T.current),T.current=null),M.current!==null&&(cancelAnimationFrame(M.current),M.current=null),A.current!==null&&(cancelAnimationFrame(A.current),A.current=null)},[]);return{requestFit:L,scheduleBoundedFit:D,seedFit:K,cancelPendingFits:J}}const lT=" ()[]{}'\"\\`";function aT(l,i,a,o=1){var A,R;if(!((A=i==null?void 0:i.buffer)!=null&&A.active)||i.cols<=0||i.rows<=0)return null;const r=a||((R=i.element)==null?void 0:R.querySelector(".xterm-screen"))||i.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const u=r.getBoundingClientRect(),h=Ty(l.clientX,l.clientY,u,o),p=ll(i);if(p.cellWidth<=0||p.cellHeight<=0)return null;const m=Math.max(1,u.width||i.cols*p.cellWidth),g=Math.max(1,u.height||i.rows*p.cellHeight),b=Math.max(0,Math.min(m-1,h.clientX-u.left)),v=Math.max(0,Math.min(g-1,h.clientY-u.top)),w=Math.max(0,Math.min(i.cols-1,Math.floor(b/p.cellWidth))),x=Math.max(0,Math.min(i.rows-1,Math.floor(v/p.cellHeight))),M=(i.buffer.active.viewportY??0)+x;return{col:w,bufferRow:M}}function sT(l,i){if(!l||l.length===0||l==="\0")return!0;for(const a of l)if(a==="\0"||/\s/.test(a)||i.includes(a))return!0;return!1}function oT(l,i,a){var w,x;if(!((w=l==null?void 0:l.buffer)!=null&&w.active)||i<0||i>=l.cols)return null;const o=l.buffer.active.getLine(a);if(!o)return null;const r=((x=l.options)==null?void 0:x.wordSeparator)??lT,u=new Array(l.cols).fill(null),h=Math.min(l.cols,o.length);let p=0;for(;p<h;){const T=o.getCell(p);if(!T){u[p]={startCol:p,endCol:p+1,isSeparator:!0},p++;continue}const M=T.getWidth();if(M===0){u[p]||(u[p]={startCol:p,endCol:p+1,isSeparator:!0}),p++;continue}const A=T.getChars(),R=sT(A,r),k=Math.min(l.cols,p+M),O={startCol:p,endCol:k,isSeparator:R};for(let $=p;$<k;$++)u[$]=O;p+=Math.max(1,M)}for(let T=h;T<l.cols;T++)u[T]||(u[T]={startCol:T,endCol:T+1,isSeparator:!0});const m=u[i];if(!m||m.isSeparator)return null;let g=m.startCol;for(;g>0;){const T=u[g-1];if(T&&!T.isSeparator)g=T.startCol;else break}let b=m.endCol;for(;b<l.cols;){const T=u[b];if(T&&!T.isSeparator)b=T.endCol;else break}const v=b-g;return v<=0?null:{startCol:g,length:v}}function rT(l){var u;if(!((u=l==null?void 0:l.buffer)!=null&&u.active))return"";const i=l.buffer.active,a=i.viewportY??0,o=l.rows,r=[];for(let h=0;h<o;h++){const p=i.getLine(a+h);r.push(p?p.translateToString(!0):"")}for(;r.length>0&&r[r.length-1]==="";)r.pop();return r.join(`
49
+ `)}const Dg=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),cT=.6,uT=new Set(["─","━","═","┄","┅","┈","┉","-"]),dT=.8;function $u(l,i){if(!l)return!1;let a=0;const o=Math.min(i,l.length);for(let r=0;r<o;r++){const u=l.getCell(r);if(u){const h=u.getChars();h&&uT.has(h)&&a++}}return a>=Math.max(5,Math.min(i*.25,10))}function qu(l,i,a){var x;if(!((x=l==null?void 0:l.buffer)!=null&&x.active)||l.cols<=0)return{startCol:0,endCol:0};const o=l.buffer.active,r=l.cols,u=Math.max(0,Math.min(r-1,i)),h=o.viewportY??0,p=l.rows>0?l.rows:1,m=new Int32Array(r);let g=0;for(let T=0;T<p;T++){const M=o.getLine(h+T);if(g++,!M)continue;const A=Math.min(r,M.length);for(let R=0;R<A;R++){const k=M.getCell(R);if(k){const O=k.getChars();O&&Dg.has(O)&&m[R]++}}}if(g===0)return{startCol:0,endCol:r-1};const b=g*cT,v=T=>m[T]>=b;let w=!1;for(let T=0;T<r;T++)if(v(T)){w=!0;break}if(w){if(v(u))return{startCol:u,endCol:u};let T=-1;for(let A=u-1;A>=0;A--)if(v(A)){T=A;break}let M=r;for(let A=u+1;A<r;A++)if(v(A)){M=A;break}return{startCol:T+1,endCol:M-1}}if(a!==void 0){const T=Math.max(h,Math.min(h+p-1,a)),M=o.getLine(T);if(!$u(M,r)){let A=h;for(let O=T-1;O>=h;O--)if($u(o.getLine(O),r)){A=O+1;break}let R=h+p-1;for(let O=T+1;O<=h+p-1;O++)if($u(o.getLine(O),r)){R=O-1;break}const k=R-A+1;if(k>=2){const O=new Int32Array(r);for(let L=A;L<=R;L++){const D=o.getLine(L);if(!D)continue;const K=Math.min(r,D.length);for(let J=0;J<K;J++){const V=D.getCell(J);if(V){const X=V.getChars();X&&Dg.has(X)&&O[J]++}}}const $=k*dT,_=L=>O[L]>=$;let z=!1;for(let L=0;L<r;L++)if(_(L)){z=!0;break}if(z){if(_(u))return{startCol:u,endCol:u};let L=-1;for(let K=u-1;K>=0;K--)if(_(K)){L=K;break}let D=r;for(let K=u+1;K<r;K++)if(_(K)){D=K;break}return{startCol:L+1,endCol:D-1}}}}}return{startCol:0,endCol:r-1}}function zg(l,i){const a=Math.min(l.startCol,l.endCol),o=Math.max(l.startCol,l.endCol),r=Math.min(l.startRow,l.endRow),u=Math.max(l.startRow,l.endRow);return{startCol:Math.max(i.startCol,Math.min(i.endCol,a)),endCol:Math.max(i.startCol,Math.min(i.endCol,o)),startRow:r,endRow:u}}function Hg(l,i){var g;if(!((g=l==null?void 0:l.buffer)!=null&&g.active)||l.cols<=0)return"";const a=l.buffer.active,o=l.cols,r=Math.min(i.startRow,i.endRow),u=Math.max(i.startRow,i.endRow),h=Math.max(0,Math.min(i.startCol,i.endCol)),p=Math.min(o-1,Math.max(i.startCol,i.endCol));if(h>p||r>u)return"";const m=[];for(let b=r;b<=u;b++){const v=a.getLine(b);if(!v){m.push("");continue}const w=v.translateToString(!0,h,p+1);m.push(w.trimEnd())}return m.join(`
50
+ `)}function fT({termRef:l,surfaceRef:i,mainRef:a,currentScaleRef:o,addToast:r,t:u}){const h=$n(r),p=$n(u),[m,g]=C.useState(null),b=C.useRef(null);b.current=m;const[v,w]=C.useState(null),x=C.useRef(null);x.current=v;const[T,M]=C.useState(""),A=C.useRef("");A.current=T;const[R,k]=C.useState(!1),O=C.useRef(!1);O.current=R;const $=C.useRef(!1),[_,z]=C.useState(0),L=C.useRef(0),D=C.useRef(null),K=C.useRef(null),J=C.useRef(null),V=C.useRef(null),X=C.useCallback(se=>{var pe;const Se=l.current;if(!Se)return null;const ae=((pe=i.current)==null?void 0:pe.querySelector(".xterm-screen"))||i.current;return aT(se,Se,ae,o.current)},[l,i,o]),ie=C.useCallback(se=>{const Se=l.current,ae=X(se);return!Se||!ae?null:OS(Se,ae.col,ae.bufferRow)},[l,X]),ue=C.useCallback((se,Se)=>{w(Se),M(Hg(se,Se)),k(!0)},[]),U=C.useCallback(()=>{w(null),M(""),k(!1),J.current=null,V.current=null},[]),E=C.useCallback(()=>{g(null),b.current=null,w(null),x.current=null,M(""),A.current="",k(!1),D.current=null,K.current=null},[]),G=C.useCallback(se=>{const Se=l.current;if(!Se)return;const ae=X(se),pe=ae?oT(Se,ae.col,ae.bufferRow):null;if(ae&&pe){J.current=ae;const Ee=qu(Se,ae.col,ae.bufferRow);V.current=Ee;const Be={startCol:pe.startCol,endCol:pe.startCol+pe.length-1,startRow:ae.bufferRow,endRow:ae.bufferRow};ue(Se,zg(Be,Ee))}else U();D.current=se,K.current=null},[l,X,ue,U]),P=C.useCallback(se=>{const Se=l.current,ae=J.current;if(!Se||!ae)return;K.current=se;const pe=X(se);if(!pe)return;const Ee=V.current??qu(Se,ae.col,ae.bufferRow),Be={startCol:Math.min(ae.col,pe.col),endCol:Math.max(ae.col,pe.col),startRow:Math.min(ae.bufferRow,pe.bufferRow),endRow:Math.max(ae.bufferRow,pe.bufferRow)};ue(Se,zg(Be,Ee))},[l,X,ue]),le=C.useCallback(()=>{const se=K.current??D.current;if(!se||!a.current)return;const Se=a.current.getBoundingClientRect(),ae=se.clientX-Se.left,pe=se.clientY-Se.top,Ee=ie(se);g({x:ae,y:pe,link:Ee}),b.current={x:ae,y:pe,link:Ee}},[a,ie]),Q=C.useCallback(async se=>{await zd(se)==="failed"?h.current("error",p.current("clipboard.copyFailed")):h.current("success",p.current("clipboard.copied"))},[h,p]),xe=C.useCallback(async()=>{const se=A.current;se&&await Q(se)},[Q]),ye=C.useCallback(async()=>{var Ee,Be,re,Ae;const se=l.current,Se=(Ee=se==null?void 0:se.buffer)==null?void 0:Ee.active;if(!se||!Se)return;const ae=((Be=x.current)==null?void 0:Be.startRow)??((re=J.current)==null?void 0:re.bufferRow)??Se.viewportY,pe=V.current??qu(se,((Ae=J.current)==null?void 0:Ae.col)??0,ae);await Q(Hg(se,{startCol:pe.startCol,endCol:pe.endCol,startRow:ae,endRow:ae}))},[l,Q]),ve=C.useCallback(async()=>{const se=l.current;se&&await Q(rT(se))},[l,Q]),me=C.useCallback((se,Se,ae)=>{const pe=se.buffer.active.viewportY??0;pe!==L.current&&(L.current=pe,z(pe));const Ee=x.current;if(Ee&&O.current){const Be=Ee.startRow-pe,re=Ee.endRow-pe;$.current&&Se<=re&&ae>=Be&&(k(!1),$.current=!1)}else $.current=!1},[]),de=C.useCallback(se=>{const Se=se.buffer.active.viewportY??0;L.current=Se,z(Se)},[]),we=C.useCallback(()=>{$.current=!0},[]);return{selectionMenu:m,selectionRect:v,selectionSnapshot:T,isHighlightVisible:R,viewportY:_,hasOpenMenu:()=>b.current!==null,clearSelection:E,handleLongPress:G,handleSelectionExtend:P,openMenuAtGesture:le,handleCopySelection:xe,handleCopyLine:ye,handleCopyScreen:ve,onTerminalRender:me,onTerminalScroll:de,onTerminalContentChanged:we}}const hT=({term:l,surface:i,main:a,rect:o,viewportY:r})=>{if(!l||!a)return null;const u=ll(l);if(u.cellWidth<=0||u.cellHeight<=0)return null;const h=(i==null?void 0:i.querySelector(".xterm-screen"))||i;if(!h)return null;const p=h.getBoundingClientRect(),m=a.getBoundingClientRect(),g=o.startRow-r;if(o.endRow-r<0||g>=l.rows)return null;const v=p.top-m.top+g*u.cellHeight,w=p.left-m.left+o.startCol*u.cellWidth,x=(o.endCol-o.startCol+1)*u.cellWidth,T=(o.endRow-o.startRow+1)*u.cellHeight;return f.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${v}px`,left:`${w}px`,width:`${x}px`,height:`${T}px`}})},qo=new Map;function My(l){let i=qo.get(l);return i===void 0&&(i=`#${(l&Ze.RGB_MASK).toString(16).padStart(6,"0")}`,qo.size>4096&&qo.clear(),qo.set(l,i)),i}function Ay(l,i,a){var o;switch(l&Ze.CM_MASK){case Ze.CM_P16:case Ze.CM_P256:return((o=i.ansi[l&Ze.PCOLOR_MASK])==null?void 0:o.css)??a;case Ze.CM_RGB:return My(l&Ze.RGB_MASK);default:return a}}function Bg(l,i,a,o){var v;const r=(l&ut.INVERSE)!==0,u=r?i:l,h=r?l:i;let p;const m=u&Ze.CM_MASK;if(m===Ze.CM_P16||m===Ze.CM_P256){let w=u&Ze.PCOLOR_MASK;o&&l&ut.BOLD&&w<8&&(w+=8),p=((v=a.ansi[w])==null?void 0:v.css)??a.foreground.css}else m===Ze.CM_RGB?p=My(u&Ze.RGB_MASK):p=r?a.background.css:a.foreground.css;const g=h&Ze.CM_MASK,b=g===Ze.CM_DEFAULT?r?a.foreground.css:a.background.css:Ay(h,a,a.background.css);return{fg:p,bg:b,bgIsDefault:!r&&g===Ze.CM_DEFAULT}}function er(l){return(l&ut.BOLD)!==0}function Vu(l){return(l&Ei.ITALIC)!==0}function xd(l){return(l&Ei.DIM)!==0}function Vo(l){return(l&ut.INVISIBLE)!==0}const mT=600;var Xl=(l=>(l[l.NONE=0]="NONE",l[l.BLOCK=1]="BLOCK",l[l.BAR=2]="BAR",l[l.UNDERLINE=3]="UNDERLINE",l[l.OUTLINE=4]="OUTLINE",l))(Xl||{});function Ug(l){switch(l){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function pT(l,i,a,o,r,u,{css:h,dpr:p,cursorWidth:m}){switch(l.save(),l.fillStyle=h,l.strokeStyle=h,u){case 2:l.fillRect(a,o,Math.max(1,Math.round(m*p)),i.cell.height);break;case 3:l.fillRect(a,o+i.cell.height-Math.max(1,Math.round(p))-1,r,Math.max(1,Math.round(p)));break;case 4:{const g=Math.max(1,Math.round(p));l.lineWidth=g,l.strokeRect(a+g/2,o+g/2,r-g,i.cell.height-g);break}}l.restore()}function gT(l,i,a,o,r){let u,h;if(a&&a.cursor!==void 0){if(a.cursor===null)return null;u=a.cursor.row,h=a.cursor.col}else{if(!l.coreService.isCursorInitialized||l.coreService.isCursorHidden)return null;u=i.ybase+i.y,h=i.x}const p=u-i.ydisp;if(p<0||p>=o.rows)return null;const m=Math.min(Math.max(0,h),o.cols-1),g=l.optionsService.rawOptions;let b;if(l._coreBrowserService.isFocused)r?b=0:b=Ug(g.cursorStyle||"block");else{const v=g.cursorInactiveStyle??"outline";b=v==="none"?0:Ug(v)}return b===0?null:{x:m,y:p,shape:b}}class bT{constructor(i){W(this,"timer",null);W(this,"visible",!0);this.onToggle=i}get running(){return this.timer!==null}get hidden(){return this.timer!==null&&!this.visible}start(){this.stop(),this.timer=setInterval(()=>{this.visible=!this.visible,this.onToggle()},mT)}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.visible=!0}}/**
51
51
  * Box drawing, block element and Powerline glyphs, drawn as shapes rather than
52
52
  * taken from the font.
53
53
  *
@@ -58,4 +58,4 @@ ${i.slice(-6).map(a=>` ${a.event}${a.count>1?` ×${a.count}`:""}`).join(`
58
58
  *
59
59
  * Copyright (c) 2021 The xterm.js authors. All rights reserved.
60
60
  * @license MIT
61
- */function Kg(l){if(!l)throw new Error("value must not be falsy");return l}const gT={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},bT={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},yT={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(l,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"║":{1:(l,i)=>`M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╒":{1:(l,i)=>`M.5,1 L.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╓":{1:(l,i)=>`M${.5-l},1 L${.5-l},.5 L1,.5 M${.5+l},.5 L${.5+l},1`},"╔":{1:(l,i)=>`M1,${.5-i} L${.5-l},${.5-i} L${.5-l},1 M1,${.5+i} L${.5+l},${.5+i} L${.5+l},1`},"╕":{1:(l,i)=>`M0,${.5-i} L.5,${.5-i} L.5,1 M0,${.5+i} L.5,${.5+i}`},"╖":{1:(l,i)=>`M${.5+l},1 L${.5+l},.5 L0,.5 M${.5-l},.5 L${.5-l},1`},"╗":{1:(l,i)=>`M0,${.5+i} L${.5-l},${.5+i} L${.5-l},1 M0,${.5-i} L${.5+l},${.5-i} L${.5+l},1`},"╘":{1:(l,i)=>`M.5,0 L.5,${.5+i} L1,${.5+i} M.5,${.5-i} L1,${.5-i}`},"╙":{1:(l,i)=>`M1,.5 L${.5-l},.5 L${.5-l},0 M${.5+l},.5 L${.5+l},0`},"╚":{1:(l,i)=>`M1,${.5-i} L${.5+l},${.5-i} L${.5+l},0 M1,${.5+i} L${.5-l},${.5+i} L${.5-l},0`},"╛":{1:(l,i)=>`M0,${.5+i} L.5,${.5+i} L.5,0 M0,${.5-i} L.5,${.5-i}`},"╜":{1:(l,i)=>`M0,.5 L${.5+l},.5 L${.5+l},0 M${.5-l},.5 L${.5-l},0`},"╝":{1:(l,i)=>`M0,${.5-i} L${.5-l},${.5-i} L${.5-l},0 M0,${.5+i} L${.5+l},${.5+i} L${.5+l},0`},"╞":{1:(l,i)=>`M.5,0 L.5,1 M.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╟":{1:(l,i)=>`M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1 M${.5+l},.5 L1,.5`},"╠":{1:(l,i)=>`M${.5-l},0 L${.5-l},1 M1,${.5+i} L${.5+l},${.5+i} L${.5+l},1 M1,${.5-i} L${.5+l},${.5-i} L${.5+l},0`},"╡":{1:(l,i)=>`M.5,0 L.5,1 M0,${.5-i} L.5,${.5-i} M0,${.5+i} L.5,${.5+i}`},"╢":{1:(l,i)=>`M0,.5 L${.5-l},.5 M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╣":{1:(l,i)=>`M${.5+l},0 L${.5+l},1 M0,${.5+i} L${.5-l},${.5+i} L${.5-l},1 M0,${.5-i} L${.5-l},${.5-i} L${.5-l},0`},"╤":{1:(l,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i} M.5,${.5+i} L.5,1`},"╥":{1:(l,i)=>`M0,.5 L1,.5 M${.5-l},.5 L${.5-l},1 M${.5+l},.5 L${.5+l},1`},"╦":{1:(l,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L${.5-l},${.5+i} L${.5-l},1 M1,${.5+i} L${.5+l},${.5+i} L${.5+l},1`},"╧":{1:(l,i)=>`M.5,0 L.5,${.5-i} M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╨":{1:(l,i)=>`M0,.5 L1,.5 M${.5-l},.5 L${.5-l},0 M${.5+l},.5 L${.5+l},0`},"╩":{1:(l,i)=>`M0,${.5+i} L1,${.5+i} M0,${.5-i} L${.5-l},${.5-i} L${.5-l},0 M1,${.5-i} L${.5+l},${.5-i} L${.5+l},0`},"╪":{1:(l,i)=>`M.5,0 L.5,1 M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╫":{1:(l,i)=>`M0,.5 L1,.5 M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╬":{1:(l,i)=>`M0,${.5+i} L${.5-l},${.5+i} L${.5-l},1 M1,${.5+i} L${.5+l},${.5+i} L${.5+l},1 M0,${.5-i} L${.5-l},${.5-i} L${.5-l},0 M1,${.5-i} L${.5+l},${.5-i} L${.5+l},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(l,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,1,.5`},"╮":{1:(l,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,0,.5`},"╯":{1:(l,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,0,.5`},"╰":{1:(l,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,1,.5`}},us={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};us[""]=us[""];us[""]=us[""];function vT(l,i,a,o,r,u,h,p){const m=gT[i];if(m)return xT(l,m,a,o,r,u),!0;const g=bT[i];if(g)return wT(l,g,a,o,r,u),!0;const b=yT[i];if(b)return ST(l,b,a,o,r,u,p),!0;const v=us[i];return v?(CT(l,v,a,o,r,u,h,p),!0):!1}function xT(l,i,a,o,r,u){for(let h=0;h<i.length;h++){const p=i[h],m=r/8,g=u/8;l.fillRect(a+p.x*m,o+p.y*g,p.w*m,p.h*g)}}const Ig=new Map;function wT(l,i,a,o,r,u){let h=Ig.get(i);h||(h=new Map,Ig.set(i,h));const p=l.fillStyle;if(typeof p!="string")throw new Error(`Unexpected fillStyle type "${p}"`);let m=h.get(p);if(!m){const g=i[0].length,b=i.length,v=l.canvas.ownerDocument.createElement("canvas");v.width=g,v.height=b;const w=Kg(v.getContext("2d")),x=new ImageData(g,b);let T,M,A,R;if(p.startsWith("#"))T=parseInt(p.slice(1,3),16),M=parseInt(p.slice(3,5),16),A=parseInt(p.slice(5,7),16),R=p.length>7&&parseInt(p.slice(7,9),16)||1;else if(p.startsWith("rgba"))[T,M,A,R]=p.substring(5,p.length-1).split(",").map(k=>parseFloat(k));else throw new Error(`Unexpected fillStyle color format "${p}" when drawing pattern glyph`);for(let k=0;k<b;k++)for(let O=0;O<g;O++)x.data[(k*g+O)*4]=T,x.data[(k*g+O)*4+1]=M,x.data[(k*g+O)*4+2]=A,x.data[(k*g+O)*4+3]=i[k][O]*(R*255);w.putImageData(x,0,0),m=Kg(l.createPattern(v,null)),h.set(p,m)}l.fillStyle=m,l.fillRect(a,o,r,u)}function ST(l,i,a,o,r,u,h){l.strokeStyle=l.fillStyle;for(const[p,m]of Object.entries(i)){l.beginPath(),l.lineWidth=h*Number.parseInt(p,10);let g;if(typeof m=="function"){const v=.15/u*r;g=m(.15,v)}else g=m;for(const b of g.split(" ")){const v=b[0],w=Ay[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}const x=b.substring(1).split(",");!x[0]||!x[1]||w(l,Ey(x,r,u,a,o,!0,h))}l.stroke(),l.closePath()}}function CT(l,i,a,o,r,u,h,p){const m=new Path2D;m.rect(a,o,r,u),l.clip(m),l.beginPath();const g=h/12;l.lineWidth=p*g;for(const b of i.d.split(" ")){const v=b[0],w=Ay[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}const x=b.substring(1).split(",");!x[0]||!x[1]||w(l,Ey(x,r,u,a,o,!1,p,(i.leftPadding??0)*(g/2),(i.rightPadding??0)*(g/2)))}i.type===1?(l.strokeStyle=l.fillStyle,l.stroke()):l.fill(),l.closePath()}function Fg(l,i,a=0){return Math.max(Math.min(l,i),a)}const Ay={C:(l,i)=>l.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5]),L:(l,i)=>l.lineTo(i[0],i[1]),M:(l,i)=>l.moveTo(i[0],i[1])};function Ey(l,i,a,o,r,u,h,p=0,m=0){const g=l.map(b=>parseFloat(b)||parseInt(b,10));if(g.length<2)throw new Error("Too few arguments for instruction");for(let b=0;b<g.length;b+=2)g[b]*=i-p*h-m*h,u&&g[b]!==0&&(g[b]=Fg(Math.round(g[b]+.5)-.5,i,0)),g[b]+=o+p*h;for(let b=1;b<g.length;b+=2)g[b]*=a,u&&g[b]!==0&&(g[b]=Fg(Math.round(g[b]+.5)-.5,a,0)),g[b]+=r;return g}const Dd=.5,TT=1024,MT=6;function AT(l){return/Firefox\//.test(l)||/Edge\/\d/.test(l)?"bottom":"ideographic"}class ET{constructor(i,a=typeof navigator<"u"?navigator.userAgent:""){W(this,"pages",[]);W(this,"slots",new Map);W(this,"inkCache",new Map);W(this,"metrics",null);W(this,"font",null);W(this,"baseline");W(this,"generation",0);W(this,"scratch");this.document=i,this.baseline=AT(a)}configure(i,a){const o=this.metrics&&this.font&&this.metrics.cellWidth===i.cellWidth&&this.metrics.cellHeight===i.cellHeight&&this.metrics.charWidth===i.charWidth&&this.metrics.charHeight===i.charHeight&&this.metrics.charLeft===i.charLeft&&this.metrics.charTop===i.charTop&&this.metrics.dpr===i.dpr&&this.font.fontFamily===a.fontFamily&&this.font.fontSize===a.fontSize&&this.font.fontWeight===a.fontWeight&&this.font.fontWeightBold===a.fontWeightBold&&this.font.customGlyphs===a.customGlyphs;this.metrics={...i},this.font={...a},o||this.clear()}clear(){this.slots.clear(),this.inkCache.clear();for(const i of this.pages)i.shelfX=0,i.shelfY=0;this.generation++}dispose(){this.slots.clear(),this.inkCache.clear();for(const i of this.pages)i.canvas.width=0,i.canvas.height=0;this.pages=[]}get pageCount(){return this.pages.length}fontString(i,a){const o=this.font,r=i?o.fontWeightBold:o.fontWeight;return`${a?"italic ":""}${r} ${o.fontSize*this.metrics.dpr}px ${o.fontFamily}`}overflow(i,a,o){if(!this.metrics||!this.font||i.length===1&&i.charCodeAt(0)<128)return 0;const r=`${a?1:0}${o?1:0}${i}`,u=this.inkCache.get(r);if(u!==void 0)return u;let h=0;const p=this.scratchContext();if(p&&!(this.font.customGlyphs&&Ny(i))){p.font=this.fontString(a,o),p.textBaseline=this.baseline;const m=p.measureText(i),g=typeof m.actualBoundingBoxRight=="number"?m.actualBoundingBoxRight:m.width;h=Math.max(0,Math.ceil(this.metrics.charLeft+g-this.metrics.cellWidth))}return this.inkCache.set(r,h),h}get(i){const a=this.metrics,o=this.font;if(!a||!o||a.cellWidth<=0||a.cellHeight<=0)return null;const r=`${i.cells}${i.bold?1:0}${i.italic?1:0}${i.dim?1:0}${i.fg}\0${i.bg}\0${i.chars}`,u=this.slots.get(r);if(u)return u;const h=a.cellWidth*i.cells,p=a.cellHeight,m=this.allocate(h,p);if(!m)return null;const{page:g,x:b,y:v}=m,w=g.ctx;w.save(),w.beginPath(),w.rect(b,v,h,p),w.clip(),w.globalAlpha=1,w.fillStyle=i.bg,w.fillRect(b,v,h,p),w.fillStyle=i.fg,i.dim&&(w.globalAlpha=Dd);let x=!1;o.customGlyphs&&(x=vT(w,i.chars,b,v,a.cellWidth,a.cellHeight,o.fontSize,a.dpr)),x||(w.font=this.fontString(i.bold,i.italic),w.textBaseline=this.baseline,w.fillText(i.chars,b+a.charLeft,v+a.charTop+a.charHeight)),w.restore();const T={source:g.canvas,x:b,y:v,width:h,height:p};return this.slots.set(r,T),T}allocate(i,a){for(const o of this.pages){const r=this.fit(o,i,a);if(r)return r}if(this.pages.length<MT){const o=this.createPage(Math.max(TT,i,a));return o?(this.pages.push(o),this.fit(o,i,a)):null}return this.clear(),this.pages[0]?this.fit(this.pages[0],i,a):null}fit(i,a,o){if(i.shelfX+a>i.canvas.width&&(i.shelfX=0,i.shelfY+=o),i.shelfY+o>i.canvas.height||a>i.canvas.width)return null;const r={page:i,x:i.shelfX,y:i.shelfY};return i.shelfX+=a,r}createPage(i){const a=this.document.createElement("canvas");a.width=i,a.height=i;const o=a.getContext("2d",{alpha:!1});return o?{canvas:a,ctx:o,shelfX:0,shelfY:0}:null}scratchContext(){if(this.scratch===void 0){const i=this.document.createElement("canvas");i.width=1,i.height=1,this.scratch=i.getContext("2d")}return this.scratch}}function Ny(l){if(l.length!==1)return!1;const i=l.charCodeAt(0);return i>=9472&&i<=9631||i>=57504&&i<=57558}function NT(l,i){return(l&(ut.UNDERLINE|ut.STRIKETHROUGH))!==0||(i&Ai.OVERLINE)!==0}function kT(l,i,{px:a,py:o,cells:r,fgWord:u,bgWord:h,ext:p,fgCss:m},{fontSize:g,dpr:b,colors:v,boldBright:w}){const x=(u&ut.UNDERLINE)!==0,T=(u&ut.STRIKETHROUGH)!==0,M=(h&Ai.OVERLINE)!==0,A=r*i.cell.width;l.save(),l.beginPath(),l.rect(a,o,A,i.cell.height),l.clip(),yd(h)&&(l.globalAlpha=Dd);const R=Math.max(1,Math.floor(g*b/15)),k=R%2===1?.5:0;if(x){const O=gC(p);let $=m;if(O){let L=O;w&&er(u)&&(L&50331648)!==50331648&&(L&255)<8&&(L+=8),$=My(L,v,m)}l.strokeStyle=$,l.lineWidth=R;const _=o+i.char.top+Math.ceil(i.char.height)-k-R*2,z=p?pC(p):Vl.SINGLE;switch(l.beginPath(),z){case Vl.DOUBLE:l.moveTo(a,_),l.lineTo(a+A,_),l.moveTo(a,_+R*2),l.lineTo(a+A,_+R*2);break;case Vl.CURLY:{const L=_+R,D=Math.max(1,R);for(let K=0;K<r;K++){const J=a+K*i.cell.width,V=J+i.cell.width/2,X=J+i.cell.width;l.moveTo(J,L),l.bezierCurveTo(J,L-D,V,L-D,V,L),l.bezierCurveTo(V,L+D,X,L+D,X,L)}break}case Vl.DOTTED:l.setLineDash([R,R]),l.moveTo(a,_),l.lineTo(a+A,_);break;case Vl.DASHED:{const L=Math.floor(.6*i.cell.width),D=Math.floor(.3*i.cell.width);l.setLineDash([L,D,i.cell.width-L-D]),l.moveTo(a,_),l.lineTo(a+A,_);break}default:l.moveTo(a,_),l.lineTo(a+A,_)}l.stroke(),l.setLineDash([])}if(M&&(l.strokeStyle=m,l.lineWidth=R,l.beginPath(),l.moveTo(a,o+i.char.top+k),l.lineTo(a+A,o+i.char.top+k),l.stroke()),T){const O=Math.max(1,Math.floor(g*b/10)),$=o+i.char.top+Math.floor(i.char.height/2)-(O%2===1?.5:0);l.strokeStyle=m,l.lineWidth=O,l.beginPath(),l.moveTo(a,$),l.lineTo(a+A,$),l.stroke()}l.restore()}const ns=4294967295,Pu=4,LT=3;class RT{constructor(i,a,o,r){W(this,"atlas");W(this,"cols",0);W(this,"rows",0);W(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});W(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});W(this,"work",mC());this.ctx=i,this.core=o,this.dimensions=r,this.atlas=new ET(a)}resize(i,a){this.cols=i,this.rows=a;const o=i*a;this.painted={content:new Uint32Array(o).fill(ns),fg:new Uint32Array(o),bg:new Uint32Array(o),ext:new Uint32Array(o),meta:new Uint32Array(o).fill(ns),combined:new Array(o).fill("")},this.row={content:new Uint32Array(i),fg:new Uint32Array(i),bg:new Uint32Array(i),ext:new Uint32Array(i),combined:new Array(i).fill("")}}invalidate(){this.painted.content.fill(ns),this.painted.meta.fill(ns)}hasPaintedInk(i,a){const o=this.dimensions.device;if(!o.cell.width||!o.cell.height)return!1;const r=Math.min(this.cols,Math.floor(i/o.cell.width)),u=Math.min(this.rows,Math.floor(a/o.cell.height)),h=this.painted;for(let p=0;p<u;p++)for(let m=0;m<r;m++){const g=p*this.cols+m,b=h.content[g];if(b===ns||h.meta[g]===Pu||Vo(h.fg[g]))continue;const v=b&ct.CODEPOINT_MASK;if(b&ct.IS_COMBINED_MASK?h.combined[g]!=="":v!==0&&v!==32)return!0}return!1}loadRow(i,a){const{content:o,fg:r,bg:u,ext:h,combined:p}=this.row,m=this.work;for(let g=0;g<this.cols;g++)i&&g<i.length?(i.loadCell(g,m),o[g]=m.content,r[g]=m.fg,u[g]=m.bg,h[g]=hy(m),p[g]=m.content&ct.IS_COMBINED_MASK?m.combinedData:""):(o[g]=1<<ct.WIDTH_SHIFT,r[g]=0,u[g]=0,h[g]=0,p[g]="");if(a)for(const g of a){const b=g.col;if(b<0||b+g.width>this.cols)continue;b>0&&!(o[b]>>>ct.WIDTH_SHIFT)&&this.blankAt(b-1);const v=b+g.width;v<this.cols&&!(o[v]>>>ct.WIDTH_SHIFT)&&o[v-1]>>>ct.WIDTH_SHIFT===2&&this.blankAt(v);const w=bC(g.chars,g.width);o[b]=w.content,p[b]=w.combinedData,r[b]=g.style.fg,u[b]=g.style.bg,h[b]=g.style.ext,g.width===2&&(o[b+1]=0,p[b+1]="",r[b+1]=g.style.fg,u[b+1]=g.style.bg,h[b+1]=g.style.ext)}}blankAt(i){this.row.content[i]=32|1<<ct.WIDTH_SHIFT,this.row.combined[i]=""}paintRow(i,a){const o=this.cols,{content:r,fg:u,bg:h,ext:p,combined:m}=this.row,g=this.painted,b=i*o;let v=0,w=-1,x=-1,T="";const M=()=>{w<0||(this.fillCells(w,i,x-w,T),w=-1)};let A=0;for(;A<o;){let k=r[A]>>>ct.WIDTH_SHIFT;k===0&&(k=1),A+k>o&&(k=o-A),k===1&&A+1<o&&this.overflowsInto(A)&&(k=2);const O=a&&a.y===i&&a.x>=A&&a.x<A+k?a.shape:Pl.NONE,$=k|O<<LT;let _=this.differs(b+A,A,$);for(let z=1;z<k;z++)this.differs(b+A+z,A+z,Pu)&&(_=!0);if(_){for(let L=0;L<k;L++){const D=b+A+L;g.content[D]=r[A+L],g.fg[D]=u[A+L],g.bg[D]=h[A+L],g.ext[D]=p[A+L],g.meta[D]=L===0?$:Pu,g.combined[D]=m[A+L]}v+=k;const z=this.plainFill(A,O);z!==null?w>=0&&x===A&&T===z?x=A+k:(M(),w=A,x=A+k,T=z):(M(),this.paintCell(A,i,k,O))}A+=k}return M(),v}differs(i,a,o){const r=this.painted,u=this.row;return r.meta[i]!==o||r.content[i]!==u.content[a]||r.fg[i]!==u.fg[a]||r.bg[i]!==u.bg[a]||r.ext[i]!==u.ext[a]||r.combined[i]!==u.combined[a]}overflowsInto(i){const{content:a,fg:o,bg:r,ext:u}=this.row,h=a[i];if((h&ct.CODEPOINT_MASK)<128&&!(h&ct.IS_COMBINED_MASK)||h>>>ct.WIDTH_SHIFT!==1||Vo(o[i]))return!1;const m=a[i+1],g=m&ct.CODEPOINT_MASK;if(m>>>ct.WIDTH_SHIFT!==1||m&ct.IS_COMBINED_MASK||g!==0&&g!==32||r[i]!==r[i+1]||u[i+1]!==0||(o[i]&ut.INVERSE)!==(o[i+1]&ut.INVERSE)||o[i]&ut.INVERSE&&o[i]!==o[i+1]||o[i+1]&(ut.UNDERLINE|ut.STRIKETHROUGH)||r[i+1]&Ai.OVERLINE)return!1;const b=this.charsAt(i);return this.core.optionsService.rawOptions.customGlyphs!==!1&&Ny(b)?!1:this.atlas.overflow(b,er(o[i]),Vu(r[i]))>0}charsAt(i){const a=this.row.content[i];if(a&ct.IS_COMBINED_MASK)return this.row.combined[i];const o=a&ct.CODEPOINT_MASK;return o?String.fromCodePoint(o):""}plainFill(i,a){if(a!==Pl.NONE)return null;const{content:o,fg:r,bg:u}=this.row,h=o[i],p=h&ct.CODEPOINT_MASK,m=!(h&ct.IS_COMBINED_MASK)&&(p===0||p===32),g=Vo(r[i]);return!m&&!g||(r[i]&(ut.UNDERLINE|ut.STRIKETHROUGH)||u[i]&Ai.OVERLINE)&&!g?null:Bg(r[i],u[i],this.colors(),this.boldBright()).bg}paintCell(i,a,o,r){const u=this.ctx,h=this.dimensions.device,p=this.colors(),m=this.row.fg[i],g=this.row.bg[i],b=this.row.ext[i],v=Bg(m,g,p,this.boldBright());let w=v.fg,x=v.bg;r===Pl.BLOCK&&(x=p.cursor.css,w=p.cursorAccent.css);const T=Vo(m),M=this.charsAt(i),A=i*h.cell.width,R=a*h.cell.height,k=o*h.cell.width,O=h.cell.height,$=T||M===""||M===" ",_=$?null:this.atlas.get({chars:M,bold:er(m),italic:Vu(g),dim:yd(g),fg:w,bg:x,cells:o});_?u.drawImage(_.source,_.x,_.y,_.width,_.height,A,R,k,O):(u.fillStyle=x,u.fillRect(A,R,k,O),$||(u.save(),u.beginPath(),u.rect(A,R,k,O),u.clip(),u.fillStyle=w,yd(g)&&(u.globalAlpha=Dd),u.font=this.atlas.fontString(er(m),Vu(g)),u.fillText(M,A+h.char.left,R+h.char.top+h.char.height),u.restore())),!T&&NT(m,g)&&kT(u,h,{px:A,py:R,cells:o,fgWord:m,bgWord:g,ext:b,fgCss:w},{fontSize:this.core.optionsService.rawOptions.fontSize,dpr:this.core._coreBrowserService.dpr,colors:p,boldBright:this.boldBright()}),r!==Pl.NONE&&r!==Pl.BLOCK&&hT(u,h,A,R,k,r,{css:p.cursor.css,dpr:this.core._coreBrowserService.dpr,cursorWidth:this.core.optionsService.rawOptions.cursorWidth})}fillCells(i,a,o,r){const u=this.dimensions.device;this.ctx.fillStyle=r,this.ctx.fillRect(i*u.cell.width,a*u.cell.height,o*u.cell.width,u.cell.height)}fillBackground(){this.ctx.fillStyle=this.colors().background.css,this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)}configureAtlas(){const i=this.dimensions.device,a=this.core.optionsService.rawOptions;this.atlas.configure({cellWidth:i.cell.width,cellHeight:i.cell.height,charWidth:i.char.width,charHeight:i.char.height,charLeft:i.char.left,charTop:i.char.top,dpr:this.core._coreBrowserService.dpr},{fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,customGlyphs:a.customGlyphs!==!1})}colors(){return this.core._themeService.colors}boldBright(){return this.core.optionsService.rawOptions.drawBoldTextInBrightColors!==!1}}class _T{constructor(i){W(this,"canvas");W(this,"ctx");W(this,"selection",null);W(this,"link",null);this.canvas=i.createElement("canvas"),this.canvas.classList.add("xterm-decor-layer"),this.canvas.style.zIndex="2";const a=this.canvas.getContext("2d");if(!a)throw new Error("2D canvas unavailable");this.ctx=a}setSelection(i,a,o){this.selection=i&&a&&!(i[0]===a[0]&&i[1]===a[1])?{start:[i[0],i[1]],end:[a[0],a[1]],columnSelectMode:o}:null}paint({dims:i,rows:a,cols:o,ydisp:r,colors:u,focused:h,dpr:p}){var w;const m=this.ctx;if(m.clearRect(0,0,this.canvas.width,this.canvas.height),!i.cell.width||!a)return;const{selection:g,link:b}=this,v=(x,T,M,A)=>m.fillRect(x*i.cell.width,T*i.cell.height,M*i.cell.width,A*i.cell.height);if(g){const x=g.start[1]-r,T=g.end[1]-r,M=Math.max(x,0),A=Math.min(T,a-1);if(M<a&&A>=0)if(m.fillStyle=(h?u.selectionBackgroundTransparent:u.selectionInactiveBackgroundTransparent).css,g.columnSelectMode)v(g.start[0],M,g.end[0]-g.start[0],A-M+1);else{const R=x===M?g.start[0]:0,k=M===T?g.end[0]:o;v(R,M,k-R,1),v(0,M+1,o,Math.max(A-M-1,0)),M!==A&&v(0,A,T===A?g.end[0]:o,1)}}if(b){m.fillStyle=b.fg===257?u.background.css:b.fg!==void 0&&b.fg<256?((w=u.ansi[b.fg])==null?void 0:w.css)??u.foreground.css:u.foreground.css;const x=(T,M,A)=>m.fillRect(T*i.cell.width,(M+1)*i.cell.height-p-1,A*i.cell.width,p);if(b.y1===b.y2)x(b.x1,b.y1,b.x2-b.x1);else{x(b.x1,b.y1,b.cols-b.x1);for(let T=b.y1+1;T<b.y2;T++)x(0,T,b.cols);x(0,b.y2,b.x2)}}}}function jT(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}function OT(l,i,a,o){const r=i._charSizeService;if(!r.hasValidSize)return!1;const u=i._coreBrowserService.dpr,h=i.optionsService.rawOptions;return l.device.char.width=Math.floor(r.width*u),l.device.char.height=Math.ceil(r.height*u),l.device.cell.height=Math.floor(l.device.char.height*h.lineHeight),l.device.char.top=h.lineHeight===1?0:Math.round((l.device.cell.height-l.device.char.height)/2),l.device.cell.width=l.device.char.width+Math.round(h.letterSpacing),l.device.char.left=Math.floor(h.letterSpacing/2),l.device.canvas.height=o*l.device.cell.height,l.device.canvas.width=a*l.device.cell.width,l.css.canvas.height=Math.round(l.device.canvas.height/u),l.css.canvas.width=Math.round(l.device.canvas.width/u),l.css.cell.height=l.css.canvas.height/o,l.css.cell.width=l.css.canvas.width/a,!0}function DT(l,i,a){if(!l||typeof l.ResizeObserver!="function")return null;let o=new l.ResizeObserver(r=>{var m;const u=r.find(g=>g.target===i);if(!u)return;if(!("devicePixelContentBoxSize"in u)||!((m=u.devicePixelContentBoxSize)!=null&&m[0])){o==null||o.disconnect(),o=null;return}const h=u.devicePixelContentBoxSize[0].inlineSize,p=u.devicePixelContentBoxSize[0].blockSize;h<=0||p<=0||h===i.width&&p===i.height||a(h,p)});try{o.observe(i,{box:"device-pixel-content-box"})}catch{o.disconnect(),o=null}return{dispose:()=>o==null?void 0:o.disconnect()}}function zT(l){if(!l)return[];const i=l.cells.map(a=>a.row);return l.cursor&&i.push(l.cursor.row),i}function HT(l){const i=new Map;for(const a of(l==null?void 0:l.cells)??[]){const o=i.get(a.row);o?o.push(a):i.set(a.row,[a])}return i}class BT{constructor(i,a,o){W(this,"startedAt",null);W(this,"held",null);W(this,"timer",null);this.now=i,this.maxHoldMs=a,this.onExpire=o}get pending(){return this.held}hold(i,a){const o=this.now();return this.startedAt===null&&(this.startedAt=o),o-this.startedAt>=this.maxHoldMs?!1:(this.held=this.held?{start:Math.min(this.held.start,i),end:Math.max(this.held.end,a)}:{start:i,end:a},this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.onExpire()},this.maxHoldMs)),!0)}release(i,a){return this.held&&(i=Math.min(i,this.held.start),a=Math.max(a,this.held.end)),this.held=null,this.startedAt=null,this.timer&&(clearTimeout(this.timer),this.timer=null),{start:i,end:a}}dispose(){this.timer&&clearTimeout(this.timer)}}function UT(l){var a,o,r,u;const i=l._core;return!(i!=null&&i.screenElement)||!i.coreService||!((a=i.optionsService)!=null&&a.rawOptions)||!((o=i._bufferService)!=null&&o.buffer)||!i._charSizeService||!i._coreBrowserService||!((r=i._themeService)!=null&&r.colors)||typeof((u=i._renderService)==null?void 0:u.setRenderer)!="function"?null:i}class KT{constructor(){W(this,"listeners",new Set);W(this,"event",i=>(this.listeners.add(i),{dispose:()=>this.listeners.delete(i)}))}fire(i){for(const a of[...this.listeners])a(i)}dispose(){this.listeners.clear()}}const IT=150;class zd{constructor(i,a){W(this,"dimensions",jT());W(this,"redraw",new KT);W(this,"onRequestRedraw",this.redraw.event);W(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});W(this,"canvas");W(this,"decor");W(this,"cells");W(this,"disposables",[]);W(this,"now");W(this,"syncHold");W(this,"cols",0);W(this,"rows",0);W(this,"overlayProvider",null);W(this,"paintedOverlayRows",new Set);W(this,"paintedCursorRow",-1);W(this,"lastYdisp",0);W(this,"inputAt",null);W(this,"blink",new pT(()=>this.requestCursorRow()));W(this,"disposed",!1);W(this,"isSynchronizing");W(this,"dprUsed",0);this.core=i,this.now=a.now??(()=>performance.now()),this.syncHold=new BT(this.now,a.maxSyncHoldMs??IT,()=>this.flushHeld()),this.isSynchronizing=a.isSynchronizing??(()=>!1);const o=i._coreBrowserService.mainDocument,r=i.screenElement;this.canvas=o.createElement("canvas"),this.canvas.classList.add("xterm-text-layer"),this.canvas.style.zIndex="0";const u=this.canvas.getContext("2d",{alpha:!1});if(!u)throw new Error("2D canvas unavailable");this.decor=new _T(o),r.appendChild(this.canvas),r.appendChild(this.decor.canvas),this.cells=new RT(u,o,i,this.dimensions),this.disposables.push(i._themeService.onChangeColors(()=>{this.cells.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),i.optionsService.onOptionChange(h=>{(h==="cursorBlink"||h==="cursorStyle")&&this.restartBlink()})),i.linkifier&&this.disposables.push(i.linkifier.onShowLinkUnderline(h=>{this.decor.link=h,this.redrawDecor()}),i.linkifier.onHideLinkUnderline(()=>{this.decor.link=null,this.redrawDecor()})),this.observeDevicePixels(),this.observeFonts(o),this.restartBlink()}static install(i,a={}){const o=UT(i);if(!o)return null;const r=new zd(o,a);return o._renderService.setRenderer(r),o._renderService.handleResize(o._bufferService.cols,o._bufferService.rows),r}setOverlayProvider(i){this.overlayProvider=i,this.invalidateOverlay()}invalidateOverlay(){var o;const i=((o=this.overlayProvider)==null?void 0:o.call(this))??null,a=new Set(this.paintedOverlayRows);for(const r of zT(i))a.add(r);this.paintedCursorRow>=0&&a.add(this.paintedCursorRow+this.buffer().ydisp),this.requestAbsoluteRows(a)}markInput(){this.inputAt=this.now()}flushHeld(){const i=this.syncHold.pending;i&&this.redraw.fire({start:i.start,end:i.end})}handleDevicePixelRatioChange(){this.dimensions.device.cell.width&&this.dprUsed!==this.core._coreBrowserService.dpr&&this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleResize(i,a){OT(this.dimensions,this.core,i,a)&&(this.dprUsed=this.core._coreBrowserService.dpr);const o=this.dimensions;for(const u of[this.canvas,this.decor.canvas])u.width=o.device.canvas.width,u.height=o.device.canvas.height,u.style.width=`${o.css.canvas.width}px`,u.style.height=`${o.css.canvas.height}px`;const r=this.core.screenElement;r&&(r.style.width=`${o.css.canvas.width}px`,r.style.height=`${o.css.canvas.height}px`),this.cols=i,this.rows=a,this.cells.resize(i,a),this.paintedOverlayRows.clear(),this.paintedCursorRow=-1,this.cells.configureAtlas(),this.cells.fillBackground(),this.redrawDecor()}handleCharSizeChanged(){this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleBlur(){this.blink.stop(),this.requestCursorRow(),this.redrawDecor()}handleFocus(){this.restartBlink(),this.requestCursorRow(),this.redrawDecor()}handleSelectionChanged(i,a,o){this.decor.setSelection(i,a,o),this.redrawDecor()}handleCursorMove(){this.blink.running&&this.restartBlink()}clear(){this.invalidateAll(),this.cells.fillBackground()}clearTextureAtlas(){this.cells.atlas.clear(),this.invalidateAll(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}renderRows(i,a){if(this.disposed||!this.cols||!this.rows||!this.dimensions.device.cell.width)return;if(this.isSynchronizing()&&this.syncHold.hold(i,a)){this.stats.heldFrames++;return}const o=this.syncHold.release(i,a);this.paint(Math.max(0,o.start),Math.min(this.rows-1,o.end))}dispose(){if(!this.disposed){this.disposed=!0,this.blink.stop(),this.syncHold.dispose();for(const i of this.disposables)i.dispose();this.disposables.length=0,this.redraw.dispose(),this.cells.atlas.dispose(),this.canvas.remove(),this.decor.canvas.remove()}}uninstall(){const i=this.core._createRenderer;typeof i=="function"&&(this.core._renderService.setRenderer(i.call(this.core)),this.core._renderService.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)),this.dispose()}get textCanvas(){return this.canvas}hasPaintedInk(i,a){return this.cells.hasPaintedInk(i,a)}paint(i,a){var v;const o=this.now(),r=this.buffer(),u=r.ydisp;u!==this.lastYdisp&&(this.lastYdisp=u,this.redrawDecor());const h=((v=this.overlayProvider)==null?void 0:v.call(this))??null,p=HT(h),m=this.cursorState(h),g=new Set;for(let w=i;w<=a;w++)g.add(w);for(const w of this.paintedOverlayRows)Po(g,w-u,this.rows);for(const w of p.keys())Po(g,w-u,this.rows);this.paintedCursorRow>=0&&Po(g,this.paintedCursorRow,this.rows),m&&Po(g,m.y,this.rows);let b=0;for(const w of g)this.cells.loadRow(r.lines.get(u+w),p.get(w+u)),b+=this.cells.paintRow(w,m);this.paintedOverlayRows=new Set(p.keys()),this.paintedCursorRow=m?m.y:-1,this.stats.frames++,this.stats.lastCells=b,this.stats.lastPaintMs=this.now()-o,this.inputAt!==null&&b>0&&(this.stats.lastInputToPaintMs=this.now()-this.inputAt,this.inputAt=null)}cursorState(i){return mT(this.core,this.buffer(),i,{rows:this.rows,cols:this.cols},this.blink.hidden)}restartBlink(){if(this.blink.stop(),this.disposed||!this.core.optionsService.rawOptions.cursorBlink||!this.core._coreBrowserService.isFocused){this.requestCursorRow();return}this.blink.start(),this.requestCursorRow()}requestCursorRow(){if(!this.rows)return;const i=this.buffer(),a=new Set;a.add(i.ybase+i.y),this.paintedCursorRow>=0&&a.add(this.paintedCursorRow+i.ydisp),this.requestAbsoluteRows(a)}redrawDecor(){this.decor.paint({dims:this.dimensions.device,rows:this.rows,cols:this.cols,ydisp:this.buffer().ydisp,colors:this.colors(),focused:this.core._coreBrowserService.isFocused,dpr:this.core._coreBrowserService.dpr})}invalidateAll(){this.cells.invalidate(),this.paintedCursorRow=-1}observeDevicePixels(){const i=DT(this.core._coreBrowserService.window,this.canvas,(a,o)=>{const r=this.core._coreBrowserService.dpr,u=this.dimensions.css.canvas;if(!(Math.abs(a-u.width*r)>2||Math.abs(o-u.height*r)>2)){this.dimensions.device.canvas.width=a,this.dimensions.device.canvas.height=o;for(const h of[this.canvas,this.decor.canvas])h.width=a,h.height=o;this.invalidateAll(),this.cells.fillBackground(),this.redrawDecor(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}});i&&this.disposables.push(i)}observeFonts(i){const a=i.fonts;if(!a||typeof a.addEventListener!="function")return;const o=()=>this.clearTextureAtlas();a.addEventListener("loadingdone",o),this.disposables.push({dispose:()=>a.removeEventListener("loadingdone",o)})}buffer(){return this.core._bufferService.buffer}colors(){return this.core._themeService.colors}requestAbsoluteRows(i){if(!this.rows)return;const a=this.buffer().ydisp;let o=1/0,r=-1/0;for(const u of i){const h=u-a;h<0||h>=this.rows||(o=Math.min(o,h),r=Math.max(r,h))}o<=r&&this.redraw.fire({start:o,end:r})}}function Po(l,i,a){i>=0&&i<a&&l.add(i)}const FT=30,ky=640,Ly=240,Xo=1,GT=720*60*60*1e3;function Ry(){const l=Mi("local",pt.rendererProbe);if(!l)return{v:Xo,ua:{}};try{const i=JSON.parse(l);return typeof i=="object"&&i!==null&&i.v===Xo&&typeof i.ua=="object"&&i.ua!==null?i:{v:Xo,ua:{}}}catch{return{v:Xo,ua:{}}}}function YT(l,i=Date.now()){const a=Ry();a.ua[l]={failedAt:i},wn("local",pt.rendererProbe,JSON.stringify(a))}function $T(l,i=Date.now()){const a=typeof navigator<"u"?navigator.userAgent:"";if(!a)return!1;const r=Ry().ua[a];return!(!r||typeof r.failedAt!="number"||i-r.failedAt>GT)}function Gg(l,i=Date.now()){const a=typeof navigator<"u"?navigator.userAgent:"";a&&YT(a,i)}function qT(l){if(l.length<4)return!0;const i=l[0],a=l[1],o=l[2],r=l[3];for(let u=4;u<l.length;u+=4)if(l[u]!==i||l[u+1]!==a||l[u+2]!==o||l[u+3]!==r)return!1;return!0}function VT(l){if(!l||l.width<=0||l.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let i=null;try{i=l.getContext("2d",{willReadFrequently:!0})||l.getContext("2d")}catch(r){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",r),"inconclusive"}if(!i)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const a=Math.min(l.width,ky),o=Math.min(l.height,Ly);if(a<=0||o<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const r=i.getImageData(0,0,a,o);return qT(r.data)?"blank":"healthy"}catch(r){return console.debug("Canvas probe inconclusive: getImageData threw exception:",r),"inconclusive"}}function Yg(l=2){return new Promise(i=>{if(typeof requestAnimationFrame!="function"){setTimeout(i,32);return}let a=l;const o=()=>{a--,a<=0?i():requestAnimationFrame(o)};requestAnimationFrame(o)})}const Xu={kind:"dom",canvas:null,dispose:()=>{},verify:async()=>{}};function PT(l,i={}){if($T())return Xu;let a;try{a=zd.install(l,{isSynchronizing:i.isSynchronizing})}catch(p){return console.debug("Canvas renderer unavailable, using the DOM renderer:",p),Gg(),Xu}if(!a)return Xu;let o=a,r=null;const u=()=>{var m;if(!o)return;Gg();const p=o;o=null;try{p.uninstall()}catch{}(m=i.onRendererSwapped)==null||m.call(i,"dom")};return{get kind(){return o?"canvas":"dom"},get canvas(){return o},dispose:()=>{const p=o;o=null;try{p==null||p.dispose()}catch{}},verify:async()=>{if(o)return r||(r=(async()=>{try{const p=o.stats.frames;await Yg(2);for(let g=0;g<FT&&o&&o.stats.frames===p;g++)await Yg(1);if(!o)return;const m=VT(o.textCanvas);m==="blank"&&o.hasPaintedInk(ky,Ly)?u():m==="blank"?console.debug("Canvas probe inconclusive: uniform, but no character was painted there"):m==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(p){console.debug("Canvas probe inconclusive: unexpected error during verify():",p)}finally{r=null}})(),r)}}}function XT(l,i,a){l.writeln(" ___ ___ .___ "),l.writeln(` / | \\ ____ _______| _/______ \x1B[1m${i}\x1B[0m`),l.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${a}\x1B[0m`),l.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),l.writeln(" \\___|_ / \\___ >|__| /___/____ >"),l.writeln(" \\/ \\/ \\/ "),l.writeln("")}var QT=ox(),Qu={exports:{}},$g;function ZT(){return $g||($g=1,(function(l,i){(function(a,o){l.exports=o()})(self,(()=>(()=>{var a={6:(h,p)=>{function m(b){try{const v=new URL(b),w=v.password&&v.username?`${v.protocol}//${v.username}:${v.password}@${v.host}`:v.username?`${v.protocol}//${v.username}@${v.host}`:`${v.protocol}//${v.host}`;return b.toLocaleLowerCase().startsWith(w.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(p,"__esModule",{value:!0}),p.LinkComputer=p.WebLinkProvider=void 0,p.WebLinkProvider=class{constructor(b,v,w,x={}){this._terminal=b,this._regex=v,this._handler=w,this._options=x}provideLinks(b,v){const w=g.computeLink(b,this._regex,this._terminal,this._handler);v(this._addCallbacks(w))}_addCallbacks(b){return b.map((v=>(v.leave=this._options.leave,v.hover=(w,x)=>{if(this._options.hover){const{range:T}=v;this._options.hover(w,x,T)}},v)))}};class g{static computeLink(v,w,x,T){const M=new RegExp(w.source,(w.flags||"")+"g"),[A,R]=g._getWindowedLineStrings(v-1,x),k=A.join("");let O;const $=[];for(;O=M.exec(k);){const _=O[0];if(!m(_))continue;const[z,L]=g._mapStrIdx(x,R,0,O.index),[D,K]=g._mapStrIdx(x,z,L,_.length);if(z===-1||L===-1||D===-1||K===-1)continue;const J={start:{x:L+1,y:z+1},end:{x:K,y:D+1}};$.push({range:J,text:_,activate:T})}return $}static _getWindowedLineStrings(v,w){let x,T=v,M=v,A=0,R="";const k=[];if(x=w.buffer.active.getLine(v)){const O=x.translateToString(!0);if(x.isWrapped&&O[0]!==" "){for(A=0;(x=w.buffer.active.getLine(--T))&&A<2048&&(R=x.translateToString(!0),A+=R.length,k.push(R),x.isWrapped&&R.indexOf(" ")===-1););k.reverse()}for(k.push(O),A=0;(x=w.buffer.active.getLine(++M))&&x.isWrapped&&A<2048&&(R=x.translateToString(!0),A+=R.length,k.push(R),R.indexOf(" ")===-1););}return[k,T]}static _mapStrIdx(v,w,x,T){const M=v.buffer.active,A=M.getNullCell();let R=x;for(;T;){const k=M.getLine(w);if(!k)return[-1,-1];for(let O=R;O<k.length;++O){k.getCell(O,A);const $=A.getChars();if(A.getWidth()&&(T-=$.length||1,O===k.length-1&&$==="")){const _=M.getLine(w+1);_&&_.isWrapped&&(_.getCell(0,A),A.getWidth()===2&&(T+=1))}if(T<0)return[w,O]}w++,R=0}return[w,R]}}p.LinkComputer=g}},o={};function r(h){var p=o[h];if(p!==void 0)return p.exports;var m=o[h]={exports:{}};return a[h](m,m.exports,r),m.exports}var u={};return(()=>{var h=u;Object.defineProperty(h,"__esModule",{value:!0}),h.WebLinksAddon=void 0;const p=r(6),m=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(b,v){const w=window.open();if(w){try{w.opener=null}catch{}w.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}h.WebLinksAddon=class{constructor(b=g,v={}){this._handler=b,this._options=v}activate(b){this._terminal=b;const v=this._options,w=v.urlRegex||m;this._linkProvider=this._terminal.registerLinkProvider(new p.WebLinkProvider(this._terminal,w,this._handler,v))}dispose(){var b;(b=this._linkProvider)==null||b.dispose()}}})(),u})()))})(Qu)),Qu.exports}var WT=ZT(),JT=rx();function e5({fontSize:l,fontFamily:i,theme:a,cols:o,rows:r}){const u=new JT.Terminal({fontSize:l,fontFamily:i,lineHeight:1.15,...a?{theme:{...a}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:o,rows:r,screenReaderMode:!1,linkHandler:{activate:(h,p)=>{md(p)}}});try{const h=new QT.Unicode11Addon;u.loadAddon(h),u.unicode.activeVersion="11"}catch(h){console.debug("Unicode11 addon unavailable, using default width table:",h)}try{u.loadAddon(new WT.WebLinksAddon((h,p)=>{md(p)}))}catch(h){console.debug("WebLinks addon unavailable, URLs stay plain text:",h)}return u}function ls(l){var i,a;if(!l)return!1;try{const o=l.modes;if(o&&typeof o.mouseTrackingMode=="string"&&o.mouseTrackingMode!=="none")return!0;const r=l._core;if((i=r==null?void 0:r._coreMouseService)!=null&&i.areMouseEventsActive||(a=r==null?void 0:r.coreMouseService)!=null&&a.areMouseEventsActive||r!=null&&r.mouseMode&&r.mouseMode!=="none")return!0}catch{}return!1}function t5(l,i){const a=i.button??0,o=i.buttons??(l==="mouseup"?0:1);return new MouseEvent(l,{bubbles:!0,cancelable:!0,clientX:i.clientX,clientY:i.clientY,screenX:i.clientX,screenY:i.clientY,button:a,buttons:o})}function _y(l,i,a){const o=t5(i,a);return l.dispatchEvent(o)}function jy(l){var i;try{return((i=l.buffer)==null?void 0:i.active)||null}catch{return null}}function Zu(l){var a;const i=(a=jy(l))==null?void 0:a.viewportY;return typeof i=="number"&&Number.isFinite(i)?i:null}function n5(l){var i;try{(i=l.blur)==null||i.call(l)}catch{}}function qg(l){var a,o;const i=l;return i.coreMouseService||((a=i._core)==null?void 0:a.coreMouseService)||((o=i._core)==null?void 0:o._coreMouseService)||null}function i5(l){var a;const i=l;return i.coreService||((a=i._core)==null?void 0:a.coreService)||null}class l5{constructor(i){this.options=i}getLogicalCoordinates(i,a){const o=this.options.getScale?this.options.getScale():1,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(o!==1&&r&&typeof r.getBoundingClientRect=="function"){const u=r.getBoundingClientRect();return Cy(i,a,u,o)}return{clientX:i,clientY:a}}getViewportElement(i){var r;const a=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(a==null?void 0:a.querySelector(".xterm-viewport"))||((r=i.element)==null?void 0:r.querySelector(".xterm-viewport"))||null}isInputLineHit(i,a){var k;const o=(k=a.buffer)==null?void 0:k.active,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,u=(r==null?void 0:r.querySelector(".xterm-screen"))||a.element||r,h=il(a);if(!u||typeof u.getBoundingClientRect!="function"||h.cellHeight<=0)return!1;const p=u.getBoundingClientRect(),m=this.getLogicalCoordinates(i.clientX,i.clientY),g=p.width>0&&p.height>0;if(![o==null?void 0:o.cursorY,o==null?void 0:o.viewportY,o==null?void 0:o.baseY].every(O=>typeof O=="number"&&Number.isFinite(O)))return!1;const v=o==null?void 0:o.cursorY,w=o==null?void 0:o.viewportY,T=(o==null?void 0:o.baseY)+v-w,M=p.top+T*h.cellHeight,A=M+h.cellHeight,R=Number(a.rows);return T>=0&&(!Number.isFinite(R)||T<R)&&m.clientY>=M-2&&m.clientY<=A+2&&(!g||m.clientX>=p.left&&m.clientX<=p.right)}resolveDispatchTarget(i,a){var p;const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(o==null?void 0:o.querySelector(".xterm-screen"))||a.querySelector(".xterm-screen")||null,u=((p=r==null?void 0:r.closest)==null?void 0:p.call(r,".xterm"))||null;let h=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(h=document.elementFromPoint(i.clientX,i.clientY)),h&&u&&(h===u||u.contains(h))?h:r||o||a}getMouseReport(i,a){const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(o==null?void 0:o.querySelector(".xterm-screen"))||a.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const u=r.getBoundingClientRect(),h=this.getLogicalCoordinates(i.clientX,i.clientY),p=il(a);if(p.cellWidth<=0||p.cellHeight<=0)return null;const m=Math.max(1,u.width||a.cols*p.cellWidth),g=Math.max(1,u.height||a.rows*p.cellHeight),b=Math.max(0,Math.min(m-1,h.clientX-u.left)),v=Math.max(0,Math.min(g-1,h.clientY-u.top)),w=Math.max(0,Math.min(a.cols-1,Math.floor(b/p.cellWidth))),x=Math.max(0,Math.min(a.rows-1,Math.floor(v/p.cellHeight)));return{col:w,row:x,x:Math.floor(b),y:Math.floor(v),button:0,action:0}}getWheelDispatchTarget(i){const a=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(a==null?void 0:a.querySelector(".xterm"))||i.element||null}dispatchWheel(i,a,o,r){const u=this.getWheelDispatchTarget(o);if(!u||typeof WheelEvent>"u"||a===0)return!1;const h=this.getLogicalCoordinates(i.clientX,i.clientY),p=a<0?-1:1;let m=0;for(let g=0;g<Math.abs(a);g+=1)try{const b=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:h.clientX,clientY:h.clientY,deltaX:0,deltaY:p,deltaMode:1,ctrlKey:!!(r!=null&&r.ctrlKey),altKey:!!(r!=null&&r.altKey),shiftKey:!!(r!=null&&r.shiftKey)});u.dispatchEvent(b),m+=1}catch{return m>0}return m>0}emitWheel(i,a,o,r){if(a===0)return!1;if(this.dispatchWheel(i,a,o,r))return!0;const u=qg(o);if(!(u!=null&&u.triggerMouseEvent))return!1;let h=0;for(let p=0;p<Math.abs(a);p+=1){const m=this.getMouseReport(i,o);m&&(m.button=4,m.action=a<0?0:1,m.ctrl=!!(r!=null&&r.ctrlKey),m.alt=!!(r!=null&&r.altKey),m.shift=!!(r!=null&&r.shiftKey),u.triggerMouseEvent(m)&&(h+=1))}return h>0}scrollAlternateBuffer(i,a,o,r){var h;if(a===0)return"none";const u=ls(o);if(!u&&!this.options.getIsController())return"none";if(this.emitWheel(i,a,o,r))return u?"application-mouse":"application-keys";if(!u){const p=i5(o);if(!(p!=null&&p.triggerDataEvent))return"none";const g=`\x1B${!!((h=p.decPrivateModes)!=null&&h.applicationCursorKeys)?"O":"["}${a<0?"A":"B"}`;return p.triggerDataEvent(g.repeat(Math.abs(a)),!0),"application-keys"}return"none"}emitMouse(i,a,o,r){const u=this.options.getTerminal();if(!u)return;const h=qg(u);if(h!=null&&h.triggerMouseEvent){const m=this.getMouseReport(a,u);m&&(m.action=i==="mousedown"?1:i==="mouseup"?0:32,m.ctrl=!!(o!=null&&o.ctrlKey),m.alt=!!(o!=null&&o.altKey),m.shift=!!(o!=null&&o.shiftKey),h.triggerMouseEvent(m));return}if(this.options.allowSyntheticMouseFallback===!1||!r)return;const p=this.getLogicalCoordinates(a.clientX,a.clientY);_y(r,i,{clientX:p.clientX,clientY:p.clientY,button:0,buttons:i==="mouseup"?0:1})}}class a5{constructor(i){W(this,"options");W(this,"state","idle");W(this,"startX",0);W(this,"startY",0);W(this,"lastX",0);W(this,"lastY",0);W(this,"activeTarget",null);W(this,"longPressTimer",null);W(this,"capturedPointerId",null);W(this,"captureElement",null);W(this,"scrollRemainderY",0);W(this,"delivery");this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...i},this.delivery=new l5(this.options)}getState(){return this.state}setGestureState(i){var a,o;this.state!==i&&(this.state=i,(o=(a=this.options).onGestureStateChange)==null||o.call(a,i))}beginGesture(i,a){this.startX=i.clientX,this.startY=i.clientY,this.lastX=i.clientX,this.lastY=i.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.delivery.resolveDispatchTarget(i,a),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var o,r;this.state==="pending"&&(this.setGestureState("longpress"),(r=(o=this.options).onLongPress)==null||r.call(o,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(i,a){var g,b,v,w;if(this.state==="longpress"){(b=(g=this.options).onSelectionExtend)==null||b.call(g,{clientX:i.clientX,clientY:i.clientY}),a!=null&&a.cancelable&&((v=a.preventDefault)==null||v.call(a));return}if(this.state==="idle")return;const o=i.clientX-this.startX,r=i.clientY-this.startY,u=Math.hypot(o,r);if(this.state==="scrolling"){this.scrollGesture(i,a);return}const h=this.options.getTerminal(),p=this.options.getIsController(),m=ls(h);if(!(u<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(r)>=Math.abs(o)||!m||!p){this.setGestureState("scrolling"),h&&n5(h),this.lastX=i.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(i,a);return}if(m&&p){this.state==="pending"&&(this.setGestureState("dragging"),this.delivery.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},a,this.activeTarget)),this.state==="dragging"&&(this.lastX=i.clientX,this.lastY=i.clientY,this.delivery.emitMouse("mousemove",i,a,this.activeTarget),a!=null&&a.cancelable&&((w=a.preventDefault)==null||w.call(a)));return}this.lastX=i.clientX,this.lastY=i.clientY}}scrollGesture(i,a){var T,M,A;const o=this.options.getTerminal();if(!o)return;const r=i.clientY-this.lastY;this.lastX=i.clientX,this.lastY=i.clientY;const u=il(o),h=u.measured?u.cellHeight:this.options.scrollLineHeightPx||u.cellHeight||18;this.scrollRemainderY+=r;const p=Math.trunc(this.scrollRemainderY/h),m=-p;let g=!1,b="none";const v=jy(o),w=ls(o);if(m!==0){if((v==null?void 0:v.type)==="alternate")b=this.delivery.scrollAlternateBuffer(i,m,o,a),g=b!=="none";else{const R=Zu(o);o.scrollLines(m);const k=Zu(o);b="buffer",g=R===null||k===null||R!==k}this.scrollRemainderY-=p*h}const x=this.delivery.getViewportElement(o);(M=(T=this.options).onGestureScroll)==null||M.call(T,{deltaY:r,lines:m,viewportY:Zu(o),scrollTop:(x==null?void 0:x.scrollTop)??null,scrollHeight:(x==null?void 0:x.scrollHeight)??null,clientHeight:(x==null?void 0:x.clientHeight)??null,moved:g,bufferType:(v==null?void 0:v.type)||null,baseY:typeof(v==null?void 0:v.baseY)=="number"?v.baseY:null,cursorY:typeof(v==null?void 0:v.cursorY)=="number"?v.cursorY:null,hasScrollback:typeof(v==null?void 0:v.hasScrollback)=="boolean"?v.hasScrollback:null,mouseTracking:w,scrollMode:b}),a!=null&&a.cancelable&&((A=a.preventDefault)==null||A.call(a))}endGesture(i,a){var h,p,m;this.clearLongPressTimer();const o=this.options.getTerminal(),r=this.options.getIsController(),u=ls(o);if(this.state==="pending"){if(u&&r){const b={clientX:this.startX,clientY:this.startY};this.delivery.emitMouse("mousedown",b,a,this.activeTarget),this.delivery.emitMouse("mouseup",b,a,this.activeTarget)}const g={clientX:this.startX,clientY:this.startY};r&&o&&this.delivery.isInputLineHit(g,o)&&((p=(h=this.options).onFocus)==null||p.call(h))}else if(this.state==="dragging"&&u&&r){const g=i??{clientX:this.lastX,clientY:this.lastY};this.delivery.emitMouse("mouseup",g,a,this.activeTarget),a!=null&&a.cancelable&&((m=a.preventDefault)==null||m.call(a))}this.reset()}handlePointerDown(i,a){if(i.pointerType==="mouse")return!1;if(!i.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(i.cancelable&&i.preventDefault(),this.beginGesture(i,a),i.pointerType!=="touch")try{typeof a.setPointerCapture=="function"&&(a.setPointerCapture(i.pointerId),this.capturedPointerId=i.pointerId,this.captureElement=a)}catch{}return!0}handlePointerMove(i){i.pointerType==="mouse"||this.state==="idle"||this.moveGesture(i,i)}handlePointerUp(i){i.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(i,i))}handlePointerCancel(i){i&&i.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(i,a){if(i.touches.length!==1){this.reset();return}i.cancelable&&i.preventDefault(),this.beginGesture(i.touches[0],a)}handleTouchMove(i){i.touches.length===1&&this.moveGesture(i.touches[0],i)}handleTouchEnd(i){i.cancelable&&i.preventDefault(),this.endGesture(null,i)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const i=this.options.getTerminal(),a=this.options.getIsController(),o=ls(i);if(this.state==="dragging"&&o&&a&&this.activeTarget){const r=this.delivery.getLogicalCoordinates(this.lastX,this.lastY);_y(this.activeTarget,"mouseup",{clientX:r.clientX,clientY:r.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const i=this.captureElement,a=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!i||a===null))try{typeof i.releasePointerCapture=="function"&&(typeof i.hasPointerCapture!="function"||i.hasPointerCapture(a))&&i.releasePointerCapture(a)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}function s5({container:l,term:i,isTouchDevice:a,debug:o,getTerminal:r,getIsController:u,getScale:h,getSurfaceElement:p,getSelection:m,onFocus:g}){const b=new a5({getTerminal:r,getIsController:u,getScale:h,getSurfaceElement:p,allowSyntheticMouseFallback:!1,onFocus:()=>{try{i.focus()}catch{}o==null||o(_=>({..._,focused:document.activeElement===i.textarea})),g()},onGestureStateChange:_=>{o==null||o(z=>({...z,state:_}))},onGestureScroll:({deltaY:_,lines:z,viewportY:L,scrollTop:D,scrollHeight:K,clientHeight:J,moved:V,bufferType:X,baseY:ie,cursorY:ue,hasScrollback:U,mouseTracking:E,scrollMode:G})=>{o==null||o(P=>({...P,deltaY:_,lines:z,viewportY:L,scrollTop:D,scrollHeight:K,clientHeight:J,moved:V,focused:document.activeElement===i.textarea,bufferType:X,baseY:ie,cursorY:ue,hasScrollback:U,mouseTracking:E,scrollMode:G,scrollCalls:P.scrollCalls+(z!==0?1:0),lastScrollLines:z}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:a?_=>m().handleLongPress(_):void 0,onSelectionExtend:a?_=>m().handleSelectionExtend(_):void 0}),v=typeof window<"u"&&"PointerEvent"in window,w=typeof TouchEvent<"u",x=[],T={passive:!1,capture:!0},M=(_,z)=>{document.addEventListener(_,z,T),x.push(()=>document.removeEventListener(_,z,T))},A=(_,z=!1)=>{const L=_.target;return L instanceof Node&&l.contains(L)||z&&b.getState()!=="idle"},R=(_,z)=>{o==null||o(L=>({...L,[_]:L[_]+1,lastInputEvent:z}))},k=_=>{const z=m();return z.hasOpenMenu()?(z.clearSelection(),_.cancelable&&_.preventDefault(),_.stopPropagation(),!0):!1},O=()=>{b.getState()==="longpress"&&m().openMenuAtGesture()};if(v){if(M("pointerdown",_=>{if(!A(_)||(R("pointerEvents","pointerdown"),k(_)))return;b.handlePointerDown(_,l)&&_.stopPropagation()}),M("pointermove",_=>{A(_,!0)&&(R("pointerEvents","pointermove"),b.handlePointerMove(_),_.pointerType!=="mouse"&&_.stopPropagation())}),M("pointerup",_=>{A(_,!0)&&(R("pointerEvents","pointerup"),O(),b.handlePointerUp(_),_.pointerType!=="mouse"&&_.stopPropagation())}),M("pointercancel",_=>{A(_,!0)&&(R("pointerEvents","pointercancel"),m().clearSelection(),b.handlePointerCancel(_),_.pointerType!=="mouse"&&_.stopPropagation())}),w){const _=z=>{A(z,!0)&&(o==null||o(L=>({...L,touchEvents:L.touchEvents+1})),z.cancelable&&z.preventDefault(),z.stopPropagation())};for(const z of["touchstart","touchmove","touchend","touchcancel"])M(z,_)}}else M("touchstart",_=>{A(_)&&(R("touchEvents","touchstart"),!k(_)&&(_.touches.length===1&&_.stopPropagation(),b.handleTouchStart(_,l)))}),M("touchmove",_=>{A(_,!0)&&(R("touchEvents","touchmove"),_.touches.length===1&&_.stopPropagation(),b.handleTouchMove(_))}),M("touchend",_=>{A(_,!0)&&(R("touchEvents","touchend"),O(),_.stopPropagation(),b.handleTouchEnd(_))}),M("touchcancel",_=>{A(_,!0)&&(R("touchEvents","touchcancel"),m().clearSelection(),_.stopPropagation(),b.handleTouchCancel())});const $=_=>{_.preventDefault()};return l.addEventListener("contextmenu",$),x.push(()=>l.removeEventListener("contextmenu",$)),()=>{b.handlePointerCancel();for(const _ of x)_()}}function o5(l,{requestFit:i,onPageVisible:a}){const o=new ResizeObserver(()=>{i()});o.observe(l);const r=()=>{i()},u=()=>{document.visibilityState==="visible"&&a()};window.addEventListener("resize",r),window.addEventListener("orientationchange",r),document.addEventListener("visibilitychange",u),window.addEventListener("pageshow",u);const h=()=>{i()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",h),window.visualViewport.addEventListener("scroll",h)),()=>{o.disconnect(),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),document.removeEventListener("visibilitychange",u),window.removeEventListener("pageshow",u),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",h),window.visualViewport.removeEventListener("scroll",h))}}function Wi(l){if(l)try{l.refresh(0,Math.max(0,l.rows-1))}catch{}}function r5({containerRef:l,surfaceRef:i,termRef:a,rendererRef:o,currentScaleRef:r,initialBannerWrittenRef:u,live:h,selection:p,prediction:m,fit:g,isTouchDevice:b,debug:v,terminalFontSize:w,terminalFontFamily:x,hostTheme:T,glyphRevision:M,terminalResetVersion:A,isActive:R,subscribeToOutput:k,onOutput:O,onTitle:$,onRendererKind:_}){const{requestFit:z,scheduleBoundedFit:L,seedFit:D,cancelPendingFits:K}=g;C.useEffect(()=>{var Be;if(!l.current||!i.current)return;const V=l.current,X=bd(V,Zl(),ed()),ie=il(null,na),ue=Sy({width:X.width,height:X.height,cellWidth:ie.cellWidth,cellHeight:ie.cellHeight});h.current.sendResize(ue.cols,ue.rows),D(X);const U=e5({fontSize:Xp(w,X.width),fontFamily:x,theme:h.current.hostTheme,cols:ue.cols,rows:ue.rows});U.open(i.current),a.current=U;const E=U.onTitleChange(re=>{$(hd(re)||null)}),{screenState:G,fieldProbe:P,overlay:le}=m.attach(U);b&&U.textarea&&(U.textarea.readOnly=!1,U.textarea.tabIndex=0,U.textarea.inputMode="text");let Q=()=>{};if(v&&U.textarea){const re=()=>{v(Ae=>({...Ae,focused:document.activeElement===U.textarea}))};U.textarea.addEventListener("focus",re),U.textarea.addEventListener("blur",re),Q=()=>{var Ae,Pe;(Ae=U.textarea)==null||Ae.removeEventListener("focus",re),(Pe=U.textarea)==null||Pe.removeEventListener("blur",re)},re()}const xe=async re=>{m.discard("paste");const Ae=uy(re);if(Ae){if(re.preventDefault(),re.stopPropagation(),!h.current.isController){h.current.warnViewerMode();return}await h.current.uploadImage(Ae)}};(Be=U.textarea)==null||Be.addEventListener("paste",xe),V.addEventListener("paste",xe);const ye=PT(U,{isSynchronizing:G.isSynchronizing,onRendererSwapped:re=>{var Ae;V.dataset.renderer=re,_(re),(Ae=m.overlayRef.current)==null||Ae.attach(null),Wi(U)}});le.attach(ye.canvas);const ve=G.onSyncEnd(()=>{var re,Ae;return(Ae=(re=o.current)==null?void 0:re.canvas)==null?void 0:Ae.flushHeld()});if(o.current=ye,V.dataset.renderer=ye.kind,_(ye.kind),XT(U,h.current.t("terminal.bannerTitle"),h.current.t("terminal.bannerSubtitle")),u.current=!0,U.write("",()=>void ye.verify()),!b)try{U.focus()}catch{}const me=typeof document<"u"?document.fonts:void 0;typeof(me==null?void 0:me.load)=="function"&&me.load('13px "Symbols Nerd Font Mono"').then(()=>{a.current&&(Wi(a.current),L(5))}).catch(()=>{});const de=U.onData(re=>{const{isController:Ae}=h.current;let Pe=re;if(Ae&&yy(re)==="keys"&&xx(re)){const Nt=h.current.consumeModifierLatch();Nt&&(Pe=tr(re,Nt))}const wt=Sd(Pe);if(!Ae&&!lr(wt)){h.current.warnViewerMode();return}m.onUserInput(wt),h.current.sendBinary(wt)}),we=U.onBinary(re=>{const Ae=new Uint8Array(re.length);for(let Pe=0;Pe<re.length;Pe++)Ae[Pe]=re.charCodeAt(Pe)&255;!h.current.isController&&!lr(Ae)||h.current.sendBinary(Ae)}),se=typeof U.onWriteParsed=="function"?U.onWriteParsed(()=>{var re;p.current.onTerminalContentChanged(),P.invalidate(),!G.isSynchronizing()&&((re=m.predictorRef.current)==null||re.onServerOutput(),m.sync())}):{dispose:()=>{}},Se=typeof U.onRender=="function"?U.onRender(re=>{var Ae;if(h.current.glyphScan){const Pe=U.buffer.active.viewportY??0;let wt="";for(let Nt=re.start;Nt<=re.end;Nt+=1)wt+=((Ae=U.buffer.active.getLine(Pe+Nt))==null?void 0:Ae.translateToString(!0))??"";/[^\x00-\x7f]/.test(wt)&&h.current.ensureHostGlyphs(wt)}p.current.onTerminalRender(U,re.start,re.end)}):{dispose:()=>{}},ae=typeof U.onScroll=="function"?U.onScroll(()=>{p.current.onTerminalScroll(U),m.discard("scroll")}):{dispose:()=>{}},pe=s5({container:V,term:U,isTouchDevice:b,debug:v,getTerminal:()=>a.current,getIsController:()=>h.current.isController,getScale:()=>r.current,getSurfaceElement:()=>i.current,getSelection:()=>p.current,onFocus:()=>{var re,Ae;return(Ae=(re=h.current).onTerminalFocus)==null?void 0:Ae.call(re)}}),Ee=o5(V,{requestFit:z,onPageVisible:()=>{L(10),Wi(a.current)}});return()=>{var re;de.dispose(),we.dispose(),Se.dispose(),ae.dispose(),se.dispose(),E.dispose(),ve.dispose(),m.detach(),G.dispose(),pe(),Ee(),K(),Q(),(re=U.textarea)==null||re.removeEventListener("paste",xe),V.removeEventListener("paste",xe),ye.dispose(),o.current=null,U.dispose(),a.current=null}},[]),C.useEffect(()=>{const V=a.current;if(!V)return;const X=bd(l.current,Zl(),ed());V.options.fontSize=Xp(w,X.width),V.options.fontFamily=x,Wi(V),L(10)},[w,x]),C.useEffect(()=>{var X,ie;const V=a.current;!V||!M||((ie=(X=o.current)==null?void 0:X.canvas)==null||ie.clearTextureAtlas(),Wi(V))},[M]);const J=C.useRef(A);C.useEffect(()=>{var X;if(J.current===A)return;J.current=A,m.forget("resetVersion");const V=a.current;if(V)try{(X=V.reset)==null||X.call(V),V.clear(),V.refresh(0,Math.max(0,V.rows-1))}catch{}},[A]),C.useEffect(()=>{const V=a.current;!V||!T||(V.options.theme={...T},Wi(V))},[T]),C.useEffect(()=>k(X=>{const ie=a.current;if(!ie)throw new Error("terminal not ready");ie.write(X),O==null||O(X.byteLength)}),[k,a,O]),C.useEffect(()=>{if(!R)return;L(10);const V=a.current;if(V&&(Wi(V),!b))try{V.focus()}catch{}},[R,b,L,a])}const c5=({onTerminalFocus:l,isActive:i=!0})=>{var Pn;const a=C.useRef(null),o=C.useRef(null),r=C.useRef(null),u=C.useRef(null),h=C.useRef(null),p=C.useRef(1),m=C.useRef(null),g=C.useRef(!1),b=Bx(),v=b||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,w=IS(),[x,T]=C.useState(KS),{metrics:M,record:A}=FS(w),[R,k]=C.useState(null),{settings:O,terminalFontFamily:$,terminalFontSize:_,hostFont:z,ensureHostGlyphs:L,profiles:D,activeProfileId:K,t:J}=Le(),{isController:V,connectionState:X,hostPalette:ie,terminalResetVersion:ue,agentStatus:U,connect:E,rttMs:G}=et(),{addToast:P}=rn(),{sendResize:le,sendBinary:Q,observeKeyInput:xe,consumeModifierLatch:ye,warnViewerMode:ve,subscribeToOutput:me,subscribeToPasteFileReady:de}=hs(),{uploadImage:we}=ur(),se=qn.useMemo(()=>Px(ie),[ie]),Se=Yn({isController:V,sendBinary:Q,sendResize:le,warnViewerMode:ve,uploadImage:we,t:J,consumeModifierLatch:ye,hostTheme:se,onTerminalFocus:l,ensureHostGlyphs:L,glyphScan:z.glyphs.status==="ready"}),ae=Yn(i),pe=VC({termRef:h,rendererRef:m,mode:O.predictiveEcho,connectionState:X,observeKeyInput:xe}),[Ee,Be]=C.useState(null),re=uT({termRef:h,surfaceRef:r,mainRef:u,currentScaleRef:p,addToast:P,t:J}),Ae=Yn(re),Pe=VS({termRef:h,isController:V,warnViewerMode:ve,uploadImage:we,addToast:P,t:J,onPaste:()=>pe.discard("paste"),subscribeToPasteFileReady:de}),wt=tT({termRef:h,containerRef:a,frameRef:o,surfaceRef:r,currentScaleRef:p,rendererRef:m,initialBannerWrittenRef:g,isActiveRef:ae,sendResize:le,onResized:()=>pe.forget("resize")});r5({containerRef:a,surfaceRef:r,termRef:h,rendererRef:m,currentScaleRef:p,initialBannerWrittenRef:g,live:Se,selection:Ae,prediction:pe,fit:wt,isTouchDevice:b,debug:w?T:null,terminalFontSize:_,terminalFontFamily:$,hostTheme:se,glyphRevision:z.glyphRevision,terminalResetVersion:ue,isActive:i,subscribeToOutput:me,onOutput:w?A:null,onTitle:Be,onRendererKind:k});const Nt=qn.useMemo(()=>{var kt;return((kt=D.find(Sn=>Sn.id===K))==null?void 0:kt.displayName)??null},[D,K]);C.useEffect(()=>{X!=="connected"&&Be(null)},[X]),C.useEffect(()=>{const kt=i&&X==="connected",Sn=O.agentAlertBadge?cs(U):null;ES(kt?Ee:null,Nt,Sn)},[i,X,Ee,Nt,U,O.agentAlertBadge]),C.useEffect(()=>{X==="disconnected"&&E()},[]);const Vn=kt=>{kt.preventDefault()};return f.jsxs("main",{ref:u,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:Vn,"aria-label":J("terminal.windowAriaLabel"),children:[f.jsx("div",{id:"terminal-container",ref:a,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:v?"none":"auto"},tabIndex:0,onContextMenu:Vn,"aria-label":J("terminal.bufferAriaLabel"),role:"region",children:f.jsx("div",{id:"terminal-frame",ref:o,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:f.jsx("div",{id:"terminal-surface",ref:r,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),w&&f.jsx(qS,{debug:x,rttMs:G,metrics:M,rendererKind:R,predictiveEcho:O.predictiveEcho,predictor:pe.predictorRef.current,field:((Pn=pe.fieldProbeRef.current)==null?void 0:Pn.detect())??null,renderer:m.current}),b&&re.selectionRect&&re.isHighlightVisible&&f.jsx(dT,{term:h.current,surface:r.current,main:u.current,rect:re.selectionRect,viewportY:re.viewportY}),b&&re.selectionMenu&&f.jsx(US,{anchorPoint:re.selectionMenu,hasSelection:!!re.selectionSnapshot,isController:V,vibrateOnKeyPress:O.vibrateOnKeyPress,linkUrl:re.selectionMenu.link??null,onOpenLink:kt=>{md(kt)||P("warning",J("clipboard.openLinkFailed"))},onCopySelection:re.handleCopySelection,onCopyLine:re.handleCopyLine,onCopyScreen:re.handleCopyScreen,onPaste:Pe.handlePaste,onClose:re.clearSelection}),b&&f.jsx(BS,{isOpen:Pe.isPasteFallbackOpen,onClose:Pe.closePasteFallback,onSend:Pe.handleFallbackPasteSend,onSendImage:Pe.handleFallbackImageSend})]})},u5=2e3;function mr(){const{t:l}=Le(),{addToast:i}=rn(),[a,o]=C.useState(null),r=C.useRef(null);C.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]);const u=C.useCallback((h,p,m="success")=>{Od(h).then(g=>{if(g==="failed"){i("error",l("clipboard.copyFailed"));return}o(h),i(m,p),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>o(null),u5)})},[i,l]);return{copied:a,copy:u}}const el="herdr-remote pair",Vg="herdr-remote",d5=({onPairedSuccess:l})=>{const{settings:i,updateSettings:a,t:o}=Le(),{connect:r,connectionState:u,stateDetail:h}=et(),{addToast:p}=rn(),[m,g]=C.useState(""),{copied:b,copy:v}=mr(),[w,x]=C.useState(!1),[T,M]=C.useState(i.wsUrl||on),[A,R]=C.useState(i.token||""),[k,O]=C.useState(i.clientId||""),$=D=>v(D,o("toasts.commandCopied")),_=D=>{D.preventDefault();const K=m.trim().toUpperCase();if(!K&&!A.trim()){p("warning",o("toasts.connectionError"));return}const J={pairCode:K,wsUrl:T.trim()||on,clientId:k.trim()||i.clientId};A.trim()&&(J.token=A.trim()),a(J),r({pairCode:K||void 0,token:A.trim()||void 0,wsUrl:T.trim()||on,clientId:k.trim()||i.clientId}),l&&l()},z=u==="connecting"||u==="reconnecting",L=({n:D})=>f.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",D,"]"]});return f.jsx("div",{className:"flex h-full w-full flex-1 justify-center overflow-y-auto bg-tui-crust p-2 sm:p-4",children:f.jsxs("div",{className:"my-auto w-full max-w-3xl space-y-3",children:[f.jsxs("div",{className:"border border-tui-border bg-tui-base px-3 py-2",children:[f.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[f.jsx("span",{"aria-hidden":"true",className:"font-bold text-tui-accent",children:"herdr-remote"}),f.jsx("h1",{className:"text-tui font-bold text-tui-text",children:o("onboarding.title")}),f.jsx("span",{className:"text-tui uppercase text-tui-warn",children:o("onboarding.firstTimeSetup")})]}),f.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:o("onboarding.description")})]}),u==="error"&&f.jsxs(Ti,{tone:"warn",action:f.jsx(Me,{variant:"warn",onClick:()=>r(),children:o("common.retry")}),children:[f.jsx("span",{className:"block font-bold",children:o("onboarding.authRequired")}),f.jsx("span",{className:"block text-tui-muted",children:h||o("onboarding.authRequiredDesc")})]}),f.jsxs("form",{onSubmit:_,className:"grid gap-3",children:[f.jsx(Tt,{title:o("onboarding.step1Title"),className:"min-w-0",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("p",{className:"flex items-start gap-2 text-tui text-tui-muted",children:[f.jsx(L,{n:1}),f.jsx("span",{className:"leading-snug",children:o("onboarding.step1Desc")})]}),f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 truncate text-tui text-tui-text",children:el}),f.jsx(Me,{onClick:()=>$(el),glyph:b===el?ke.check:"⧉",className:ne("shrink-0",b===el&&"border-tui-ok text-tui-ok"),children:o(b===el?"common.copied":"common.copy")})]}),f.jsx("div",{className:"space-y-0.5 text-tui-sm",children:f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx("span",{className:"truncate text-tui-faint",children:o("onboarding.step1TuiNote")}),f.jsx("button",{type:"button",onClick:()=>$(Vg),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:o("common.clickToCopy"),children:f.jsx("code",{children:Vg})})]})})]})}),f.jsx(Tt,{title:o("onboarding.step2Title"),className:"min-w-0",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(L,{n:2}),f.jsx(Et,{type:"text",value:m,onChange:D=>g(D.target.value.toUpperCase()),placeholder:o("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":o("onboarding.step2Title"),className:"font-bold uppercase"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:o("onboarding.step2Note")})]})}),f.jsx(Me,{variant:"primary",type:"submit",block:!0,disabled:z,className:"py-1.5",children:z?f.jsx(nl,{label:o("onboarding.connectingAndPairing")}):o("onboarding.connectAndPair")}),f.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[f.jsxs("button",{type:"button",onClick:()=>x(!w),"aria-expanded":w,className:"tui-focusable flex w-full items-center gap-2 px-2 py-1 text-left text-tui text-tui-muted transition-colors hover:text-tui-accent",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:w?ke.chevronDown:ke.chevronRight}),f.jsx("span",{className:"uppercase",children:o("onboarding.advancedTitle")})]}),w&&f.jsxs("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"onboarding-token",children:o("onboarding.manualTokenLabel")}),f.jsx(Et,{id:"onboarding-token",type:"password",value:A,onChange:D=>R(D.target.value),placeholder:o("onboarding.manualTokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"onboarding-ws",children:o("onboarding.wsEndpointLabel")}),f.jsx(Et,{id:"onboarding-ws",type:"text",value:T,onChange:D=>M(D.target.value),placeholder:o("onboarding.wsEndpointPlaceholder")})]}),f.jsx(pS,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"onboarding-client-id",children:o("onboarding.clientIdLabel")}),f.jsx(Et,{id:"onboarding-client-id",type:"text",value:k,onChange:D=>O(D.target.value)})]})]})]})]})]})})},Ei="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",ms="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",f5="border-tui-accent bg-tui-accent text-tui-crust font-bold",h5="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",Oy={default:ms,bad:"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust",warn:"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust"};function m5(l){return{capHeight:l?"h-8":"h-7",keyClass:l?"h-8 min-w-[2rem] px-1.5":"h-7 min-w-[1.75rem] px-1.5",squareKeyClass:l?"h-8 w-8":"h-7 w-7",drawerToggleClass:l?"h-8 px-1.5":"h-7 px-1.5"}}function p5({capHeight:l,onCustomize:i,sendCombo:a}){const{settings:o,t:r}=Le(),{agentProfile:u}=et(),h=Ox(u,o.agentKeymaps[u]),p=g=>{let b="";try{b=is(g.combo)}catch{}const v=g.custom?g.customLabel||"":r(`agentActions.${g.labelKey}`),w=g.labelKey==="interrupt"&&g.combo.trim().toLowerCase()==="ctrl+c"?"bad":g.combo.trim().toLowerCase()==="ctrl+z"?"warn":"default";return f.jsxs("button",{type:"button","data-testid":`agent-key-${g.id}`,onClick:()=>a(g.combo),className:ne(Ei,l,"max-w-[10rem] gap-1 px-1.5",Oy[w]),title:`${b} ${v}`.trim(),"aria-label":`${b} ${v}`.trim(),children:[f.jsx("span",{className:"font-bold",children:b}),f.jsx("span",{className:"max-w-[5rem] truncate text-tui-sm opacity-70",children:v})]},g.id)},m=[...h.agentActions,...h.genericActions];return m.length===0&&!i?null:f.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${Ji[u].name} ${r("agentKeymaps.agentGroup")}`,className:"flex shrink-0 items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",className:"mx-1 h-5 w-px shrink-0 bg-tui-border-dim"}),m.map(p),i&&f.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:i,className:ne(Ei,l,"px-1.5 text-tui-sm border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:r("agentKeymaps.customizeBar"),"aria-label":r("agentKeymaps.customizeBar"),children:r("agentKeymaps.customizeBarShort")})]})}const Dy="scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5";function g5({capHeight:l,onKey:i}){return f.jsx("div",{className:"grid grid-cols-6 gap-1 border-b border-tui-border-dim bg-tui-crust p-1.5 sm:grid-cols-12",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(a=>{const o=`F${a}`;return f.jsxs("button",{type:"button",onClick:()=>i(oe[o]),className:ne(Ei,ms,l),children:["F",a]},o)})})}const b5=[{code:oe.CTRL_C,caption:"^C",title:"virtualKeyboard.ctrlCTitle",badge:"virtualKeyboard.badgeSigint",tone:"bad"},{code:oe.CTRL_D,caption:"^D",title:"virtualKeyboard.ctrlDTitle",badge:"virtualKeyboard.badgeEof"},{code:oe.CTRL_Z,caption:"^Z",title:"virtualKeyboard.ctrlZTitle",badge:"virtualKeyboard.badgeTstp",tone:"warn"},{code:oe.CTRL_L,caption:"^L",title:"virtualKeyboard.ctrlLTitle",badge:"virtualKeyboard.badgeClear"},{code:oe.CTRL_R,caption:"^R",title:"virtualKeyboard.ctrlRTitle",badge:"virtualKeyboard.badgeSearch"},{code:oe.CTRL_A,caption:"^A",title:"virtualKeyboard.ctrlATitle",badge:"virtualKeyboard.badgeStart"},{code:oe.CTRL_E,caption:"^E",title:"virtualKeyboard.ctrlETitle",badge:"virtualKeyboard.badgeEnd"},{code:oe.CTRL_K,caption:"^K",title:"virtualKeyboard.ctrlKTitle",badge:"virtualKeyboard.badgeKill"}];function y5({capHeight:l,onKey:i}){const{t:a}=Le();return f.jsx("div",{className:Dy,children:b5.map(o=>f.jsxs("button",{type:"button",onClick:()=>i(o.code,!1),className:ne(Ei,l,"gap-1.5 px-2",Oy[o.tone??"default"]),title:a(o.title),children:[f.jsx("span",{className:"font-bold",children:o.caption}),f.jsx("span",{className:"text-tui-sm opacity-70",children:a(o.badge)})]},o.caption))})}const v5=["|","~","/","\\","-","_","$","&",";",":","`",'"',"'",">","<","=","#","@","{","}","[","]"];function x5({squareKeyClass:l,onKey:i}){return f.jsx("div",{className:Dy,children:v5.map(a=>f.jsx("button",{type:"button",onClick:()=>i(a,!0),className:ne(Ei,ms,l,"font-bold"),children:a},a))})}const Pg="image/png,image/jpeg,image/webp,image/gif,image/*";function Xg({fileInputRef:l}){const{uploadImage:i}=ur(),a=o=>{var u;const r=(u=o.target.files)==null?void 0:u[0];o.target.value="",r&&i(r)};return f.jsxs(f.Fragment,{children:[f.jsx("input",{ref:l,type:"file",accept:Pg,className:"hidden","data-testid":"key-toolbar-file-input",onChange:a}),f.jsx("input",{type:"file",accept:Pg,capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:a})]})}function Qg({collapsed:l}){const{uploadProgress:i}=ur();return i.active?f.jsx("div",{"data-testid":l?"key-toolbar-progress-collapsed":"key-toolbar-progress",className:"w-full border-b border-tui-border-dim bg-tui-crust px-2 py-1",children:f.jsx(vS,{ratio:i.ratio,label:i.statusText,tone:i.phase==="completed"?"ok":i.phase==="error"?"bad":"accent","aria-label":i.statusText})}):null}function w5({fileInputRef:l,keyClass:i,vibrate:a}){const{t:o}=Le(),{isController:r}=et(),{warnViewerMode:u}=hs(),{uploadProgress:h}=ur(),p=h.active,m=()=>{var g;if(a(),!r){u();return}p||(g=l.current)==null||g.click()};return f.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:m,disabled:p,className:ne(Ei,i,p?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":ms),title:p?h.statusText:o("virtualKeyboard.uploadImageTitle"),"aria-label":o("virtualKeyboard.uploadImage"),children:f.jsx("span",{className:"font-medium",children:p?`${h.percent}%`:o("virtualKeyboard.image")})})}function S5(){const{settings:l}=Le(),{isController:i}=et(),{sendKey:a,warnViewerMode:o,consumeModifierLatch:r}=hs(),u=C.useRef([]);C.useEffect(()=>()=>{for(const g of u.current)clearTimeout(g);u.current=[]},[]);const h=C.useCallback(()=>{if(l.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[l.vibrateOnKeyPress]),p=C.useCallback((g,b=!0)=>{if(h(),!i){o();return}const v=r();a(b&&v?tr(g,v):g)},[i,a,o,h,r]),m=C.useCallback(g=>{if(h(),!i){o();return}let b;try{b=xn(g)}catch{return}if(r(),b.length===1){a(b[0]);return}b.forEach((v,w)=>{const x=setTimeout(()=>{u.current=u.current.filter(T=>T!==x),a(v)},w*120);u.current.push(x)})},[r,i,a,h,o]);return{vibrate:h,pressKey:p,sendCombo:m}}const C5=({compact:l=!1,onCustomize:i})=>{const{settings:a,updateSettings:o,t:r}=Le(),{modifierLatch:u,toggleModifierLatch:h}=hs(),{vibrate:p,pressKey:m,sendCombo:g}=S5(),{capHeight:b,keyClass:v,squareKeyClass:w,drawerToggleClass:x}=m5(l),T=C.useRef(null),[M,A]=C.useState(!1),[R,k]=C.useState(!1),[O,$]=C.useState(!1),_=C.useRef(null),[z,L]=C.useState(!1),D=C.useCallback(()=>{const U=_.current;L(!!U&&U.scrollLeft+U.clientWidth<U.scrollWidth-1)},[]);if(C.useEffect(D),C.useEffect(()=>{const U=_.current;if(!U||typeof ResizeObserver!="function")return;const E=new ResizeObserver(D);return E.observe(U),()=>E.disconnect()},[D,a.toolbarVisible]),!a.toolbarVisible)return f.jsxs("div",{"data-testid":"key-toolbar-collapsed",className:"z-20 flex shrink-0 flex-col border-t border-tui-border bg-tui-mantle pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]",children:[f.jsx(Xg,{fileInputRef:T}),f.jsx(Qg,{collapsed:!0}),f.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:f.jsxs("button",{type:"button",onClick:()=>o({toolbarVisible:!0}),className:"tui-focusable flex h-6 w-28 items-center justify-center gap-1 text-tui uppercase text-tui-faint transition-colors hover:text-tui-accent",title:r("virtualKeyboard.expandToolbar"),"aria-label":r("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[f.jsx("span",{"aria-hidden":"true",children:"▴"}),f.jsx("span",{"aria-hidden":"true",children:r("common.keyBar")})]})})]});const K=a.virtualKeys&&a.virtualKeys.length>0?a.virtualKeys.filter(U=>U.enabled):_b,J=U=>U.id==="left"?f.jsx("span",{"aria-hidden":"true",children:"←"}):U.id==="up"?f.jsx("span",{"aria-hidden":"true",children:"↑"}):U.id==="down"?f.jsx("span",{"aria-hidden":"true",children:"↓"}):U.id==="right"?f.jsx("span",{"aria-hidden":"true",children:"→"}):U.id==="enter"?f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",children:"⏎"}),f.jsx("span",{className:"hidden sm:inline",children:r("virtualKeyboard.keyEnter")})]}):U.id==="drawer_chords"?f.jsx("span",{children:"^C"}):U.id==="drawer_fn"?f.jsxs("span",{className:"flex items-center gap-0.5",children:[f.jsx("span",{children:"Fn"}),f.jsx("span",{"aria-hidden":"true",children:M?"▾":"▴"})]}):f.jsx("span",{children:U.label}),V=U=>{if(p(),U.type==="modifier"){U.modifierType==="ctrl"||U.modifierType==="alt"||U.modifierType==="shift"?h(U.modifierType):U.modifierType==="meta"&&m(oe.ESC);return}if(U.type==="drawer"){U.drawerType==="fn"?(A(!M),k(!1),$(!1)):U.drawerType==="chords"?($(!O),A(!1),k(!1)):U.drawerType==="symbols"&&(k(!R),A(!1),$(!1));return}m(U.code,U.type!=="chord")},X=U=>{if(U.type==="modifier"){if(U.modifierType==="ctrl")return u.ctrl;if(U.modifierType==="alt")return u.alt;if(U.modifierType==="shift")return u.shift}if(U.type==="drawer"){if(U.drawerType==="fn")return M;if(U.drawerType==="chords")return O;if(U.drawerType==="symbols")return R}return!1},ie=U=>{const E=X(U),G=["left","up","down","right"].includes(U.id),P=U.type==="drawer",le=sd(U,r);return f.jsx("button",{type:"button",onClick:()=>V(U),className:ne(Ei,G?w:P?x:v,U.id==="enter"?h5:E?f5:ms),title:le,"aria-label":le,"aria-pressed":E,children:J(U)},U.id)},ue=K.find(U=>U.id==="enter");return f.jsxs("div",{"data-testid":"key-toolbar",className:ne("z-20 flex shrink-0 select-none flex-col border-t border-tui-border bg-tui-mantle",l?"pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]":"pb-[max(env(safe-area-inset-bottom,0px),0.25rem)]"),role:"toolbar","aria-label":r("virtualKeyboard.touchKeyboardShortcuts"),children:[f.jsx(Xg,{fileInputRef:T}),f.jsx(Qg,{collapsed:!1}),M&&f.jsx(g5,{capHeight:b,onKey:m}),O&&f.jsx(y5,{capHeight:b,onKey:m}),R&&f.jsx(x5,{squareKeyClass:w,onKey:m}),f.jsxs("div",{"data-testid":"key-toolbar-row",className:ne("flex flex-nowrap items-center justify-start gap-1",l?"px-1.5 py-1":"px-2 py-1.5"),children:[f.jsxs("div",{className:"relative min-w-0",children:[f.jsxs("div",{ref:_,"data-testid":"key-toolbar-scroll",onScroll:D,className:"scrollbar-none flex flex-nowrap touch-pan-x items-center gap-1 overflow-x-auto overscroll-x-contain",children:[f.jsx("button",{type:"button",onClick:()=>o({toolbarVisible:!1}),className:ne(Ei,w,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:r("virtualKeyboard.collapseToolbar"),"aria-label":r("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:f.jsx("span",{"aria-hidden":"true",children:"▾"})}),K.filter(U=>U.id!=="enter").map(ie),f.jsx(p5,{capHeight:b,onCustomize:i,sendCombo:g}),f.jsx(w5,{fileInputRef:T,keyClass:v,vibrate:p})]}),z&&f.jsx("span",{"aria-hidden":"true","data-testid":"key-toolbar-more",className:"pointer-events-none absolute inset-y-0 right-0 w-4 bg-gradient-to-l from-tui-mantle"})]}),ue&&ie(ue)]})]})},T5=["ls -la","clear","git status","pwd","top","exit","cat"],M5=({isOpen:l,onClose:i})=>{const{t:a}=Le(),{isController:o}=et(),{sendKey:r,warnViewerMode:u}=hs(),[h,p]=C.useState("");if(!l)return null;const m=b=>{if(b&&b.preventDefault(),!o){u();return}h.length>0?(r(`${h}\r`),p("")):r("\r")},g=b=>{if(!o){u();return}r(`${b}\r`)};return f.jsxs("section",{className:"z-20 flex flex-col gap-1.5 border-t border-tui-border bg-tui-mantle p-2","aria-label":a("virtualKeyboard.helperTitle"),children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-tui font-bold uppercase text-tui-accent",children:a("virtualKeyboard.helperTitle")}),f.jsx(Me,{variant:"ghost",onClick:i,"aria-label":a("virtualKeyboard.closeHelper"),children:"esc"})]}),f.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:T5.map(b=>f.jsx("button",{type:"button",onClick:()=>g(b),className:"tui-focusable shrink-0 select-none border border-tui-border bg-tui-surface px-2 py-0.5 text-tui-sm text-tui-muted transition-colors hover:border-tui-accent hover:text-tui-accent",children:b},b))}),f.jsxs("form",{onSubmit:m,className:"flex items-center gap-1.5",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none font-bold text-tui-ok",children:"$"}),f.jsxs("div",{className:"relative flex-1",children:[f.jsx("label",{htmlFor:"virtual-keyboard-input",className:"sr-only",children:a("virtualKeyboard.placeholder")}),f.jsx(Et,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:h,onChange:b=>p(b.target.value),placeholder:a("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),h.length>0&&f.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":a("virtualKeyboard.clearInput"),children:f.jsx("span",{"aria-hidden":"true",children:ke.cross})})]}),f.jsx(Me,{variant:"primary",type:"submit",title:a("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:f.jsx("span",{className:"hidden sm:inline",children:a("virtualKeyboard.sendButton")})})]})]})};function pr(l,i){const a=(o,r)=>i?i(o):r;switch(l){case"connected":return{label:a("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:a("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:a("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:a("connection.reconnectNow","Reconnect now")};case"error":return{label:a("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:a("connection.retry","Retry")};default:return{label:a("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:a("connection.connect","Connect")}}}const A5={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},E5=({isOpen:l,onClose:i,isAddMode:a=!1})=>{const{settings:o,updateSettings:r,t:u,activeProfile:h,activeProfileId:p,addProfileAndConnect:m,renameProfile:g}=Le(),{connect:b,disconnect:v,connectionState:w,hostId:x}=et(),{addToast:T}=rn(),[M,A]=C.useState(o.wsUrl),[R,k]=C.useState(o.token),[O,$]=C.useState(o.pairCode),[_,z]=C.useState(o.clientId),[L,D]=C.useState((h==null?void 0:h.displayName)||""),[K,J]=C.useState(o.autoReconnect),{copied:V,copy:X}=mr(),ie=V!==null;if(C.useEffect(()=>{l&&(A(o.wsUrl),k(a?"":o.token),$(a?"":o.pairCode),z(o.clientId),D(a?"":(h==null?void 0:h.displayName)||""),J(o.autoReconnect))},[l,a,o,h]),!l)return null;const ue=P=>{P.preventDefault();const le={wsUrl:M.trim()||on,token:R.trim(),pairCode:O.trim().toUpperCase(),clientId:_.trim()||o.clientId,autoReconnect:K};if(!le.token&&!le.pairCode){T("warning",u("pairing.credentialsRequired"));return}a?m({...le,displayName:L.trim()||void 0}):(r(le),p&&L.trim()&&g(p,L),v(),b({wsUrl:le.wsUrl,token:le.token||void 0,pairCode:le.pairCode||void 0,clientId:le.clientId,autoReconnect:K})),i()},U=()=>{const P=`client-${Math.random().toString(36).substring(2,8)}`;z(P)},E=()=>{const P=new URL(window.location.href);P.search="",O.trim()&&P.searchParams.set("pairCode",O.trim().toUpperCase()),X(P.toString(),u("toasts.pairingLinkCopied"))},G=A5[w]??"idle";return f.jsxs(hr,{isOpen:l,onClose:i,title:u(a?"pairing.addTitle":"pairing.title"),subtitle:u("pairing.subtitle"),closeLabel:u("common.closeDialog"),hints:[{keys:"esc",action:u("common.close")},{keys:"⏎",action:u("pairing.saveAndConnect")}],footer:f.jsxs(f.Fragment,{children:[w==="connected"&&f.jsx(Me,{variant:"danger",onClick:()=>{v(),i()},children:u("common.disconnect")}),f.jsx(Me,{variant:"primary",type:"submit",form:"pairing-form",children:u("pairing.saveAndConnect")})]}),children:[f.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2 border-b border-tui-border-dim pb-2 text-tui",children:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(Bt,{level:G}),f.jsx("span",{className:"text-tui-muted",children:u("common.status")}),f.jsx("span",{className:ne(G==="ok"?"text-tui-ok":G==="bad"?"text-tui-bad":G==="warn"?"text-tui-warn":"text-tui-faint"),children:pr(w,u).label})]}),x&&f.jsxs("span",{className:"flex items-center gap-1.5 text-tui-muted",children:[u("common.host")," ",f.jsx("span",{className:"text-tui-text",children:x})]})]}),f.jsxs("form",{id:"pairing-form",onSubmit:ue,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"pairing-name",children:u("pairing.displayNameLabel")}),f.jsx(Et,{id:"pairing-name",type:"text",value:L,onChange:P=>D(P.target.value),placeholder:u("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:u("pairing.displayNameHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"pairing-code",hint:u("pairing.pairCodeNote"),children:u("pairing.pairCodeLabel")}),f.jsx(Et,{id:"pairing-code",type:"text",value:O,onChange:P=>$(P.target.value.toUpperCase()),placeholder:u("pairing.pairCodePlaceholder"),maxLength:12,className:"uppercase"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:u("pairing.pairCodeHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"pairing-token",hint:u("pairing.tokenNote"),children:u("pairing.tokenLabel")}),f.jsx(Et,{id:"pairing-token",type:"password",value:R,onChange:P=>k(P.target.value),placeholder:u("pairing.tokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"pairing-ws",children:u("pairing.wsUrlLabel")}),f.jsx(Et,{id:"pairing-ws",type:"text",value:M,onChange:P=>A(P.target.value),placeholder:u("pairing.wsUrlPlaceholder")}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:u("pairing.wsUrlDefaultNote")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"pairing-client-id",children:u("pairing.clientIdLabel")}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Et,{id:"pairing-client-id",type:"text",value:_,onChange:P=>z(P.target.value),className:"flex-1"}),f.jsx(Me,{onClick:U,title:u("pairing.regenerateClientIdTitle"),className:"shrink-0",children:u("pairing.newIdButton")})]})]}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(bS,{checked:K,onChange:J,label:u("pairing.autoReconnectLabel"),description:u("pairing.autoReconnectDesc")})}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(Me,{onClick:E,block:!0,glyph:ie?ke.check:"⧉",className:ne(ie&&"border-tui-ok text-tui-ok"),children:u("pairing.copyDirectLink")})})]})]})},Ci=ne(fr,"py-0"),N5="h-7 py-0",vd="h-7 py-0 px-1.5",rr="text-tui-bad hover:border-tui-bad hover:text-tui-bad",k5=["grid items-center gap-x-2 gap-y-1 py-1","grid-cols-[4rem_minmax(0,1fr)_9rem] [grid-template-areas:'cap_label_actions'_'combo_combo_default']","sm:grid-cols-[4rem_minmax(0,1fr)_9rem_9rem_7rem] sm:[grid-template-areas:'cap_label_combo_default_actions']"].join(" ");function zy(l){return{offLabel:l("settings.toggleOff"),onLabel:l("settings.toggleOn")}}const L5=({profile:l,onProfileChange:i})=>{const{settings:a,updateSettings:o,t:r}=Le(),{agentProfile:u}=et(),[h,p]=C.useState({}),m=C.useRef({}),[g,b]=C.useState(""),[v,w]=C.useState(""),x=l||u,T=a.agentKeymaps[x]||{},M=hb(x,T),A=mb(x,T),R=A.filter(E=>!E.hidden).length,k=E=>E.custom?E.customLabel||"":r(`agentActions.${E.labelKey}`),O=E=>{try{return is(E.combo)}catch{return E.combo}},$=E=>{o({agentKeymaps:{...a.agentKeymaps,[x]:E}})},_=(E,G)=>{var P;$({...T,actions:{...T.actions,[E]:{...(P=T.actions)==null?void 0:P[E],...G}}})},z=E=>{_(E.id,{keys:E.defaultCombo})},L=(E,G)=>{const P=E+(G==="up"?-1:1);if(P<0||P>=M.length)return;const le=M.map(Q=>Q.id);[le[E],le[P]]=[le[P],le[E]],$({...T,order:le})},D=E=>{var G;$({...T,custom:(T.custom||[]).filter(P=>P.id!==E),order:(G=T.order)==null?void 0:G.filter(P=>P!==E)})},K=()=>$(Dx(T)),J=()=>{const E={...a.agentKeymaps};delete E[x],o({agentKeymaps:E})},V=()=>{const E=g.trim();if(!E)return;try{xn(v)}catch{return}const G=`custom-${Date.now().toString(36)}`;$({...T,custom:[...T.custom||[],{id:G,label:E,keys:v.trim()}],order:[...M.map(P=>P.id),G]}),b(""),w("")},X=E=>E instanceof vn?r(`agentKeymaps.errors.${E.code}`,E.params):String(E),ie=(E,G)=>`${E}:${G}`,ue=(E,G)=>{const P=ie(x,E);m.current={...m.current,[P]:G},p(m.current);try{xn(G),_(E,{keys:G})}catch{}},U=E=>{const G=ie(x,E),P=m.current[G];if(P!==void 0){delete m.current[G],p({...m.current});try{xn(P),_(E,{keys:P})}catch{}}};return f.jsxs("div",{className:"space-y-4",children:[f.jsx(hn,{title:r("agentKeymaps.settingsProfileLabel"),aside:f.jsx(Me,{variant:"ghost",onClick:J,className:ne(rr,vd),children:r("agentKeymaps.restoreProfile")}),children:f.jsx(Ht,{label:r("agentKeymaps.profileRowLabel"),htmlFor:"agent-keymap-profile",hint:Ji[x].configHint?r("agentKeymaps.configHint",{path:Ji[x].configHint}):void 0,control:f.jsx(dr,{id:"agent-keymap-profile","aria-label":r("agentKeymaps.settingsProfileLabel"),value:x,onChange:E=>i(E.target.value),className:Ci,children:Ax.map(E=>f.jsx("option",{value:E,children:Ji[E].name},E))})})}),f.jsx(hn,{title:r("agentKeymaps.barGroup"),aside:f.jsx(Me,{variant:"ghost",onClick:K,className:ne(rr,vd),children:r("agentKeymaps.restoreBar")}),children:f.jsxs("div",{className:"space-y-2 py-1.5",children:[f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r("agentKeymaps.barHint",{profile:Ji[x].name,count:R})}),f.jsx("div",{role:"group","aria-label":r("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:A.map(E=>{const G=k(E),P=O(E),le=!E.hidden;return f.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${E.id}`,"aria-pressed":le,onClick:()=>_(E.id,{hidden:le}),title:`${P} ${G}`.trim(),className:ne("tui-focusable inline-flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",le?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent"),children:[f.jsx("span",{"aria-hidden":"true",className:"font-bold",children:le?ke.check:"+"}),f.jsx("span",{className:"font-bold",children:P}),f.jsx("span",{className:le?void 0:"opacity-80",children:G})]},E.id)})})]})}),f.jsx(hn,{title:r("agentKeymaps.listGroup",{profile:Ji[x].name}),children:M.map((E,G)=>{var de,we;const P=k(E),le=r("agentKeymaps.defaultCombo",{combo:is(E.defaultCombo)}),Q=((we=(de=T.actions)==null?void 0:de[E.id])==null?void 0:we.keys)??E.combo,xe=ie(x,E.id),ye=h[xe]??Q;let ve="",me=null;try{xn(ye),ve=is(ye)}catch(se){me=X(se)}return f.jsxs("div",{"data-testid":`agent-setting-row-${E.id}`,className:k5,children:[f.jsx(oy,{className:"w-full overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:ve||"—"}),f.jsxs("span",{className:"min-w-0 break-words text-tui text-tui-text [grid-area:label]",title:P,children:[P,!E.verified&&f.jsx("span",{className:"ml-1 text-tui-sm text-tui-faint",children:r("agentKeymaps.unverified")})]}),f.jsxs("label",{className:"sr-only",htmlFor:`agent-combo-${E.id}`,children:[r("agentKeymaps.shortcutLabel")," ",P]}),f.jsx(Et,{id:`agent-combo-${E.id}`,"aria-label":`${r("agentKeymaps.shortcutLabel")} ${P}`,value:ye,onChange:se=>ue(E.id,se.target.value),onBlur:()=>U(E.id),onKeyDown:se=>{se.key==="Enter"&&se.currentTarget.blur()},placeholder:r("agentKeymaps.comboPlaceholder"),"aria-invalid":!!me,className:ne("w-full min-w-0 [grid-area:combo]",N5)}),f.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint [grid-area:default]",title:le,children:le}),f.jsxs("div",{className:"flex items-center justify-end [grid-area:actions]",children:[f.jsx(tl,{onClick:()=>z(E),title:r("agentKeymaps.resetAction"),"aria-label":`${r("agentKeymaps.resetAction")} ${P}`,children:"↺"}),f.jsx(tl,{disabled:G===0,onClick:()=>L(G,"up"),title:r("agentKeymaps.moveUp"),"aria-label":`${r("agentKeymaps.moveUp")} ${P}`,children:"↑"}),f.jsx(tl,{disabled:G===M.length-1,onClick:()=>L(G,"down"),title:r("agentKeymaps.moveDown"),"aria-label":`${r("agentKeymaps.moveDown")} ${P}`,children:"↓"}),E.custom?f.jsx(tl,{variant:"danger",onClick:()=>D(E.id),title:r("agentKeymaps.removeCustom"),"aria-label":`${r("agentKeymaps.removeCustom")} ${P}`,children:ke.cross}):f.jsx("span",{"aria-hidden":"true",className:"h-7 w-7 shrink-0"})]}),me&&f.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:r("agentKeymaps.invalidCombo",{error:me})})]},E.id)})}),f.jsx(hn,{title:r("agentKeymaps.addCustom"),children:f.jsxs("div",{className:"space-y-1 py-1.5",children:[f.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[f.jsx("span",{children:r("agentKeymaps.customLabel")}),f.jsx(Et,{value:g,onChange:E=>b(E.target.value),className:Ci})]}),f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[f.jsx("span",{children:r("agentKeymaps.customCombo")}),f.jsx(Et,{value:v,onChange:E=>w(E.target.value),placeholder:r("agentKeymaps.comboPlaceholder"),className:Ci})]}),f.jsx(Me,{variant:"primary",glyph:"+",onClick:V,disabled:!g.trim()||!v.trim(),className:Ci,children:r("agentKeymaps.addAction")})]}),v.trim()&&(()=>{try{return xn(v),f.jsx("p",{className:"text-tui-sm text-tui-info",children:is(v)})}catch(E){const G=X(E);return f.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:G})}})()]})})]})},Hy={"gnome-terminal":"GNOME Terminal",ptyxis:"Ptyxis",tilix:"Tilix",konsole:"Konsole","xfce4-terminal":"Xfce Terminal",kitty:"kitty",alacritty:"Alacritty",ghostty:"Ghostty",wezterm:"WezTerm",foot:"foot",vscode:"VS Code",iterm2:"iTerm2","apple-terminal":"Terminal",xterm:"xterm",urxvt:"urxvt"},R5=["host_font_unavailable","host_font_timeout","disconnected","font_api_unavailable"],_5=()=>{const{hostFont:l,loadHostFont:i,declineHostFont:a,settings:o,activeProfile:r,t:u}=Le(),{herdrLaunch:h,hostname:p}=et(),{addToast:m}=rn(),{font:g,status:b,glyphs:v}=l,w=b==="loading"||v.status==="loading",x=b==="failed"||v.status==="failed",T=C.useRef(!1);C.useEffect(()=>{T.current&&!w&&!x&&l.interactive&&m("success",u("hostFont.loaded")),T.current=w&&l.interactive},[w,x,l.interactive,m,u]);const M=b==="available"||v.status==="available",A=l.interactive&&(w||x);if(!(g&&o.fontFamily==="host"&&!h&&(M||A)))return null;const k=b==="available"||l.interactive&&(b==="loading"||b==="failed"),O=v.source&&(v.status==="available"||l.interactive&&(v.status==="loading"||v.status==="failed")),$=p||(r==null?void 0:r.displayName)||u("herdrLaunch.thisHost"),_=[g.sizePx?`${Math.round(g.sizePx)}px`:null,g.source?Hy[g.source]||g.source:null].filter(Boolean).join(u("hostFont.detailSeparator")),z=l.error&&R5.includes(l.error)?l.error:"other",L=l.totalBytes?l.receivedBytes/l.totalBytes:0;return f.jsx("div",{"data-testid":"host-font-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:f.jsxs(Tt,{title:u("hostFont.title"),tone:b==="failed"?"bad":"accent",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":u("hostFont.title"),children:[f.jsx("p",{className:"leading-snug text-tui-text",children:k||!v.source?u("hostFont.body",{host:$,family:g.family,detail:_?u("hostFont.detail",{detail:_}):""}):u("hostFont.bodyGlyphsOnly",{host:$,family:v.source.family})}),w?f.jsxs("div",{className:"space-y-1",role:"status",children:[f.jsx(yS,{value:L,width:32,className:"max-w-full overflow-hidden"}),f.jsx("p",{className:"text-tui-sm text-tui-muted",children:u("hostFont.loading",{received:zu(l.receivedBytes),total:zu(l.totalBytes)})})]}):f.jsxs(f.Fragment,{children:[x?f.jsx(Ti,{tone:"bad",children:u("hostFont.failed",{reason:u(`hostFont.reasons.${z}`)})}):f.jsxs("div",{className:"space-y-1 text-tui-sm leading-snug text-tui-faint",children:[k&&g.faces.length?f.jsx("p",{children:u("hostFont.download",{count:g.faces.length,size:zu(l.totalBytes)})}):null,O&&v.source?f.jsx("p",{children:u(v.source.scope==="all"?"hostFont.glyphsAll":"hostFont.glyphs",{family:v.source.family})}):null]}),f.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[f.jsx(Me,{onClick:a,children:u("hostFont.decline")}),f.jsx(Me,{variant:"primary",onClick:i,autoFocus:!0,children:u(x?"common.retry":"hostFont.load")})]})]})]})})},j5=({onOpenAdmin:l})=>{var _;const{settings:i,updateSettings:a,language:o,setLanguage:r,t:u,hostFont:h,syncHostFont:p,terminalFontFamily:m,terminalFontSize:g}=Le(),{connectionState:b}=et(),v=td.find(z=>z.id===i.fontFamily),w=(z,L)=>z==="host"||z==="system"?u(`fontPresets.${z}`):L,x=(()=>{const{font:z,status:L}=h,D=h.totalBytes?Math.round(h.receivedBytes/h.totalBytes*100):0,K=u(`settings.hostFontStatus.${L}`,{percent:D});return z?[z.family,z.sizePx?`${Math.round(z.sizePx)}px`:null,z.source?Hy[z.source]||z.source:null,K].filter(Boolean).join(" · "):K})(),T=(_=h.font)!=null&&_.sizePx?Wl(h.font.sizePx):null,M=h.glyphs.source&&h.glyphs.status!=="none"?u("settings.hostGlyphLine",{family:h.glyphs.source.family,status:u(`settings.hostGlyphStatus.${h.glyphs.status}`,{count:h.glyphs.covered.toLocaleString()})}):null,A=typeof window<"u"&&window.isSecureContext&&"Notification"in window,R=10,k=24,O=zy(u),$=T?u("settings.fontSizeFollowHost",{size:T}):u("settings.fontSizeFollowHostUnknown");return f.jsxs("div",{className:"space-y-4",children:[f.jsx(hn,{title:u("settings.sectionInterface"),children:f.jsx(Ht,{label:u("settings.languageLabel"),control:f.jsx(wg,{name:"ui-language","aria-label":u("settings.languageLabel"),value:o,onChange:r,options:[{value:"zh",label:"简体中文"},{value:"en",label:"English"}]})})}),f.jsxs(hn,{title:u("settings.sectionFont"),children:[f.jsx(Ht,{label:u("settings.fontFamilyLabel"),htmlFor:"terminal-font-select",control:f.jsxs(dr,{id:"terminal-font-select",value:i.fontFamily,onChange:z=>a({fontFamily:z.target.value}),"aria-label":u("settings.fontFamilyLabel"),className:Ci,children:[!v&&f.jsx("option",{value:i.fontFamily,children:i.fontFamily}),td.map(z=>f.jsx("option",{value:z.id,children:w(z.id,z.name)},z.id))]})}),i.fontFamily==="host"&&f.jsx(Ht,{label:u("settings.hostFontLabel"),hint:f.jsxs(f.Fragment,{children:[f.jsx("span",{"data-testid":"host-font-status",className:"block break-words text-tui-info",children:x}),M?f.jsx("span",{"data-testid":"host-glyph-status",className:"block break-words",children:M}):null]}),control:f.jsx(Me,{block:!0,onClick:p,disabled:b!=="connected"||h.status==="loading"||h.glyphs.status==="loading",className:Ci,children:u("settings.hostFontSync")})}),f.jsx(Ht,{label:u("settings.fontSizeLabel",{size:g}),hint:u("settings.fontSizeHint"),htmlFor:"terminal-font-size",control:f.jsx("div",{className:ne("flex items-center",fr),children:f.jsx("input",{id:"terminal-font-size",type:"range",min:R,max:k,step:1,value:g,onChange:z=>a({fontSize:Number(z.target.value),fontSizeFollowsHost:!1}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})})}),f.jsx(Ht,{label:$,control:f.jsx(wi,{label:$,...O,checked:i.fontSizeFollowsHost,onChange:z=>a(z?{fontSizeFollowsHost:!0}:{fontSizeFollowsHost:!1,fontSize:g})})}),f.jsx("div",{className:"py-1.5",children:f.jsxs("div",{className:"overflow-x-auto whitespace-nowrap border border-tui-border bg-tui-mantle px-2 py-1.5 leading-snug text-tui-text",style:{fontFamily:m,fontSize:`${g}px`},children:[f.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})})]}),f.jsxs(hn,{title:u("settings.sectionInput"),children:[f.jsx(Ht,{label:u("settings.predictiveEchoLabel"),hint:u("settings.predictiveEchoDesc"),control:f.jsx(wg,{name:"predictive-echo","aria-label":u("settings.predictiveEchoLabel"),value:i.predictiveEcho,onChange:z=>a({predictiveEcho:z}),options:[{value:"auto",label:u("settings.predictiveEchoAuto")},{value:"always",label:u("settings.predictiveEchoAlways")},{value:"off",label:u("settings.predictiveEchoOff")}]})}),f.jsx(Ht,{label:u("settings.touchKeyToolbar"),hint:u("settings.touchKeyToolbarDesc"),control:f.jsx(wi,{label:u("settings.touchKeyToolbar"),...O,checked:i.toolbarVisible,onChange:z=>a({toolbarVisible:z})})}),f.jsx(Ht,{label:u("settings.touchHaptics"),hint:u("settings.touchHapticsDesc"),control:f.jsx(wi,{label:u("settings.touchHaptics"),...O,checked:i.vibrateOnKeyPress,onChange:z=>a({vibrateOnKeyPress:z})})})]}),f.jsxs(hn,{title:u("settings.agentAlertsLabel"),children:[f.jsx(Ht,{label:u("settings.agentAlertBadge"),hint:u("settings.agentAlertBadgeDesc"),control:f.jsx(wi,{label:u("settings.agentAlertBadge"),...O,checked:i.agentAlertBadge,onChange:z=>a({agentAlertBadge:z})})}),f.jsx(Ht,{label:u("settings.agentAlertVibrate"),hint:u("settings.agentAlertVibrateDesc"),control:f.jsx(wi,{label:u("settings.agentAlertVibrate"),...O,checked:i.agentAlertVibrate,onChange:z=>a({agentAlertVibrate:z})})}),f.jsx(Ht,{label:u("settings.agentAlertSound"),hint:u("settings.agentAlertSoundDesc"),control:f.jsx(wi,{label:u("settings.agentAlertSound"),...O,checked:i.agentAlertSound,onChange:z=>{a({agentAlertSound:z}),z&&(Fb(),Gb("done"))}})}),A&&f.jsx(Ht,{label:u("settings.agentAlertNotify"),hint:u("settings.agentAlertNotifyDesc"),control:f.jsx(wi,{label:u("settings.agentAlertNotify"),...O,checked:i.agentAlertNotify,onChange:z=>{if(z&&Notification.permission!=="granted"){Notification.requestPermission().then(L=>a({agentAlertNotify:L==="granted"}));return}a({agentAlertNotify:z})}})})]}),l&&f.jsx(hn,{title:u("settings.sectionAdmin"),children:f.jsx(Ht,{label:u("settings.adminEntry"),hint:u("settings.adminEntryHint"),control:f.jsx(Me,{block:!0,variant:"primary",glyph:ke.arrowRight,onClick:l,className:Ci,children:u("settings.adminEntryOpen")})})})]})},O5=()=>{const{settings:l,updateSettings:i,t:a}=Le(),{addToast:o}=rn(),[r,u]=C.useState(!1),h=zy(a),p=l.virtualKeys&&l.virtualKeys.length>0?l.virtualKeys:rs(),m=x=>{const T=p.map(M=>M.id===x?{...M,enabled:!M.enabled}:M);i({virtualKeys:T})},g=(x,T)=>{const M=T==="up"?x-1:x+1;if(M<0||M>=p.length)return;const A=[...p],R=A[x];A[x]=A[M],A[M]=R,i({virtualKeys:A})},b=x=>{if(p.some(M=>M.id===x.id)){const M=p.map(A=>A.id===x.id?{...A,enabled:!0}:A);i({virtualKeys:M})}else{const M=[...p,{...x,enabled:!0}];i({virtualKeys:M})}u(!1)},v=x=>{const T=p.filter(M=>M.id!==x);i({virtualKeys:T})},w=()=>{i({virtualKeys:rs()}),o("info",a("toasts.keyLayoutReset"))};return f.jsxs("div",{className:"space-y-3",children:[f.jsx(hn,{title:a("virtualKeyboard.customizeTitle"),aside:f.jsx(Me,{variant:"ghost",onClick:w,className:ne(rr,vd),children:a("virtualKeyboard.resetLayout")}),children:p.map((x,T)=>{const M=sd(x,a);return f.jsxs("div",{className:"flex items-center gap-2 py-1",children:[f.jsx(oy,{className:ne("w-16 shrink-0 truncate",!x.enabled&&"opacity-50"),children:x.label}),f.jsx("span",{className:ne("min-w-0 flex-1 break-words text-tui",x.enabled?"text-tui-text":"text-tui-faint"),children:M}),f.jsx(wi,{label:`${a("virtualKeyboard.enableKey")} ${x.label}`,...h,checked:x.enabled,onChange:()=>m(x.id),className:"h-7 w-24 shrink-0"}),f.jsx(tl,{disabled:T===0,onClick:()=>g(T,"up"),title:a("virtualKeyboard.moveUp"),"aria-label":a("virtualKeyboard.moveUp"),children:"↑"}),f.jsx(tl,{disabled:T===p.length-1,onClick:()=>g(T,"down"),title:a("virtualKeyboard.moveDown"),"aria-label":a("virtualKeyboard.moveDown"),children:"↓"}),f.jsx(tl,{variant:"danger",onClick:()=>v(x.id),title:a("virtualKeyboard.deleteKeyTitle"),"aria-label":a("virtualKeyboard.deleteKeyTitle"),children:ke.cross})]},x.id)})}),f.jsx(Me,{block:!0,glyph:"+",onClick:()=>u(!r),className:ne("border-dashed",Ci),children:a("virtualKeyboard.addKey")}),r&&f.jsx(hn,{title:a("virtualKeyboard.availableKeys"),children:f.jsx("div",{className:"flex flex-wrap gap-1 py-1.5",children:Xw.map(x=>{const T=p.some(M=>M.id===x.id);return f.jsxs("button",{type:"button",onClick:()=>b(x),title:sd(x,a),className:ne("tui-focusable flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",T?"border-tui-border-dim text-tui-faint":"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent"),children:[f.jsx("span",{children:x.label}),f.jsx("span",{"aria-hidden":"true",className:T?"text-tui-ok":"text-tui-accent",children:T?ke.check:"+"})]},x.id)})})})]})},D5=({isOpen:l,onClose:i,initialTab:a,onOpenAdmin:o})=>{const{updateSettings:r,t:u}=Le(),{addToast:h}=rn(),[p,m]=C.useState("general"),[g,b]=C.useState(null);if(C.useEffect(()=>{!l||!a||(m(a),b(null))},[l,a]),!l)return null;const v=()=>{const w=Db();r({fontSize:w.fontSize,fontSizeFollowsHost:w.fontSizeFollowsHost,fontFamily:w.fontFamily,toolbarVisible:w.toolbarVisible,vibrateOnKeyPress:w.vibrateOnKeyPress,predictiveEcho:w.predictiveEcho,agentAlertBadge:w.agentAlertBadge,agentAlertSound:w.agentAlertSound,agentAlertVibrate:w.agentAlertVibrate,agentAlertNotify:w.agentAlertNotify,language:w.language,virtualKeys:w.virtualKeys}),h("info",u("settings.resetDefaultsToast"))};return f.jsxs(hr,{isOpen:l,onClose:i,title:u("settings.title"),subtitle:u("settings.subtitle"),closeLabel:u("common.closeDialog"),size:"lg",fixedHeight:!0,hints:[{keys:"esc",action:u("common.close")}],footer:f.jsxs(f.Fragment,{children:[f.jsx(Me,{variant:"ghost",onClick:v,className:rr,children:u("settings.resetDefaults")}),f.jsx(Me,{variant:"primary",onClick:i,children:u("common.done")})]}),children:[f.jsx(Rd,{tabs:[{id:"general",label:u("settings.tabGeneral"),index:1},{id:"virtualKeys",label:u("settings.tabVirtualKeys"),index:2},{id:"agentKeymaps",label:u("settings.tabAgentKeymaps"),index:3}],activeId:p,onSelect:w=>m(w),className:"mb-3 border-b border-tui-border-dim pb-1"}),p==="general"&&f.jsx(j5,{onOpenAdmin:o}),p==="virtualKeys"&&f.jsx(O5,{}),p==="agentKeymaps"&&f.jsx(L5,{profile:g,onProfileChange:b})]})},z5={success:"ok",warning:"warn",error:"bad",info:"accent"},H5={success:ke.check,warning:ke.warn,error:ke.cross,info:"›"},B5=()=>{const{t:l}=Le(),{toasts:i,removeToast:a}=rn();return i.length===0?null:f.jsx("div",{className:"pointer-events-none fixed right-2 top-12 z-50 flex w-[calc(100vw-16px)] max-w-sm flex-col gap-1","aria-live":"polite","aria-atomic":"true",children:i.map(o=>{const r=z5[o.type];return f.jsxs("div",{className:ne("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",sn[r].edgeL),role:"alert",children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",sn[r].text),children:H5[o.type]}),f.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:o.message}),o.count>1&&f.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted",children:["×",o.count]}),f.jsx("button",{type:"button",onClick:()=>a(o.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":l("common.dismissNotification"),children:f.jsx("span",{"aria-hidden":"true",children:ke.cross})})]},o.id)})})},By=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}];function U5(l){return l?l.total>0||By.some(({status:i})=>{var a;return(((a=l.counts)==null?void 0:a[i])??0)>0}):!1}const Uy=({className:l,compact:i=!1})=>{const{t:a}=Le(),{agentStatus:o}=et();if(!o)return null;const r=By.map(({status:h,level:p})=>{var m;return{status:h,level:p,count:((m=o.counts)==null?void 0:m[h])??0}}).filter(h=>h.count>0),u=i?r.slice(0,1):r;return u.length===0?o.total===0?null:f.jsxs("span",{"data-testid":"agent-status-chip",className:ne("flex shrink-0 items-center gap-1 px-1 text-tui-muted",l),title:a("agents.title"),children:[f.jsx(Bt,{level:"idle"}),f.jsx("span",{className:"text-tui-faint",children:a("agents.allIdle")})]}):f.jsx("span",{"data-testid":"agent-status-chip",className:ne("flex shrink-0 items-center gap-2 px-1",l),title:a("agents.title"),children:u.map(({status:h,level:p,count:m})=>f.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[f.jsx(Bt,{level:p}),f.jsx("span",{className:"text-tui-text",children:m}),f.jsx("span",{className:"text-tui-faint",children:a(`agents.${h}`)})]},h))})},Hd=({onAddProfile:l,mobile:i=!1,statusBar:a=!1})=>{const{profiles:o,activeProfileId:r,activeProfile:u,switchProfile:h,renameProfile:p,removeProfile:m,t:g}=Le(),{connectionState:b}=et(),[v,w]=C.useState(!1),[x,T]=C.useState(null),[M,A]=C.useState(""),R=C.useRef(null);C.useEffect(()=>{if(!v)return;const L=D=>{R.current&&!R.current.contains(D.target)&&w(!1)};return document.addEventListener("pointerdown",L),()=>document.removeEventListener("pointerdown",L)},[v]);const k=(L,D)=>{T(L),A(D)},O=L=>{const D=M.trim();D&&p(L,D),T(null)},$=L=>{typeof window<"u"&&!window.confirm(g("profiles.removeConfirm"))||(m(L),T(null))},_=(u==null?void 0:u.displayName)||g("profiles.addHost"),z=b==="connected"?"ok":b==="connecting"||b==="reconnecting"?"warn":b==="error"?"bad":"idle";return f.jsxs("div",{ref:R,className:ne("relative min-w-0",i&&"w-full",a&&"flex-1",!i&&!a&&"h-full"),children:[f.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":v,"aria-label":g("profiles.switcherLabel"),onClick:()=>w(L=>!L),className:ne("tui-focusable flex min-w-0 items-center gap-1.5 border border-transparent text-left text-tui-muted transition-colors hover:border-tui-border hover:text-tui-accent",a?"min-h-11 w-full max-w-none px-2":i?"min-h-11 w-full px-2":"h-full max-w-[18rem] px-1"),children:[f.jsx(Bt,{level:z}),f.jsx("span",{className:ne("truncate text-tui-text",a&&"min-w-0 flex-1"),children:_}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:v?ke.chevronDown:ke.chevronRight})]}),v&&f.jsxs("div",{role:"menu","aria-label":g("profiles.switcherLabel"),className:ne("absolute bottom-full left-0 z-[100] mb-1 max-h-[min(70vh,24rem)] overflow-y-auto border border-tui-border bg-tui-base p-1 shadow-lg",a?"w-80 max-w-[calc(100vw-1rem)]":i?"inset-x-0 bottom-auto top-full mt-1 mb-0 w-full":"w-80 max-w-[calc(100vw-1rem)]"),children:[f.jsx("div",{className:"border-b border-tui-border-dim px-2 py-1 text-tui-sm uppercase text-tui-faint",children:g("profiles.title")}),o.length===0?f.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:g("profiles.empty")}):o.map(L=>{const D=L.id===r,K=L.id===x;return f.jsxs("div",{role:"none",className:"border-b border-tui-border-dim last:border-b-0",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs("button",{type:"button",role:"menuitem","aria-current":D?"true":void 0,onClick:()=>{h(L.id),w(!1)},className:ne("tui-focusable flex min-h-11 min-w-0 flex-1 items-center gap-2 px-2 text-left text-tui transition-colors hover:bg-tui-selection",D?"text-tui-accent":"text-tui-text"),children:[f.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:D?ke.cursor:""}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:"block truncate font-bold",children:L.displayName}),f.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:L.hostname||L.hostId,children:L.hostname||L.hostId||L.wsUrl})]}),D&&f.jsx("span",{className:"shrink-0 text-tui-sm text-tui-ok",children:g("profiles.current")})]}),f.jsx("button",{type:"button",role:"menuitem","aria-label":g("profiles.rename"),title:g("profiles.rename"),onClick:()=>k(L.id,L.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:ke.ellipsis})]}),K&&f.jsxs("div",{className:"flex items-center gap-1 px-2 pb-2",children:[f.jsx("input",{autoFocus:!0,value:M,maxLength:64,onChange:J=>A(J.target.value),onKeyDown:J=>{J.key==="Enter"&&O(L.id),J.key==="Escape"&&T(null)},"aria-label":g("profiles.rename"),className:"tui-input min-w-0 flex-1 px-2 py-1 text-tui"}),f.jsx(Me,{onClick:()=>O(L.id),variant:"primary",className:"min-h-11",children:g("common.save")}),f.jsx(Me,{onClick:()=>$(L.id),variant:"danger",className:"min-h-11",children:g("profiles.remove")})]})]},L.id)}),f.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{w(!1),l()},className:"tui-focusable flex min-h-11 w-full items-center gap-2 px-2 text-left text-tui-accent hover:bg-tui-selection",children:[f.jsx("span",{"aria-hidden":"true",children:"+"}),f.jsx("span",{children:g("profiles.addHost")})]})]})]})};function Ky(){const{updateStatus:l,ignoredUpdate:i}=et();return!!(l!=null&&l.updateAvailable)&&i!==(l==null?void 0:l.latest)}const Iy=({compact:l=!1,className:i})=>{const{t:a}=Le(),{updateStatus:o}=et(),r=Ky(),[u,h]=C.useState(!1);if(!r||!o)return null;const{latest:p,restartPending:m}=o,g=m?a("update.chipRestart",{version:p}):l?a("update.chipCompact",{version:p}):a("update.chip",{version:p});return f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button","data-testid":"update-chip",onClick:()=>h(!0),title:a("update.title"),className:ne("tui-focusable shrink-0 whitespace-nowrap px-1 text-tui-warn hover:underline",i),children:g}),f.jsx(K5,{isOpen:u,onClose:()=>h(!1)})]})},Wu=({command:l})=>{const{t:i}=Le(),{addToast:a}=rn();return f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 break-all text-tui-text",children:l}),f.jsx(Me,{glyph:"⧉",className:"shrink-0",onClick:()=>{Od(l).then(o=>{a(o==="failed"?"error":"success",i(o==="failed"?"clipboard.copyFailed":"toasts.commandCopied"))})},children:i("common.copy")})]})},K5=({isOpen:l,onClose:i})=>{const{t:a}=Le(),{updateStatus:o,ignoreUpdate:r,hostname:u,hostId:h}=et();if(!o)return null;const{current:p,installed:m,latest:g,restartPending:b}=o;return f.jsx(hr,{isOpen:l,onClose:i,title:a("update.title"),closeLabel:a("common.closeDialog"),size:"md",footer:f.jsxs(f.Fragment,{children:[f.jsx(Me,{variant:"ghost",onClick:()=>{r(g),i()},children:a("update.ignore")}),f.jsx(Me,{variant:"primary",onClick:i,children:a("common.done")})]}),children:f.jsxs("div",{className:"space-y-3","data-testid":"update-modal",children:[f.jsxs("div",{className:"space-y-0.5",children:[f.jsx(Si,{label:a("common.host"),labelWidth:10,children:u||h||"—"}),f.jsx(Si,{label:a("update.running"),labelWidth:10,children:p}),m!==p?f.jsx(Si,{label:a("update.installed"),labelWidth:10,children:m}):null,f.jsx(Si,{label:a("update.latest"),labelWidth:10,children:f.jsx("span",{className:"text-tui-ok",children:g})})]}),b?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:a("update.restartPending",{version:m})}),f.jsx(Wu,{command:"herdr-remote restart"})]}):f.jsxs(f.Fragment,{children:[f.jsxs("p",{className:"leading-snug text-tui-text",children:[f.jsx("span",{"aria-hidden":"true",className:"mr-1 text-tui-accent",children:ke.arrowRight}),a("update.stepTui")]}),f.jsx("p",{className:"leading-snug text-tui-muted",children:a("update.stepCli")}),f.jsx(Wu,{command:`npm install -g herdr-remote@${g} --prefer-online`}),f.jsx(Wu,{command:"herdr-remote restart"}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:a("update.restartNote")})]})]})})},I5=({onAddProfile:l=()=>{}})=>{const{settings:i,t:a}=Le(),{connectionState:o,role:r,hostId:u,assignedClientId:h,sharedWindowCount:p,rttMs:m,agentStatus:g}=et(),b=pr(o,a),v=o==="connected",w=Ky();return f.jsx(ry,{left:f.jsxs(f.Fragment,{children:[f.jsx(Hd,{onAddProfile:l}),f.jsx(fd,{items:[f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx(Bt,{level:b.level}),f.jsx("span",{className:"text-tui-text",children:b.label})]},"status"),v?f.jsx(Ld,{tone:r==="controller"?"ok":"warn",children:a(r==="controller"?"role.sharedControl":"common.viewer")},"role"):null,v&&p>1?f.jsx("span",{className:"text-tui-muted",children:a("role.sharedWindows",{count:p})},"windows"):null,u?f.jsxs("span",{children:[f.jsxs("span",{className:"text-tui-faint",children:[a("common.host"),":"]})," ",f.jsx("span",{className:"text-tui-text",children:u})]},"host"):null,f.jsxs("span",{children:[f.jsx("span",{className:"text-tui-faint",children:a("header.clientIdLabel")})," ",f.jsx("span",{className:"text-tui-text",children:h||i.clientId})]},"client")]})]}),right:f.jsx(fd,{items:[w?f.jsx(Iy,{},"update"):null,v&&U5(g)?f.jsx(Uy,{},"agents"):null,m!==null?f.jsxs("span",{className:"text-tui-muted",children:[a("header.latencyTitle"),": ",f.jsxs("span",{className:"text-tui-text",children:[m,"ms"]})]},"rtt"):null,f.jsx("span",{className:"hidden text-tui-faint sm:inline",children:a("header.tagline")},"mode")]})})},F5=({wsUrl:l,adminUrl:i,onOpenRemoteAdmin:a,onSignIn:o})=>{const{t:r}=Le();return f.jsxs(Tt,{title:r("admin.remoteRelayTitle"),bodyClassName:"space-y-2",children:[f.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:r("admin.remoteRelayNotice")}),f.jsxs("div",{className:"space-y-0.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[f.jsx(Si,{label:r("admin.remoteRelayEndpoint"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-accent",children:l})}),f.jsx(Si,{label:r("admin.remoteRelayAdminUrl"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-ok",children:i})})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Me,{variant:"primary",onClick:a,glyph:ke.arrowRight,children:r("admin.openRemoteAdminBtn")}),f.jsx(Me,{onClick:o,children:r("admin.relayAdminLoginBtn")})]})]})},G5=({adminConfigured:l,isAuthError:i,tokenInput:a,onTokenInput:o,onSubmit:r,isSameOriginRelay:u,onBackToTerminal:h,showBack:p,onCancel:m})=>{const{t:g}=Le();return f.jsxs(Tt,{title:g("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[l===!1?f.jsx(Ti,{tone:"warn",children:g("admin.relayAdminNotConfigured")}):i?f.jsx(Ti,{tone:"bad",children:g("admin.relayAdminAuthError")}):f.jsx(Ti,{tone:"accent",children:g("admin.relayAdminPrompt")}),f.jsxs("form",{onSubmit:r,className:"space-y-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"relay-admin-token",children:g("admin.relayAdminTokenLabel")}),f.jsx(Et,{id:"relay-admin-token",type:"password",autoComplete:"current-password",value:a,onChange:b=>o(b.target.value),placeholder:g("admin.relayAdminTokenPlaceholder")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Me,{variant:"primary",type:"submit",disabled:!a.trim(),children:g("admin.relayAdminLoginBtn")}),u?h&&!p?f.jsx(Me,{variant:"ghost",onClick:h,children:g("admin.returnToTerminal")}):null:f.jsx(Me,{variant:"ghost",onClick:m,children:g("common.cancel")})]})]})]})},Y5=({onOpenPairing:l,onRetry:i})=>{const{t:a}=Le(),{copied:o,copy:r}=mr(),u=o!==null,h=()=>r(el,a("toasts.commandCopied"));return f.jsxs(Tt,{title:a("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[f.jsx(Ti,{tone:"bad",children:a("admin.unauthorizedDesc")}),f.jsxs("div",{className:"space-y-1.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[f.jsx("span",{className:"block text-tui-sm uppercase text-tui-muted",children:a("admin.pairingStepsTitle")}),f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-crust px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 truncate text-tui-text",children:el}),f.jsx(Me,{onClick:h,glyph:u?ke.check:"⧉",className:ne("shrink-0",u&&"border-tui-ok text-tui-ok"),children:a(u?"admin.copiedJson":"common.copy")})]}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:a("admin.pairingStepsHelp")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[l&&f.jsx(Me,{variant:"primary",onClick:l,children:a("admin.enterPairCodeBtn")}),f.jsx(Me,{onClick:i,children:a("admin.retryFetchBtn")})]})]})},$5=[[/\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"]],q5=[[/\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 Zg(l,i){for(const[a,o]of l)if(a.test(i))return o;return null}function Bd(l){const i=typeof l=="string"?l.trim():"";if(!i)return{label:"",raw:""};const a=Zg($5,i),o=Zg(q5,i);return a&&o?{label:`${a} · ${o}`,raw:i}:a?{label:a,raw:i}:o?{label:o,raw:i}:{label:i.length>32?`${i.slice(0,32)}…`:i,raw:i}}function Xl(l){if(!l||l<=0)return"0 B";const i=1024,a=["B","KB","MB","GB","TB"],o=Math.min(a.length-1,Math.floor(Math.log(l)/Math.log(i)));return`${(l/i**o).toFixed(1)} ${a[o]}`}function Wg(l,i,a=!1){const o=Math.max(0,Math.floor(l)),r=Math.floor(o/86400),u=Math.floor(o%86400/3600),h=Math.floor(o%3600/60),p=o%60,m=(b,v)=>`${b}${i(`admin.unit${v}`)}`,g=r>0?[m(r,"Day"),m(u,"Hour"),m(h,"Minute")]:u>0?[m(u,"Hour"),m(h,"Minute"),m(p,"Second")]:[m(h,"Minute"),m(p,"Second")];return(a?g.slice(0,2):g).join(" ")}function Ud(l,i,a=Date.now()){if(!l)return"—";const o=new Date(l).getTime();if(Number.isNaN(o))return"—";const r=Math.max(0,Math.floor((a-o)/1e3));return r<60?i("admin.relJustNow"):r<3600?i("admin.relMinutes",{count:Math.floor(r/60)}):r<86400?i("admin.relHours",{count:Math.floor(r/3600)}):i("admin.relDays",{count:Math.floor(r/86400)})}function Kd(l){if(!l)return"";const i=new Date(l);return Number.isNaN(i.getTime())?"":i.toLocaleString()}function Fy(l=[]){const i=new Map;for(const a of l)a.deviceId&&i.set(a.deviceId,(i.get(a.deviceId)||0)+1);return i}const V5=({clients:l})=>{const{t:i}=Le(),a=l.some(r=>r.hostId),o=[{key:"id",header:i("admin.colClientId"),render:r=>f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(Bt,{level:"ok"}),f.jsx("span",{className:"font-bold text-tui-text",children:r.id})]})},...a?[{key:"host",header:i("admin.colHost"),render:r=>f.jsx("span",{className:"text-tui-text",children:r.hostId||"—"})}]:[],{key:"role",header:i("admin.colRole"),width:10,render:r=>{const u=r.role==="controller";return f.jsx(Ld,{tone:u?"ok":"warn",className:"text-tui-sm",children:i(u?"common.controller":"common.viewer")})}},{key:"device",header:i("admin.colDevice"),render:r=>{const u=Bd(r.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:u.label?"text-tui-text":"text-tui-faint",title:u.raw,children:u.label||i("admin.unknownDevice")}),r.deviceId?f.jsx("code",{className:"text-tui-sm text-tui-faint",children:r.deviceId}):null]})}},{key:"ip",header:i("admin.colIp"),render:r=>f.jsx("span",{className:"text-tui-muted",children:r.ip||"127.0.0.1"})},{key:"connectedAt",header:i("admin.colConnectedAt"),render:r=>f.jsx("span",{className:"whitespace-nowrap text-tui-muted",title:Kd(r.connectedAt),children:r.connectedAt?Ud(r.connectedAt,i):i("admin.startedRecently")})},{key:"traffic",header:i("admin.colTraffic"),align:"right",render:r=>f.jsxs("span",{className:"whitespace-nowrap",children:[f.jsxs("span",{className:"text-tui-accent",children:["↓",Xl(r.bytesReceived||0)]}),f.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),f.jsxs("span",{className:"text-tui-ok",children:["↑",Xl(r.bytesSent||0)]})]})}];return f.jsx(Tt,{title:i("admin.connectedClientsTitle",{count:l.length}),bodyClassName:"-mx-1",children:f.jsx(_d,{columns:o,items:l,rowKey:r=>r.id,empty:i("admin.noClients")})})},P5=({devices:l,clients:i,onRevoke:a})=>{const{t:o}=Le(),[r,u]=C.useState(null),[h,p]=C.useState(null),m=Fy(i),g=[...l].sort((w,x)=>{const T=+!!m.get(x.deviceId)-+!!m.get(w.deviceId);return T||(Date.parse(x.lastSeenAt)||0)-(Date.parse(w.lastSeenAt)||0)}),b=async w=>{if(r!==w){u(w);return}p(w);try{await a(w)}finally{p(null),u(null)}},v=[{key:"status",header:o("admin.colStatus"),width:12,render:w=>{const x=m.get(w.deviceId)||0;return f.jsxs("span",{className:ne("flex items-center gap-1.5 whitespace-nowrap",x?"text-tui-ok":"text-tui-faint"),children:[f.jsx(Bt,{level:x?"ok":"idle"}),o(x?"admin.hostStatusOnline":"admin.hostStatusOffline")]})}},{key:"device",header:o("admin.colDevice"),render:w=>{const x=Bd(w.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:"text-tui-text",title:x.raw,children:x.label||o("admin.unknownDevice")}),f.jsx("code",{className:"text-tui-sm text-tui-faint",children:w.deviceId})]})}},{key:"host",header:o("admin.colHost"),render:w=>f.jsx("span",{className:"text-tui-text",children:w.hostId||"—"})},{key:"ip",header:o("admin.colIp"),render:w=>f.jsx("span",{className:"text-tui-muted",children:w.lastIp||"—"})},{key:"lastSeen",header:o("admin.colLastSeen"),render:w=>{const x=m.get(w.deviceId)||0;return f.jsx("span",{className:ne("whitespace-nowrap",x?"text-tui-ok":"text-tui-muted"),title:Kd(w.lastSeenAt),children:x?o("admin.deviceWindows",{count:x}):Ud(w.lastSeenAt,o)})}},{key:"actions",header:o("admin.colActions"),align:"right",render:w=>{const x=r===w.deviceId,T=h===w.deviceId;return f.jsx(Me,{variant:"danger",disabled:T,onClick:()=>void b(w.deviceId),onBlur:()=>u(M=>M===w.deviceId?null:M),"aria-label":o("admin.revokeDevice"),className:ne("h-6 py-0 text-tui-sm",x&&"bg-tui-bad text-tui-crust"),children:T?f.jsx(nl,{}):o(x?"admin.revokeConfirm":"admin.revokeDevice")})}}];return f.jsx(Tt,{title:o("admin.pairedDevicesTitle",{count:l.length}),bodyClassName:"-mx-1",children:f.jsx(_d,{columns:v,items:g,rowKey:w=>w.deviceId,empty:o("admin.noDevices")})})},Jg={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function X5(l=[],i=[]){const a=new Map;for(const u of i){if(!(u!=null&&u.hostId))continue;const h=a.get(u.hostId);h?h.push(u):a.set(u.hostId,[u])}const o=l.map(u=>{const h=a.get(u.id)||[];return{id:u.id,hostname:u.hostname||u.id,status:u.status||"online",connectedDeviceCount:u.connectedDeviceCount??0,pairedDeviceCount:u.pairedDeviceCount??h.length,activePtyCount:u.activePtyCount??0,devices:h,fromRosterOnly:!1}}),r=new Set(o.map(u=>u.id));for(const[u,h]of a)r.has(u)||o.push({id:u,hostname:u,status:"offline",connectedDeviceCount:0,pairedDeviceCount:h.length,activePtyCount:0,devices:h,fromRosterOnly:!0});return o.sort((u,h)=>u.fromRosterOnly!==h.fromRosterOnly?u.fromRosterOnly?1:-1:u.hostname.localeCompare(h.hostname))}const Q5=({hosts:l,devices:i,clients:a})=>{const{t:o}=Le(),r=X5(l,i),u=Fy(a),h={online:o("admin.hostStatusOnline"),busy:o("admin.hostStatusBusy"),reconnecting:o("admin.hostStatusReconnecting"),offline:o("admin.hostStatusOffline")};return f.jsx(Tt,{title:o("admin.hostsTitle",{count:r.length}),bodyClassName:"space-y-2",children:r.length===0?f.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:o("admin.noHosts")}):r.map(p=>f.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border-dim px-2 py-1",children:[f.jsxs("span",{className:"flex min-w-0 flex-auto items-center gap-1.5 text-tui",children:[f.jsx(Bt,{level:Jg[p.status]}),f.jsx("span",{className:"truncate font-bold text-tui-text",children:p.hostname}),p.hostname!==p.id?f.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:p.id}):null,f.jsx(Ld,{tone:Jg[p.status],className:"ml-1 text-tui-sm",children:h[p.status]})]}),f.jsx(fd,{className:"shrink-0 text-tui-sm",items:[f.jsx("span",{className:p.connectedDeviceCount?"text-tui-ok":"text-tui-faint",children:o("admin.hostConnectedDevices",{count:p.connectedDeviceCount})},"connected"),f.jsx("span",{className:"text-tui-muted",children:o("admin.hostPairedDevices",{count:p.pairedDeviceCount})},"paired"),p.fromRosterOnly?null:f.jsx("span",{className:p.activePtyCount?"text-tui-info":"text-tui-faint",children:o("admin.hostPtys",{count:p.activePtyCount})},"ptys")]})]}),p.devices.length>0?f.jsx("ul",{className:"divide-y divide-tui-border-dim",children:p.devices.map(m=>{const g=Bd(m.userAgent),b=u.get(m.deviceId)||0;return f.jsxs("li",{className:"grid grid-cols-[1ch_minmax(0,1fr)_auto] items-baseline gap-x-2 px-2 py-0.5 text-tui sm:grid-cols-[1ch_minmax(0,18ch)_minmax(0,1fr)_16ch_16ch]",children:[f.jsx(Bt,{level:b?"ok":"idle"}),f.jsx("span",{className:"truncate text-tui-text",title:g.raw,children:g.label||o("admin.unknownDevice")}),f.jsx("code",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:m.deviceId}),f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-muted sm:block",children:m.lastIp||"—"}),f.jsx("span",{className:ne("whitespace-nowrap text-right text-tui-sm",b?"text-tui-ok":"text-tui-faint"),title:Kd(m.lastSeenAt),children:b?o("admin.deviceWindows",{count:b}):Ud(m.lastSeenAt,o)})]},m.deviceId)})}):f.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:p.pairedDeviceCount>0?o("admin.hostRosterOperatorOnly"):o("admin.noDevices")})]},p.id))})},Z5=({data:l})=>{var r,u,h,p,m,g,b,v,w,x;const{t:i}=Le(),a=l.activeUserCount??((r=l.clients)==null?void 0:r.length)??0,o=new Set((l.devices||[]).map(T=>T.hostId).filter(T=>T&&!(l.hosts||[]).some(M=>M.id===T))).size;return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 xl:grid-cols-6",children:[f.jsx(Gl,{label:i("admin.connectedHosts"),value:((u=l.hosts)==null?void 0:u.length)||0,sub:o?i("admin.hostsOfflineSub",{count:o}):void 0,tone:(h=l.hosts)!=null&&h.length?"ok":"idle"}),f.jsx(Gl,{label:i("admin.activeUsers"),value:a,sub:i("admin.acrossWindows",{count:((p=l.clients)==null?void 0:p.length)||0}),tone:a?"accent":"idle"}),f.jsx(Gl,{label:i("admin.activePtys"),value:((m=l.ptys)==null?void 0:m.length)||0,sub:i("admin.terminalShells"),tone:(g=l.ptys)!=null&&g.length?"info":"idle"}),f.jsx(Gl,{label:i("admin.statInbound"),value:i("admin.perSecond",{value:Xl(((b=l.throughput)==null?void 0:b.bytesInPerSec)||0)}),sub:i("admin.statTotal",{value:Xl(((v=l.throughput)==null?void 0:v.bytesIn)||0)}),tone:"accent"}),f.jsx(Gl,{label:i("admin.statOutbound"),value:i("admin.perSecond",{value:Xl(((w=l.throughput)==null?void 0:w.bytesOutPerSec)||0)}),sub:i("admin.statTotal",{value:Xl(((x=l.throughput)==null?void 0:x.bytesOut)||0)}),tone:"ok"}),f.jsx(Gl,{label:i("admin.uptime"),value:Wg(l.uptimeSeconds||0,i,!0),title:Wg(l.uptimeSeconds||0,i),sub:l.startTime?i("admin.startedAt",{time:new Date(l.startTime).toLocaleTimeString()}):i("admin.startedRecently")})]}),f.jsx(Q5,{hosts:l.hosts||[],devices:l.devices,clients:l.clients||[]})]})},W5=({ptys:l})=>{const{t:i}=Le(),a=l.some(r=>r.hostId),o=[{key:"id",header:i("admin.colPtyId"),render:r=>f.jsx("span",{className:"font-bold text-tui-accent",children:r.id})},...a?[{key:"host",header:i("admin.colHost"),render:r=>f.jsx("span",{className:"text-tui-text",children:r.hostId})}]:[],{key:"pid",header:i("admin.colPid"),width:9,render:r=>f.jsx("span",{className:"text-tui-muted",children:r.pid})},{key:"command",header:i("admin.colCommand"),render:r=>f.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:r.command})},{key:"grid",header:i("admin.colGrid"),width:11,render:r=>f.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[r.cols,f.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),r.rows]})},{key:"cwd",header:i("admin.colCwd"),className:"max-w-xs truncate",render:r=>f.jsx("span",{className:"text-tui-muted",children:r.cwd||"~"})},{key:"viewers",header:i("admin.colViewers"),align:"right",width:9,render:r=>f.jsx("span",{className:"font-bold text-tui-ok",children:r.activeClients})}];return f.jsx(Tt,{title:i("admin.activePtysTitle",{count:l.length}),bodyClassName:"-mx-1",children:f.jsx(_d,{columns:o,items:l,rowKey:r=>r.id,empty:i("admin.noPtys")})})};function xd(l){if(typeof window>"u"||!l||l.startsWith("/"))return"";try{const i=new URL(l.replace(/^ws/,"http")),a=i.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return i.origin===window.location.origin&&!a?"":`${i.origin}${a}`}catch{return""}}function ds(l,i){const a=xd(l);return a?`${a}${i.startsWith("/")?i:`/${i}`}`:i}async function J5(l){try{const a=await fetch(ds(l,"/api/info"),{headers:{Accept:"application/json"}});if(a.ok)return await a.json()}catch{}return{ok:!0,version:"0.1.0",protocol:1,relayMode:!!(l&&!l.startsWith("/")&&!l.includes("localhost")&&!l.includes("127.0.0.1")&&typeof window<"u"&&!l.startsWith(window.location.origin.replace("http","ws")))?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}}async function eb(l,i){const a=await fetch(l,{headers:{Accept:"application/json",...i}});if(a.status===401||a.status===403)return{kind:"denied",status:a.status};if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);return{kind:"ok",data:await a.json()}}async function eM(l,i,a){return(await fetch(ds(l,`/api/admin/devices/${encodeURIComponent(a)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":i}})).ok}function tM(l,i,a){return l!=null&&l.adminPath?l.publicUrl?`${l.publicUrl.replace(/\/$/,"")}${l.adminPath}`:ds(a,l.adminPath):i!=null&&i.remoteAdminUrl?i.remoteAdminUrl:a?ds(a,"/admin"):"/admin"}function nM({wsUrl:l,deviceToken:i,adminToken:a,relayOrigin:o,refreshInterval:r,t:u}){const[h,p]=C.useState(null),[m,g]=C.useState(null),[b,v]=C.useState(!1),[w,x]=C.useState(!0),[T,M]=C.useState(null),[A,R]=C.useState(!1),[k,O]=C.useState(null);C.useEffect(()=>{p(null),g(null),v(!1)},[o]),C.useEffect(()=>{let K=!0;return x(!0),J5(l).then(J=>{K&&(g(J),v(!0))}),()=>{K=!1}},[l,o]);const $=(m==null?void 0:m.relayMode)==="remote",_=C.useCallback((K,J)=>{if(K.kind==="denied"){R(!0),M(J),p(null);return}p(K.data),M(null),R(!1),O(new Date)},[]),z=C.useCallback((K,J)=>{R(!1),M(K instanceof Error?K.message:J),p(null)},[]),L=C.useCallback(async()=>{if(b){if($){if(!a){p(null),x(!1),M(null),R(!1);return}try{x(!0);const K=await eb(ds(l,(m==null?void 0:m.adminStatusPath)||"/api/admin/status"),{"X-Relay-Admin-Token":a});_(K,u("admin.relayAdminAuthError"))}catch(K){console.warn("GET /api/admin/status request failed:",K),z(K,"Failed to fetch remote admin status")}finally{x(!1)}return}try{x(!0);const K=await eb("/api/status",i?{Authorization:`Bearer ${i}`}:{});_(K,K.kind==="denied"?`Authentication failed (HTTP ${K.status}): Access denied. Please configure an authorized token or pair with the host.`:"")}catch(K){console.warn("GET /api/status request failed:",K),z(K,"Failed to fetch status")}finally{x(!1)}}},[b,$,a,m,i,l,o,u]),D=C.useCallback(async K=>{try{if(!await eM(l,a,K)){M(u("admin.revokeFailed"));return}await L()}catch{M(u("admin.revokeFailed"))}},[a,L,l,u]);return C.useEffect(()=>{if(!b)return;L();let K=null;const J=()=>{r>0&&!K&&(K=setInterval(()=>{document.visibilityState==="visible"&&L()},r))},V=()=>{K&&(clearInterval(K),K=null)},X=()=>{document.visibilityState==="visible"?(L(),J()):V()};return J(),document.addEventListener("visibilitychange",X),()=>{V(),document.removeEventListener("visibilitychange",X)}},[b,L,r]),{data:h,relayInfo:m,infoLoaded:b,isRemoteRelay:$,loading:w,error:T,isAuthError:A,lastUpdated:k,fetchStatus:L,revokeDevice:D}}const Ju="h-7 py-0",iM=({onBackToTerminal:l,onOpenPairing:i,showBack:a=!1})=>{var ye,ve,me;const{settings:o,updateSettings:r,t:u}=Le(),h=xd(o.wsUrl)||(typeof window<"u"?window.location.origin:"local"),p=((ye=o.adminTokens)==null?void 0:ye[h])||(h===(typeof window<"u"?window.location.origin:"local")?o.adminToken:"")||"",[m,g]=C.useState(3e3),[b,v]=C.useState("overview"),[w,x]=C.useState(p),[T,M]=C.useState(p),[A,R]=C.useState(!!p),k=!xd(o.wsUrl);C.useEffect(()=>{x(p),M(p),R(!!p)},[h]);const{data:O,relayInfo:$,infoLoaded:_,isRemoteRelay:z,loading:L,error:D,isAuthError:K,lastUpdated:J,fetchStatus:V,revokeDevice:X}=nM({wsUrl:o.wsUrl,deviceToken:o.token,adminToken:T,relayOrigin:h,refreshInterval:m,t:u}),ie=de=>{de.preventDefault();const we=w.trim();r({adminToken:we,adminTokens:{...o.adminTokens||{},[h]:we}}),M(we),R(!!we)},ue=tM($,O,o.wsUrl),U=O?[{id:"overview",label:u("admin.tabOverview"),index:1},{id:"clients",label:u("admin.tabClients",{count:((ve=O.clients)==null?void 0:ve.length)||0}),index:2},{id:"ptys",label:u("admin.tabPtys",{count:((me=O.ptys)==null?void 0:me.length)||0}),index:3},...O.devices?[{id:"devices",label:u("admin.tabDevices",{count:O.devices.length}),index:4}]:[]]:[],E=U.map(de=>de.id).join("|");C.useEffect(()=>{const de=E?E.split("|"):[],we=se=>{if(se.ctrlKey||se.altKey||se.metaKey)return;const Se=se.target;if(Se instanceof HTMLInputElement||Se instanceof HTMLTextAreaElement||Se instanceof HTMLSelectElement||Se!=null&&Se.isContentEditable||document.querySelector('[role="dialog"]'))return;if(se.key==="Escape"&&l){se.preventDefault(),l();return}if(se.key.toLowerCase()==="r"){se.preventDefault(),V();return}const ae=Number.parseInt(se.key,10)-1;Number.isInteger(ae)&&ae>=0&&ae<de.length&&(se.preventDefault(),v(de[ae]))};return window.addEventListener("keydown",we),()=>window.removeEventListener("keydown",we)},[V,l,E]);const G=($==null?void 0:$.version)||(O==null?void 0:O.version)||"0.1.0",P=a&&l?f.jsx(Me,{variant:"ghost",onClick:l,title:u("admin.returnToTerminal"),"aria-label":u("admin.returnToTerminal"),glyph:ke.arrowLeft,brackets:!1,className:Ju,children:f.jsx("span",{className:"sr-only",children:u("admin.returnToTerminal")})}):null,le=f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:"hidden items-center gap-1.5 whitespace-nowrap text-tui-sm sm:flex",children:[f.jsxs("span",{className:"text-tui-faint",children:["v",G]}),f.jsx(kd,{}),f.jsx("span",{className:z?"text-tui-alt":"text-tui-ok",children:u(z?"admin.modeRemote":"admin.localWorkstationBadge")})]}),O?f.jsxs(f.Fragment,{children:[f.jsxs("label",{className:"hidden items-center gap-1.5 text-tui-sm text-tui-muted md:flex",children:[f.jsx("span",{children:u("admin.autoRefresh")}),f.jsxs(dr,{value:m,onChange:de=>g(Number(de.target.value)),"aria-label":u("admin.autoRefresh"),className:ne("w-auto",Ju),children:[f.jsx("option",{value:0,children:u("admin.paused")}),f.jsx("option",{value:1e3,children:"1s"}),f.jsx("option",{value:3e3,children:"3s"}),f.jsx("option",{value:5e3,children:"5s"}),f.jsx("option",{value:1e4,children:"10s"})]})]}),f.jsx(Me,{variant:"primary",onClick:V,disabled:L,title:u("admin.refreshNow"),className:Ju,children:L?f.jsx(nl,{}):u("admin.refreshNow")})]}):null]}),Q=_&&z&&!A&&!k,xe=_&&z&&(A||k)&&!O;return f.jsxs(wS,{tabs:U,activeTabId:b,onSelectTab:de=>v(de),tabsAriaLabel:u("header.mainNavigationAria"),toolbarStart:P,toolbarAside:le,hints:[...O?[{keys:"1–4",action:u("admin.hintTabs")},{keys:"r",action:u("admin.hintRefresh")}]:[],...l?[{keys:"esc",action:u("admin.hintBack")}]:[]],footerAside:J?f.jsx("span",{className:"text-tui-faint",children:u("admin.updatedAt",{time:J.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!_&&f.jsx("div",{className:"flex items-center justify-center gap-2 border border-tui-border bg-tui-base px-3 py-8 text-tui text-tui-muted",children:f.jsx(nl,{label:u("admin.loadingStatus")})}),Q&&f.jsx(F5,{wsUrl:o.wsUrl,adminUrl:ue,onOpenRemoteAdmin:()=>window.open(ue,"_blank","noopener,noreferrer"),onSignIn:()=>R(!0)}),xe&&f.jsx(G5,{adminConfigured:$==null?void 0:$.adminConfigured,isAuthError:K,tokenInput:w,onTokenInput:x,onSubmit:ie,isSameOriginRelay:k,onBackToTerminal:l,showBack:a,onCancel:()=>R(!1)}),_&&!z&&K&&f.jsx(Y5,{onOpenPairing:i,onRetry:V}),_&&D&&!K&&f.jsx(Ti,{tone:"warn",action:f.jsx(Me,{variant:"warn",onClick:V,children:u("common.retry")}),children:u("admin.errorConnecting",{error:D})}),O&&f.jsxs(f.Fragment,{children:[b==="overview"&&f.jsx(Z5,{data:O}),b==="clients"&&f.jsx(V5,{clients:O.clients||[]}),b==="ptys"&&f.jsx(W5,{ptys:O.ptys||[]}),b==="devices"&&f.jsx(P5,{devices:O.devices||[],clients:O.clients||[],onRevoke:X})]})]})},lM=({compact:l=!1})=>{const{t:i}=Le(),{role:a,connectionState:o,sharedWindowCount:r,assignedClientId:u}=et();if(!(o==="connected"))return f.jsxs("div",{className:"inline-flex select-none items-center gap-1.5 text-tui uppercase text-tui-faint",role:"status","aria-label":i("terminal.offlineStatusAria"),children:[f.jsx(Bt,{level:"idle"}),f.jsx("span",{children:i("common.offline")})]});const p=a==="controller",m=r>1,g=f.jsxs("div",{className:ne("inline-flex min-w-0 select-none items-center gap-1.5 text-tui uppercase",p?"text-tui-ok":"text-tui-warn"),role:"status","aria-label":i(p?"role.controllerMode":"role.viewerMode"),children:[f.jsx(Bt,{level:p?"ok":"warn"}),f.jsx("span",{className:"truncate",children:i(p?"role.sharedControl":"role.viewerReadOnly")}),m?f.jsx("span",{className:"shrink-0 normal-case text-tui-muted",children:i("role.sharedWindows",{count:r})}):null]});return l?g:f.jsxs("div",{className:"flex w-full flex-col gap-1",children:[g,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:i("role.sharedControlDesc")}),u?f.jsx(Si,{label:i("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:f.jsx("span",{className:"truncate text-tui-muted",children:u})}):null]})},Qo="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Zo="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",aM="border-tui-accent bg-tui-selection text-tui-accent",Wo=({active:l=!1})=>f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",l?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:ke.cursor}),sM=({onClose:l,onOpenPairing:i,onOpenSettings:a,onAddProfile:o=()=>{}})=>{const{settings:r,updateSettings:u,language:h,setLanguage:p,t:m}=Le(),{connectionState:g,stateDetail:b,rttMs:v,hostId:w,connect:x}=et(),{addToast:T}=rn(),{copied:M,copy:A}=mr(),R=M!==null,k=pr(g,m),O=z=>()=>{var D;const L=document.activeElement;(D=L==null?void 0:L.blur)==null||D.call(L),z()},$=()=>A(r.clientId,m("toasts.clientIdCopied",{id:r.clientId}),"info"),_=()=>{const z=h==="zh"?"en":"zh";p(z),T("info",wd(z,"toasts.switchedLanguage",{lang:z==="zh"?"简体中文":"English"}))};return f.jsxs("div",{className:"flex flex-col gap-3 px-3 pb-2 pt-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border pb-1.5",children:[f.jsx("h2",{className:"text-tui font-bold uppercase text-tui-accent",children:m("mobile.sessionControls")}),f.jsx(Me,{variant:"ghost",onClick:l,"aria-label":m("mobile.closeSessionControls"),children:"esc"})]}),f.jsx(Tt,{title:m("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:f.jsx(Hd,{mobile:!0,onAddProfile:o})}),f.jsxs(Tt,{title:m("common.status"),tone:k.level==="ok"?"ok":k.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(Bt,{level:k.level}),f.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:k.label}),g==="connected"&&v!==null&&f.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[v,"ms"]})]}),k.actionLabel&&f.jsx(Me,{variant:"primary",onClick:()=>x(),className:"shrink-0",children:k.actionLabel})]}),k.needsAttention&&b&&f.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:b}),w&&f.jsx(Si,{label:m("common.host"),labelWidth:9,children:w}),f.jsxs("button",{type:"button",onClick:$,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:m("header.copyClientIdTitle"),children:[f.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:m("header.clientIdLabel")}),f.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:r.clientId}),f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",R?"text-tui-ok":"text-tui-faint"),children:R?ke.check:"⧉"})]})]}),f.jsx(Tt,{title:m("mobile.inputControl"),tone:"accent","aria-label":m("mobile.terminalControlAria"),children:f.jsx(lM,{})}),f.jsxs(Tt,{title:m("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[f.jsxs("button",{type:"button",onClick:_,className:ne(Qo,Zo),"aria-label":m("header.languageToggleTitle"),children:[f.jsx(Wo,{}),f.jsx("span",{className:"truncate",children:h==="zh"?"English":"中文"})]}),f.jsxs("button",{type:"button",onClick:O(a),className:ne(Qo,Zo),"aria-label":m("mobile.settingsAria"),children:[f.jsx(Wo,{}),f.jsx("span",{className:"truncate",children:m("common.settings")})]}),f.jsxs("button",{type:"button",onClick:O(i),className:ne(Qo,Zo),"aria-label":m("mobile.pairingAria"),children:[f.jsx(Wo,{}),f.jsx("span",{className:"truncate",children:m("common.pairing")})]}),f.jsxs("button",{type:"button",onClick:()=>u({toolbarVisible:!r.toolbarVisible}),className:ne(Qo,r.toolbarVisible?aM:Zo),"aria-label":m("mobile.keybarAria"),"aria-pressed":r.toolbarVisible,children:[f.jsx(Wo,{active:r.toolbarVisible}),f.jsx("span",{className:"truncate",children:m("common.keyBar")}),f.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:r.toolbarVisible?"[x]":"[ ]"})]})]})]})},oM=({onAddProfile:l})=>{const{t:i}=Le(),{rttMs:a}=et();return f.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":i("mobile.statusBarAria"),className:"absolute inset-x-0 bottom-0 z-40 flex h-11 shrink-0 items-center gap-2 border-t border-tui-border bg-tui-mantle px-1 text-tui-sm",children:[f.jsx(Hd,{statusBar:!0,onAddProfile:l}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),f.jsx(Uy,{compact:!0}),f.jsx(Iy,{compact:!0}),f.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:i("header.latencyTitle"),children:[f.jsx("span",{className:"text-tui-faint",children:"RTT"}),f.jsx("span",{className:ne(a===null?"text-tui-faint":"text-tui-text"),children:a===null?"—":`${a}ms`})]})]})},rM=({onOpenPairing:l,onOpenSettings:i,onAddProfile:a=()=>{}})=>{const{t:o}=Le(),{connectionState:r,isController:u}=et(),[h,p]=C.useState(!1),m=C.useRef(null),g=C.useCallback(()=>p(!1),[]);C.useEffect(()=>{if(!h)return;const v=w=>{if(!(w.ctrlKey||w.altKey||w.metaKey)&&w.key==="Escape"){const x=w.target;x&&typeof x.closest=="function"&&!!x.closest("#terminal-container")||(w.stopPropagation(),w.preventDefault(),g())}};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[h,g]),C.useEffect(()=>{var v;h&&((v=m.current)==null||v.focus({preventScroll:!0}))},[h]);const b=pr(r,o);return f.jsxs(f.Fragment,{children:[f.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":o("mobile.sessionControls"),className:"pointer-events-none absolute inset-x-0 top-0 z-40 flex h-12 items-center justify-between gap-2 border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-sm text-tui-muted",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:"herdr"}),f.jsx(kd,{className:"shrink-0"}),f.jsx(Bt,{level:b.level}),f.jsx("span",{className:"truncate uppercase",children:b.label})]}),f.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>p(!0),"aria-label":o("mobile.sessionControls"),"aria-expanded":h,"aria-haspopup":"dialog",className:ne("tui-focusable pointer-events-auto flex h-9 shrink-0 select-none items-center gap-1.5 border px-2 text-tui uppercase transition-colors",b.needsAttention?"border-tui-warn text-tui-warn":u?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!u&&!b.needsAttention&&f.jsx("span",{className:"max-w-[8rem] truncate",children:o("common.viewer")}),f.jsx("span",{"aria-hidden":"true",className:"text-tui",children:ke.chevronDown}),f.jsx("span",{"aria-hidden":"true",children:o("mobile.menu")})]})]}),h&&f.jsxs(f.Fragment,{children:[f.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:g,"aria-hidden":"true"}),f.jsx("div",{ref:m,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":o("mobile.sessionControls"),tabIndex:-1,className:"herdr-sheet absolute inset-x-0 bottom-0 z-50 max-h-[85%] overflow-y-auto border-t border-tui-border bg-tui-base pb-3 focus:outline-none",children:f.jsx(sM,{onClose:g,onOpenPairing:()=>{g(),l()},onOpenSettings:()=>{g(),i()},onAddProfile:()=>{g(),a()}})})]}),f.jsx(oM,{onAddProfile:a})]})},cM=()=>{const{activeProfile:l,t:i}=Le(),{herdrLaunch:a,startHerdr:o,hostname:r}=et();if(!a)return null;const u=r||(l==null?void 0:l.displayName)||i("herdrLaunch.thisHost"),h=a.phase==="failed";return f.jsx("div",{"data-testid":"herdr-start-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:f.jsx(Tt,{title:i(h?"herdrLaunch.failedTitle":"herdrLaunch.title"),tone:h?"bad":"warn",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":i("herdrLaunch.title"),children:a.phase==="starting"?f.jsxs("p",{className:"flex items-center gap-2 text-tui-text",role:"status",children:[f.jsx(nl,{}),f.jsx("span",{children:i("herdrLaunch.starting",{host:u})})]}):f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:i("herdrLaunch.body",{host:u})}),h&&a.message?f.jsx(Ti,{tone:"bad",children:f.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap break-words font-mono text-tui-sm",children:a.message})}):null,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:i("herdrLaunch.scope")}),f.jsx("div",{className:"flex justify-end",children:f.jsx(Me,{variant:"primary",onClick:o,autoFocus:!0,children:i(h?"common.retry":"herdrLaunch.start")})})]})})})},Gy="--app-height",Yy="--keyboard-inset",uM=80;function dM(){if(typeof window>"u")return{height:768,keyboardInset:0};const l=window.innerHeight||768,i=window.visualViewport;if(i&&typeof i.height=="number"&&i.height>0){const a=l-i.height-(i.offsetTop||0),o=a>=uM?Math.round(a):0;return{height:Math.round(i.height),keyboardInset:o}}return{height:l,keyboardInset:0}}function tb(l,i=dM()){return l.style.setProperty(Gy,`${i.height}px`),l.style.setProperty(Yy,`${i.keyboardInset}px`),i}function fM(l=typeof document<"u"?document.documentElement:null){if(!l||typeof window>"u")return()=>{};let i=null;const a=()=>{i=null,tb(l)},o=()=>{if(i===null){if(typeof requestAnimationFrame!="function"){a();return}i=requestAnimationFrame(a)}};tb(l);const r=window.visualViewport;return r==null||r.addEventListener("resize",o),r==null||r.addEventListener("scroll",o),window.addEventListener("resize",o),window.addEventListener("orientationchange",o),()=>{i!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(i),i=null),r==null||r.removeEventListener("resize",o),r==null||r.removeEventListener("scroll",o),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),l.style.removeProperty(Gy),l.style.removeProperty(Yy)}}const hM=900;function nb(){if(typeof window>"u")return!1;const l=Zl();return l<Cd?!0:l<=hM}function mM(){const[l,i]=C.useState(nb);return C.useEffect(()=>{var r,u;const a=()=>{const h=nb();i(p=>p===h?p:h)};a();let o=null;try{o=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{o=null}return(r=o==null?void 0:o.addEventListener)==null||r.call(o,"change",a),window.addEventListener("resize",a),window.addEventListener("orientationchange",a),(u=window.visualViewport)==null||u.addEventListener("resize",a),()=>{var h,p;(h=o==null?void 0:o.removeEventListener)==null||h.call(o,"change",a),window.removeEventListener("resize",a),window.removeEventListener("orientationchange",a),(p=window.visualViewport)==null||p.removeEventListener("resize",a)}},[]),l}function pM(l){const i=l.target;if(!i)return!1;if(i.id==="terminal-container"||i.id==="terminal-frame"||i.id==="terminal-surface"||i.classList.contains("xterm-helper-textarea")||i.classList.contains("xterm")||i.closest("#terminal-container")||i.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const a=document.activeElement;if(a.id==="terminal-container"||a.classList.contains("xterm-helper-textarea")||a.closest("#terminal-container")||a.closest(".xterm"))return!0}return!1}function gM(l,i={}){if(typeof window>"u")return()=>{};const a=o=>{var r;o.ctrlKey||o.altKey||o.metaKey||o.key==="Escape"&&(i.isModalOpen||i.isSheetOpen)&&(pM(o)||(o.preventDefault(),o.stopPropagation(),(r=l.onCloseModals)==null||r.call(l)))};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}}function bM(){const[l,i]=C.useState("terminal"),[a,o]=C.useState(!1),[r,u]=C.useState(!1),[h,p]=C.useState(!1),[m,g]=C.useState(void 0),b=U=>{g(U),p(!0)},[v,w]=C.useState(!1),{updateSettings:x,addProfileAndConnect:T,settings:M}=Le(),{connectionState:A,stateDetail:R,stateCode:k,lastPairedAt:O}=et();S1();const $=mM();C.useEffect(()=>fM(),[]),C.useEffect(()=>{bb()},[]),C.useEffect(()=>{const U=a||h||v;if(U)return gM({onCloseModals:()=>{o(!1),p(!1),w(!1)}},{isModalOpen:U})},[a,h,v]),C.useEffect(()=>{var E;const U=()=>{const G=window.location.pathname,P=window.location.hash;i(G==="/admin"||P==="#admin"?"admin":"terminal")};U(),window.addEventListener("popstate",U),window.addEventListener("hashchange",U);try{const G=new URL(window.location.href),P=(E=G.searchParams.get("pairCode"))==null?void 0:E.toUpperCase();P&&Ad().token?T({wsUrl:on,pairCode:P}):P&&x({pairCode:P});let le=!1;if(G.searchParams.has("token")&&(G.searchParams.delete("token"),le=!0),G.searchParams.has("pairCode")&&(G.searchParams.delete("pairCode"),le=!0),le){const Q=G.searchParams.toString(),xe=G.pathname+(Q?`?${Q}`:"")+G.hash;window.history.replaceState({},"",xe)}}catch(G){console.warn("Failed to parse URL query params:",G)}return()=>{window.removeEventListener("popstate",U),window.removeEventListener("hashchange",U)}},[x,T]);const _=(U=!1)=>{u(U),o(!0)},z=()=>{o(!1),u(!1)},L=U=>{i(U),U==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},D=!M.token&&!M.pairCode&&A!=="connected",K=A==="error"&&(["auth_required","unauthorized","device_revoked"].includes(k||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(R||"")),J=D||K,[V,X]=C.useState(!J);C.useEffect(()=>{J||X(!0)},[J]),C.useEffect(()=>{O&&(o(!1),X(!0),i("terminal"))},[O]);const ie=l==="terminal"&&!J,ue=U=>({visibility:U?"visible":"hidden",opacity:U?1:0,pointerEvents:U?"auto":"none",zIndex:U?1:0});return f.jsxs("div",{"data-testid":"app-shell",style:$?{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:U=>{U.preventDefault(),U.stopPropagation()},children:[!$&&f.jsx(CS,{currentView:l,onNavigate:L,onOpenPairing:()=>_(!1),onOpenSettings:()=>b(),onToggleVirtualKeyboard:()=>w(!v),isVirtualKeyboardOpen:v}),!$&&!J&&f.jsx(TS,{}),f.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[V&&f.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${$?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:ue(ie),"aria-hidden":!ie,children:[f.jsx(c5,{isActive:ie}),!$&&f.jsx(M5,{isOpen:v,onClose:()=>w(!1)}),f.jsx(C5,{compact:$,onCustomize:()=>b("agentKeymaps")}),f.jsx(cM,{}),f.jsx(_5,{})]}),l==="terminal"&&J&&f.jsx("div",{"data-testid":"onboarding-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-10",children:f.jsx(d5,{onPairedSuccess:()=>{}})}),l==="admin"&&f.jsx("div",{"data-testid":"admin-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-20",children:f.jsx(iM,{onBackToTerminal:()=>L("terminal"),onOpenPairing:()=>_(!1),showBack:$})}),$&&ie&&f.jsx(rM,{onOpenPairing:()=>_(!1),onOpenSettings:()=>b(),onAddProfile:()=>_(!0)})]}),!$&&l!=="admin"&&f.jsx(I5,{onAddProfile:()=>_(!0)}),f.jsx(E5,{isOpen:a,isAddMode:r,onClose:z}),f.jsx(D5,{isOpen:h,initialTab:m,onClose:()=>p(!1),onOpenAdmin:()=>{p(!1),L("admin")}}),f.jsx(B5,{})]})}function yM(){return f.jsx(u1,{children:f.jsx(bM,{})})}const $y=document.getElementById("root");if(!$y)throw new Error("Root element not found");gx.createRoot($y).render(f.jsx(qn.StrictMode,{children:f.jsx(yM,{})}));
61
+ */function Kg(l){if(!l)throw new Error("value must not be falsy");return l}const yT={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},vT={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},xT={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(l,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"║":{1:(l,i)=>`M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╒":{1:(l,i)=>`M.5,1 L.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╓":{1:(l,i)=>`M${.5-l},1 L${.5-l},.5 L1,.5 M${.5+l},.5 L${.5+l},1`},"╔":{1:(l,i)=>`M1,${.5-i} L${.5-l},${.5-i} L${.5-l},1 M1,${.5+i} L${.5+l},${.5+i} L${.5+l},1`},"╕":{1:(l,i)=>`M0,${.5-i} L.5,${.5-i} L.5,1 M0,${.5+i} L.5,${.5+i}`},"╖":{1:(l,i)=>`M${.5+l},1 L${.5+l},.5 L0,.5 M${.5-l},.5 L${.5-l},1`},"╗":{1:(l,i)=>`M0,${.5+i} L${.5-l},${.5+i} L${.5-l},1 M0,${.5-i} L${.5+l},${.5-i} L${.5+l},1`},"╘":{1:(l,i)=>`M.5,0 L.5,${.5+i} L1,${.5+i} M.5,${.5-i} L1,${.5-i}`},"╙":{1:(l,i)=>`M1,.5 L${.5-l},.5 L${.5-l},0 M${.5+l},.5 L${.5+l},0`},"╚":{1:(l,i)=>`M1,${.5-i} L${.5+l},${.5-i} L${.5+l},0 M1,${.5+i} L${.5-l},${.5+i} L${.5-l},0`},"╛":{1:(l,i)=>`M0,${.5+i} L.5,${.5+i} L.5,0 M0,${.5-i} L.5,${.5-i}`},"╜":{1:(l,i)=>`M0,.5 L${.5+l},.5 L${.5+l},0 M${.5-l},.5 L${.5-l},0`},"╝":{1:(l,i)=>`M0,${.5-i} L${.5-l},${.5-i} L${.5-l},0 M0,${.5+i} L${.5+l},${.5+i} L${.5+l},0`},"╞":{1:(l,i)=>`M.5,0 L.5,1 M.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╟":{1:(l,i)=>`M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1 M${.5+l},.5 L1,.5`},"╠":{1:(l,i)=>`M${.5-l},0 L${.5-l},1 M1,${.5+i} L${.5+l},${.5+i} L${.5+l},1 M1,${.5-i} L${.5+l},${.5-i} L${.5+l},0`},"╡":{1:(l,i)=>`M.5,0 L.5,1 M0,${.5-i} L.5,${.5-i} M0,${.5+i} L.5,${.5+i}`},"╢":{1:(l,i)=>`M0,.5 L${.5-l},.5 M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╣":{1:(l,i)=>`M${.5+l},0 L${.5+l},1 M0,${.5+i} L${.5-l},${.5+i} L${.5-l},1 M0,${.5-i} L${.5-l},${.5-i} L${.5-l},0`},"╤":{1:(l,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i} M.5,${.5+i} L.5,1`},"╥":{1:(l,i)=>`M0,.5 L1,.5 M${.5-l},.5 L${.5-l},1 M${.5+l},.5 L${.5+l},1`},"╦":{1:(l,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L${.5-l},${.5+i} L${.5-l},1 M1,${.5+i} L${.5+l},${.5+i} L${.5+l},1`},"╧":{1:(l,i)=>`M.5,0 L.5,${.5-i} M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╨":{1:(l,i)=>`M0,.5 L1,.5 M${.5-l},.5 L${.5-l},0 M${.5+l},.5 L${.5+l},0`},"╩":{1:(l,i)=>`M0,${.5+i} L1,${.5+i} M0,${.5-i} L${.5-l},${.5-i} L${.5-l},0 M1,${.5-i} L${.5+l},${.5-i} L${.5+l},0`},"╪":{1:(l,i)=>`M.5,0 L.5,1 M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╫":{1:(l,i)=>`M0,.5 L1,.5 M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╬":{1:(l,i)=>`M0,${.5+i} L${.5-l},${.5+i} L${.5-l},1 M1,${.5+i} L${.5+l},${.5+i} L${.5+l},1 M0,${.5-i} L${.5-l},${.5-i} L${.5-l},0 M1,${.5-i} L${.5+l},${.5-i} L${.5+l},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(l,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,1,.5`},"╮":{1:(l,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,0,.5`},"╯":{1:(l,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,0,.5`},"╰":{1:(l,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,1,.5`}},us={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};us[""]=us[""];us[""]=us[""];function wT(l,i,a,o,r,u,h,p){const m=yT[i];if(m)return ST(l,m,a,o,r,u),!0;const g=vT[i];if(g)return CT(l,g,a,o,r,u),!0;const b=xT[i];if(b)return TT(l,b,a,o,r,u,p),!0;const v=us[i];return v?(MT(l,v,a,o,r,u,h,p),!0):!1}function ST(l,i,a,o,r,u){for(let h=0;h<i.length;h++){const p=i[h],m=r/8,g=u/8;l.fillRect(a+p.x*m,o+p.y*g,p.w*m,p.h*g)}}const Ig=new Map;function CT(l,i,a,o,r,u){let h=Ig.get(i);h||(h=new Map,Ig.set(i,h));const p=l.fillStyle;if(typeof p!="string")throw new Error(`Unexpected fillStyle type "${p}"`);let m=h.get(p);if(!m){const g=i[0].length,b=i.length,v=l.canvas.ownerDocument.createElement("canvas");v.width=g,v.height=b;const w=Kg(v.getContext("2d")),x=new ImageData(g,b);let T,M,A,R;if(p.startsWith("#"))T=parseInt(p.slice(1,3),16),M=parseInt(p.slice(3,5),16),A=parseInt(p.slice(5,7),16),R=p.length>7&&parseInt(p.slice(7,9),16)||1;else if(p.startsWith("rgba"))[T,M,A,R]=p.substring(5,p.length-1).split(",").map(k=>parseFloat(k));else throw new Error(`Unexpected fillStyle color format "${p}" when drawing pattern glyph`);for(let k=0;k<b;k++)for(let O=0;O<g;O++)x.data[(k*g+O)*4]=T,x.data[(k*g+O)*4+1]=M,x.data[(k*g+O)*4+2]=A,x.data[(k*g+O)*4+3]=i[k][O]*(R*255);w.putImageData(x,0,0),m=Kg(l.createPattern(v,null)),h.set(p,m)}l.fillStyle=m,l.fillRect(a,o,r,u)}function TT(l,i,a,o,r,u,h){l.strokeStyle=l.fillStyle;for(const[p,m]of Object.entries(i)){l.beginPath(),l.lineWidth=h*Number.parseInt(p,10);let g;if(typeof m=="function"){const v=.15/u*r;g=m(.15,v)}else g=m;for(const b of g.split(" ")){const v=b[0],w=Ey[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}const x=b.substring(1).split(",");!x[0]||!x[1]||w(l,Ny(x,r,u,a,o,!0,h))}l.stroke(),l.closePath()}}function MT(l,i,a,o,r,u,h,p){const m=new Path2D;m.rect(a,o,r,u),l.clip(m),l.beginPath();const g=h/12;l.lineWidth=p*g;for(const b of i.d.split(" ")){const v=b[0],w=Ey[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}const x=b.substring(1).split(",");!x[0]||!x[1]||w(l,Ny(x,r,u,a,o,!1,p,(i.leftPadding??0)*(g/2),(i.rightPadding??0)*(g/2)))}i.type===1?(l.strokeStyle=l.fillStyle,l.stroke()):l.fill(),l.closePath()}function Fg(l,i,a=0){return Math.max(Math.min(l,i),a)}const Ey={C:(l,i)=>l.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5]),L:(l,i)=>l.lineTo(i[0],i[1]),M:(l,i)=>l.moveTo(i[0],i[1])};function Ny(l,i,a,o,r,u,h,p=0,m=0){const g=l.map(b=>parseFloat(b)||parseInt(b,10));if(g.length<2)throw new Error("Too few arguments for instruction");for(let b=0;b<g.length;b+=2)g[b]*=i-p*h-m*h,u&&g[b]!==0&&(g[b]=Fg(Math.round(g[b]+.5)-.5,i,0)),g[b]+=o+p*h;for(let b=1;b<g.length;b+=2)g[b]*=a,u&&g[b]!==0&&(g[b]=Fg(Math.round(g[b]+.5)-.5,a,0)),g[b]+=r;return g}const Hd=.5,AT=1024,ET=6;function NT(l){return/Firefox\//.test(l)||/Edge\/\d/.test(l)?"bottom":"ideographic"}class kT{constructor(i,a=typeof navigator<"u"?navigator.userAgent:""){W(this,"pages",[]);W(this,"slots",new Map);W(this,"inkCache",new Map);W(this,"metrics",null);W(this,"font",null);W(this,"baseline");W(this,"generation",0);W(this,"scratch");this.document=i,this.baseline=NT(a)}configure(i,a){const o=this.metrics&&this.font&&this.metrics.cellWidth===i.cellWidth&&this.metrics.cellHeight===i.cellHeight&&this.metrics.charWidth===i.charWidth&&this.metrics.charHeight===i.charHeight&&this.metrics.charLeft===i.charLeft&&this.metrics.charTop===i.charTop&&this.metrics.dpr===i.dpr&&this.font.fontFamily===a.fontFamily&&this.font.fontSize===a.fontSize&&this.font.fontWeight===a.fontWeight&&this.font.fontWeightBold===a.fontWeightBold&&this.font.customGlyphs===a.customGlyphs;this.metrics={...i},this.font={...a},o||this.clear()}clear(){this.slots.clear(),this.inkCache.clear();for(const i of this.pages)i.shelfX=0,i.shelfY=0;this.generation++}dispose(){this.slots.clear(),this.inkCache.clear();for(const i of this.pages)i.canvas.width=0,i.canvas.height=0;this.pages=[]}get pageCount(){return this.pages.length}fontString(i,a){const o=this.font,r=i?o.fontWeightBold:o.fontWeight;return`${a?"italic ":""}${r} ${o.fontSize*this.metrics.dpr}px ${o.fontFamily}`}overflow(i,a,o){if(!this.metrics||!this.font||i.length===1&&i.charCodeAt(0)<128)return 0;const r=`${a?1:0}${o?1:0}${i}`,u=this.inkCache.get(r);if(u!==void 0)return u;let h=0;const p=this.scratchContext();if(p&&!(this.font.customGlyphs&&ky(i))){p.font=this.fontString(a,o),p.textBaseline=this.baseline;const m=p.measureText(i),g=typeof m.actualBoundingBoxRight=="number"?m.actualBoundingBoxRight:m.width;h=Math.max(0,Math.ceil(this.metrics.charLeft+g-this.metrics.cellWidth))}return this.inkCache.set(r,h),h}get(i){const a=this.metrics,o=this.font;if(!a||!o||a.cellWidth<=0||a.cellHeight<=0)return null;const r=`${i.cells}${i.bold?1:0}${i.italic?1:0}${i.dim?1:0}${i.fg}\0${i.bg}\0${i.chars}`,u=this.slots.get(r);if(u)return u;const h=a.cellWidth*i.cells,p=a.cellHeight,m=this.allocate(h,p);if(!m)return null;const{page:g,x:b,y:v}=m,w=g.ctx;w.save(),w.beginPath(),w.rect(b,v,h,p),w.clip(),w.globalAlpha=1,w.fillStyle=i.bg,w.fillRect(b,v,h,p),w.fillStyle=i.fg,i.dim&&(w.globalAlpha=Hd);let x=!1;o.customGlyphs&&(x=wT(w,i.chars,b,v,a.cellWidth,a.cellHeight,o.fontSize,a.dpr)),x||(w.font=this.fontString(i.bold,i.italic),w.textBaseline=this.baseline,w.fillText(i.chars,b+a.charLeft,v+a.charTop+a.charHeight)),w.restore();const T={source:g.canvas,x:b,y:v,width:h,height:p};return this.slots.set(r,T),T}allocate(i,a){for(const o of this.pages){const r=this.fit(o,i,a);if(r)return r}if(this.pages.length<ET){const o=this.createPage(Math.max(AT,i,a));return o?(this.pages.push(o),this.fit(o,i,a)):null}return this.clear(),this.pages[0]?this.fit(this.pages[0],i,a):null}fit(i,a,o){if(i.shelfX+a>i.canvas.width&&(i.shelfX=0,i.shelfY+=o),i.shelfY+o>i.canvas.height||a>i.canvas.width)return null;const r={page:i,x:i.shelfX,y:i.shelfY};return i.shelfX+=a,r}createPage(i){const a=this.document.createElement("canvas");a.width=i,a.height=i;const o=a.getContext("2d",{alpha:!1});return o?{canvas:a,ctx:o,shelfX:0,shelfY:0}:null}scratchContext(){if(this.scratch===void 0){const i=this.document.createElement("canvas");i.width=1,i.height=1,this.scratch=i.getContext("2d")}return this.scratch}}function ky(l){if(l.length!==1)return!1;const i=l.charCodeAt(0);return i>=9472&&i<=9631||i>=57504&&i<=57558}function LT(l,i){return(l&(ut.UNDERLINE|ut.STRIKETHROUGH))!==0||(i&Ei.OVERLINE)!==0}function RT(l,i,{px:a,py:o,cells:r,fgWord:u,bgWord:h,ext:p,fgCss:m},{fontSize:g,dpr:b,colors:v,boldBright:w}){const x=(u&ut.UNDERLINE)!==0,T=(u&ut.STRIKETHROUGH)!==0,M=(h&Ei.OVERLINE)!==0,A=r*i.cell.width;l.save(),l.beginPath(),l.rect(a,o,A,i.cell.height),l.clip(),xd(h)&&(l.globalAlpha=Hd);const R=Math.max(1,Math.floor(g*b/15)),k=R%2===1?.5:0;if(x){const O=yC(p);let $=m;if(O){let L=O;w&&er(u)&&(L&50331648)!==50331648&&(L&255)<8&&(L+=8),$=Ay(L,v,m)}l.strokeStyle=$,l.lineWidth=R;const _=o+i.char.top+Math.ceil(i.char.height)-k-R*2,z=p?bC(p):Pl.SINGLE;switch(l.beginPath(),z){case Pl.DOUBLE:l.moveTo(a,_),l.lineTo(a+A,_),l.moveTo(a,_+R*2),l.lineTo(a+A,_+R*2);break;case Pl.CURLY:{const L=_+R,D=Math.max(1,R);for(let K=0;K<r;K++){const J=a+K*i.cell.width,V=J+i.cell.width/2,X=J+i.cell.width;l.moveTo(J,L),l.bezierCurveTo(J,L-D,V,L-D,V,L),l.bezierCurveTo(V,L+D,X,L+D,X,L)}break}case Pl.DOTTED:l.setLineDash([R,R]),l.moveTo(a,_),l.lineTo(a+A,_);break;case Pl.DASHED:{const L=Math.floor(.6*i.cell.width),D=Math.floor(.3*i.cell.width);l.setLineDash([L,D,i.cell.width-L-D]),l.moveTo(a,_),l.lineTo(a+A,_);break}default:l.moveTo(a,_),l.lineTo(a+A,_)}l.stroke(),l.setLineDash([])}if(M&&(l.strokeStyle=m,l.lineWidth=R,l.beginPath(),l.moveTo(a,o+i.char.top+k),l.lineTo(a+A,o+i.char.top+k),l.stroke()),T){const O=Math.max(1,Math.floor(g*b/10)),$=o+i.char.top+Math.floor(i.char.height/2)-(O%2===1?.5:0);l.strokeStyle=m,l.lineWidth=O,l.beginPath(),l.moveTo(a,$),l.lineTo(a+A,$),l.stroke()}l.restore()}const ns=4294967295,Pu=4,_T=3;class jT{constructor(i,a,o,r){W(this,"atlas");W(this,"cols",0);W(this,"rows",0);W(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});W(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});W(this,"work",gC());this.ctx=i,this.core=o,this.dimensions=r,this.atlas=new kT(a)}resize(i,a){this.cols=i,this.rows=a;const o=i*a;this.painted={content:new Uint32Array(o).fill(ns),fg:new Uint32Array(o),bg:new Uint32Array(o),ext:new Uint32Array(o),meta:new Uint32Array(o).fill(ns),combined:new Array(o).fill("")},this.row={content:new Uint32Array(i),fg:new Uint32Array(i),bg:new Uint32Array(i),ext:new Uint32Array(i),combined:new Array(i).fill("")}}invalidate(){this.painted.content.fill(ns),this.painted.meta.fill(ns)}hasPaintedInk(i,a){const o=this.dimensions.device;if(!o.cell.width||!o.cell.height)return!1;const r=Math.min(this.cols,Math.floor(i/o.cell.width)),u=Math.min(this.rows,Math.floor(a/o.cell.height)),h=this.painted;for(let p=0;p<u;p++)for(let m=0;m<r;m++){const g=p*this.cols+m,b=h.content[g];if(b===ns||h.meta[g]===Pu||Vo(h.fg[g]))continue;const v=b&ct.CODEPOINT_MASK;if(b&ct.IS_COMBINED_MASK?h.combined[g]!=="":v!==0&&v!==32)return!0}return!1}loadRow(i,a){const{content:o,fg:r,bg:u,ext:h,combined:p}=this.row,m=this.work;for(let g=0;g<this.cols;g++)i&&g<i.length?(i.loadCell(g,m),o[g]=m.content,r[g]=m.fg,u[g]=m.bg,h[g]=my(m),p[g]=m.content&ct.IS_COMBINED_MASK?m.combinedData:""):(o[g]=1<<ct.WIDTH_SHIFT,r[g]=0,u[g]=0,h[g]=0,p[g]="");if(a)for(const g of a){const b=g.col;if(b<0||b+g.width>this.cols)continue;b>0&&!(o[b]>>>ct.WIDTH_SHIFT)&&this.blankAt(b-1);const v=b+g.width;v<this.cols&&!(o[v]>>>ct.WIDTH_SHIFT)&&o[v-1]>>>ct.WIDTH_SHIFT===2&&this.blankAt(v);const w=vC(g.chars,g.width);o[b]=w.content,p[b]=w.combinedData,r[b]=g.style.fg,u[b]=g.style.bg,h[b]=g.style.ext,g.width===2&&(o[b+1]=0,p[b+1]="",r[b+1]=g.style.fg,u[b+1]=g.style.bg,h[b+1]=g.style.ext)}}blankAt(i){this.row.content[i]=32|1<<ct.WIDTH_SHIFT,this.row.combined[i]=""}paintRow(i,a){const o=this.cols,{content:r,fg:u,bg:h,ext:p,combined:m}=this.row,g=this.painted,b=i*o;let v=0,w=-1,x=-1,T="";const M=()=>{w<0||(this.fillCells(w,i,x-w,T),w=-1)};let A=0;for(;A<o;){let k=r[A]>>>ct.WIDTH_SHIFT;k===0&&(k=1),A+k>o&&(k=o-A),k===1&&A+1<o&&this.overflowsInto(A)&&(k=2);const O=a&&a.y===i&&a.x>=A&&a.x<A+k?a.shape:Xl.NONE,$=k|O<<_T;let _=this.differs(b+A,A,$);for(let z=1;z<k;z++)this.differs(b+A+z,A+z,Pu)&&(_=!0);if(_){for(let L=0;L<k;L++){const D=b+A+L;g.content[D]=r[A+L],g.fg[D]=u[A+L],g.bg[D]=h[A+L],g.ext[D]=p[A+L],g.meta[D]=L===0?$:Pu,g.combined[D]=m[A+L]}v+=k;const z=this.plainFill(A,O);z!==null?w>=0&&x===A&&T===z?x=A+k:(M(),w=A,x=A+k,T=z):(M(),this.paintCell(A,i,k,O))}A+=k}return M(),v}differs(i,a,o){const r=this.painted,u=this.row;return r.meta[i]!==o||r.content[i]!==u.content[a]||r.fg[i]!==u.fg[a]||r.bg[i]!==u.bg[a]||r.ext[i]!==u.ext[a]||r.combined[i]!==u.combined[a]}overflowsInto(i){const{content:a,fg:o,bg:r,ext:u}=this.row,h=a[i];if((h&ct.CODEPOINT_MASK)<128&&!(h&ct.IS_COMBINED_MASK)||h>>>ct.WIDTH_SHIFT!==1||Vo(o[i]))return!1;const m=a[i+1],g=m&ct.CODEPOINT_MASK;if(m>>>ct.WIDTH_SHIFT!==1||m&ct.IS_COMBINED_MASK||g!==0&&g!==32||r[i]!==r[i+1]||u[i+1]!==0||(o[i]&ut.INVERSE)!==(o[i+1]&ut.INVERSE)||o[i]&ut.INVERSE&&o[i]!==o[i+1]||o[i+1]&(ut.UNDERLINE|ut.STRIKETHROUGH)||r[i+1]&Ei.OVERLINE)return!1;const b=this.charsAt(i);return this.core.optionsService.rawOptions.customGlyphs!==!1&&ky(b)?!1:this.atlas.overflow(b,er(o[i]),Vu(r[i]))>0}charsAt(i){const a=this.row.content[i];if(a&ct.IS_COMBINED_MASK)return this.row.combined[i];const o=a&ct.CODEPOINT_MASK;return o?String.fromCodePoint(o):""}plainFill(i,a){if(a!==Xl.NONE)return null;const{content:o,fg:r,bg:u}=this.row,h=o[i],p=h&ct.CODEPOINT_MASK,m=!(h&ct.IS_COMBINED_MASK)&&(p===0||p===32),g=Vo(r[i]);return!m&&!g||(r[i]&(ut.UNDERLINE|ut.STRIKETHROUGH)||u[i]&Ei.OVERLINE)&&!g?null:Bg(r[i],u[i],this.colors(),this.boldBright()).bg}paintCell(i,a,o,r){const u=this.ctx,h=this.dimensions.device,p=this.colors(),m=this.row.fg[i],g=this.row.bg[i],b=this.row.ext[i],v=Bg(m,g,p,this.boldBright());let w=v.fg,x=v.bg;r===Xl.BLOCK&&(x=p.cursor.css,w=p.cursorAccent.css);const T=Vo(m),M=this.charsAt(i),A=i*h.cell.width,R=a*h.cell.height,k=o*h.cell.width,O=h.cell.height,$=T||M===""||M===" ",_=$?null:this.atlas.get({chars:M,bold:er(m),italic:Vu(g),dim:xd(g),fg:w,bg:x,cells:o});_?u.drawImage(_.source,_.x,_.y,_.width,_.height,A,R,k,O):(u.fillStyle=x,u.fillRect(A,R,k,O),$||(u.save(),u.beginPath(),u.rect(A,R,k,O),u.clip(),u.fillStyle=w,xd(g)&&(u.globalAlpha=Hd),u.font=this.atlas.fontString(er(m),Vu(g)),u.fillText(M,A+h.char.left,R+h.char.top+h.char.height),u.restore())),!T&&LT(m,g)&&RT(u,h,{px:A,py:R,cells:o,fgWord:m,bgWord:g,ext:b,fgCss:w},{fontSize:this.core.optionsService.rawOptions.fontSize,dpr:this.core._coreBrowserService.dpr,colors:p,boldBright:this.boldBright()}),r!==Xl.NONE&&r!==Xl.BLOCK&&pT(u,h,A,R,k,r,{css:p.cursor.css,dpr:this.core._coreBrowserService.dpr,cursorWidth:this.core.optionsService.rawOptions.cursorWidth})}fillCells(i,a,o,r){const u=this.dimensions.device;this.ctx.fillStyle=r,this.ctx.fillRect(i*u.cell.width,a*u.cell.height,o*u.cell.width,u.cell.height)}fillBackground(){this.ctx.fillStyle=this.colors().background.css,this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)}configureAtlas(){const i=this.dimensions.device,a=this.core.optionsService.rawOptions;this.atlas.configure({cellWidth:i.cell.width,cellHeight:i.cell.height,charWidth:i.char.width,charHeight:i.char.height,charLeft:i.char.left,charTop:i.char.top,dpr:this.core._coreBrowserService.dpr},{fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,customGlyphs:a.customGlyphs!==!1})}colors(){return this.core._themeService.colors}boldBright(){return this.core.optionsService.rawOptions.drawBoldTextInBrightColors!==!1}}class OT{constructor(i){W(this,"canvas");W(this,"ctx");W(this,"selection",null);W(this,"link",null);this.canvas=i.createElement("canvas"),this.canvas.classList.add("xterm-decor-layer"),this.canvas.style.zIndex="2";const a=this.canvas.getContext("2d");if(!a)throw new Error("2D canvas unavailable");this.ctx=a}setSelection(i,a,o){this.selection=i&&a&&!(i[0]===a[0]&&i[1]===a[1])?{start:[i[0],i[1]],end:[a[0],a[1]],columnSelectMode:o}:null}paint({dims:i,rows:a,cols:o,ydisp:r,colors:u,focused:h,dpr:p}){var w;const m=this.ctx;if(m.clearRect(0,0,this.canvas.width,this.canvas.height),!i.cell.width||!a)return;const{selection:g,link:b}=this,v=(x,T,M,A)=>m.fillRect(x*i.cell.width,T*i.cell.height,M*i.cell.width,A*i.cell.height);if(g){const x=g.start[1]-r,T=g.end[1]-r,M=Math.max(x,0),A=Math.min(T,a-1);if(M<a&&A>=0)if(m.fillStyle=(h?u.selectionBackgroundTransparent:u.selectionInactiveBackgroundTransparent).css,g.columnSelectMode)v(g.start[0],M,g.end[0]-g.start[0],A-M+1);else{const R=x===M?g.start[0]:0,k=M===T?g.end[0]:o;v(R,M,k-R,1),v(0,M+1,o,Math.max(A-M-1,0)),M!==A&&v(0,A,T===A?g.end[0]:o,1)}}if(b){m.fillStyle=b.fg===257?u.background.css:b.fg!==void 0&&b.fg<256?((w=u.ansi[b.fg])==null?void 0:w.css)??u.foreground.css:u.foreground.css;const x=(T,M,A)=>m.fillRect(T*i.cell.width,(M+1)*i.cell.height-p-1,A*i.cell.width,p);if(b.y1===b.y2)x(b.x1,b.y1,b.x2-b.x1);else{x(b.x1,b.y1,b.cols-b.x1);for(let T=b.y1+1;T<b.y2;T++)x(0,T,b.cols);x(0,b.y2,b.x2)}}}}function DT(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}function zT(l,i,a,o){const r=i._charSizeService;if(!r.hasValidSize)return!1;const u=i._coreBrowserService.dpr,h=i.optionsService.rawOptions;return l.device.char.width=Math.floor(r.width*u),l.device.char.height=Math.ceil(r.height*u),l.device.cell.height=Math.floor(l.device.char.height*h.lineHeight),l.device.char.top=h.lineHeight===1?0:Math.round((l.device.cell.height-l.device.char.height)/2),l.device.cell.width=l.device.char.width+Math.round(h.letterSpacing),l.device.char.left=Math.floor(h.letterSpacing/2),l.device.canvas.height=o*l.device.cell.height,l.device.canvas.width=a*l.device.cell.width,l.css.canvas.height=Math.round(l.device.canvas.height/u),l.css.canvas.width=Math.round(l.device.canvas.width/u),l.css.cell.height=l.css.canvas.height/o,l.css.cell.width=l.css.canvas.width/a,!0}function HT(l,i,a){if(!l||typeof l.ResizeObserver!="function")return null;let o=new l.ResizeObserver(r=>{var m;const u=r.find(g=>g.target===i);if(!u)return;if(!("devicePixelContentBoxSize"in u)||!((m=u.devicePixelContentBoxSize)!=null&&m[0])){o==null||o.disconnect(),o=null;return}const h=u.devicePixelContentBoxSize[0].inlineSize,p=u.devicePixelContentBoxSize[0].blockSize;h<=0||p<=0||h===i.width&&p===i.height||a(h,p)});try{o.observe(i,{box:"device-pixel-content-box"})}catch{o.disconnect(),o=null}return{dispose:()=>o==null?void 0:o.disconnect()}}function BT(l){if(!l)return[];const i=l.cells.map(a=>a.row);return l.cursor&&i.push(l.cursor.row),i}function UT(l){const i=new Map;for(const a of(l==null?void 0:l.cells)??[]){const o=i.get(a.row);o?o.push(a):i.set(a.row,[a])}return i}class KT{constructor(i,a,o){W(this,"startedAt",null);W(this,"held",null);W(this,"timer",null);this.now=i,this.maxHoldMs=a,this.onExpire=o}get pending(){return this.held}hold(i,a){const o=this.now();return this.startedAt===null&&(this.startedAt=o),o-this.startedAt>=this.maxHoldMs?!1:(this.held=this.held?{start:Math.min(this.held.start,i),end:Math.max(this.held.end,a)}:{start:i,end:a},this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.onExpire()},this.maxHoldMs)),!0)}release(i,a){return this.held&&(i=Math.min(i,this.held.start),a=Math.max(a,this.held.end)),this.held=null,this.startedAt=null,this.timer&&(clearTimeout(this.timer),this.timer=null),{start:i,end:a}}dispose(){this.timer&&clearTimeout(this.timer)}}function IT(l){var a,o,r,u;const i=l._core;return!(i!=null&&i.screenElement)||!i.coreService||!((a=i.optionsService)!=null&&a.rawOptions)||!((o=i._bufferService)!=null&&o.buffer)||!i._charSizeService||!i._coreBrowserService||!((r=i._themeService)!=null&&r.colors)||typeof((u=i._renderService)==null?void 0:u.setRenderer)!="function"?null:i}class FT{constructor(){W(this,"listeners",new Set);W(this,"event",i=>(this.listeners.add(i),{dispose:()=>this.listeners.delete(i)}))}fire(i){for(const a of[...this.listeners])a(i)}dispose(){this.listeners.clear()}}const GT=150;class Bd{constructor(i,a){W(this,"dimensions",DT());W(this,"redraw",new FT);W(this,"onRequestRedraw",this.redraw.event);W(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});W(this,"canvas");W(this,"decor");W(this,"cells");W(this,"disposables",[]);W(this,"now");W(this,"syncHold");W(this,"cols",0);W(this,"rows",0);W(this,"overlayProvider",null);W(this,"paintedOverlayRows",new Set);W(this,"paintedCursorRow",-1);W(this,"lastYdisp",0);W(this,"inputAt",null);W(this,"blink",new bT(()=>this.requestCursorRow()));W(this,"disposed",!1);W(this,"isSynchronizing");W(this,"dprUsed",0);this.core=i,this.now=a.now??(()=>performance.now()),this.syncHold=new KT(this.now,a.maxSyncHoldMs??GT,()=>this.flushHeld()),this.isSynchronizing=a.isSynchronizing??(()=>!1);const o=i._coreBrowserService.mainDocument,r=i.screenElement;this.canvas=o.createElement("canvas"),this.canvas.classList.add("xterm-text-layer"),this.canvas.style.zIndex="0";const u=this.canvas.getContext("2d",{alpha:!1});if(!u)throw new Error("2D canvas unavailable");this.decor=new OT(o),r.appendChild(this.canvas),r.appendChild(this.decor.canvas),this.cells=new jT(u,o,i,this.dimensions),this.disposables.push(i._themeService.onChangeColors(()=>{this.cells.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),i.optionsService.onOptionChange(h=>{(h==="cursorBlink"||h==="cursorStyle")&&this.restartBlink()})),i.linkifier&&this.disposables.push(i.linkifier.onShowLinkUnderline(h=>{this.decor.link=h,this.redrawDecor()}),i.linkifier.onHideLinkUnderline(()=>{this.decor.link=null,this.redrawDecor()})),this.observeDevicePixels(),this.observeFonts(o),this.restartBlink()}static install(i,a={}){const o=IT(i);if(!o)return null;const r=new Bd(o,a);return o._renderService.setRenderer(r),o._renderService.handleResize(o._bufferService.cols,o._bufferService.rows),r}setOverlayProvider(i){this.overlayProvider=i,this.invalidateOverlay()}invalidateOverlay(){var o;const i=((o=this.overlayProvider)==null?void 0:o.call(this))??null,a=new Set(this.paintedOverlayRows);for(const r of BT(i))a.add(r);this.paintedCursorRow>=0&&a.add(this.paintedCursorRow+this.buffer().ydisp),this.requestAbsoluteRows(a)}markInput(){this.inputAt=this.now()}flushHeld(){const i=this.syncHold.pending;i&&this.redraw.fire({start:i.start,end:i.end})}handleDevicePixelRatioChange(){this.dimensions.device.cell.width&&this.dprUsed!==this.core._coreBrowserService.dpr&&this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleResize(i,a){zT(this.dimensions,this.core,i,a)&&(this.dprUsed=this.core._coreBrowserService.dpr);const o=this.dimensions;for(const u of[this.canvas,this.decor.canvas])u.width=o.device.canvas.width,u.height=o.device.canvas.height,u.style.width=`${o.css.canvas.width}px`,u.style.height=`${o.css.canvas.height}px`;const r=this.core.screenElement;r&&(r.style.width=`${o.css.canvas.width}px`,r.style.height=`${o.css.canvas.height}px`),this.cols=i,this.rows=a,this.cells.resize(i,a),this.paintedOverlayRows.clear(),this.paintedCursorRow=-1,this.cells.configureAtlas(),this.cells.fillBackground(),this.redrawDecor()}handleCharSizeChanged(){this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleBlur(){this.blink.stop(),this.requestCursorRow(),this.redrawDecor()}handleFocus(){this.restartBlink(),this.requestCursorRow(),this.redrawDecor()}handleSelectionChanged(i,a,o){this.decor.setSelection(i,a,o),this.redrawDecor()}handleCursorMove(){this.blink.running&&this.restartBlink()}clear(){this.invalidateAll(),this.cells.fillBackground()}clearTextureAtlas(){this.cells.atlas.clear(),this.invalidateAll(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}renderRows(i,a){if(this.disposed||!this.cols||!this.rows||!this.dimensions.device.cell.width)return;if(this.isSynchronizing()&&this.syncHold.hold(i,a)){this.stats.heldFrames++;return}const o=this.syncHold.release(i,a);this.paint(Math.max(0,o.start),Math.min(this.rows-1,o.end))}dispose(){if(!this.disposed){this.disposed=!0,this.blink.stop(),this.syncHold.dispose();for(const i of this.disposables)i.dispose();this.disposables.length=0,this.redraw.dispose(),this.cells.atlas.dispose(),this.canvas.remove(),this.decor.canvas.remove()}}uninstall(){const i=this.core._createRenderer;typeof i=="function"&&(this.core._renderService.setRenderer(i.call(this.core)),this.core._renderService.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)),this.dispose()}get textCanvas(){return this.canvas}hasPaintedInk(i,a){return this.cells.hasPaintedInk(i,a)}paint(i,a){var v;const o=this.now(),r=this.buffer(),u=r.ydisp;u!==this.lastYdisp&&(this.lastYdisp=u,this.redrawDecor());const h=((v=this.overlayProvider)==null?void 0:v.call(this))??null,p=UT(h),m=this.cursorState(h),g=new Set;for(let w=i;w<=a;w++)g.add(w);for(const w of this.paintedOverlayRows)Po(g,w-u,this.rows);for(const w of p.keys())Po(g,w-u,this.rows);this.paintedCursorRow>=0&&Po(g,this.paintedCursorRow,this.rows),m&&Po(g,m.y,this.rows);let b=0;for(const w of g)this.cells.loadRow(r.lines.get(u+w),p.get(w+u)),b+=this.cells.paintRow(w,m);this.paintedOverlayRows=new Set(p.keys()),this.paintedCursorRow=m?m.y:-1,this.stats.frames++,this.stats.lastCells=b,this.stats.lastPaintMs=this.now()-o,this.inputAt!==null&&b>0&&(this.stats.lastInputToPaintMs=this.now()-this.inputAt,this.inputAt=null)}cursorState(i){return gT(this.core,this.buffer(),i,{rows:this.rows,cols:this.cols},this.blink.hidden)}restartBlink(){if(this.blink.stop(),this.disposed||!this.core.optionsService.rawOptions.cursorBlink||!this.core._coreBrowserService.isFocused){this.requestCursorRow();return}this.blink.start(),this.requestCursorRow()}requestCursorRow(){if(!this.rows)return;const i=this.buffer(),a=new Set;a.add(i.ybase+i.y),this.paintedCursorRow>=0&&a.add(this.paintedCursorRow+i.ydisp),this.requestAbsoluteRows(a)}redrawDecor(){this.decor.paint({dims:this.dimensions.device,rows:this.rows,cols:this.cols,ydisp:this.buffer().ydisp,colors:this.colors(),focused:this.core._coreBrowserService.isFocused,dpr:this.core._coreBrowserService.dpr})}invalidateAll(){this.cells.invalidate(),this.paintedCursorRow=-1}observeDevicePixels(){const i=HT(this.core._coreBrowserService.window,this.canvas,(a,o)=>{const r=this.core._coreBrowserService.dpr,u=this.dimensions.css.canvas;if(!(Math.abs(a-u.width*r)>2||Math.abs(o-u.height*r)>2)){this.dimensions.device.canvas.width=a,this.dimensions.device.canvas.height=o;for(const h of[this.canvas,this.decor.canvas])h.width=a,h.height=o;this.invalidateAll(),this.cells.fillBackground(),this.redrawDecor(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}});i&&this.disposables.push(i)}observeFonts(i){const a=i.fonts;if(!a||typeof a.addEventListener!="function")return;const o=()=>this.clearTextureAtlas();a.addEventListener("loadingdone",o),this.disposables.push({dispose:()=>a.removeEventListener("loadingdone",o)})}buffer(){return this.core._bufferService.buffer}colors(){return this.core._themeService.colors}requestAbsoluteRows(i){if(!this.rows)return;const a=this.buffer().ydisp;let o=1/0,r=-1/0;for(const u of i){const h=u-a;h<0||h>=this.rows||(o=Math.min(o,h),r=Math.max(r,h))}o<=r&&this.redraw.fire({start:o,end:r})}}function Po(l,i,a){i>=0&&i<a&&l.add(i)}const YT=30,Ly=640,Ry=240,Xo=1,$T=720*60*60*1e3;function _y(){const l=Ai("local",pt.rendererProbe);if(!l)return{v:Xo,ua:{}};try{const i=JSON.parse(l);return typeof i=="object"&&i!==null&&i.v===Xo&&typeof i.ua=="object"&&i.ua!==null?i:{v:Xo,ua:{}}}catch{return{v:Xo,ua:{}}}}function qT(l,i=Date.now()){const a=_y();a.ua[l]={failedAt:i},wn("local",pt.rendererProbe,JSON.stringify(a))}function VT(l,i=Date.now()){const a=typeof navigator<"u"?navigator.userAgent:"";if(!a)return!1;const r=_y().ua[a];return!(!r||typeof r.failedAt!="number"||i-r.failedAt>$T)}function Gg(l,i=Date.now()){const a=typeof navigator<"u"?navigator.userAgent:"";a&&qT(a,i)}function PT(l){if(l.length<4)return!0;const i=l[0],a=l[1],o=l[2],r=l[3];for(let u=4;u<l.length;u+=4)if(l[u]!==i||l[u+1]!==a||l[u+2]!==o||l[u+3]!==r)return!1;return!0}function XT(l){if(!l||l.width<=0||l.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let i=null;try{i=l.getContext("2d",{willReadFrequently:!0})||l.getContext("2d")}catch(r){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",r),"inconclusive"}if(!i)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const a=Math.min(l.width,Ly),o=Math.min(l.height,Ry);if(a<=0||o<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const r=i.getImageData(0,0,a,o);return PT(r.data)?"blank":"healthy"}catch(r){return console.debug("Canvas probe inconclusive: getImageData threw exception:",r),"inconclusive"}}function Yg(l=2){return new Promise(i=>{if(typeof requestAnimationFrame!="function"){setTimeout(i,32);return}let a=l;const o=()=>{a--,a<=0?i():requestAnimationFrame(o)};requestAnimationFrame(o)})}const Xu={kind:"dom",canvas:null,dispose:()=>{},verify:async()=>{}};function QT(l,i={}){if(VT())return Xu;let a;try{a=Bd.install(l,{isSynchronizing:i.isSynchronizing})}catch(p){return console.debug("Canvas renderer unavailable, using the DOM renderer:",p),Gg(),Xu}if(!a)return Xu;let o=a,r=null;const u=()=>{var m;if(!o)return;Gg();const p=o;o=null;try{p.uninstall()}catch{}(m=i.onRendererSwapped)==null||m.call(i,"dom")};return{get kind(){return o?"canvas":"dom"},get canvas(){return o},dispose:()=>{const p=o;o=null;try{p==null||p.dispose()}catch{}},verify:async()=>{if(o)return r||(r=(async()=>{try{const p=o.stats.frames;await Yg(2);for(let g=0;g<YT&&o&&o.stats.frames===p;g++)await Yg(1);if(!o)return;const m=XT(o.textCanvas);m==="blank"&&o.hasPaintedInk(Ly,Ry)?u():m==="blank"?console.debug("Canvas probe inconclusive: uniform, but no character was painted there"):m==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(p){console.debug("Canvas probe inconclusive: unexpected error during verify():",p)}finally{r=null}})(),r)}}}function ZT(l,i,a){l.writeln(" ___ ___ .___ "),l.writeln(` / | \\ ____ _______| _/______ \x1B[1m${i}\x1B[0m`),l.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${a}\x1B[0m`),l.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),l.writeln(" \\___|_ / \\___ >|__| /___/____ >"),l.writeln(" \\/ \\/ \\/ "),l.writeln("")}var WT=rx(),Qu={exports:{}},$g;function JT(){return $g||($g=1,(function(l,i){(function(a,o){l.exports=o()})(self,(()=>(()=>{var a={6:(h,p)=>{function m(b){try{const v=new URL(b),w=v.password&&v.username?`${v.protocol}//${v.username}:${v.password}@${v.host}`:v.username?`${v.protocol}//${v.username}@${v.host}`:`${v.protocol}//${v.host}`;return b.toLocaleLowerCase().startsWith(w.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(p,"__esModule",{value:!0}),p.LinkComputer=p.WebLinkProvider=void 0,p.WebLinkProvider=class{constructor(b,v,w,x={}){this._terminal=b,this._regex=v,this._handler=w,this._options=x}provideLinks(b,v){const w=g.computeLink(b,this._regex,this._terminal,this._handler);v(this._addCallbacks(w))}_addCallbacks(b){return b.map((v=>(v.leave=this._options.leave,v.hover=(w,x)=>{if(this._options.hover){const{range:T}=v;this._options.hover(w,x,T)}},v)))}};class g{static computeLink(v,w,x,T){const M=new RegExp(w.source,(w.flags||"")+"g"),[A,R]=g._getWindowedLineStrings(v-1,x),k=A.join("");let O;const $=[];for(;O=M.exec(k);){const _=O[0];if(!m(_))continue;const[z,L]=g._mapStrIdx(x,R,0,O.index),[D,K]=g._mapStrIdx(x,z,L,_.length);if(z===-1||L===-1||D===-1||K===-1)continue;const J={start:{x:L+1,y:z+1},end:{x:K,y:D+1}};$.push({range:J,text:_,activate:T})}return $}static _getWindowedLineStrings(v,w){let x,T=v,M=v,A=0,R="";const k=[];if(x=w.buffer.active.getLine(v)){const O=x.translateToString(!0);if(x.isWrapped&&O[0]!==" "){for(A=0;(x=w.buffer.active.getLine(--T))&&A<2048&&(R=x.translateToString(!0),A+=R.length,k.push(R),x.isWrapped&&R.indexOf(" ")===-1););k.reverse()}for(k.push(O),A=0;(x=w.buffer.active.getLine(++M))&&x.isWrapped&&A<2048&&(R=x.translateToString(!0),A+=R.length,k.push(R),R.indexOf(" ")===-1););}return[k,T]}static _mapStrIdx(v,w,x,T){const M=v.buffer.active,A=M.getNullCell();let R=x;for(;T;){const k=M.getLine(w);if(!k)return[-1,-1];for(let O=R;O<k.length;++O){k.getCell(O,A);const $=A.getChars();if(A.getWidth()&&(T-=$.length||1,O===k.length-1&&$==="")){const _=M.getLine(w+1);_&&_.isWrapped&&(_.getCell(0,A),A.getWidth()===2&&(T+=1))}if(T<0)return[w,O]}w++,R=0}return[w,R]}}p.LinkComputer=g}},o={};function r(h){var p=o[h];if(p!==void 0)return p.exports;var m=o[h]={exports:{}};return a[h](m,m.exports,r),m.exports}var u={};return(()=>{var h=u;Object.defineProperty(h,"__esModule",{value:!0}),h.WebLinksAddon=void 0;const p=r(6),m=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(b,v){const w=window.open();if(w){try{w.opener=null}catch{}w.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}h.WebLinksAddon=class{constructor(b=g,v={}){this._handler=b,this._options=v}activate(b){this._terminal=b;const v=this._options,w=v.urlRegex||m;this._linkProvider=this._terminal.registerLinkProvider(new p.WebLinkProvider(this._terminal,w,this._handler,v))}dispose(){var b;(b=this._linkProvider)==null||b.dispose()}}})(),u})()))})(Qu)),Qu.exports}var e5=JT(),t5=cx();function n5({fontSize:l,fontFamily:i,theme:a,cols:o,rows:r}){const u=new t5.Terminal({fontSize:l,fontFamily:i,lineHeight:1.15,...a?{theme:{...a}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:o,rows:r,screenReaderMode:!1,linkHandler:{activate:(h,p)=>{md(p)}}});try{const h=new WT.Unicode11Addon;u.loadAddon(h),u.unicode.activeVersion="11"}catch(h){console.debug("Unicode11 addon unavailable, using default width table:",h)}try{u.loadAddon(new e5.WebLinksAddon((h,p)=>{md(p)}))}catch(h){console.debug("WebLinks addon unavailable, URLs stay plain text:",h)}return u}function ls(l){var i,a;if(!l)return!1;try{const o=l.modes;if(o&&typeof o.mouseTrackingMode=="string"&&o.mouseTrackingMode!=="none")return!0;const r=l._core;if((i=r==null?void 0:r._coreMouseService)!=null&&i.areMouseEventsActive||(a=r==null?void 0:r.coreMouseService)!=null&&a.areMouseEventsActive||r!=null&&r.mouseMode&&r.mouseMode!=="none")return!0}catch{}return!1}function i5(l,i){const a=i.button??0,o=i.buttons??(l==="mouseup"?0:1);return new MouseEvent(l,{bubbles:!0,cancelable:!0,clientX:i.clientX,clientY:i.clientY,screenX:i.clientX,screenY:i.clientY,button:a,buttons:o})}function jy(l,i,a){const o=i5(i,a);return l.dispatchEvent(o)}function Oy(l){var i;try{return((i=l.buffer)==null?void 0:i.active)||null}catch{return null}}function Zu(l){var a;const i=(a=Oy(l))==null?void 0:a.viewportY;return typeof i=="number"&&Number.isFinite(i)?i:null}function l5(l){var i;try{(i=l.blur)==null||i.call(l)}catch{}}function qg(l){var a,o;const i=l;return i.coreMouseService||((a=i._core)==null?void 0:a.coreMouseService)||((o=i._core)==null?void 0:o._coreMouseService)||null}function a5(l){var a;const i=l;return i.coreService||((a=i._core)==null?void 0:a.coreService)||null}class s5{constructor(i){this.options=i}getLogicalCoordinates(i,a){const o=this.options.getScale?this.options.getScale():1,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(o!==1&&r&&typeof r.getBoundingClientRect=="function"){const u=r.getBoundingClientRect();return Ty(i,a,u,o)}return{clientX:i,clientY:a}}getViewportElement(i){var r;const a=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(a==null?void 0:a.querySelector(".xterm-viewport"))||((r=i.element)==null?void 0:r.querySelector(".xterm-viewport"))||null}isInputLineHit(i,a){var k;const o=(k=a.buffer)==null?void 0:k.active,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,u=(r==null?void 0:r.querySelector(".xterm-screen"))||a.element||r,h=ll(a);if(!u||typeof u.getBoundingClientRect!="function"||h.cellHeight<=0)return!1;const p=u.getBoundingClientRect(),m=this.getLogicalCoordinates(i.clientX,i.clientY),g=p.width>0&&p.height>0;if(![o==null?void 0:o.cursorY,o==null?void 0:o.viewportY,o==null?void 0:o.baseY].every(O=>typeof O=="number"&&Number.isFinite(O)))return!1;const v=o==null?void 0:o.cursorY,w=o==null?void 0:o.viewportY,T=(o==null?void 0:o.baseY)+v-w,M=p.top+T*h.cellHeight,A=M+h.cellHeight,R=Number(a.rows);return T>=0&&(!Number.isFinite(R)||T<R)&&m.clientY>=M-2&&m.clientY<=A+2&&(!g||m.clientX>=p.left&&m.clientX<=p.right)}resolveDispatchTarget(i,a){var p;const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(o==null?void 0:o.querySelector(".xterm-screen"))||a.querySelector(".xterm-screen")||null,u=((p=r==null?void 0:r.closest)==null?void 0:p.call(r,".xterm"))||null;let h=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(h=document.elementFromPoint(i.clientX,i.clientY)),h&&u&&(h===u||u.contains(h))?h:r||o||a}getMouseReport(i,a){const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(o==null?void 0:o.querySelector(".xterm-screen"))||a.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const u=r.getBoundingClientRect(),h=this.getLogicalCoordinates(i.clientX,i.clientY),p=ll(a);if(p.cellWidth<=0||p.cellHeight<=0)return null;const m=Math.max(1,u.width||a.cols*p.cellWidth),g=Math.max(1,u.height||a.rows*p.cellHeight),b=Math.max(0,Math.min(m-1,h.clientX-u.left)),v=Math.max(0,Math.min(g-1,h.clientY-u.top)),w=Math.max(0,Math.min(a.cols-1,Math.floor(b/p.cellWidth))),x=Math.max(0,Math.min(a.rows-1,Math.floor(v/p.cellHeight)));return{col:w,row:x,x:Math.floor(b),y:Math.floor(v),button:0,action:0}}getWheelDispatchTarget(i){const a=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(a==null?void 0:a.querySelector(".xterm"))||i.element||null}dispatchWheel(i,a,o,r){const u=this.getWheelDispatchTarget(o);if(!u||typeof WheelEvent>"u"||a===0)return!1;const h=this.getLogicalCoordinates(i.clientX,i.clientY),p=a<0?-1:1;let m=0;for(let g=0;g<Math.abs(a);g+=1)try{const b=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:h.clientX,clientY:h.clientY,deltaX:0,deltaY:p,deltaMode:1,ctrlKey:!!(r!=null&&r.ctrlKey),altKey:!!(r!=null&&r.altKey),shiftKey:!!(r!=null&&r.shiftKey)});u.dispatchEvent(b),m+=1}catch{return m>0}return m>0}emitWheel(i,a,o,r){if(a===0)return!1;if(this.dispatchWheel(i,a,o,r))return!0;const u=qg(o);if(!(u!=null&&u.triggerMouseEvent))return!1;let h=0;for(let p=0;p<Math.abs(a);p+=1){const m=this.getMouseReport(i,o);m&&(m.button=4,m.action=a<0?0:1,m.ctrl=!!(r!=null&&r.ctrlKey),m.alt=!!(r!=null&&r.altKey),m.shift=!!(r!=null&&r.shiftKey),u.triggerMouseEvent(m)&&(h+=1))}return h>0}scrollAlternateBuffer(i,a,o,r){var h;if(a===0)return"none";const u=ls(o);if(!u&&!this.options.getIsController())return"none";if(this.emitWheel(i,a,o,r))return u?"application-mouse":"application-keys";if(!u){const p=a5(o);if(!(p!=null&&p.triggerDataEvent))return"none";const g=`\x1B${!!((h=p.decPrivateModes)!=null&&h.applicationCursorKeys)?"O":"["}${a<0?"A":"B"}`;return p.triggerDataEvent(g.repeat(Math.abs(a)),!0),"application-keys"}return"none"}emitMouse(i,a,o,r){const u=this.options.getTerminal();if(!u)return;const h=qg(u);if(h!=null&&h.triggerMouseEvent){const m=this.getMouseReport(a,u);m&&(m.action=i==="mousedown"?1:i==="mouseup"?0:32,m.ctrl=!!(o!=null&&o.ctrlKey),m.alt=!!(o!=null&&o.altKey),m.shift=!!(o!=null&&o.shiftKey),h.triggerMouseEvent(m));return}if(this.options.allowSyntheticMouseFallback===!1||!r)return;const p=this.getLogicalCoordinates(a.clientX,a.clientY);jy(r,i,{clientX:p.clientX,clientY:p.clientY,button:0,buttons:i==="mouseup"?0:1})}}class o5{constructor(i){W(this,"options");W(this,"state","idle");W(this,"startX",0);W(this,"startY",0);W(this,"lastX",0);W(this,"lastY",0);W(this,"activeTarget",null);W(this,"longPressTimer",null);W(this,"capturedPointerId",null);W(this,"captureElement",null);W(this,"scrollRemainderY",0);W(this,"delivery");this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...i},this.delivery=new s5(this.options)}getState(){return this.state}setGestureState(i){var a,o;this.state!==i&&(this.state=i,(o=(a=this.options).onGestureStateChange)==null||o.call(a,i))}beginGesture(i,a){this.startX=i.clientX,this.startY=i.clientY,this.lastX=i.clientX,this.lastY=i.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.delivery.resolveDispatchTarget(i,a),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var o,r;this.state==="pending"&&(this.setGestureState("longpress"),(r=(o=this.options).onLongPress)==null||r.call(o,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(i,a){var g,b,v,w;if(this.state==="longpress"){(b=(g=this.options).onSelectionExtend)==null||b.call(g,{clientX:i.clientX,clientY:i.clientY}),a!=null&&a.cancelable&&((v=a.preventDefault)==null||v.call(a));return}if(this.state==="idle")return;const o=i.clientX-this.startX,r=i.clientY-this.startY,u=Math.hypot(o,r);if(this.state==="scrolling"){this.scrollGesture(i,a);return}const h=this.options.getTerminal(),p=this.options.getIsController(),m=ls(h);if(!(u<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(r)>=Math.abs(o)||!m||!p){this.setGestureState("scrolling"),h&&l5(h),this.lastX=i.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(i,a);return}if(m&&p){this.state==="pending"&&(this.setGestureState("dragging"),this.delivery.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},a,this.activeTarget)),this.state==="dragging"&&(this.lastX=i.clientX,this.lastY=i.clientY,this.delivery.emitMouse("mousemove",i,a,this.activeTarget),a!=null&&a.cancelable&&((w=a.preventDefault)==null||w.call(a)));return}this.lastX=i.clientX,this.lastY=i.clientY}}scrollGesture(i,a){var T,M,A;const o=this.options.getTerminal();if(!o)return;const r=i.clientY-this.lastY;this.lastX=i.clientX,this.lastY=i.clientY;const u=ll(o),h=u.measured?u.cellHeight:this.options.scrollLineHeightPx||u.cellHeight||18;this.scrollRemainderY+=r;const p=Math.trunc(this.scrollRemainderY/h),m=-p;let g=!1,b="none";const v=Oy(o),w=ls(o);if(m!==0){if((v==null?void 0:v.type)==="alternate")b=this.delivery.scrollAlternateBuffer(i,m,o,a),g=b!=="none";else{const R=Zu(o);o.scrollLines(m);const k=Zu(o);b="buffer",g=R===null||k===null||R!==k}this.scrollRemainderY-=p*h}const x=this.delivery.getViewportElement(o);(M=(T=this.options).onGestureScroll)==null||M.call(T,{deltaY:r,lines:m,viewportY:Zu(o),scrollTop:(x==null?void 0:x.scrollTop)??null,scrollHeight:(x==null?void 0:x.scrollHeight)??null,clientHeight:(x==null?void 0:x.clientHeight)??null,moved:g,bufferType:(v==null?void 0:v.type)||null,baseY:typeof(v==null?void 0:v.baseY)=="number"?v.baseY:null,cursorY:typeof(v==null?void 0:v.cursorY)=="number"?v.cursorY:null,hasScrollback:typeof(v==null?void 0:v.hasScrollback)=="boolean"?v.hasScrollback:null,mouseTracking:w,scrollMode:b}),a!=null&&a.cancelable&&((A=a.preventDefault)==null||A.call(a))}endGesture(i,a){var h,p,m;this.clearLongPressTimer();const o=this.options.getTerminal(),r=this.options.getIsController(),u=ls(o);if(this.state==="pending"){if(u&&r){const b={clientX:this.startX,clientY:this.startY};this.delivery.emitMouse("mousedown",b,a,this.activeTarget),this.delivery.emitMouse("mouseup",b,a,this.activeTarget)}const g={clientX:this.startX,clientY:this.startY};r&&o&&this.delivery.isInputLineHit(g,o)&&((p=(h=this.options).onFocus)==null||p.call(h))}else if(this.state==="dragging"&&u&&r){const g=i??{clientX:this.lastX,clientY:this.lastY};this.delivery.emitMouse("mouseup",g,a,this.activeTarget),a!=null&&a.cancelable&&((m=a.preventDefault)==null||m.call(a))}this.reset()}handlePointerDown(i,a){if(i.pointerType==="mouse")return!1;if(!i.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(i.cancelable&&i.preventDefault(),this.beginGesture(i,a),i.pointerType!=="touch")try{typeof a.setPointerCapture=="function"&&(a.setPointerCapture(i.pointerId),this.capturedPointerId=i.pointerId,this.captureElement=a)}catch{}return!0}handlePointerMove(i){i.pointerType==="mouse"||this.state==="idle"||this.moveGesture(i,i)}handlePointerUp(i){i.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(i,i))}handlePointerCancel(i){i&&i.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(i,a){if(i.touches.length!==1){this.reset();return}i.cancelable&&i.preventDefault(),this.beginGesture(i.touches[0],a)}handleTouchMove(i){i.touches.length===1&&this.moveGesture(i.touches[0],i)}handleTouchEnd(i){i.cancelable&&i.preventDefault(),this.endGesture(null,i)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const i=this.options.getTerminal(),a=this.options.getIsController(),o=ls(i);if(this.state==="dragging"&&o&&a&&this.activeTarget){const r=this.delivery.getLogicalCoordinates(this.lastX,this.lastY);jy(this.activeTarget,"mouseup",{clientX:r.clientX,clientY:r.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const i=this.captureElement,a=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!i||a===null))try{typeof i.releasePointerCapture=="function"&&(typeof i.hasPointerCapture!="function"||i.hasPointerCapture(a))&&i.releasePointerCapture(a)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}function r5({container:l,term:i,isTouchDevice:a,debug:o,getTerminal:r,getIsController:u,getScale:h,getSurfaceElement:p,getSelection:m,onFocus:g}){const b=new o5({getTerminal:r,getIsController:u,getScale:h,getSurfaceElement:p,allowSyntheticMouseFallback:!1,onFocus:()=>{try{i.focus()}catch{}o==null||o(_=>({..._,focused:document.activeElement===i.textarea})),g()},onGestureStateChange:_=>{o==null||o(z=>({...z,state:_}))},onGestureScroll:({deltaY:_,lines:z,viewportY:L,scrollTop:D,scrollHeight:K,clientHeight:J,moved:V,bufferType:X,baseY:ie,cursorY:ue,hasScrollback:U,mouseTracking:E,scrollMode:G})=>{o==null||o(P=>({...P,deltaY:_,lines:z,viewportY:L,scrollTop:D,scrollHeight:K,clientHeight:J,moved:V,focused:document.activeElement===i.textarea,bufferType:X,baseY:ie,cursorY:ue,hasScrollback:U,mouseTracking:E,scrollMode:G,scrollCalls:P.scrollCalls+(z!==0?1:0),lastScrollLines:z}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:a?_=>m().handleLongPress(_):void 0,onSelectionExtend:a?_=>m().handleSelectionExtend(_):void 0}),v=typeof window<"u"&&"PointerEvent"in window,w=typeof TouchEvent<"u",x=[],T={passive:!1,capture:!0},M=(_,z)=>{document.addEventListener(_,z,T),x.push(()=>document.removeEventListener(_,z,T))},A=(_,z=!1)=>{const L=_.target;return L instanceof Node&&l.contains(L)||z&&b.getState()!=="idle"},R=(_,z)=>{o==null||o(L=>({...L,[_]:L[_]+1,lastInputEvent:z}))},k=_=>{const z=m();return z.hasOpenMenu()?(z.clearSelection(),_.cancelable&&_.preventDefault(),_.stopPropagation(),!0):!1},O=()=>{b.getState()==="longpress"&&m().openMenuAtGesture()};if(v){if(M("pointerdown",_=>{if(!A(_)||(R("pointerEvents","pointerdown"),k(_)))return;b.handlePointerDown(_,l)&&_.stopPropagation()}),M("pointermove",_=>{A(_,!0)&&(R("pointerEvents","pointermove"),b.handlePointerMove(_),_.pointerType!=="mouse"&&_.stopPropagation())}),M("pointerup",_=>{A(_,!0)&&(R("pointerEvents","pointerup"),O(),b.handlePointerUp(_),_.pointerType!=="mouse"&&_.stopPropagation())}),M("pointercancel",_=>{A(_,!0)&&(R("pointerEvents","pointercancel"),m().clearSelection(),b.handlePointerCancel(_),_.pointerType!=="mouse"&&_.stopPropagation())}),w){const _=z=>{A(z,!0)&&(o==null||o(L=>({...L,touchEvents:L.touchEvents+1})),z.cancelable&&z.preventDefault(),z.stopPropagation())};for(const z of["touchstart","touchmove","touchend","touchcancel"])M(z,_)}}else M("touchstart",_=>{A(_)&&(R("touchEvents","touchstart"),!k(_)&&(_.touches.length===1&&_.stopPropagation(),b.handleTouchStart(_,l)))}),M("touchmove",_=>{A(_,!0)&&(R("touchEvents","touchmove"),_.touches.length===1&&_.stopPropagation(),b.handleTouchMove(_))}),M("touchend",_=>{A(_,!0)&&(R("touchEvents","touchend"),O(),_.stopPropagation(),b.handleTouchEnd(_))}),M("touchcancel",_=>{A(_,!0)&&(R("touchEvents","touchcancel"),m().clearSelection(),_.stopPropagation(),b.handleTouchCancel())});const $=_=>{_.preventDefault()};return l.addEventListener("contextmenu",$),x.push(()=>l.removeEventListener("contextmenu",$)),()=>{b.handlePointerCancel();for(const _ of x)_()}}function c5(l,{requestFit:i,onPageVisible:a}){const o=new ResizeObserver(()=>{i()});o.observe(l);const r=()=>{i()},u=()=>{document.visibilityState==="visible"&&a()};window.addEventListener("resize",r),window.addEventListener("orientationchange",r),document.addEventListener("visibilitychange",u),window.addEventListener("pageshow",u);const h=()=>{i()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",h),window.visualViewport.addEventListener("scroll",h)),()=>{o.disconnect(),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),document.removeEventListener("visibilitychange",u),window.removeEventListener("pageshow",u),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",h),window.visualViewport.removeEventListener("scroll",h))}}function Ji(l){if(l)try{l.refresh(0,Math.max(0,l.rows-1))}catch{}}function u5({containerRef:l,surfaceRef:i,termRef:a,rendererRef:o,currentScaleRef:r,initialBannerWrittenRef:u,live:h,selection:p,prediction:m,fit:g,isTouchDevice:b,debug:v,terminalFontSize:w,terminalFontFamily:x,hostTheme:T,glyphRevision:M,terminalResetVersion:A,isActive:R,subscribeToOutput:k,onOutput:O,onTitle:$,onRendererKind:_}){const{requestFit:z,scheduleBoundedFit:L,seedFit:D,cancelPendingFits:K}=g;C.useEffect(()=>{var Be;if(!l.current||!i.current)return;const V=l.current,X=vd(V,Zl(),ed()),ie=ll(null,na),ue=Cy({width:X.width,height:X.height,cellWidth:ie.cellWidth,cellHeight:ie.cellHeight});h.current.sendResize(ue.cols,ue.rows),D(X);const U=n5({fontSize:Zp(w,X.width),fontFamily:x,theme:h.current.hostTheme,cols:ue.cols,rows:ue.rows});U.open(i.current),a.current=U;const E=U.onTitleChange(re=>{$(hd(re)||null)}),{screenState:G,fieldProbe:P,overlay:le}=m.attach(U);b&&U.textarea&&(U.textarea.readOnly=!1,U.textarea.tabIndex=0,U.textarea.inputMode="text");let Q=()=>{};if(v&&U.textarea){const re=()=>{v(Ae=>({...Ae,focused:document.activeElement===U.textarea}))};U.textarea.addEventListener("focus",re),U.textarea.addEventListener("blur",re),Q=()=>{var Ae,Pe;(Ae=U.textarea)==null||Ae.removeEventListener("focus",re),(Pe=U.textarea)==null||Pe.removeEventListener("blur",re)},re()}const xe=async re=>{m.discard("paste");const Ae=uy(re);if(Ae){if(re.preventDefault(),re.stopPropagation(),!h.current.isController){h.current.warnViewerMode();return}await h.current.uploadImage(Ae)}};(Be=U.textarea)==null||Be.addEventListener("paste",xe),V.addEventListener("paste",xe);const ye=QT(U,{isSynchronizing:G.isSynchronizing,onRendererSwapped:re=>{var Ae;V.dataset.renderer=re,_(re),(Ae=m.overlayRef.current)==null||Ae.attach(null),Ji(U)}});le.attach(ye.canvas);const ve=G.onSyncEnd(()=>{var re,Ae;return(Ae=(re=o.current)==null?void 0:re.canvas)==null?void 0:Ae.flushHeld()});if(o.current=ye,V.dataset.renderer=ye.kind,_(ye.kind),ZT(U,h.current.t("terminal.bannerTitle"),h.current.t("terminal.bannerSubtitle")),u.current=!0,U.write("",()=>void ye.verify()),!b)try{U.focus()}catch{}const me=typeof document<"u"?document.fonts:void 0;typeof(me==null?void 0:me.load)=="function"&&me.load('13px "Symbols Nerd Font Mono"').then(()=>{a.current&&(Ji(a.current),L(5))}).catch(()=>{});const de=U.onData(re=>{const{isController:Ae}=h.current;let Pe=re;if(Ae&&vy(re)==="keys"&&wx(re)){const Nt=h.current.consumeModifierLatch();Nt&&(Pe=tr(re,Nt))}const wt=Td(Pe);if(!Ae&&!lr(wt)){h.current.warnViewerMode();return}m.onUserInput(wt),h.current.sendBinary(wt)}),we=U.onBinary(re=>{const Ae=new Uint8Array(re.length);for(let Pe=0;Pe<re.length;Pe++)Ae[Pe]=re.charCodeAt(Pe)&255;!h.current.isController&&!lr(Ae)||h.current.sendBinary(Ae)}),se=typeof U.onWriteParsed=="function"?U.onWriteParsed(()=>{var re;p.current.onTerminalContentChanged(),P.invalidate(),!G.isSynchronizing()&&((re=m.predictorRef.current)==null||re.onServerOutput(),m.sync())}):{dispose:()=>{}},Se=typeof U.onRender=="function"?U.onRender(re=>{var Ae;if(h.current.glyphScan){const Pe=U.buffer.active.viewportY??0;let wt="";for(let Nt=re.start;Nt<=re.end;Nt+=1)wt+=((Ae=U.buffer.active.getLine(Pe+Nt))==null?void 0:Ae.translateToString(!0))??"";/[^\x00-\x7f]/.test(wt)&&h.current.ensureHostGlyphs(wt)}p.current.onTerminalRender(U,re.start,re.end)}):{dispose:()=>{}},ae=typeof U.onScroll=="function"?U.onScroll(()=>{p.current.onTerminalScroll(U),m.discard("scroll")}):{dispose:()=>{}},pe=r5({container:V,term:U,isTouchDevice:b,debug:v,getTerminal:()=>a.current,getIsController:()=>h.current.isController,getScale:()=>r.current,getSurfaceElement:()=>i.current,getSelection:()=>p.current,onFocus:()=>{var re,Ae;return(Ae=(re=h.current).onTerminalFocus)==null?void 0:Ae.call(re)}}),Ee=c5(V,{requestFit:z,onPageVisible:()=>{L(10),Ji(a.current)}});return()=>{var re;de.dispose(),we.dispose(),Se.dispose(),ae.dispose(),se.dispose(),E.dispose(),ve.dispose(),m.detach(),G.dispose(),pe(),Ee(),K(),Q(),(re=U.textarea)==null||re.removeEventListener("paste",xe),V.removeEventListener("paste",xe),ye.dispose(),o.current=null,U.dispose(),a.current=null}},[]),C.useEffect(()=>{const V=a.current;if(!V)return;const X=vd(l.current,Zl(),ed());V.options.fontSize=Zp(w,X.width),V.options.fontFamily=x,Ji(V),L(10)},[w,x]),C.useEffect(()=>{var X,ie;const V=a.current;!V||!M||((ie=(X=o.current)==null?void 0:X.canvas)==null||ie.clearTextureAtlas(),Ji(V))},[M]);const J=C.useRef(A);C.useEffect(()=>{var X;if(J.current===A)return;J.current=A,m.forget("resetVersion");const V=a.current;if(V)try{(X=V.reset)==null||X.call(V),V.clear(),V.refresh(0,Math.max(0,V.rows-1))}catch{}},[A]),C.useEffect(()=>{const V=a.current;!V||!T||(V.options.theme={...T},Ji(V))},[T]),C.useEffect(()=>k(X=>{const ie=a.current;if(!ie)throw new Error("terminal not ready");ie.write(X),O==null||O(X.byteLength)}),[k,a,O]),C.useEffect(()=>{if(!R)return;L(10);const V=a.current;if(V&&(Ji(V),!b))try{V.focus()}catch{}},[R,b,L,a])}const d5=({onTerminalFocus:l,isActive:i=!0})=>{var Xn;const a=C.useRef(null),o=C.useRef(null),r=C.useRef(null),u=C.useRef(null),h=C.useRef(null),p=C.useRef(1),m=C.useRef(null),g=C.useRef(!1),b=Ux(),v=b||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,w=FS(),[x,T]=C.useState(IS),{metrics:M,record:A}=GS(w),[R,k]=C.useState(null),{settings:O,terminalFontFamily:$,terminalFontSize:_,hostFont:z,ensureHostGlyphs:L,profiles:D,activeProfileId:K,t:J}=Le(),{isController:V,connectionState:X,hostPalette:ie,terminalResetVersion:ue,agentStatus:U,connect:E,rttMs:G}=et(),{addToast:P}=rn(),{sendResize:le,sendBinary:Q,observeKeyInput:xe,consumeModifierLatch:ye,warnViewerMode:ve,subscribeToOutput:me,subscribeToPasteFileReady:de}=hs(),{uploadImage:we}=ur(),se=Vn.useMemo(()=>Xx(ie),[ie]),Se=$n({isController:V,sendBinary:Q,sendResize:le,warnViewerMode:ve,uploadImage:we,t:J,consumeModifierLatch:ye,hostTheme:se,onTerminalFocus:l,ensureHostGlyphs:L,glyphScan:z.glyphs.status==="ready"}),ae=$n(i),pe=XC({termRef:h,rendererRef:m,mode:O.predictiveEcho,connectionState:X,observeKeyInput:xe}),[Ee,Be]=C.useState(null),re=fT({termRef:h,surfaceRef:r,mainRef:u,currentScaleRef:p,addToast:P,t:J}),Ae=$n(re),Pe=PS({termRef:h,isController:V,warnViewerMode:ve,uploadImage:we,addToast:P,t:J,onPaste:()=>pe.discard("paste"),subscribeToPasteFileReady:de}),wt=iT({termRef:h,containerRef:a,frameRef:o,surfaceRef:r,currentScaleRef:p,rendererRef:m,initialBannerWrittenRef:g,isActiveRef:ae,sendResize:le,onResized:()=>pe.forget("resize")});u5({containerRef:a,surfaceRef:r,termRef:h,rendererRef:m,currentScaleRef:p,initialBannerWrittenRef:g,live:Se,selection:Ae,prediction:pe,fit:wt,isTouchDevice:b,debug:w?T:null,terminalFontSize:_,terminalFontFamily:$,hostTheme:se,glyphRevision:z.glyphRevision,terminalResetVersion:ue,isActive:i,subscribeToOutput:me,onOutput:w?A:null,onTitle:Be,onRendererKind:k});const Nt=Vn.useMemo(()=>{var kt;return((kt=D.find(Cn=>Cn.id===K))==null?void 0:kt.displayName)??null},[D,K]);C.useEffect(()=>{X!=="connected"&&Be(null)},[X]),C.useEffect(()=>{const kt=i&&X==="connected",Cn=O.agentAlertBadge?cs(U):null;NS(kt?Ee:null,Nt,Cn)},[i,X,Ee,Nt,U,O.agentAlertBadge]),C.useEffect(()=>{X==="disconnected"&&E()},[]);const Pn=kt=>{kt.preventDefault()};return f.jsxs("main",{ref:u,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:Pn,"aria-label":J("terminal.windowAriaLabel"),children:[f.jsx("div",{id:"terminal-container",ref:a,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:v?"none":"auto"},tabIndex:0,onContextMenu:Pn,"aria-label":J("terminal.bufferAriaLabel"),role:"region",children:f.jsx("div",{id:"terminal-frame",ref:o,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:f.jsx("div",{id:"terminal-surface",ref:r,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),w&&f.jsx(VS,{debug:x,rttMs:G,metrics:M,rendererKind:R,predictiveEcho:O.predictiveEcho,predictor:pe.predictorRef.current,field:((Xn=pe.fieldProbeRef.current)==null?void 0:Xn.detect())??null,renderer:m.current}),b&&re.selectionRect&&re.isHighlightVisible&&f.jsx(hT,{term:h.current,surface:r.current,main:u.current,rect:re.selectionRect,viewportY:re.viewportY}),b&&re.selectionMenu&&f.jsx(KS,{anchorPoint:re.selectionMenu,hasSelection:!!re.selectionSnapshot,isController:V,vibrateOnKeyPress:O.vibrateOnKeyPress,linkUrl:re.selectionMenu.link??null,onOpenLink:kt=>{md(kt)||P("warning",J("clipboard.openLinkFailed"))},onCopySelection:re.handleCopySelection,onCopyLine:re.handleCopyLine,onCopyScreen:re.handleCopyScreen,onPaste:Pe.handlePaste,onClose:re.clearSelection}),b&&f.jsx(US,{isOpen:Pe.isPasteFallbackOpen,onClose:Pe.closePasteFallback,onSend:Pe.handleFallbackPasteSend,onSendImage:Pe.handleFallbackImageSend})]})},f5=2e3;function mr(){const{t:l}=Le(),{addToast:i}=rn(),[a,o]=C.useState(null),r=C.useRef(null);C.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]);const u=C.useCallback((h,p,m="success")=>{zd(h).then(g=>{if(g==="failed"){i("error",l("clipboard.copyFailed"));return}o(h),i(m,p),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>o(null),f5)})},[i,l]);return{copied:a,copy:u}}const tl="herdr-remote pair",Vg="herdr-remote",h5=({onPairedSuccess:l})=>{const{settings:i,updateSettings:a,t:o}=Le(),{connect:r,connectionState:u,stateDetail:h}=et(),{addToast:p}=rn(),[m,g]=C.useState(""),{copied:b,copy:v}=mr(),[w,x]=C.useState(!1),[T,M]=C.useState(i.wsUrl||on),[A,R]=C.useState(i.token||""),[k,O]=C.useState(i.clientId||""),$=D=>v(D,o("toasts.commandCopied")),_=D=>{D.preventDefault();const K=m.trim().toUpperCase();if(!K&&!A.trim()){p("warning",o("toasts.connectionError"));return}const J={pairCode:K,wsUrl:T.trim()||on,clientId:k.trim()||i.clientId};A.trim()&&(J.token=A.trim()),a(J),r({pairCode:K||void 0,token:A.trim()||void 0,wsUrl:T.trim()||on,clientId:k.trim()||i.clientId}),l&&l()},z=u==="connecting"||u==="reconnecting",L=({n:D})=>f.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",D,"]"]});return f.jsx("div",{className:"flex h-full w-full flex-1 justify-center overflow-y-auto bg-tui-crust p-2 sm:p-4",children:f.jsxs("div",{className:"my-auto w-full max-w-3xl space-y-3",children:[f.jsxs("div",{className:"border border-tui-border bg-tui-base px-3 py-2",children:[f.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[f.jsx("span",{"aria-hidden":"true",className:"font-bold text-tui-accent",children:"herdr-remote"}),f.jsx("h1",{className:"text-tui font-bold text-tui-text",children:o("onboarding.title")}),f.jsx("span",{className:"text-tui uppercase text-tui-warn",children:o("onboarding.firstTimeSetup")})]}),f.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:o("onboarding.description")})]}),u==="error"&&f.jsxs(Mi,{tone:"warn",action:f.jsx(Me,{variant:"warn",onClick:()=>r(),children:o("common.retry")}),children:[f.jsx("span",{className:"block font-bold",children:o("onboarding.authRequired")}),f.jsx("span",{className:"block text-tui-muted",children:h||o("onboarding.authRequiredDesc")})]}),f.jsxs("form",{onSubmit:_,className:"grid gap-3",children:[f.jsx(Tt,{title:o("onboarding.step1Title"),className:"min-w-0",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("p",{className:"flex items-start gap-2 text-tui text-tui-muted",children:[f.jsx(L,{n:1}),f.jsx("span",{className:"leading-snug",children:o("onboarding.step1Desc")})]}),f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 truncate text-tui text-tui-text",children:tl}),f.jsx(Me,{onClick:()=>$(tl),glyph:b===tl?ke.check:"⧉",className:ne("shrink-0",b===tl&&"border-tui-ok text-tui-ok"),children:o(b===tl?"common.copied":"common.copy")})]}),f.jsx("div",{className:"space-y-0.5 text-tui-sm",children:f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx("span",{className:"truncate text-tui-faint",children:o("onboarding.step1TuiNote")}),f.jsx("button",{type:"button",onClick:()=>$(Vg),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:o("common.clickToCopy"),children:f.jsx("code",{children:Vg})})]})})]})}),f.jsx(Tt,{title:o("onboarding.step2Title"),className:"min-w-0",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(L,{n:2}),f.jsx(Et,{type:"text",value:m,onChange:D=>g(D.target.value.toUpperCase()),placeholder:o("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":o("onboarding.step2Title"),className:"font-bold uppercase"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:o("onboarding.step2Note")})]})}),f.jsx(Me,{variant:"primary",type:"submit",block:!0,disabled:z,className:"py-1.5",children:z?f.jsx(il,{label:o("onboarding.connectingAndPairing")}):o("onboarding.connectAndPair")}),f.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[f.jsxs("button",{type:"button",onClick:()=>x(!w),"aria-expanded":w,className:"tui-focusable flex w-full items-center gap-2 px-2 py-1 text-left text-tui text-tui-muted transition-colors hover:text-tui-accent",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:w?ke.chevronDown:ke.chevronRight}),f.jsx("span",{className:"uppercase",children:o("onboarding.advancedTitle")})]}),w&&f.jsxs("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Gn,{htmlFor:"onboarding-token",children:o("onboarding.manualTokenLabel")}),f.jsx(Et,{id:"onboarding-token",type:"password",value:A,onChange:D=>R(D.target.value),placeholder:o("onboarding.manualTokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Gn,{htmlFor:"onboarding-ws",children:o("onboarding.wsEndpointLabel")}),f.jsx(Et,{id:"onboarding-ws",type:"text",value:T,onChange:D=>M(D.target.value),placeholder:o("onboarding.wsEndpointPlaceholder")})]}),f.jsx(gS,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Gn,{htmlFor:"onboarding-client-id",children:o("onboarding.clientIdLabel")}),f.jsx(Et,{id:"onboarding-client-id",type:"text",value:k,onChange:D=>O(D.target.value)})]})]})]})]})]})})},Ni="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",ms="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",m5="border-tui-accent bg-tui-accent text-tui-crust font-bold",p5="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",Dy={default:ms,bad:"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust",warn:"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust"};function g5(l){return{capHeight:l?"h-8":"h-7",keyClass:l?"h-8 min-w-[2rem] px-1.5":"h-7 min-w-[1.75rem] px-1.5",squareKeyClass:l?"h-8 w-8":"h-7 w-7",drawerToggleClass:l?"h-8 px-1.5":"h-7 px-1.5"}}function b5({capHeight:l,onCustomize:i,sendCombo:a}){const{settings:o,t:r}=Le(),{agentProfile:u}=et(),h=Dx(u,o.agentKeymaps[u]),p=g=>{let b="";try{b=is(g.combo)}catch{}const v=g.custom?g.customLabel||"":r(`agentActions.${g.labelKey}`),w=g.labelKey==="interrupt"&&g.combo.trim().toLowerCase()==="ctrl+c"?"bad":g.combo.trim().toLowerCase()==="ctrl+z"?"warn":"default";return f.jsxs("button",{type:"button","data-testid":`agent-key-${g.id}`,onClick:()=>a(g.combo),className:ne(Ni,l,"max-w-[10rem] gap-1 px-1.5",Dy[w]),title:`${b} ${v}`.trim(),"aria-label":`${b} ${v}`.trim(),children:[f.jsx("span",{className:"font-bold",children:b}),f.jsx("span",{className:"max-w-[5rem] truncate text-tui-sm opacity-70",children:v})]},g.id)},m=[...h.agentActions,...h.genericActions];return m.length===0&&!i?null:f.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${el[u].name} ${r("agentKeymaps.agentGroup")}`,className:"flex shrink-0 items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",className:"mx-1 h-5 w-px shrink-0 bg-tui-border-dim"}),m.map(p),i&&f.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:i,className:ne(Ni,l,"px-1.5 text-tui-sm border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:r("agentKeymaps.customizeBar"),"aria-label":r("agentKeymaps.customizeBar"),children:r("agentKeymaps.customizeBarShort")})]})}const zy="scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5";function y5({capHeight:l,onKey:i}){return f.jsx("div",{className:"grid grid-cols-6 gap-1 border-b border-tui-border-dim bg-tui-crust p-1.5 sm:grid-cols-12",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(a=>{const o=`F${a}`;return f.jsxs("button",{type:"button",onClick:()=>i(oe[o]),className:ne(Ni,ms,l),children:["F",a]},o)})})}const v5=[{code:oe.CTRL_C,caption:"^C",title:"virtualKeyboard.ctrlCTitle",badge:"virtualKeyboard.badgeSigint",tone:"bad"},{code:oe.CTRL_D,caption:"^D",title:"virtualKeyboard.ctrlDTitle",badge:"virtualKeyboard.badgeEof"},{code:oe.CTRL_Z,caption:"^Z",title:"virtualKeyboard.ctrlZTitle",badge:"virtualKeyboard.badgeTstp",tone:"warn"},{code:oe.CTRL_L,caption:"^L",title:"virtualKeyboard.ctrlLTitle",badge:"virtualKeyboard.badgeClear"},{code:oe.CTRL_R,caption:"^R",title:"virtualKeyboard.ctrlRTitle",badge:"virtualKeyboard.badgeSearch"},{code:oe.CTRL_A,caption:"^A",title:"virtualKeyboard.ctrlATitle",badge:"virtualKeyboard.badgeStart"},{code:oe.CTRL_E,caption:"^E",title:"virtualKeyboard.ctrlETitle",badge:"virtualKeyboard.badgeEnd"},{code:oe.CTRL_K,caption:"^K",title:"virtualKeyboard.ctrlKTitle",badge:"virtualKeyboard.badgeKill"}];function x5({capHeight:l,onKey:i}){const{t:a}=Le();return f.jsx("div",{className:zy,children:v5.map(o=>f.jsxs("button",{type:"button",onClick:()=>i(o.code,!1),className:ne(Ni,l,"gap-1.5 px-2",Dy[o.tone??"default"]),title:a(o.title),children:[f.jsx("span",{className:"font-bold",children:o.caption}),f.jsx("span",{className:"text-tui-sm opacity-70",children:a(o.badge)})]},o.caption))})}const w5=["|","~","/","\\","-","_","$","&",";",":","`",'"',"'",">","<","=","#","@","{","}","[","]"];function S5({squareKeyClass:l,onKey:i}){return f.jsx("div",{className:zy,children:w5.map(a=>f.jsx("button",{type:"button",onClick:()=>i(a,!0),className:ne(Ni,ms,l,"font-bold"),children:a},a))})}const Pg="image/png,image/jpeg,image/webp,image/gif,image/*";function Xg({fileInputRef:l}){const{uploadImage:i}=ur(),a=o=>{var u;const r=(u=o.target.files)==null?void 0:u[0];o.target.value="",r&&i(r)};return f.jsxs(f.Fragment,{children:[f.jsx("input",{ref:l,type:"file",accept:Pg,className:"hidden","data-testid":"key-toolbar-file-input",onChange:a}),f.jsx("input",{type:"file",accept:Pg,capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:a})]})}function Qg({collapsed:l}){const{uploadProgress:i}=ur();return i.active?f.jsx("div",{"data-testid":l?"key-toolbar-progress-collapsed":"key-toolbar-progress",className:"w-full border-b border-tui-border-dim bg-tui-crust px-2 py-1",children:f.jsx(xS,{ratio:i.ratio,label:i.statusText,tone:i.phase==="completed"?"ok":i.phase==="error"?"bad":"accent","aria-label":i.statusText})}):null}function C5({fileInputRef:l,keyClass:i,vibrate:a}){const{t:o}=Le(),{isController:r}=et(),{warnViewerMode:u}=hs(),{uploadProgress:h}=ur(),p=h.active,m=()=>{var g;if(a(),!r){u();return}p||(g=l.current)==null||g.click()};return f.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:m,disabled:p,className:ne(Ni,i,p?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":ms),title:p?h.statusText:o("virtualKeyboard.uploadImageTitle"),"aria-label":o("virtualKeyboard.uploadImage"),children:f.jsx("span",{className:"font-medium",children:p?`${h.percent}%`:o("virtualKeyboard.image")})})}function T5(){const{settings:l}=Le(),{isController:i}=et(),{sendKey:a,warnViewerMode:o,consumeModifierLatch:r}=hs(),u=C.useRef([]);C.useEffect(()=>()=>{for(const g of u.current)clearTimeout(g);u.current=[]},[]);const h=C.useCallback(()=>{if(l.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[l.vibrateOnKeyPress]),p=C.useCallback((g,b=!0)=>{if(h(),!i){o();return}const v=r();a(b&&v?tr(g,v):g)},[i,a,o,h,r]),m=C.useCallback(g=>{if(h(),!i){o();return}let b;try{b=xn(g)}catch{return}if(r(),b.length===1){a(b[0]);return}b.forEach((v,w)=>{const x=setTimeout(()=>{u.current=u.current.filter(T=>T!==x),a(v)},w*120);u.current.push(x)})},[r,i,a,h,o]);return{vibrate:h,pressKey:p,sendCombo:m}}const M5=({compact:l=!1,onCustomize:i})=>{const{settings:a,updateSettings:o,t:r}=Le(),{modifierLatch:u,toggleModifierLatch:h}=hs(),{vibrate:p,pressKey:m,sendCombo:g}=T5(),{capHeight:b,keyClass:v,squareKeyClass:w,drawerToggleClass:x}=g5(l),T=C.useRef(null),[M,A]=C.useState(!1),[R,k]=C.useState(!1),[O,$]=C.useState(!1),_=C.useRef(null),[z,L]=C.useState(!1),D=C.useCallback(()=>{const U=_.current;L(!!U&&U.scrollLeft+U.clientWidth<U.scrollWidth-1)},[]);if(C.useEffect(D),C.useEffect(()=>{const U=_.current;if(!U||typeof ResizeObserver!="function")return;const E=new ResizeObserver(D);return E.observe(U),()=>E.disconnect()},[D,a.toolbarVisible]),!a.toolbarVisible)return f.jsxs("div",{"data-testid":"key-toolbar-collapsed",className:"z-20 flex shrink-0 flex-col border-t border-tui-border bg-tui-mantle pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]",children:[f.jsx(Xg,{fileInputRef:T}),f.jsx(Qg,{collapsed:!0}),f.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:f.jsxs("button",{type:"button",onClick:()=>o({toolbarVisible:!0}),className:"tui-focusable flex h-6 w-28 items-center justify-center gap-1 text-tui uppercase text-tui-faint transition-colors hover:text-tui-accent",title:r("virtualKeyboard.expandToolbar"),"aria-label":r("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[f.jsx("span",{"aria-hidden":"true",children:"▴"}),f.jsx("span",{"aria-hidden":"true",children:r("common.keyBar")})]})})]});const K=a.virtualKeys&&a.virtualKeys.length>0?a.virtualKeys.filter(U=>U.enabled):_b,J=U=>U.id==="left"?f.jsx("span",{"aria-hidden":"true",children:"←"}):U.id==="up"?f.jsx("span",{"aria-hidden":"true",children:"↑"}):U.id==="down"?f.jsx("span",{"aria-hidden":"true",children:"↓"}):U.id==="right"?f.jsx("span",{"aria-hidden":"true",children:"→"}):U.id==="enter"?f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",children:"⏎"}),f.jsx("span",{className:"hidden sm:inline",children:r("virtualKeyboard.keyEnter")})]}):U.id==="drawer_chords"?f.jsx("span",{children:"^C"}):U.id==="drawer_fn"?f.jsxs("span",{className:"flex items-center gap-0.5",children:[f.jsx("span",{children:"Fn"}),f.jsx("span",{"aria-hidden":"true",children:M?"▾":"▴"})]}):f.jsx("span",{children:U.label}),V=U=>{if(p(),U.type==="modifier"){U.modifierType==="ctrl"||U.modifierType==="alt"||U.modifierType==="shift"?h(U.modifierType):U.modifierType==="meta"&&m(oe.ESC);return}if(U.type==="drawer"){U.drawerType==="fn"?(A(!M),k(!1),$(!1)):U.drawerType==="chords"?($(!O),A(!1),k(!1)):U.drawerType==="symbols"&&(k(!R),A(!1),$(!1));return}m(U.code,U.type!=="chord")},X=U=>{if(U.type==="modifier"){if(U.modifierType==="ctrl")return u.ctrl;if(U.modifierType==="alt")return u.alt;if(U.modifierType==="shift")return u.shift}if(U.type==="drawer"){if(U.drawerType==="fn")return M;if(U.drawerType==="chords")return O;if(U.drawerType==="symbols")return R}return!1},ie=U=>{const E=X(U),G=["left","up","down","right"].includes(U.id),P=U.type==="drawer",le=sd(U,r);return f.jsx("button",{type:"button",onClick:()=>V(U),className:ne(Ni,G?w:P?x:v,U.id==="enter"?p5:E?m5:ms),title:le,"aria-label":le,"aria-pressed":E,children:J(U)},U.id)},ue=K.find(U=>U.id==="enter");return f.jsxs("div",{"data-testid":"key-toolbar",className:ne("z-20 flex shrink-0 select-none flex-col border-t border-tui-border bg-tui-mantle",l?"pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]":"pb-[max(env(safe-area-inset-bottom,0px),0.25rem)]"),role:"toolbar","aria-label":r("virtualKeyboard.touchKeyboardShortcuts"),children:[f.jsx(Xg,{fileInputRef:T}),f.jsx(Qg,{collapsed:!1}),M&&f.jsx(y5,{capHeight:b,onKey:m}),O&&f.jsx(x5,{capHeight:b,onKey:m}),R&&f.jsx(S5,{squareKeyClass:w,onKey:m}),f.jsxs("div",{"data-testid":"key-toolbar-row",className:ne("flex flex-nowrap items-center justify-start gap-1",l?"px-1.5 py-1":"px-2 py-1.5"),children:[f.jsxs("div",{className:"relative min-w-0",children:[f.jsxs("div",{ref:_,"data-testid":"key-toolbar-scroll",onScroll:D,className:"scrollbar-none flex flex-nowrap touch-pan-x items-center gap-1 overflow-x-auto overscroll-x-contain",children:[f.jsx("button",{type:"button",onClick:()=>o({toolbarVisible:!1}),className:ne(Ni,w,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:r("virtualKeyboard.collapseToolbar"),"aria-label":r("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:f.jsx("span",{"aria-hidden":"true",children:"▾"})}),K.filter(U=>U.id!=="enter").map(ie),f.jsx(b5,{capHeight:b,onCustomize:i,sendCombo:g}),f.jsx(C5,{fileInputRef:T,keyClass:v,vibrate:p})]}),z&&f.jsx("span",{"aria-hidden":"true","data-testid":"key-toolbar-more",className:"pointer-events-none absolute inset-y-0 right-0 w-4 bg-gradient-to-l from-tui-mantle"})]}),ue&&ie(ue)]})]})},A5=["ls -la","clear","git status","pwd","top","exit","cat"],E5=({isOpen:l,onClose:i})=>{const{t:a}=Le(),{isController:o}=et(),{sendKey:r,warnViewerMode:u}=hs(),[h,p]=C.useState("");if(!l)return null;const m=b=>{if(b&&b.preventDefault(),!o){u();return}h.length>0?(r(`${h}\r`),p("")):r("\r")},g=b=>{if(!o){u();return}r(`${b}\r`)};return f.jsxs("section",{className:"z-20 flex flex-col gap-1.5 border-t border-tui-border bg-tui-mantle p-2","aria-label":a("virtualKeyboard.helperTitle"),children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-tui font-bold uppercase text-tui-accent",children:a("virtualKeyboard.helperTitle")}),f.jsx(Me,{variant:"ghost",onClick:i,"aria-label":a("virtualKeyboard.closeHelper"),children:"esc"})]}),f.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:A5.map(b=>f.jsx("button",{type:"button",onClick:()=>g(b),className:"tui-focusable shrink-0 select-none border border-tui-border bg-tui-surface px-2 py-0.5 text-tui-sm text-tui-muted transition-colors hover:border-tui-accent hover:text-tui-accent",children:b},b))}),f.jsxs("form",{onSubmit:m,className:"flex items-center gap-1.5",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none font-bold text-tui-ok",children:"$"}),f.jsxs("div",{className:"relative flex-1",children:[f.jsx("label",{htmlFor:"virtual-keyboard-input",className:"sr-only",children:a("virtualKeyboard.placeholder")}),f.jsx(Et,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:h,onChange:b=>p(b.target.value),placeholder:a("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),h.length>0&&f.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":a("virtualKeyboard.clearInput"),children:f.jsx("span",{"aria-hidden":"true",children:ke.cross})})]}),f.jsx(Me,{variant:"primary",type:"submit",title:a("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:f.jsx("span",{className:"hidden sm:inline",children:a("virtualKeyboard.sendButton")})})]})]})};function pr(l,i){const a=(o,r)=>i?i(o):r;switch(l){case"connected":return{label:a("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:a("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:a("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:a("connection.reconnectNow","Reconnect now")};case"error":return{label:a("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:a("connection.retry","Retry")};default:return{label:a("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:a("connection.connect","Connect")}}}const N5={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},k5=({isOpen:l,onClose:i,isAddMode:a=!1})=>{const{settings:o,updateSettings:r,t:u,activeProfile:h,activeProfileId:p,addProfileAndConnect:m,renameProfile:g}=Le(),{connect:b,disconnect:v,connectionState:w,hostId:x}=et(),{addToast:T}=rn(),[M,A]=C.useState(o.wsUrl),[R,k]=C.useState(o.token),[O,$]=C.useState(o.pairCode),[_,z]=C.useState(o.clientId),[L,D]=C.useState((h==null?void 0:h.displayName)||""),[K,J]=C.useState(o.autoReconnect),{copied:V,copy:X}=mr(),ie=V!==null;if(C.useEffect(()=>{l&&(A(o.wsUrl),k(a?"":o.token),$(a?"":o.pairCode),z(o.clientId),D(a?"":(h==null?void 0:h.displayName)||""),J(o.autoReconnect))},[l,a,o,h]),!l)return null;const ue=P=>{P.preventDefault();const le={wsUrl:M.trim()||on,token:R.trim(),pairCode:O.trim().toUpperCase(),clientId:_.trim()||o.clientId,autoReconnect:K};if(!le.token&&!le.pairCode){T("warning",u("pairing.credentialsRequired"));return}a?m({...le,displayName:L.trim()||void 0}):(r(le),p&&L.trim()&&g(p,L),v(),b({wsUrl:le.wsUrl,token:le.token||void 0,pairCode:le.pairCode||void 0,clientId:le.clientId,autoReconnect:K})),i()},U=()=>{const P=`client-${Math.random().toString(36).substring(2,8)}`;z(P)},E=()=>{const P=new URL(window.location.href);P.search="",O.trim()&&P.searchParams.set("pairCode",O.trim().toUpperCase()),X(P.toString(),u("toasts.pairingLinkCopied"))},G=N5[w]??"idle";return f.jsxs(hr,{isOpen:l,onClose:i,title:u(a?"pairing.addTitle":"pairing.title"),subtitle:u("pairing.subtitle"),closeLabel:u("common.closeDialog"),hints:[{keys:"esc",action:u("common.close")},{keys:"⏎",action:u("pairing.saveAndConnect")}],footer:f.jsxs(f.Fragment,{children:[w==="connected"&&f.jsx(Me,{variant:"danger",onClick:()=>{v(),i()},children:u("common.disconnect")}),f.jsx(Me,{variant:"primary",type:"submit",form:"pairing-form",children:u("pairing.saveAndConnect")})]}),children:[f.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2 border-b border-tui-border-dim pb-2 text-tui",children:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(Bt,{level:G}),f.jsx("span",{className:"text-tui-muted",children:u("common.status")}),f.jsx("span",{className:ne(G==="ok"?"text-tui-ok":G==="bad"?"text-tui-bad":G==="warn"?"text-tui-warn":"text-tui-faint"),children:pr(w,u).label})]}),x&&f.jsxs("span",{className:"flex items-center gap-1.5 text-tui-muted",children:[u("common.host")," ",f.jsx("span",{className:"text-tui-text",children:x})]})]}),f.jsxs("form",{id:"pairing-form",onSubmit:ue,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Gn,{htmlFor:"pairing-name",children:u("pairing.displayNameLabel")}),f.jsx(Et,{id:"pairing-name",type:"text",value:L,onChange:P=>D(P.target.value),placeholder:u("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:u("pairing.displayNameHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Gn,{htmlFor:"pairing-code",hint:u("pairing.pairCodeNote"),children:u("pairing.pairCodeLabel")}),f.jsx(Et,{id:"pairing-code",type:"text",value:O,onChange:P=>$(P.target.value.toUpperCase()),placeholder:u("pairing.pairCodePlaceholder"),maxLength:12,className:"uppercase"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:u("pairing.pairCodeHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Gn,{htmlFor:"pairing-token",hint:u("pairing.tokenNote"),children:u("pairing.tokenLabel")}),f.jsx(Et,{id:"pairing-token",type:"password",value:R,onChange:P=>k(P.target.value),placeholder:u("pairing.tokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Gn,{htmlFor:"pairing-ws",children:u("pairing.wsUrlLabel")}),f.jsx(Et,{id:"pairing-ws",type:"text",value:M,onChange:P=>A(P.target.value),placeholder:u("pairing.wsUrlPlaceholder")}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:u("pairing.wsUrlDefaultNote")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Gn,{htmlFor:"pairing-client-id",children:u("pairing.clientIdLabel")}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Et,{id:"pairing-client-id",type:"text",value:_,onChange:P=>z(P.target.value),className:"flex-1"}),f.jsx(Me,{onClick:U,title:u("pairing.regenerateClientIdTitle"),className:"shrink-0",children:u("pairing.newIdButton")})]})]}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(yS,{checked:K,onChange:J,label:u("pairing.autoReconnectLabel"),description:u("pairing.autoReconnectDesc")})}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(Me,{onClick:E,block:!0,glyph:ie?ke.check:"⧉",className:ne(ie&&"border-tui-ok text-tui-ok"),children:u("pairing.copyDirectLink")})})]})]})},Ti=ne(fr,"py-0"),L5="h-7 py-0",wd="h-7 py-0 px-1.5",rr="text-tui-bad hover:border-tui-bad hover:text-tui-bad",R5=["grid items-center gap-x-2 gap-y-1 py-1","grid-cols-[4rem_minmax(0,1fr)_9rem] [grid-template-areas:'cap_label_actions'_'combo_combo_default']","sm:grid-cols-[4rem_minmax(0,1fr)_9rem_9rem_7rem] sm:[grid-template-areas:'cap_label_combo_default_actions']"].join(" ");function Hy(l){return{offLabel:l("settings.toggleOff"),onLabel:l("settings.toggleOn")}}const _5=({profile:l,onProfileChange:i})=>{const{settings:a,updateSettings:o,t:r}=Le(),{agentProfile:u}=et(),[h,p]=C.useState({}),m=C.useRef({}),[g,b]=C.useState(""),[v,w]=C.useState(""),x=l||u,T=a.agentKeymaps[x]||{},M=hb(x,T),A=mb(x,T),R=A.filter(E=>!E.hidden).length,k=E=>E.custom?E.customLabel||"":r(`agentActions.${E.labelKey}`),O=E=>{try{return is(E.combo)}catch{return E.combo}},$=E=>{o({agentKeymaps:{...a.agentKeymaps,[x]:E}})},_=(E,G)=>{var P;$({...T,actions:{...T.actions,[E]:{...(P=T.actions)==null?void 0:P[E],...G}}})},z=E=>{_(E.id,{keys:E.defaultCombo})},L=(E,G)=>{const P=E+(G==="up"?-1:1);if(P<0||P>=M.length)return;const le=M.map(Q=>Q.id);[le[E],le[P]]=[le[P],le[E]],$({...T,order:le})},D=E=>{var G;$({...T,custom:(T.custom||[]).filter(P=>P.id!==E),order:(G=T.order)==null?void 0:G.filter(P=>P!==E)})},K=()=>$(zx(T)),J=()=>{const E={...a.agentKeymaps};delete E[x],o({agentKeymaps:E})},V=()=>{const E=g.trim();if(!E)return;try{xn(v)}catch{return}const G=`custom-${Date.now().toString(36)}`;$({...T,custom:[...T.custom||[],{id:G,label:E,keys:v.trim()}],order:[...M.map(P=>P.id),G]}),b(""),w("")},X=E=>E instanceof vn?r(`agentKeymaps.errors.${E.code}`,E.params):String(E),ie=(E,G)=>`${E}:${G}`,ue=(E,G)=>{const P=ie(x,E);m.current={...m.current,[P]:G},p(m.current);try{xn(G),_(E,{keys:G})}catch{}},U=E=>{const G=ie(x,E),P=m.current[G];if(P!==void 0){delete m.current[G],p({...m.current});try{xn(P),_(E,{keys:P})}catch{}}};return f.jsxs("div",{className:"space-y-4",children:[f.jsx(hn,{title:r("agentKeymaps.settingsProfileLabel"),aside:f.jsx(Me,{variant:"ghost",onClick:J,className:ne(rr,wd),children:r("agentKeymaps.restoreProfile")}),children:f.jsx(Ht,{label:r("agentKeymaps.profileRowLabel"),htmlFor:"agent-keymap-profile",hint:el[x].configHint?r("agentKeymaps.configHint",{path:el[x].configHint}):void 0,control:f.jsx(dr,{id:"agent-keymap-profile","aria-label":r("agentKeymaps.settingsProfileLabel"),value:x,onChange:E=>i(E.target.value),className:Ti,children:Ex.map(E=>f.jsx("option",{value:E,children:el[E].name},E))})})}),f.jsx(hn,{title:r("agentKeymaps.barGroup"),aside:f.jsx(Me,{variant:"ghost",onClick:K,className:ne(rr,wd),children:r("agentKeymaps.restoreBar")}),children:f.jsxs("div",{className:"space-y-2 py-1.5",children:[f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r("agentKeymaps.barHint",{profile:el[x].name,count:R})}),f.jsx("div",{role:"group","aria-label":r("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:A.map(E=>{const G=k(E),P=O(E),le=!E.hidden;return f.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${E.id}`,"aria-pressed":le,onClick:()=>_(E.id,{hidden:le}),title:`${P} ${G}`.trim(),className:ne("tui-focusable inline-flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",le?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent"),children:[f.jsx("span",{"aria-hidden":"true",className:"font-bold",children:le?ke.check:"+"}),f.jsx("span",{className:"font-bold",children:P}),f.jsx("span",{className:le?void 0:"opacity-80",children:G})]},E.id)})})]})}),f.jsx(hn,{title:r("agentKeymaps.listGroup",{profile:el[x].name}),children:M.map((E,G)=>{var de,we;const P=k(E),le=r("agentKeymaps.defaultCombo",{combo:is(E.defaultCombo)}),Q=((we=(de=T.actions)==null?void 0:de[E.id])==null?void 0:we.keys)??E.combo,xe=ie(x,E.id),ye=h[xe]??Q;let ve="",me=null;try{xn(ye),ve=is(ye)}catch(se){me=X(se)}return f.jsxs("div",{"data-testid":`agent-setting-row-${E.id}`,className:R5,children:[f.jsx(oy,{className:"w-full overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:ve||"—"}),f.jsxs("span",{className:"min-w-0 break-words text-tui text-tui-text [grid-area:label]",title:P,children:[P,!E.verified&&f.jsx("span",{className:"ml-1 text-tui-sm text-tui-faint",children:r("agentKeymaps.unverified")})]}),f.jsxs("label",{className:"sr-only",htmlFor:`agent-combo-${E.id}`,children:[r("agentKeymaps.shortcutLabel")," ",P]}),f.jsx(Et,{id:`agent-combo-${E.id}`,"aria-label":`${r("agentKeymaps.shortcutLabel")} ${P}`,value:ye,onChange:se=>ue(E.id,se.target.value),onBlur:()=>U(E.id),onKeyDown:se=>{se.key==="Enter"&&se.currentTarget.blur()},placeholder:r("agentKeymaps.comboPlaceholder"),"aria-invalid":!!me,className:ne("w-full min-w-0 [grid-area:combo]",L5)}),f.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint [grid-area:default]",title:le,children:le}),f.jsxs("div",{className:"flex items-center justify-end [grid-area:actions]",children:[f.jsx(nl,{onClick:()=>z(E),title:r("agentKeymaps.resetAction"),"aria-label":`${r("agentKeymaps.resetAction")} ${P}`,children:"↺"}),f.jsx(nl,{disabled:G===0,onClick:()=>L(G,"up"),title:r("agentKeymaps.moveUp"),"aria-label":`${r("agentKeymaps.moveUp")} ${P}`,children:"↑"}),f.jsx(nl,{disabled:G===M.length-1,onClick:()=>L(G,"down"),title:r("agentKeymaps.moveDown"),"aria-label":`${r("agentKeymaps.moveDown")} ${P}`,children:"↓"}),E.custom?f.jsx(nl,{variant:"danger",onClick:()=>D(E.id),title:r("agentKeymaps.removeCustom"),"aria-label":`${r("agentKeymaps.removeCustom")} ${P}`,children:ke.cross}):f.jsx("span",{"aria-hidden":"true",className:"h-7 w-7 shrink-0"})]}),me&&f.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:r("agentKeymaps.invalidCombo",{error:me})})]},E.id)})}),f.jsx(hn,{title:r("agentKeymaps.addCustom"),children:f.jsxs("div",{className:"space-y-1 py-1.5",children:[f.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[f.jsx("span",{children:r("agentKeymaps.customLabel")}),f.jsx(Et,{value:g,onChange:E=>b(E.target.value),className:Ti})]}),f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[f.jsx("span",{children:r("agentKeymaps.customCombo")}),f.jsx(Et,{value:v,onChange:E=>w(E.target.value),placeholder:r("agentKeymaps.comboPlaceholder"),className:Ti})]}),f.jsx(Me,{variant:"primary",glyph:"+",onClick:V,disabled:!g.trim()||!v.trim(),className:Ti,children:r("agentKeymaps.addAction")})]}),v.trim()&&(()=>{try{return xn(v),f.jsx("p",{className:"text-tui-sm text-tui-info",children:is(v)})}catch(E){const G=X(E);return f.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:G})}})()]})})]})},By={"gnome-terminal":"GNOME Terminal",ptyxis:"Ptyxis",tilix:"Tilix",konsole:"Konsole","xfce4-terminal":"Xfce Terminal",kitty:"kitty",alacritty:"Alacritty",ghostty:"Ghostty",wezterm:"WezTerm",foot:"foot",vscode:"VS Code",iterm2:"iTerm2","apple-terminal":"Terminal",xterm:"xterm",urxvt:"urxvt"},j5=["host_font_unavailable","host_font_timeout","disconnected","font_api_unavailable"],O5=()=>{const{hostFont:l,loadHostFont:i,declineHostFont:a,settings:o,activeProfile:r,t:u}=Le(),{herdrLaunch:h,hostname:p}=et(),{addToast:m}=rn(),{font:g,status:b,glyphs:v}=l,w=b==="loading"||v.status==="loading",x=b==="failed"||v.status==="failed",T=C.useRef(!1);C.useEffect(()=>{T.current&&!w&&!x&&l.interactive&&m("success",u("hostFont.loaded")),T.current=w&&l.interactive},[w,x,l.interactive,m,u]);const M=b==="available"||v.status==="available",A=l.interactive&&(w||x);if(!(g&&o.fontFamily==="host"&&!h&&(M||A)))return null;const k=b==="available"||l.interactive&&(b==="loading"||b==="failed"),O=v.source&&(v.status==="available"||l.interactive&&(v.status==="loading"||v.status==="failed")),$=p||(r==null?void 0:r.displayName)||u("herdrLaunch.thisHost"),_=[g.sizePx?`${Math.round(g.sizePx)}px`:null,g.source?By[g.source]||g.source:null].filter(Boolean).join(u("hostFont.detailSeparator")),z=l.error&&j5.includes(l.error)?l.error:"other",L=l.totalBytes?l.receivedBytes/l.totalBytes:0;return f.jsx("div",{"data-testid":"host-font-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:f.jsxs(Tt,{title:u("hostFont.title"),tone:b==="failed"?"bad":"accent",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":u("hostFont.title"),children:[f.jsx("p",{className:"leading-snug text-tui-text",children:k||!v.source?u("hostFont.body",{host:$,family:g.family,detail:_?u("hostFont.detail",{detail:_}):""}):u("hostFont.bodyGlyphsOnly",{host:$,family:v.source.family})}),w?f.jsxs("div",{className:"space-y-1",role:"status",children:[f.jsx(vS,{value:L,width:32,className:"max-w-full overflow-hidden"}),f.jsx("p",{className:"text-tui-sm text-tui-muted",children:u("hostFont.loading",{received:zu(l.receivedBytes),total:zu(l.totalBytes)})})]}):f.jsxs(f.Fragment,{children:[x?f.jsx(Mi,{tone:"bad",children:u("hostFont.failed",{reason:u(`hostFont.reasons.${z}`)})}):f.jsxs("div",{className:"space-y-1 text-tui-sm leading-snug text-tui-faint",children:[k&&g.faces.length?f.jsx("p",{children:u("hostFont.download",{count:g.faces.length,size:zu(l.totalBytes)})}):null,O&&v.source?f.jsx("p",{children:u(v.source.scope==="all"?"hostFont.glyphsAll":"hostFont.glyphs",{family:v.source.family})}):null]}),f.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[f.jsx(Me,{onClick:a,children:u("hostFont.decline")}),f.jsx(Me,{variant:"primary",onClick:i,autoFocus:!0,children:u(x?"common.retry":"hostFont.load")})]})]})]})})},D5=({onOpenAdmin:l})=>{var _;const{settings:i,updateSettings:a,language:o,setLanguage:r,t:u,hostFont:h,syncHostFont:p,terminalFontFamily:m,terminalFontSize:g}=Le(),{connectionState:b}=et(),v=td.find(z=>z.id===i.fontFamily),w=(z,L)=>z==="host"||z==="system"?u(`fontPresets.${z}`):L,x=(()=>{const{font:z,status:L}=h,D=h.totalBytes?Math.round(h.receivedBytes/h.totalBytes*100):0,K=u(`settings.hostFontStatus.${L}`,{percent:D});return z?[z.family,z.sizePx?`${Math.round(z.sizePx)}px`:null,z.source?By[z.source]||z.source:null,K].filter(Boolean).join(" · "):K})(),T=(_=h.font)!=null&&_.sizePx?Wl(h.font.sizePx):null,M=h.glyphs.source&&h.glyphs.status!=="none"?u("settings.hostGlyphLine",{family:h.glyphs.source.family,status:u(`settings.hostGlyphStatus.${h.glyphs.status}`,{count:h.glyphs.covered.toLocaleString()})}):null,A=typeof window<"u"&&window.isSecureContext&&"Notification"in window,R=10,k=24,O=Hy(u),$=T?u("settings.fontSizeFollowHost",{size:T}):u("settings.fontSizeFollowHostUnknown");return f.jsxs("div",{className:"space-y-4",children:[f.jsx(hn,{title:u("settings.sectionInterface"),children:f.jsx(Ht,{label:u("settings.languageLabel"),control:f.jsx(Cg,{name:"ui-language","aria-label":u("settings.languageLabel"),value:o,onChange:r,options:[{value:"zh",label:"简体中文"},{value:"en",label:"English"}]})})}),f.jsxs(hn,{title:u("settings.sectionFont"),children:[f.jsx(Ht,{label:u("settings.fontFamilyLabel"),htmlFor:"terminal-font-select",control:f.jsxs(dr,{id:"terminal-font-select",value:i.fontFamily,onChange:z=>a({fontFamily:z.target.value}),"aria-label":u("settings.fontFamilyLabel"),className:Ti,children:[!v&&f.jsx("option",{value:i.fontFamily,children:i.fontFamily}),td.map(z=>f.jsx("option",{value:z.id,children:w(z.id,z.name)},z.id))]})}),i.fontFamily==="host"&&f.jsx(Ht,{label:u("settings.hostFontLabel"),hint:f.jsxs(f.Fragment,{children:[f.jsx("span",{"data-testid":"host-font-status",className:"block break-words text-tui-info",children:x}),M?f.jsx("span",{"data-testid":"host-glyph-status",className:"block break-words",children:M}):null]}),control:f.jsx(Me,{block:!0,onClick:p,disabled:b!=="connected"||h.status==="loading"||h.glyphs.status==="loading",className:Ti,children:u("settings.hostFontSync")})}),f.jsx(Ht,{label:u("settings.fontSizeLabel",{size:g}),hint:u("settings.fontSizeHint"),htmlFor:"terminal-font-size",control:f.jsx("div",{className:ne("flex items-center",fr),children:f.jsx("input",{id:"terminal-font-size",type:"range",min:R,max:k,step:1,value:g,onChange:z=>a({fontSize:Number(z.target.value),fontSizeFollowsHost:!1}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})})}),f.jsx(Ht,{label:$,control:f.jsx(Si,{label:$,...O,checked:i.fontSizeFollowsHost,onChange:z=>a(z?{fontSizeFollowsHost:!0}:{fontSizeFollowsHost:!1,fontSize:g})})}),f.jsx("div",{className:"py-1.5",children:f.jsxs("div",{className:"overflow-x-auto whitespace-nowrap border border-tui-border bg-tui-mantle px-2 py-1.5 leading-snug text-tui-text",style:{fontFamily:m,fontSize:`${g}px`},children:[f.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})})]}),f.jsxs(hn,{title:u("settings.sectionInput"),children:[f.jsx(Ht,{label:u("settings.predictiveEchoLabel"),hint:u("settings.predictiveEchoDesc"),control:f.jsx(Cg,{name:"predictive-echo","aria-label":u("settings.predictiveEchoLabel"),value:i.predictiveEcho,onChange:z=>a({predictiveEcho:z}),options:[{value:"auto",label:u("settings.predictiveEchoAuto")},{value:"always",label:u("settings.predictiveEchoAlways")},{value:"off",label:u("settings.predictiveEchoOff")}]})}),f.jsx(Ht,{label:u("settings.touchKeyToolbar"),hint:u("settings.touchKeyToolbarDesc"),control:f.jsx(Si,{label:u("settings.touchKeyToolbar"),...O,checked:i.toolbarVisible,onChange:z=>a({toolbarVisible:z})})}),f.jsx(Ht,{label:u("settings.touchHaptics"),hint:u("settings.touchHapticsDesc"),control:f.jsx(Si,{label:u("settings.touchHaptics"),...O,checked:i.vibrateOnKeyPress,onChange:z=>a({vibrateOnKeyPress:z})})})]}),f.jsxs(hn,{title:u("settings.agentAlertsLabel"),children:[f.jsx(Ht,{label:u("settings.agentAlertBadge"),hint:u("settings.agentAlertBadgeDesc"),control:f.jsx(Si,{label:u("settings.agentAlertBadge"),...O,checked:i.agentAlertBadge,onChange:z=>a({agentAlertBadge:z})})}),f.jsx(Ht,{label:u("settings.agentAlertVibrate"),hint:u("settings.agentAlertVibrateDesc"),control:f.jsx(Si,{label:u("settings.agentAlertVibrate"),...O,checked:i.agentAlertVibrate,onChange:z=>a({agentAlertVibrate:z})})}),f.jsx(Ht,{label:u("settings.agentAlertSound"),hint:u("settings.agentAlertSoundDesc"),control:f.jsx(Si,{label:u("settings.agentAlertSound"),...O,checked:i.agentAlertSound,onChange:z=>{a({agentAlertSound:z}),z&&(Fb(),Gb("done"))}})}),A&&f.jsx(Ht,{label:u("settings.agentAlertNotify"),hint:u("settings.agentAlertNotifyDesc"),control:f.jsx(Si,{label:u("settings.agentAlertNotify"),...O,checked:i.agentAlertNotify,onChange:z=>{if(z&&Notification.permission!=="granted"){Notification.requestPermission().then(L=>a({agentAlertNotify:L==="granted"}));return}a({agentAlertNotify:z})}})})]}),l&&f.jsx(hn,{title:u("settings.sectionAdmin"),children:f.jsx(Ht,{label:u("settings.adminEntry"),hint:u("settings.adminEntryHint"),control:f.jsx(Me,{block:!0,variant:"primary",glyph:ke.arrowRight,onClick:l,className:Ti,children:u("settings.adminEntryOpen")})})})]})},z5=()=>{const{settings:l,updateSettings:i,t:a}=Le(),{addToast:o}=rn(),[r,u]=C.useState(!1),h=Hy(a),p=l.virtualKeys&&l.virtualKeys.length>0?l.virtualKeys:rs(),m=x=>{const T=p.map(M=>M.id===x?{...M,enabled:!M.enabled}:M);i({virtualKeys:T})},g=(x,T)=>{const M=T==="up"?x-1:x+1;if(M<0||M>=p.length)return;const A=[...p],R=A[x];A[x]=A[M],A[M]=R,i({virtualKeys:A})},b=x=>{if(p.some(M=>M.id===x.id)){const M=p.map(A=>A.id===x.id?{...A,enabled:!0}:A);i({virtualKeys:M})}else{const M=[...p,{...x,enabled:!0}];i({virtualKeys:M})}u(!1)},v=x=>{const T=p.filter(M=>M.id!==x);i({virtualKeys:T})},w=()=>{i({virtualKeys:rs()}),o("info",a("toasts.keyLayoutReset"))};return f.jsxs("div",{className:"space-y-3",children:[f.jsx(hn,{title:a("virtualKeyboard.customizeTitle"),aside:f.jsx(Me,{variant:"ghost",onClick:w,className:ne(rr,wd),children:a("virtualKeyboard.resetLayout")}),children:p.map((x,T)=>{const M=sd(x,a);return f.jsxs("div",{className:"flex items-center gap-2 py-1",children:[f.jsx(oy,{className:ne("w-16 shrink-0 truncate",!x.enabled&&"opacity-50"),children:x.label}),f.jsx("span",{className:ne("min-w-0 flex-1 break-words text-tui",x.enabled?"text-tui-text":"text-tui-faint"),children:M}),f.jsx(Si,{label:`${a("virtualKeyboard.enableKey")} ${x.label}`,...h,checked:x.enabled,onChange:()=>m(x.id),className:"h-7 w-24 shrink-0"}),f.jsx(nl,{disabled:T===0,onClick:()=>g(T,"up"),title:a("virtualKeyboard.moveUp"),"aria-label":a("virtualKeyboard.moveUp"),children:"↑"}),f.jsx(nl,{disabled:T===p.length-1,onClick:()=>g(T,"down"),title:a("virtualKeyboard.moveDown"),"aria-label":a("virtualKeyboard.moveDown"),children:"↓"}),f.jsx(nl,{variant:"danger",onClick:()=>v(x.id),title:a("virtualKeyboard.deleteKeyTitle"),"aria-label":a("virtualKeyboard.deleteKeyTitle"),children:ke.cross})]},x.id)})}),f.jsx(Me,{block:!0,glyph:"+",onClick:()=>u(!r),className:ne("border-dashed",Ti),children:a("virtualKeyboard.addKey")}),r&&f.jsx(hn,{title:a("virtualKeyboard.availableKeys"),children:f.jsx("div",{className:"flex flex-wrap gap-1 py-1.5",children:Qw.map(x=>{const T=p.some(M=>M.id===x.id);return f.jsxs("button",{type:"button",onClick:()=>b(x),title:sd(x,a),className:ne("tui-focusable flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",T?"border-tui-border-dim text-tui-faint":"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent"),children:[f.jsx("span",{children:x.label}),f.jsx("span",{"aria-hidden":"true",className:T?"text-tui-ok":"text-tui-accent",children:T?ke.check:"+"})]},x.id)})})})]})},H5=({isOpen:l,onClose:i,initialTab:a,onOpenAdmin:o})=>{const{updateSettings:r,t:u}=Le(),{addToast:h}=rn(),[p,m]=C.useState("general"),[g,b]=C.useState(null);if(C.useEffect(()=>{!l||!a||(m(a),b(null))},[l,a]),!l)return null;const v=()=>{const w=Db();r({fontSize:w.fontSize,fontSizeFollowsHost:w.fontSizeFollowsHost,fontFamily:w.fontFamily,toolbarVisible:w.toolbarVisible,vibrateOnKeyPress:w.vibrateOnKeyPress,predictiveEcho:w.predictiveEcho,agentAlertBadge:w.agentAlertBadge,agentAlertSound:w.agentAlertSound,agentAlertVibrate:w.agentAlertVibrate,agentAlertNotify:w.agentAlertNotify,language:w.language,virtualKeys:w.virtualKeys}),h("info",u("settings.resetDefaultsToast"))};return f.jsxs(hr,{isOpen:l,onClose:i,title:u("settings.title"),subtitle:u("settings.subtitle"),closeLabel:u("common.closeDialog"),size:"lg",fixedHeight:!0,hints:[{keys:"esc",action:u("common.close")}],footer:f.jsxs(f.Fragment,{children:[f.jsx(Me,{variant:"ghost",onClick:v,className:rr,children:u("settings.resetDefaults")}),f.jsx(Me,{variant:"primary",onClick:i,children:u("common.done")})]}),children:[f.jsx(jd,{tabs:[{id:"general",label:u("settings.tabGeneral"),index:1},{id:"virtualKeys",label:u("settings.tabVirtualKeys"),index:2},{id:"agentKeymaps",label:u("settings.tabAgentKeymaps"),index:3}],activeId:p,onSelect:w=>m(w),className:"mb-3 border-b border-tui-border-dim pb-1"}),p==="general"&&f.jsx(D5,{onOpenAdmin:o}),p==="virtualKeys"&&f.jsx(z5,{}),p==="agentKeymaps"&&f.jsx(_5,{profile:g,onProfileChange:b})]})},B5={success:"ok",warning:"warn",error:"bad",info:"accent"},U5={success:ke.check,warning:ke.warn,error:ke.cross,info:"›"},K5=()=>{const{t:l}=Le(),{toasts:i,removeToast:a}=rn();return i.length===0?null:f.jsx("div",{className:"pointer-events-none fixed right-2 top-12 z-50 flex w-[calc(100vw-16px)] max-w-sm flex-col gap-1","aria-live":"polite","aria-atomic":"true",children:i.map(o=>{const r=B5[o.type];return f.jsxs("div",{className:ne("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",sn[r].edgeL),role:"alert",children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",sn[r].text),children:U5[o.type]}),f.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:o.message}),o.count>1&&f.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted",children:["×",o.count]}),f.jsx("button",{type:"button",onClick:()=>a(o.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":l("common.dismissNotification"),children:f.jsx("span",{"aria-hidden":"true",children:ke.cross})})]},o.id)})})},Uy=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}];function I5(l){return l?l.total>0||Uy.some(({status:i})=>{var a;return(((a=l.counts)==null?void 0:a[i])??0)>0}):!1}const Ky=({className:l,compact:i=!1})=>{const{t:a}=Le(),{agentStatus:o}=et();if(!o)return null;const r=Uy.map(({status:h,level:p})=>{var m;return{status:h,level:p,count:((m=o.counts)==null?void 0:m[h])??0}}).filter(h=>h.count>0),u=i?r.slice(0,1):r;return u.length===0?o.total===0?null:f.jsxs("span",{"data-testid":"agent-status-chip",className:ne("flex shrink-0 items-center gap-1 px-1 text-tui-muted",l),title:a("agents.title"),children:[f.jsx(Bt,{level:"idle"}),f.jsx("span",{className:"text-tui-faint",children:a("agents.allIdle")})]}):f.jsx("span",{"data-testid":"agent-status-chip",className:ne("flex shrink-0 items-center gap-2 px-1",l),title:a("agents.title"),children:u.map(({status:h,level:p,count:m})=>f.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[f.jsx(Bt,{level:p}),f.jsx("span",{className:"text-tui-text",children:m}),f.jsx("span",{className:"text-tui-faint",children:a(`agents.${h}`)})]},h))})},Ud=({onAddProfile:l,mobile:i=!1,statusBar:a=!1})=>{const{profiles:o,activeProfileId:r,activeProfile:u,switchProfile:h,renameProfile:p,removeProfile:m,t:g}=Le(),{connectionState:b}=et(),[v,w]=C.useState(!1),[x,T]=C.useState(null),[M,A]=C.useState(""),R=C.useRef(null);C.useEffect(()=>{if(!v)return;const L=D=>{R.current&&!R.current.contains(D.target)&&w(!1)};return document.addEventListener("pointerdown",L),()=>document.removeEventListener("pointerdown",L)},[v]);const k=(L,D)=>{T(L),A(D)},O=L=>{const D=M.trim();D&&p(L,D),T(null)},$=L=>{typeof window<"u"&&!window.confirm(g("profiles.removeConfirm"))||(m(L),T(null))},_=(u==null?void 0:u.displayName)||g("profiles.addHost"),z=b==="connected"?"ok":b==="connecting"||b==="reconnecting"?"warn":b==="error"?"bad":"idle";return f.jsxs("div",{ref:R,className:ne("relative min-w-0",i&&"w-full",a&&"flex-1",!i&&!a&&"h-full"),children:[f.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":v,"aria-label":g("profiles.switcherLabel"),onClick:()=>w(L=>!L),className:ne("tui-focusable flex min-w-0 items-center gap-1.5 border border-transparent text-left text-tui-muted transition-colors hover:border-tui-border hover:text-tui-accent",a?"min-h-11 w-full max-w-none px-2":i?"min-h-11 w-full px-2":"h-full max-w-[18rem] px-1"),children:[f.jsx(Bt,{level:z}),f.jsx("span",{className:ne("truncate text-tui-text",a&&"min-w-0 flex-1"),children:_}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:v?ke.chevronDown:ke.chevronRight})]}),v&&f.jsxs("div",{role:"menu","aria-label":g("profiles.switcherLabel"),className:ne("absolute bottom-full left-0 z-[100] mb-1 max-h-[min(70vh,24rem)] overflow-y-auto border border-tui-border bg-tui-base p-1 shadow-lg",a?"w-80 max-w-[calc(100vw-1rem)]":i?"inset-x-0 bottom-auto top-full mt-1 mb-0 w-full":"w-80 max-w-[calc(100vw-1rem)]"),children:[f.jsx("div",{className:"border-b border-tui-border-dim px-2 py-1 text-tui-sm uppercase text-tui-faint",children:g("profiles.title")}),o.length===0?f.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:g("profiles.empty")}):o.map(L=>{const D=L.id===r,K=L.id===x;return f.jsxs("div",{role:"none",className:"border-b border-tui-border-dim last:border-b-0",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs("button",{type:"button",role:"menuitem","aria-current":D?"true":void 0,onClick:()=>{h(L.id),w(!1)},className:ne("tui-focusable flex min-h-11 min-w-0 flex-1 items-center gap-2 px-2 text-left text-tui transition-colors hover:bg-tui-selection",D?"text-tui-accent":"text-tui-text"),children:[f.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:D?ke.cursor:""}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:"block truncate font-bold",children:L.displayName}),f.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:L.hostname||L.hostId,children:L.hostname||L.hostId||L.wsUrl})]}),D&&f.jsx("span",{className:"shrink-0 text-tui-sm text-tui-ok",children:g("profiles.current")})]}),f.jsx("button",{type:"button",role:"menuitem","aria-label":g("profiles.rename"),title:g("profiles.rename"),onClick:()=>k(L.id,L.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:ke.ellipsis})]}),K&&f.jsxs("div",{className:"flex items-center gap-1 px-2 pb-2",children:[f.jsx("input",{autoFocus:!0,value:M,maxLength:64,onChange:J=>A(J.target.value),onKeyDown:J=>{J.key==="Enter"&&O(L.id),J.key==="Escape"&&T(null)},"aria-label":g("profiles.rename"),className:"tui-input min-w-0 flex-1 px-2 py-1 text-tui"}),f.jsx(Me,{onClick:()=>O(L.id),variant:"primary",className:"min-h-11",children:g("common.save")}),f.jsx(Me,{onClick:()=>$(L.id),variant:"danger",className:"min-h-11",children:g("profiles.remove")})]})]},L.id)}),f.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{w(!1),l()},className:"tui-focusable flex min-h-11 w-full items-center gap-2 px-2 text-left text-tui-accent hover:bg-tui-selection",children:[f.jsx("span",{"aria-hidden":"true",children:"+"}),f.jsx("span",{children:g("profiles.addHost")})]})]})]})};function Iy(){const{updateStatus:l,ignoredUpdate:i}=et();return!!(l!=null&&l.updateAvailable)&&i!==(l==null?void 0:l.latest)}const Fy=({compact:l=!1,className:i})=>{const{t:a}=Le(),{updateStatus:o}=et(),r=Iy(),[u,h]=C.useState(!1);if(!r||!o)return null;const{latest:p,restartPending:m}=o,g=m?a("update.chipRestart",{version:p}):l?a("update.chipCompact",{version:p}):a("update.chip",{version:p});return f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button","data-testid":"update-chip",onClick:()=>h(!0),title:a("update.title"),className:ne("tui-focusable shrink-0 whitespace-nowrap px-1 text-tui-warn hover:underline",i),children:g}),f.jsx(F5,{isOpen:u,onClose:()=>h(!1)})]})},Wu=({command:l})=>{const{t:i}=Le(),{addToast:a}=rn();return f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 break-all text-tui-text",children:l}),f.jsx(Me,{glyph:"⧉",className:"shrink-0",onClick:()=>{zd(l).then(o=>{a(o==="failed"?"error":"success",i(o==="failed"?"clipboard.copyFailed":"toasts.commandCopied"))})},children:i("common.copy")})]})},F5=({isOpen:l,onClose:i})=>{const{t:a}=Le(),{updateStatus:o,ignoreUpdate:r,hostname:u,hostId:h}=et();if(!o)return null;const{current:p,installed:m,latest:g,restartPending:b}=o;return f.jsx(hr,{isOpen:l,onClose:i,title:a("update.title"),closeLabel:a("common.closeDialog"),size:"md",footer:f.jsxs(f.Fragment,{children:[f.jsx(Me,{variant:"ghost",onClick:()=>{r(g),i()},children:a("update.ignore")}),f.jsx(Me,{variant:"primary",onClick:i,children:a("common.done")})]}),children:f.jsxs("div",{className:"space-y-3","data-testid":"update-modal",children:[f.jsxs("div",{className:"space-y-0.5",children:[f.jsx(Ci,{label:a("common.host"),labelWidth:10,children:u||h||"—"}),f.jsx(Ci,{label:a("update.running"),labelWidth:10,children:p}),m!==p?f.jsx(Ci,{label:a("update.installed"),labelWidth:10,children:m}):null,f.jsx(Ci,{label:a("update.latest"),labelWidth:10,children:f.jsx("span",{className:"text-tui-ok",children:g})})]}),b?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:a("update.restartPending",{version:m})}),f.jsx(Wu,{command:"herdr-remote restart"})]}):f.jsxs(f.Fragment,{children:[f.jsxs("p",{className:"leading-snug text-tui-text",children:[f.jsx("span",{"aria-hidden":"true",className:"mr-1 text-tui-accent",children:ke.arrowRight}),a("update.stepTui")]}),f.jsx("p",{className:"leading-snug text-tui-muted",children:a("update.stepCli")}),f.jsx(Wu,{command:`npm install -g herdr-remote@${g} --prefer-online`}),f.jsx(Wu,{command:"herdr-remote restart"}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:a("update.restartNote")})]})]})})},G5=({onAddProfile:l=()=>{}})=>{const{settings:i,t:a}=Le(),{connectionState:o,role:r,hostId:u,assignedClientId:h,sharedWindowCount:p,rttMs:m,agentStatus:g}=et(),b=pr(o,a),v=o==="connected",w=Iy();return f.jsx(ry,{left:f.jsxs(f.Fragment,{children:[f.jsx(Ud,{onAddProfile:l}),f.jsx(fd,{items:[f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx(Bt,{level:b.level}),f.jsx("span",{className:"text-tui-text",children:b.label})]},"status"),v?f.jsx(_d,{tone:r==="controller"?"ok":"warn",children:a(r==="controller"?"role.sharedControl":"common.viewer")},"role"):null,v&&p>1?f.jsx("span",{className:"text-tui-muted",children:a("role.sharedWindows",{count:p})},"windows"):null,u?f.jsxs("span",{children:[f.jsxs("span",{className:"text-tui-faint",children:[a("common.host"),":"]})," ",f.jsx("span",{className:"text-tui-text",children:u})]},"host"):null,f.jsxs("span",{children:[f.jsx("span",{className:"text-tui-faint",children:a("header.clientIdLabel")})," ",f.jsx("span",{className:"text-tui-text",children:h||i.clientId})]},"client")]})]}),right:f.jsx(fd,{items:[w?f.jsx(Fy,{},"update"):null,v&&I5(g)?f.jsx(Ky,{},"agents"):null,m!==null?f.jsxs("span",{className:"text-tui-muted",children:[a("header.latencyTitle"),": ",f.jsxs("span",{className:"text-tui-text",children:[m,"ms"]})]},"rtt"):null,f.jsx("span",{className:"hidden text-tui-faint sm:inline",children:a("header.tagline")},"mode")]})})},Y5=({wsUrl:l,adminUrl:i,onOpenRemoteAdmin:a,onSignIn:o})=>{const{t:r}=Le();return f.jsxs(Tt,{title:r("admin.remoteRelayTitle"),bodyClassName:"space-y-2",children:[f.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:r("admin.remoteRelayNotice")}),f.jsxs("div",{className:"space-y-0.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[f.jsx(Ci,{label:r("admin.remoteRelayEndpoint"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-accent",children:l})}),f.jsx(Ci,{label:r("admin.remoteRelayAdminUrl"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-ok",children:i})})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Me,{variant:"primary",onClick:a,glyph:ke.arrowRight,children:r("admin.openRemoteAdminBtn")}),f.jsx(Me,{onClick:o,children:r("admin.relayAdminLoginBtn")})]})]})},$5=({adminConfigured:l,isAuthError:i,tokenInput:a,onTokenInput:o,onSubmit:r,isSameOriginRelay:u,onBackToTerminal:h,showBack:p,onCancel:m})=>{const{t:g}=Le();return f.jsxs(Tt,{title:g("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[l===!1?f.jsx(Mi,{tone:"warn",children:g("admin.relayAdminNotConfigured")}):i?f.jsx(Mi,{tone:"bad",children:g("admin.relayAdminAuthError")}):f.jsx(Mi,{tone:"accent",children:g("admin.relayAdminPrompt")}),f.jsxs("form",{onSubmit:r,className:"space-y-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Gn,{htmlFor:"relay-admin-token",children:g("admin.relayAdminTokenLabel")}),f.jsx(Et,{id:"relay-admin-token",type:"password",autoComplete:"current-password",value:a,onChange:b=>o(b.target.value),placeholder:g("admin.relayAdminTokenPlaceholder")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Me,{variant:"primary",type:"submit",disabled:!a.trim(),children:g("admin.relayAdminLoginBtn")}),u?h&&!p?f.jsx(Me,{variant:"ghost",onClick:h,children:g("admin.returnToTerminal")}):null:f.jsx(Me,{variant:"ghost",onClick:m,children:g("common.cancel")})]})]})]})},q5=({onOpenPairing:l,onRetry:i})=>{const{t:a}=Le(),{copied:o,copy:r}=mr(),u=o!==null,h=()=>r(tl,a("toasts.commandCopied"));return f.jsxs(Tt,{title:a("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[f.jsx(Mi,{tone:"bad",children:a("admin.unauthorizedDesc")}),f.jsxs("div",{className:"space-y-1.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[f.jsx("span",{className:"block text-tui-sm uppercase text-tui-muted",children:a("admin.pairingStepsTitle")}),f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-crust px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 truncate text-tui-text",children:tl}),f.jsx(Me,{onClick:h,glyph:u?ke.check:"⧉",className:ne("shrink-0",u&&"border-tui-ok text-tui-ok"),children:a(u?"admin.copiedJson":"common.copy")})]}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:a("admin.pairingStepsHelp")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[l&&f.jsx(Me,{variant:"primary",onClick:l,children:a("admin.enterPairCodeBtn")}),f.jsx(Me,{onClick:i,children:a("admin.retryFetchBtn")})]})]})},V5=[[/\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"]],P5=[[/\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 Zg(l,i){for(const[a,o]of l)if(a.test(i))return o;return null}function Kd(l){const i=typeof l=="string"?l.trim():"";if(!i)return{label:"",raw:""};const a=Zg(V5,i),o=Zg(P5,i);return a&&o?{label:`${a} · ${o}`,raw:i}:a?{label:a,raw:i}:o?{label:o,raw:i}:{label:i.length>32?`${i.slice(0,32)}…`:i,raw:i}}function Ql(l){if(!l||l<=0)return"0 B";const i=1024,a=["B","KB","MB","GB","TB"],o=Math.min(a.length-1,Math.floor(Math.log(l)/Math.log(i)));return`${(l/i**o).toFixed(1)} ${a[o]}`}function Wg(l,i,a=!1){const o=Math.max(0,Math.floor(l)),r=Math.floor(o/86400),u=Math.floor(o%86400/3600),h=Math.floor(o%3600/60),p=o%60,m=(b,v)=>`${b}${i(`admin.unit${v}`)}`,g=r>0?[m(r,"Day"),m(u,"Hour"),m(h,"Minute")]:u>0?[m(u,"Hour"),m(h,"Minute"),m(p,"Second")]:[m(h,"Minute"),m(p,"Second")];return(a?g.slice(0,2):g).join(" ")}function Id(l,i,a=Date.now()){if(!l)return"—";const o=new Date(l).getTime();if(Number.isNaN(o))return"—";const r=Math.max(0,Math.floor((a-o)/1e3));return r<60?i("admin.relJustNow"):r<3600?i("admin.relMinutes",{count:Math.floor(r/60)}):r<86400?i("admin.relHours",{count:Math.floor(r/3600)}):i("admin.relDays",{count:Math.floor(r/86400)})}function Fd(l){if(!l)return"";const i=new Date(l);return Number.isNaN(i.getTime())?"":i.toLocaleString()}function Gy(l=[]){const i=new Map;for(const a of l)a.deviceId&&i.set(a.deviceId,(i.get(a.deviceId)||0)+1);return i}const X5=({clients:l})=>{const{t:i}=Le(),a=l.some(r=>r.hostId),o=[{key:"id",header:i("admin.colClientId"),render:r=>f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(Bt,{level:"ok"}),f.jsx("span",{className:"font-bold text-tui-text",children:r.id})]})},...a?[{key:"host",header:i("admin.colHost"),render:r=>f.jsx("span",{className:"text-tui-text",children:r.hostId||"—"})}]:[],{key:"role",header:i("admin.colRole"),width:10,render:r=>{const u=r.role==="controller";return f.jsx(_d,{tone:u?"ok":"warn",className:"text-tui-sm",children:i(u?"common.controller":"common.viewer")})}},{key:"device",header:i("admin.colDevice"),render:r=>{const u=Kd(r.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:u.label?"text-tui-text":"text-tui-faint",title:u.raw,children:u.label||i("admin.unknownDevice")}),r.deviceId?f.jsx("code",{className:"text-tui-sm text-tui-faint",children:r.deviceId}):null]})}},{key:"ip",header:i("admin.colIp"),render:r=>f.jsx("span",{className:"text-tui-muted",children:r.ip||"127.0.0.1"})},{key:"connectedAt",header:i("admin.colConnectedAt"),render:r=>f.jsx("span",{className:"whitespace-nowrap text-tui-muted",title:Fd(r.connectedAt),children:r.connectedAt?Id(r.connectedAt,i):i("admin.startedRecently")})},{key:"traffic",header:i("admin.colTraffic"),align:"right",render:r=>f.jsxs("span",{className:"whitespace-nowrap",children:[f.jsxs("span",{className:"text-tui-accent",children:["↓",Ql(r.bytesReceived||0)]}),f.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),f.jsxs("span",{className:"text-tui-ok",children:["↑",Ql(r.bytesSent||0)]})]})}];return f.jsx(Tt,{title:i("admin.connectedClientsTitle",{count:l.length}),bodyClassName:"-mx-1",children:f.jsx(Od,{columns:o,items:l,rowKey:r=>r.id,empty:i("admin.noClients")})})},Q5=({devices:l,clients:i,onRevoke:a})=>{const{t:o}=Le(),[r,u]=C.useState(null),[h,p]=C.useState(null),m=Gy(i),g=[...l].sort((w,x)=>{const T=+!!m.get(x.deviceId)-+!!m.get(w.deviceId);return T||(Date.parse(x.lastSeenAt)||0)-(Date.parse(w.lastSeenAt)||0)}),b=async w=>{if(r!==w){u(w);return}p(w);try{await a(w)}finally{p(null),u(null)}},v=[{key:"status",header:o("admin.colStatus"),width:12,render:w=>{const x=m.get(w.deviceId)||0;return f.jsxs("span",{className:ne("flex items-center gap-1.5 whitespace-nowrap",x?"text-tui-ok":"text-tui-faint"),children:[f.jsx(Bt,{level:x?"ok":"idle"}),o(x?"admin.hostStatusOnline":"admin.hostStatusOffline")]})}},{key:"device",header:o("admin.colDevice"),render:w=>{const x=Kd(w.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:"text-tui-text",title:x.raw,children:x.label||o("admin.unknownDevice")}),f.jsx("code",{className:"text-tui-sm text-tui-faint",children:w.deviceId})]})}},{key:"host",header:o("admin.colHost"),render:w=>f.jsx("span",{className:"text-tui-text",children:w.hostId||"—"})},{key:"ip",header:o("admin.colIp"),render:w=>f.jsx("span",{className:"text-tui-muted",children:w.lastIp||"—"})},{key:"lastSeen",header:o("admin.colLastSeen"),render:w=>{const x=m.get(w.deviceId)||0;return f.jsx("span",{className:ne("whitespace-nowrap",x?"text-tui-ok":"text-tui-muted"),title:Fd(w.lastSeenAt),children:x?o("admin.deviceWindows",{count:x}):Id(w.lastSeenAt,o)})}},{key:"actions",header:o("admin.colActions"),align:"right",render:w=>{const x=r===w.deviceId,T=h===w.deviceId;return f.jsx(Me,{variant:"danger",disabled:T,onClick:()=>void b(w.deviceId),onBlur:()=>u(M=>M===w.deviceId?null:M),"aria-label":o("admin.revokeDevice"),className:ne("h-6 py-0 text-tui-sm",x&&"bg-tui-bad text-tui-crust"),children:T?f.jsx(il,{}):o(x?"admin.revokeConfirm":"admin.revokeDevice")})}}];return f.jsx(Tt,{title:o("admin.pairedDevicesTitle",{count:l.length}),bodyClassName:"-mx-1",children:f.jsx(Od,{columns:v,items:g,rowKey:w=>w.deviceId,empty:o("admin.noDevices")})})},Jg={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function Z5(l=[],i=[]){const a=new Map;for(const u of i){if(!(u!=null&&u.hostId))continue;const h=a.get(u.hostId);h?h.push(u):a.set(u.hostId,[u])}const o=l.map(u=>{const h=a.get(u.id)||[];return{id:u.id,hostname:u.hostname||u.id,status:u.status||"online",connectedDeviceCount:u.connectedDeviceCount??0,pairedDeviceCount:u.pairedDeviceCount??h.length,activePtyCount:u.activePtyCount??0,devices:h,fromRosterOnly:!1}}),r=new Set(o.map(u=>u.id));for(const[u,h]of a)r.has(u)||o.push({id:u,hostname:u,status:"offline",connectedDeviceCount:0,pairedDeviceCount:h.length,activePtyCount:0,devices:h,fromRosterOnly:!0});return o.sort((u,h)=>u.fromRosterOnly!==h.fromRosterOnly?u.fromRosterOnly?1:-1:u.hostname.localeCompare(h.hostname))}const W5=({hosts:l,devices:i,clients:a})=>{const{t:o}=Le(),r=Z5(l,i),u=Gy(a),h={online:o("admin.hostStatusOnline"),busy:o("admin.hostStatusBusy"),reconnecting:o("admin.hostStatusReconnecting"),offline:o("admin.hostStatusOffline")};return f.jsx(Tt,{title:o("admin.hostsTitle",{count:r.length}),bodyClassName:"space-y-2",children:r.length===0?f.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:o("admin.noHosts")}):r.map(p=>f.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border-dim px-2 py-1",children:[f.jsxs("span",{className:"flex min-w-0 flex-auto items-center gap-1.5 text-tui",children:[f.jsx(Bt,{level:Jg[p.status]}),f.jsx("span",{className:"truncate font-bold text-tui-text",children:p.hostname}),p.hostname!==p.id?f.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:p.id}):null,f.jsx(_d,{tone:Jg[p.status],className:"ml-1 text-tui-sm",children:h[p.status]})]}),f.jsx(fd,{className:"shrink-0 text-tui-sm",items:[f.jsx("span",{className:p.connectedDeviceCount?"text-tui-ok":"text-tui-faint",children:o("admin.hostConnectedDevices",{count:p.connectedDeviceCount})},"connected"),f.jsx("span",{className:"text-tui-muted",children:o("admin.hostPairedDevices",{count:p.pairedDeviceCount})},"paired"),p.fromRosterOnly?null:f.jsx("span",{className:p.activePtyCount?"text-tui-info":"text-tui-faint",children:o("admin.hostPtys",{count:p.activePtyCount})},"ptys")]})]}),p.devices.length>0?f.jsx("ul",{className:"divide-y divide-tui-border-dim",children:p.devices.map(m=>{const g=Kd(m.userAgent),b=u.get(m.deviceId)||0;return f.jsxs("li",{className:"grid grid-cols-[1ch_minmax(0,1fr)_auto] items-baseline gap-x-2 px-2 py-0.5 text-tui sm:grid-cols-[1ch_minmax(0,18ch)_minmax(0,1fr)_16ch_16ch]",children:[f.jsx(Bt,{level:b?"ok":"idle"}),f.jsx("span",{className:"truncate text-tui-text",title:g.raw,children:g.label||o("admin.unknownDevice")}),f.jsx("code",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:m.deviceId}),f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-muted sm:block",children:m.lastIp||"—"}),f.jsx("span",{className:ne("whitespace-nowrap text-right text-tui-sm",b?"text-tui-ok":"text-tui-faint"),title:Fd(m.lastSeenAt),children:b?o("admin.deviceWindows",{count:b}):Id(m.lastSeenAt,o)})]},m.deviceId)})}):f.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:p.pairedDeviceCount>0?o("admin.hostRosterOperatorOnly"):o("admin.noDevices")})]},p.id))})},J5=({data:l})=>{var r,u,h,p,m,g,b,v,w,x;const{t:i}=Le(),a=l.activeUserCount??((r=l.clients)==null?void 0:r.length)??0,o=new Set((l.devices||[]).map(T=>T.hostId).filter(T=>T&&!(l.hosts||[]).some(M=>M.id===T))).size;return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 xl:grid-cols-6",children:[f.jsx(Yl,{label:i("admin.connectedHosts"),value:((u=l.hosts)==null?void 0:u.length)||0,sub:o?i("admin.hostsOfflineSub",{count:o}):void 0,tone:(h=l.hosts)!=null&&h.length?"ok":"idle"}),f.jsx(Yl,{label:i("admin.activeUsers"),value:a,sub:i("admin.acrossWindows",{count:((p=l.clients)==null?void 0:p.length)||0}),tone:a?"accent":"idle"}),f.jsx(Yl,{label:i("admin.activePtys"),value:((m=l.ptys)==null?void 0:m.length)||0,sub:i("admin.terminalShells"),tone:(g=l.ptys)!=null&&g.length?"info":"idle"}),f.jsx(Yl,{label:i("admin.statInbound"),value:i("admin.perSecond",{value:Ql(((b=l.throughput)==null?void 0:b.bytesInPerSec)||0)}),sub:i("admin.statTotal",{value:Ql(((v=l.throughput)==null?void 0:v.bytesIn)||0)}),tone:"accent"}),f.jsx(Yl,{label:i("admin.statOutbound"),value:i("admin.perSecond",{value:Ql(((w=l.throughput)==null?void 0:w.bytesOutPerSec)||0)}),sub:i("admin.statTotal",{value:Ql(((x=l.throughput)==null?void 0:x.bytesOut)||0)}),tone:"ok"}),f.jsx(Yl,{label:i("admin.uptime"),value:Wg(l.uptimeSeconds||0,i,!0),title:Wg(l.uptimeSeconds||0,i),sub:l.startTime?i("admin.startedAt",{time:new Date(l.startTime).toLocaleTimeString()}):i("admin.startedRecently")})]}),f.jsx(W5,{hosts:l.hosts||[],devices:l.devices,clients:l.clients||[]})]})},eM=({ptys:l})=>{const{t:i}=Le(),a=l.some(r=>r.hostId),o=[{key:"id",header:i("admin.colPtyId"),render:r=>f.jsx("span",{className:"font-bold text-tui-accent",children:r.id})},...a?[{key:"host",header:i("admin.colHost"),render:r=>f.jsx("span",{className:"text-tui-text",children:r.hostId})}]:[],{key:"pid",header:i("admin.colPid"),width:9,render:r=>f.jsx("span",{className:"text-tui-muted",children:r.pid})},{key:"command",header:i("admin.colCommand"),render:r=>f.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:r.command})},{key:"grid",header:i("admin.colGrid"),width:11,render:r=>f.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[r.cols,f.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),r.rows]})},{key:"cwd",header:i("admin.colCwd"),className:"max-w-xs truncate",render:r=>f.jsx("span",{className:"text-tui-muted",children:r.cwd||"~"})},{key:"viewers",header:i("admin.colViewers"),align:"right",width:9,render:r=>f.jsx("span",{className:"font-bold text-tui-ok",children:r.activeClients})}];return f.jsx(Tt,{title:i("admin.activePtysTitle",{count:l.length}),bodyClassName:"-mx-1",children:f.jsx(Od,{columns:o,items:l,rowKey:r=>r.id,empty:i("admin.noPtys")})})};function Sd(l){if(typeof window>"u"||!l||l.startsWith("/"))return"";try{const i=new URL(l.replace(/^ws/,"http")),a=i.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return i.origin===window.location.origin&&!a?"":`${i.origin}${a}`}catch{return""}}function ds(l,i){const a=Sd(l);return a?`${a}${i.startsWith("/")?i:`/${i}`}`:i}async function tM(l){try{const a=await fetch(ds(l,"/api/info"),{headers:{Accept:"application/json"}});if(a.ok)return await a.json()}catch{}return{ok:!0,version:"0.1.0",protocol:1,relayMode:!!(l&&!l.startsWith("/")&&!l.includes("localhost")&&!l.includes("127.0.0.1")&&typeof window<"u"&&!l.startsWith(window.location.origin.replace("http","ws")))?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}}async function eb(l,i){const a=await fetch(l,{headers:{Accept:"application/json",...i}});if(a.status===401||a.status===403)return{kind:"denied",status:a.status};if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);return{kind:"ok",data:await a.json()}}async function nM(l,i,a){return(await fetch(ds(l,`/api/admin/devices/${encodeURIComponent(a)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":i}})).ok}function iM(l,i,a){return l!=null&&l.adminPath?l.publicUrl?`${l.publicUrl.replace(/\/$/,"")}${l.adminPath}`:ds(a,l.adminPath):i!=null&&i.remoteAdminUrl?i.remoteAdminUrl:a?ds(a,"/admin"):"/admin"}function lM({wsUrl:l,deviceToken:i,adminToken:a,relayOrigin:o,refreshInterval:r,t:u}){const[h,p]=C.useState(null),[m,g]=C.useState(null),[b,v]=C.useState(!1),[w,x]=C.useState(!0),[T,M]=C.useState(null),[A,R]=C.useState(!1),[k,O]=C.useState(null);C.useEffect(()=>{p(null),g(null),v(!1)},[o]),C.useEffect(()=>{let K=!0;return x(!0),tM(l).then(J=>{K&&(g(J),v(!0))}),()=>{K=!1}},[l,o]);const $=(m==null?void 0:m.relayMode)==="remote",_=C.useCallback((K,J)=>{if(K.kind==="denied"){R(!0),M(J),p(null);return}p(K.data),M(null),R(!1),O(new Date)},[]),z=C.useCallback((K,J)=>{R(!1),M(K instanceof Error?K.message:J),p(null)},[]),L=C.useCallback(async()=>{if(b){if($){if(!a){p(null),x(!1),M(null),R(!1);return}try{x(!0);const K=await eb(ds(l,(m==null?void 0:m.adminStatusPath)||"/api/admin/status"),{"X-Relay-Admin-Token":a});_(K,u("admin.relayAdminAuthError"))}catch(K){console.warn("GET /api/admin/status request failed:",K),z(K,"Failed to fetch remote admin status")}finally{x(!1)}return}try{x(!0);const K=await eb("/api/status",i?{Authorization:`Bearer ${i}`}:{});_(K,K.kind==="denied"?`Authentication failed (HTTP ${K.status}): Access denied. Please configure an authorized token or pair with the host.`:"")}catch(K){console.warn("GET /api/status request failed:",K),z(K,"Failed to fetch status")}finally{x(!1)}}},[b,$,a,m,i,l,o,u]),D=C.useCallback(async K=>{try{if(!await nM(l,a,K)){M(u("admin.revokeFailed"));return}await L()}catch{M(u("admin.revokeFailed"))}},[a,L,l,u]);return C.useEffect(()=>{if(!b)return;L();let K=null;const J=()=>{r>0&&!K&&(K=setInterval(()=>{document.visibilityState==="visible"&&L()},r))},V=()=>{K&&(clearInterval(K),K=null)},X=()=>{document.visibilityState==="visible"?(L(),J()):V()};return J(),document.addEventListener("visibilitychange",X),()=>{V(),document.removeEventListener("visibilitychange",X)}},[b,L,r]),{data:h,relayInfo:m,infoLoaded:b,isRemoteRelay:$,loading:w,error:T,isAuthError:A,lastUpdated:k,fetchStatus:L,revokeDevice:D}}const Ju="h-7 py-0",aM=({onBackToTerminal:l,onOpenPairing:i,showBack:a=!1})=>{var ye,ve,me;const{settings:o,updateSettings:r,t:u}=Le(),h=Sd(o.wsUrl)||(typeof window<"u"?window.location.origin:"local"),p=((ye=o.adminTokens)==null?void 0:ye[h])||(h===(typeof window<"u"?window.location.origin:"local")?o.adminToken:"")||"",[m,g]=C.useState(3e3),[b,v]=C.useState("overview"),[w,x]=C.useState(p),[T,M]=C.useState(p),[A,R]=C.useState(!!p),k=!Sd(o.wsUrl);C.useEffect(()=>{x(p),M(p),R(!!p)},[h]);const{data:O,relayInfo:$,infoLoaded:_,isRemoteRelay:z,loading:L,error:D,isAuthError:K,lastUpdated:J,fetchStatus:V,revokeDevice:X}=lM({wsUrl:o.wsUrl,deviceToken:o.token,adminToken:T,relayOrigin:h,refreshInterval:m,t:u}),ie=de=>{de.preventDefault();const we=w.trim();r({adminToken:we,adminTokens:{...o.adminTokens||{},[h]:we}}),M(we),R(!!we)},ue=iM($,O,o.wsUrl),U=O?[{id:"overview",label:u("admin.tabOverview"),index:1},{id:"clients",label:u("admin.tabClients",{count:((ve=O.clients)==null?void 0:ve.length)||0}),index:2},{id:"ptys",label:u("admin.tabPtys",{count:((me=O.ptys)==null?void 0:me.length)||0}),index:3},...O.devices?[{id:"devices",label:u("admin.tabDevices",{count:O.devices.length}),index:4}]:[]]:[],E=U.map(de=>de.id).join("|");C.useEffect(()=>{const de=E?E.split("|"):[],we=se=>{if(se.ctrlKey||se.altKey||se.metaKey)return;const Se=se.target;if(Se instanceof HTMLInputElement||Se instanceof HTMLTextAreaElement||Se instanceof HTMLSelectElement||Se!=null&&Se.isContentEditable||document.querySelector('[role="dialog"]'))return;if(se.key==="Escape"&&l){se.preventDefault(),l();return}if(se.key.toLowerCase()==="r"){se.preventDefault(),V();return}const ae=Number.parseInt(se.key,10)-1;Number.isInteger(ae)&&ae>=0&&ae<de.length&&(se.preventDefault(),v(de[ae]))};return window.addEventListener("keydown",we),()=>window.removeEventListener("keydown",we)},[V,l,E]);const G=($==null?void 0:$.version)||(O==null?void 0:O.version)||"0.1.0",P=a&&l?f.jsx(Me,{variant:"ghost",onClick:l,title:u("admin.returnToTerminal"),"aria-label":u("admin.returnToTerminal"),glyph:ke.arrowLeft,brackets:!1,className:Ju,children:f.jsx("span",{className:"sr-only",children:u("admin.returnToTerminal")})}):null,le=f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:"hidden items-center gap-1.5 whitespace-nowrap text-tui-sm sm:flex",children:[f.jsxs("span",{className:"text-tui-faint",children:["v",G]}),f.jsx(Rd,{}),f.jsx("span",{className:z?"text-tui-alt":"text-tui-ok",children:u(z?"admin.modeRemote":"admin.localWorkstationBadge")})]}),O?f.jsxs(f.Fragment,{children:[f.jsxs("label",{className:"hidden items-center gap-1.5 text-tui-sm text-tui-muted md:flex",children:[f.jsx("span",{children:u("admin.autoRefresh")}),f.jsxs(dr,{value:m,onChange:de=>g(Number(de.target.value)),"aria-label":u("admin.autoRefresh"),className:ne("w-auto",Ju),children:[f.jsx("option",{value:0,children:u("admin.paused")}),f.jsx("option",{value:1e3,children:"1s"}),f.jsx("option",{value:3e3,children:"3s"}),f.jsx("option",{value:5e3,children:"5s"}),f.jsx("option",{value:1e4,children:"10s"})]})]}),f.jsx(Me,{variant:"primary",onClick:V,disabled:L,title:u("admin.refreshNow"),className:Ju,children:L?f.jsx(il,{}):u("admin.refreshNow")})]}):null]}),Q=_&&z&&!A&&!k,xe=_&&z&&(A||k)&&!O;return f.jsxs(SS,{tabs:U,activeTabId:b,onSelectTab:de=>v(de),tabsAriaLabel:u("header.mainNavigationAria"),toolbarStart:P,toolbarAside:le,hints:[...O?[{keys:"1–4",action:u("admin.hintTabs")},{keys:"r",action:u("admin.hintRefresh")}]:[],...l?[{keys:"esc",action:u("admin.hintBack")}]:[]],footerAside:J?f.jsx("span",{className:"text-tui-faint",children:u("admin.updatedAt",{time:J.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!_&&f.jsx("div",{className:"flex items-center justify-center gap-2 border border-tui-border bg-tui-base px-3 py-8 text-tui text-tui-muted",children:f.jsx(il,{label:u("admin.loadingStatus")})}),Q&&f.jsx(Y5,{wsUrl:o.wsUrl,adminUrl:ue,onOpenRemoteAdmin:()=>window.open(ue,"_blank","noopener,noreferrer"),onSignIn:()=>R(!0)}),xe&&f.jsx($5,{adminConfigured:$==null?void 0:$.adminConfigured,isAuthError:K,tokenInput:w,onTokenInput:x,onSubmit:ie,isSameOriginRelay:k,onBackToTerminal:l,showBack:a,onCancel:()=>R(!1)}),_&&!z&&K&&f.jsx(q5,{onOpenPairing:i,onRetry:V}),_&&D&&!K&&f.jsx(Mi,{tone:"warn",action:f.jsx(Me,{variant:"warn",onClick:V,children:u("common.retry")}),children:u("admin.errorConnecting",{error:D})}),O&&f.jsxs(f.Fragment,{children:[b==="overview"&&f.jsx(J5,{data:O}),b==="clients"&&f.jsx(X5,{clients:O.clients||[]}),b==="ptys"&&f.jsx(eM,{ptys:O.ptys||[]}),b==="devices"&&f.jsx(Q5,{devices:O.devices||[],clients:O.clients||[],onRevoke:X})]})]})},sM=({compact:l=!1})=>{const{t:i}=Le(),{role:a,connectionState:o,sharedWindowCount:r,assignedClientId:u}=et();if(!(o==="connected"))return f.jsxs("div",{className:"inline-flex select-none items-center gap-1.5 text-tui uppercase text-tui-faint",role:"status","aria-label":i("terminal.offlineStatusAria"),children:[f.jsx(Bt,{level:"idle"}),f.jsx("span",{children:i("common.offline")})]});const p=a==="controller",m=r>1,g=f.jsxs("div",{className:ne("inline-flex min-w-0 select-none items-center gap-1.5 text-tui uppercase",p?"text-tui-ok":"text-tui-warn"),role:"status","aria-label":i(p?"role.controllerMode":"role.viewerMode"),children:[f.jsx(Bt,{level:p?"ok":"warn"}),f.jsx("span",{className:"truncate",children:i(p?"role.sharedControl":"role.viewerReadOnly")}),m?f.jsx("span",{className:"shrink-0 normal-case text-tui-muted",children:i("role.sharedWindows",{count:r})}):null]});return l?g:f.jsxs("div",{className:"flex w-full flex-col gap-1",children:[g,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:i("role.sharedControlDesc")}),u?f.jsx(Ci,{label:i("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:f.jsx("span",{className:"truncate text-tui-muted",children:u})}):null]})},Qo="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Zo="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",oM="border-tui-accent bg-tui-selection text-tui-accent",Wo=({active:l=!1})=>f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",l?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:ke.cursor}),rM=({onClose:l,onOpenPairing:i,onOpenSettings:a,onAddProfile:o=()=>{}})=>{const{settings:r,updateSettings:u,language:h,setLanguage:p,t:m}=Le(),{connectionState:g,stateDetail:b,rttMs:v,hostId:w,connect:x}=et(),{addToast:T}=rn(),{copied:M,copy:A}=mr(),R=M!==null,k=pr(g,m),O=z=>()=>{var D;const L=document.activeElement;(D=L==null?void 0:L.blur)==null||D.call(L),z()},$=()=>A(r.clientId,m("toasts.clientIdCopied",{id:r.clientId}),"info"),_=()=>{const z=h==="zh"?"en":"zh";p(z),T("info",Cd(z,"toasts.switchedLanguage",{lang:z==="zh"?"简体中文":"English"}))};return f.jsxs("div",{className:"flex flex-col gap-3 px-3 pb-2 pt-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border pb-1.5",children:[f.jsx("h2",{className:"text-tui font-bold uppercase text-tui-accent",children:m("mobile.sessionControls")}),f.jsx(Me,{variant:"ghost",onClick:l,"aria-label":m("mobile.closeSessionControls"),children:"esc"})]}),f.jsx(Tt,{title:m("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:f.jsx(Ud,{mobile:!0,onAddProfile:o})}),f.jsxs(Tt,{title:m("common.status"),tone:k.level==="ok"?"ok":k.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(Bt,{level:k.level}),f.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:k.label}),g==="connected"&&v!==null&&f.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[v,"ms"]})]}),k.actionLabel&&f.jsx(Me,{variant:"primary",onClick:()=>x(),className:"shrink-0",children:k.actionLabel})]}),k.needsAttention&&b&&f.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:b}),w&&f.jsx(Ci,{label:m("common.host"),labelWidth:9,children:w}),f.jsxs("button",{type:"button",onClick:$,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:m("header.copyClientIdTitle"),children:[f.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:m("header.clientIdLabel")}),f.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:r.clientId}),f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",R?"text-tui-ok":"text-tui-faint"),children:R?ke.check:"⧉"})]})]}),f.jsx(Tt,{title:m("mobile.inputControl"),tone:"accent","aria-label":m("mobile.terminalControlAria"),children:f.jsx(sM,{})}),f.jsxs(Tt,{title:m("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[f.jsxs("button",{type:"button",onClick:_,className:ne(Qo,Zo),"aria-label":m("header.languageToggleTitle"),children:[f.jsx(Wo,{}),f.jsx("span",{className:"truncate",children:h==="zh"?"English":"中文"})]}),f.jsxs("button",{type:"button",onClick:O(a),className:ne(Qo,Zo),"aria-label":m("mobile.settingsAria"),children:[f.jsx(Wo,{}),f.jsx("span",{className:"truncate",children:m("common.settings")})]}),f.jsxs("button",{type:"button",onClick:O(i),className:ne(Qo,Zo),"aria-label":m("mobile.pairingAria"),children:[f.jsx(Wo,{}),f.jsx("span",{className:"truncate",children:m("common.pairing")})]}),f.jsxs("button",{type:"button",onClick:()=>u({toolbarVisible:!r.toolbarVisible}),className:ne(Qo,r.toolbarVisible?oM:Zo),"aria-label":m("mobile.keybarAria"),"aria-pressed":r.toolbarVisible,children:[f.jsx(Wo,{active:r.toolbarVisible}),f.jsx("span",{className:"truncate",children:m("common.keyBar")}),f.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:r.toolbarVisible?"[x]":"[ ]"})]})]})]})},cM=({onAddProfile:l})=>{const{t:i}=Le(),{rttMs:a}=et();return f.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":i("mobile.statusBarAria"),className:"absolute inset-x-0 bottom-0 z-40 flex h-11 shrink-0 items-center gap-2 border-t border-tui-border bg-tui-mantle px-1 text-tui-sm",children:[f.jsx(Ud,{statusBar:!0,onAddProfile:l}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),f.jsx(Ky,{compact:!0}),f.jsx(Fy,{compact:!0}),f.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:i("header.latencyTitle"),children:[f.jsx("span",{className:"text-tui-faint",children:"RTT"}),f.jsx("span",{className:ne(a===null?"text-tui-faint":"text-tui-text"),children:a===null?"—":`${a}ms`})]})]})},uM=({onOpenPairing:l,onOpenSettings:i,onAddProfile:a=()=>{}})=>{const{t:o}=Le(),{connectionState:r,isController:u}=et(),[h,p]=C.useState(!1),m=C.useRef(null),g=C.useCallback(()=>p(!1),[]);C.useEffect(()=>{if(!h)return;const v=w=>{if(!(w.ctrlKey||w.altKey||w.metaKey)&&w.key==="Escape"){const x=w.target;x&&typeof x.closest=="function"&&!!x.closest("#terminal-container")||(w.stopPropagation(),w.preventDefault(),g())}};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[h,g]),C.useEffect(()=>{var v;h&&((v=m.current)==null||v.focus({preventScroll:!0}))},[h]);const b=pr(r,o);return f.jsxs(f.Fragment,{children:[f.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":o("mobile.sessionControls"),className:"pointer-events-none absolute inset-x-0 top-0 z-40 flex h-12 items-center justify-between gap-2 border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-sm text-tui-muted",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:"herdr"}),f.jsx(Rd,{className:"shrink-0"}),f.jsx(Bt,{level:b.level}),f.jsx("span",{className:"truncate uppercase",children:b.label})]}),f.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>p(!0),"aria-label":o("mobile.sessionControls"),"aria-expanded":h,"aria-haspopup":"dialog",className:ne("tui-focusable pointer-events-auto flex h-9 shrink-0 select-none items-center gap-1.5 border px-2 text-tui uppercase transition-colors",b.needsAttention?"border-tui-warn text-tui-warn":u?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!u&&!b.needsAttention&&f.jsx("span",{className:"max-w-[8rem] truncate",children:o("common.viewer")}),f.jsx("span",{"aria-hidden":"true",className:"text-tui",children:ke.chevronDown}),f.jsx("span",{"aria-hidden":"true",children:o("mobile.menu")})]})]}),h&&f.jsxs(f.Fragment,{children:[f.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:g,"aria-hidden":"true"}),f.jsx("div",{ref:m,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":o("mobile.sessionControls"),tabIndex:-1,className:"herdr-sheet absolute inset-x-0 bottom-0 z-50 max-h-[85%] overflow-y-auto border-t border-tui-border bg-tui-base pb-3 focus:outline-none",children:f.jsx(rM,{onClose:g,onOpenPairing:()=>{g(),l()},onOpenSettings:()=>{g(),i()},onAddProfile:()=>{g(),a()}})})]}),f.jsx(cM,{onAddProfile:a})]})},dM=()=>{const{activeProfile:l,t:i}=Le(),{herdrLaunch:a,startHerdr:o,hostname:r}=et();if(!a)return null;const u=r||(l==null?void 0:l.displayName)||i("herdrLaunch.thisHost"),h=a.phase==="failed";return f.jsx("div",{"data-testid":"herdr-start-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:f.jsx(Tt,{title:i(h?"herdrLaunch.failedTitle":"herdrLaunch.title"),tone:h?"bad":"warn",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":i("herdrLaunch.title"),children:a.phase==="starting"?f.jsxs("p",{className:"flex items-center gap-2 text-tui-text",role:"status",children:[f.jsx(il,{}),f.jsx("span",{children:i("herdrLaunch.starting",{host:u})})]}):f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:i("herdrLaunch.body",{host:u})}),h&&a.message?f.jsx(Mi,{tone:"bad",children:f.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap break-words font-mono text-tui-sm",children:a.message})}):null,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:i("herdrLaunch.scope")}),f.jsx("div",{className:"flex justify-end",children:f.jsx(Me,{variant:"primary",onClick:o,autoFocus:!0,children:i(h?"common.retry":"herdrLaunch.start")})})]})})})},Yy="--app-height",$y="--keyboard-inset",fM=80;function hM(){if(typeof window>"u")return{height:768,keyboardInset:0};const l=window.innerHeight||768,i=window.visualViewport;if(i&&typeof i.height=="number"&&i.height>0){const a=l-i.height-(i.offsetTop||0),o=a>=fM?Math.round(a):0;return{height:Math.round(i.height),keyboardInset:o}}return{height:l,keyboardInset:0}}function tb(l,i=hM()){return l.style.setProperty(Yy,`${i.height}px`),l.style.setProperty($y,`${i.keyboardInset}px`),i}function mM(l=typeof document<"u"?document.documentElement:null){if(!l||typeof window>"u")return()=>{};let i=null;const a=()=>{i=null,tb(l)},o=()=>{if(i===null){if(typeof requestAnimationFrame!="function"){a();return}i=requestAnimationFrame(a)}};tb(l);const r=window.visualViewport;return r==null||r.addEventListener("resize",o),r==null||r.addEventListener("scroll",o),window.addEventListener("resize",o),window.addEventListener("orientationchange",o),()=>{i!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(i),i=null),r==null||r.removeEventListener("resize",o),r==null||r.removeEventListener("scroll",o),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),l.style.removeProperty(Yy),l.style.removeProperty($y)}}const pM=900;function nb(){if(typeof window>"u")return!1;const l=Zl();return l<Md?!0:l<=pM}function gM(){const[l,i]=C.useState(nb);return C.useEffect(()=>{var r,u;const a=()=>{const h=nb();i(p=>p===h?p:h)};a();let o=null;try{o=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{o=null}return(r=o==null?void 0:o.addEventListener)==null||r.call(o,"change",a),window.addEventListener("resize",a),window.addEventListener("orientationchange",a),(u=window.visualViewport)==null||u.addEventListener("resize",a),()=>{var h,p;(h=o==null?void 0:o.removeEventListener)==null||h.call(o,"change",a),window.removeEventListener("resize",a),window.removeEventListener("orientationchange",a),(p=window.visualViewport)==null||p.removeEventListener("resize",a)}},[]),l}function bM(l){const i=l.target;if(!i)return!1;if(i.id==="terminal-container"||i.id==="terminal-frame"||i.id==="terminal-surface"||i.classList.contains("xterm-helper-textarea")||i.classList.contains("xterm")||i.closest("#terminal-container")||i.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const a=document.activeElement;if(a.id==="terminal-container"||a.classList.contains("xterm-helper-textarea")||a.closest("#terminal-container")||a.closest(".xterm"))return!0}return!1}function yM(l,i={}){if(typeof window>"u")return()=>{};const a=o=>{var r;o.ctrlKey||o.altKey||o.metaKey||o.key==="Escape"&&(i.isModalOpen||i.isSheetOpen)&&(bM(o)||(o.preventDefault(),o.stopPropagation(),(r=l.onCloseModals)==null||r.call(l)))};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}}function vM(){const[l,i]=C.useState("terminal"),[a,o]=C.useState(!1),[r,u]=C.useState(!1),[h,p]=C.useState(!1),[m,g]=C.useState(void 0),b=U=>{g(U),p(!0)},[v,w]=C.useState(!1),{updateSettings:x,addProfileAndConnect:T,settings:M}=Le(),{connectionState:A,stateDetail:R,stateCode:k,lastPairedAt:O}=et();C1();const $=gM();C.useEffect(()=>mM(),[]),C.useEffect(()=>{bb()},[]),C.useEffect(()=>{const U=a||h||v;if(U)return yM({onCloseModals:()=>{o(!1),p(!1),w(!1)}},{isModalOpen:U})},[a,h,v]),C.useEffect(()=>{var E;const U=()=>{const G=window.location.pathname,P=window.location.hash;i(G==="/admin"||P==="#admin"?"admin":"terminal")};U(),window.addEventListener("popstate",U),window.addEventListener("hashchange",U);try{const G=new URL(window.location.href),P=(E=G.searchParams.get("pairCode"))==null?void 0:E.toUpperCase();P&&Nd().token?T({wsUrl:on,pairCode:P}):P&&x({pairCode:P});let le=!1;if(G.searchParams.has("token")&&(G.searchParams.delete("token"),le=!0),G.searchParams.has("pairCode")&&(G.searchParams.delete("pairCode"),le=!0),le){const Q=G.searchParams.toString(),xe=G.pathname+(Q?`?${Q}`:"")+G.hash;window.history.replaceState({},"",xe)}}catch(G){console.warn("Failed to parse URL query params:",G)}return()=>{window.removeEventListener("popstate",U),window.removeEventListener("hashchange",U)}},[x,T]);const _=(U=!1)=>{u(U),o(!0)},z=()=>{o(!1),u(!1)},L=U=>{i(U),U==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},D=!M.token&&!M.pairCode&&A!=="connected",K=A==="error"&&(["auth_required","unauthorized","device_revoked"].includes(k||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(R||"")),J=D||K,[V,X]=C.useState(!J);C.useEffect(()=>{J||X(!0)},[J]),C.useEffect(()=>{O&&(o(!1),X(!0),i("terminal"))},[O]);const ie=l==="terminal"&&!J,ue=U=>({visibility:U?"visible":"hidden",opacity:U?1:0,pointerEvents:U?"auto":"none",zIndex:U?1:0});return f.jsxs("div",{"data-testid":"app-shell",style:$?{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:U=>{U.preventDefault(),U.stopPropagation()},children:[!$&&f.jsx(TS,{currentView:l,onNavigate:L,onOpenPairing:()=>_(!1),onOpenSettings:()=>b(),onToggleVirtualKeyboard:()=>w(!v),isVirtualKeyboardOpen:v}),!$&&!J&&f.jsx(MS,{}),f.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[V&&f.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${$?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:ue(ie),"aria-hidden":!ie,children:[f.jsx(d5,{isActive:ie}),!$&&f.jsx(E5,{isOpen:v,onClose:()=>w(!1)}),f.jsx(M5,{compact:$,onCustomize:()=>b("agentKeymaps")}),f.jsx(dM,{}),f.jsx(O5,{})]}),l==="terminal"&&J&&f.jsx("div",{"data-testid":"onboarding-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-10",children:f.jsx(h5,{onPairedSuccess:()=>{}})}),l==="admin"&&f.jsx("div",{"data-testid":"admin-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-20",children:f.jsx(aM,{onBackToTerminal:()=>L("terminal"),onOpenPairing:()=>_(!1),showBack:$})}),$&&ie&&f.jsx(uM,{onOpenPairing:()=>_(!1),onOpenSettings:()=>b(),onAddProfile:()=>_(!0)})]}),!$&&l!=="admin"&&f.jsx(G5,{onAddProfile:()=>_(!0)}),f.jsx(k5,{isOpen:a,isAddMode:r,onClose:z}),f.jsx(H5,{isOpen:h,initialTab:m,onClose:()=>p(!1),onOpenAdmin:()=>{p(!1),L("admin")}}),f.jsx(K5,{})]})}function xM(){return f.jsx(d1,{children:f.jsx(vM,{})})}const qy=document.getElementById("root");if(!qy)throw new Error("Root element not found");bx.createRoot(qy).render(f.jsx(Vn.StrictMode,{children:f.jsx(xM,{})}));