herdr-remote-relay 0.3.26 → 0.3.28

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.
Files changed (105) hide show
  1. package/dist/relay-server.d.ts +3 -0
  2. package/dist/relay-server.js +3 -1
  3. package/dist/server/http-api.d.ts +1 -0
  4. package/dist/server/http-api.js +12 -7
  5. package/dist/server/types.d.ts +2 -0
  6. package/package.json +1 -1
  7. package/web/dist/assets/index-BxVyQeOw.js +61 -0
  8. package/web/dist/assets/index-CI0UHcI0.css +32 -0
  9. package/web/dist/fonts/maple-mono/OFL.txt +93 -0
  10. package/web/dist/fonts/maple-mono/maple-mono-cjk-0-400.woff2 +0 -0
  11. package/web/dist/fonts/maple-mono/maple-mono-cjk-0-700.woff2 +0 -0
  12. package/web/dist/fonts/maple-mono/maple-mono-cjk-1-400.woff2 +0 -0
  13. package/web/dist/fonts/maple-mono/maple-mono-cjk-1-700.woff2 +0 -0
  14. package/web/dist/fonts/maple-mono/maple-mono-cjk-10-400.woff2 +0 -0
  15. package/web/dist/fonts/maple-mono/maple-mono-cjk-10-700.woff2 +0 -0
  16. package/web/dist/fonts/maple-mono/maple-mono-cjk-11-400.woff2 +0 -0
  17. package/web/dist/fonts/maple-mono/maple-mono-cjk-11-700.woff2 +0 -0
  18. package/web/dist/fonts/maple-mono/maple-mono-cjk-12-400.woff2 +0 -0
  19. package/web/dist/fonts/maple-mono/maple-mono-cjk-12-700.woff2 +0 -0
  20. package/web/dist/fonts/maple-mono/maple-mono-cjk-13-400.woff2 +0 -0
  21. package/web/dist/fonts/maple-mono/maple-mono-cjk-13-700.woff2 +0 -0
  22. package/web/dist/fonts/maple-mono/maple-mono-cjk-14-400.woff2 +0 -0
  23. package/web/dist/fonts/maple-mono/maple-mono-cjk-14-700.woff2 +0 -0
  24. package/web/dist/fonts/maple-mono/maple-mono-cjk-15-400.woff2 +0 -0
  25. package/web/dist/fonts/maple-mono/maple-mono-cjk-15-700.woff2 +0 -0
  26. package/web/dist/fonts/maple-mono/maple-mono-cjk-16-400.woff2 +0 -0
  27. package/web/dist/fonts/maple-mono/maple-mono-cjk-16-700.woff2 +0 -0
  28. package/web/dist/fonts/maple-mono/maple-mono-cjk-17-400.woff2 +0 -0
  29. package/web/dist/fonts/maple-mono/maple-mono-cjk-17-700.woff2 +0 -0
  30. package/web/dist/fonts/maple-mono/maple-mono-cjk-18-400.woff2 +0 -0
  31. package/web/dist/fonts/maple-mono/maple-mono-cjk-18-700.woff2 +0 -0
  32. package/web/dist/fonts/maple-mono/maple-mono-cjk-19-400.woff2 +0 -0
  33. package/web/dist/fonts/maple-mono/maple-mono-cjk-19-700.woff2 +0 -0
  34. package/web/dist/fonts/maple-mono/maple-mono-cjk-2-400.woff2 +0 -0
  35. package/web/dist/fonts/maple-mono/maple-mono-cjk-2-700.woff2 +0 -0
  36. package/web/dist/fonts/maple-mono/maple-mono-cjk-3-400.woff2 +0 -0
  37. package/web/dist/fonts/maple-mono/maple-mono-cjk-3-700.woff2 +0 -0
  38. package/web/dist/fonts/maple-mono/maple-mono-cjk-4-400.woff2 +0 -0
  39. package/web/dist/fonts/maple-mono/maple-mono-cjk-4-700.woff2 +0 -0
  40. package/web/dist/fonts/maple-mono/maple-mono-cjk-5-400.woff2 +0 -0
  41. package/web/dist/fonts/maple-mono/maple-mono-cjk-5-700.woff2 +0 -0
  42. package/web/dist/fonts/maple-mono/maple-mono-cjk-6-400.woff2 +0 -0
  43. package/web/dist/fonts/maple-mono/maple-mono-cjk-6-700.woff2 +0 -0
  44. package/web/dist/fonts/maple-mono/maple-mono-cjk-7-400.woff2 +0 -0
  45. package/web/dist/fonts/maple-mono/maple-mono-cjk-7-700.woff2 +0 -0
  46. package/web/dist/fonts/maple-mono/maple-mono-cjk-8-400.woff2 +0 -0
  47. package/web/dist/fonts/maple-mono/maple-mono-cjk-8-700.woff2 +0 -0
  48. package/web/dist/fonts/maple-mono/maple-mono-cjk-9-400.woff2 +0 -0
  49. package/web/dist/fonts/maple-mono/maple-mono-cjk-9-700.woff2 +0 -0
  50. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-0-400.woff2 +0 -0
  51. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-0-700.woff2 +0 -0
  52. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-1-400.woff2 +0 -0
  53. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-1-700.woff2 +0 -0
  54. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-10-400.woff2 +0 -0
  55. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-10-700.woff2 +0 -0
  56. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-11-400.woff2 +0 -0
  57. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-11-700.woff2 +0 -0
  58. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-12-400.woff2 +0 -0
  59. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-12-700.woff2 +0 -0
  60. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-13-400.woff2 +0 -0
  61. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-13-700.woff2 +0 -0
  62. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-14-400.woff2 +0 -0
  63. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-14-700.woff2 +0 -0
  64. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-2-400.woff2 +0 -0
  65. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-2-700.woff2 +0 -0
  66. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-3-400.woff2 +0 -0
  67. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-3-700.woff2 +0 -0
  68. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-4-400.woff2 +0 -0
  69. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-4-700.woff2 +0 -0
  70. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-5-400.woff2 +0 -0
  71. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-5-700.woff2 +0 -0
  72. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-6-400.woff2 +0 -0
  73. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-6-700.woff2 +0 -0
  74. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-7-400.woff2 +0 -0
  75. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-7-700.woff2 +0 -0
  76. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-8-400.woff2 +0 -0
  77. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-8-700.woff2 +0 -0
  78. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-9-400.woff2 +0 -0
  79. package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-9-700.woff2 +0 -0
  80. package/web/dist/fonts/maple-mono/maple-mono-icons-0-400.woff2 +0 -0
  81. package/web/dist/fonts/maple-mono/maple-mono-icons-1-400.woff2 +0 -0
  82. package/web/dist/fonts/maple-mono/maple-mono-icons-10-400.woff2 +0 -0
  83. package/web/dist/fonts/maple-mono/maple-mono-icons-11-400.woff2 +0 -0
  84. package/web/dist/fonts/maple-mono/maple-mono-icons-12-400.woff2 +0 -0
  85. package/web/dist/fonts/maple-mono/maple-mono-icons-13-400.woff2 +0 -0
  86. package/web/dist/fonts/maple-mono/maple-mono-icons-14-400.woff2 +0 -0
  87. package/web/dist/fonts/maple-mono/maple-mono-icons-15-400.woff2 +0 -0
  88. package/web/dist/fonts/maple-mono/maple-mono-icons-16-400.woff2 +0 -0
  89. package/web/dist/fonts/maple-mono/maple-mono-icons-17-400.woff2 +0 -0
  90. package/web/dist/fonts/maple-mono/maple-mono-icons-2-400.woff2 +0 -0
  91. package/web/dist/fonts/maple-mono/maple-mono-icons-3-400.woff2 +0 -0
  92. package/web/dist/fonts/maple-mono/maple-mono-icons-4-400.woff2 +0 -0
  93. package/web/dist/fonts/maple-mono/maple-mono-icons-5-400.woff2 +0 -0
  94. package/web/dist/fonts/maple-mono/maple-mono-icons-6-400.woff2 +0 -0
  95. package/web/dist/fonts/maple-mono/maple-mono-icons-7-400.woff2 +0 -0
  96. package/web/dist/fonts/maple-mono/maple-mono-icons-8-400.woff2 +0 -0
  97. package/web/dist/fonts/maple-mono/maple-mono-icons-9-400.woff2 +0 -0
  98. package/web/dist/fonts/maple-mono/maple-mono-latin-400.woff2 +0 -0
  99. package/web/dist/fonts/maple-mono/maple-mono-latin-700.woff2 +0 -0
  100. package/web/dist/fonts/maple-mono/maple-mono-symbols-400.woff2 +0 -0
  101. package/web/dist/fonts/maple-mono/maple-mono-symbols-700.woff2 +0 -0
  102. package/web/dist/fonts/maple-mono/maple-mono.css +992 -0
  103. package/web/dist/index.html +5 -2
  104. package/web/dist/assets/index-BeveQ9Di.js +0 -61
  105. package/web/dist/assets/index-XYYRsgSb.css +0 -32
@@ -0,0 +1,61 @@
1
+ var Lx=Object.defineProperty;var Rx=(l,n,a)=>n in l?Lx(l,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[n]=a;var $=(l,n,a)=>Rx(l,typeof n!="symbol"?n+"":n,a);import{r as Cb,g as Tb,a as Mb}from"./vendor-react-CYSfZuHu.js";import{r as jx,a as Ox}from"./vendor-xterm-BhCxil_4.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const c of r)if(c.type==="childList")for(const f of c.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function a(r){const c={};return r.integrity&&(c.integrity=r.integrity),r.referrerPolicy&&(c.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?c.credentials="include":r.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(r){if(r.ep)return;r.ep=!0;const c=a(r);fetch(r.href,c)}})();var Uu={exports:{}},cs={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Jp;function Dx(){if(Jp)return cs;Jp=1;var l=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function a(s,r,c){var f=null;if(c!==void 0&&(f=""+c),r.key!==void 0&&(f=""+r.key),"key"in r){c={};for(var m in r)m!=="key"&&(c[m]=r[m])}else c=r;return r=c.ref,{$$typeof:l,type:s,key:f,ref:r!==void 0?r:null,props:c}}return cs.Fragment=n,cs.jsx=a,cs.jsxs=a,cs}var eg;function zx(){return eg||(eg=1,Uu.exports=Dx()),Uu.exports}var h=zx(),M=Cb();const Jn=Tb(M);var Ku={exports:{}},us={},Iu={exports:{}},Fu={};/**
10
+ * @license React
11
+ * scheduler.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var tg;function Hx(){return tg||(tg=1,(function(l){function n(O,J){var I=O.length;O.push(J);e:for(;0<I;){var le=I-1>>>1,P=O[le];if(0<r(P,J))O[le]=J,O[I]=P,I=le;else break e}}function a(O){return O.length===0?null:O[0]}function s(O){if(O.length===0)return null;var J=O[0],I=O.pop();if(I!==J){O[0]=I;e:for(var le=0,P=O.length,fe=P>>>1;le<fe;){var ve=2*(le+1)-1,X=O[ve],ue=ve+1,oe=O[ue];if(0>r(X,I))ue<P&&0>r(oe,X)?(O[le]=oe,O[ue]=I,le=ue):(O[le]=X,O[ve]=I,le=ve);else if(ue<P&&0>r(oe,I))O[le]=oe,O[ue]=I,le=ue;else break e}}return J}function r(O,J){var I=O.sortIndex-J.sortIndex;return I!==0?I:O.id-J.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;l.unstable_now=function(){return c.now()}}else{var f=Date,m=f.now();l.unstable_now=function(){return f.now()-m}}var p=[],g=[],y=1,v=null,w=3,x=!1,S=!1,T=!1,A=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function B(O){for(var J=a(g);J!==null;){if(J.callback===null)s(g);else if(J.startTime<=O)s(g),J.sortIndex=J.expirationTime,n(p,J);else break;J=a(g)}}function L(O){if(T=!1,B(O),!S)if(a(p)!==null)S=!0,D||(D=!0,Z());else{var J=a(g);J!==null&&ce(L,J.startTime-O)}}var D=!1,R=-1,z=5,K=-1;function V(){return A?!0:!(l.unstable_now()-K<z)}function te(){if(A=!1,D){var O=l.unstable_now();K=O;var J=!0;try{e:{S=!1,T&&(T=!1,E(R),R=-1),x=!0;var I=w;try{t:{for(B(O),v=a(p);v!==null&&!(v.expirationTime>O&&V());){var le=v.callback;if(typeof le=="function"){v.callback=null,w=v.priorityLevel;var P=le(v.expirationTime<=O);if(O=l.unstable_now(),typeof P=="function"){v.callback=P,B(O),J=!0;break t}v===a(p)&&s(p),B(O)}else s(p);v=a(p)}if(v!==null)J=!0;else{var fe=a(g);fe!==null&&ce(L,fe.startTime-O),J=!1}}break e}finally{v=null,w=I,x=!1}J=void 0}}finally{J?Z():D=!1}}}var Z;if(typeof N=="function")Z=function(){N(te)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,re=ie.port2;ie.port1.onmessage=te,Z=function(){re.postMessage(null)}}else Z=function(){k(te,0)};function ce(O,J){R=k(function(){O(l.unstable_now())},J)}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(O){O.callback=null},l.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<O?Math.floor(1e3/O):5},l.unstable_getCurrentPriorityLevel=function(){return w},l.unstable_next=function(O){switch(w){case 1:case 2:case 3:var J=3;break;default:J=w}var I=w;w=J;try{return O()}finally{w=I}},l.unstable_requestPaint=function(){A=!0},l.unstable_runWithPriority=function(O,J){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var I=w;w=O;try{return J()}finally{w=I}},l.unstable_scheduleCallback=function(O,J,I){var le=l.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?le+I:le):I=le,O){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=I+P,O={id:y++,callback:J,priorityLevel:O,startTime:I,expirationTime:P,sortIndex:-1},I>le?(O.sortIndex=I,n(g,O),a(p)===null&&O===a(g)&&(T?(E(R),R=-1):T=!0,ce(L,I-le))):(O.sortIndex=P,n(p,O),S||x||(S=!0,D||(D=!0,Z()))),O},l.unstable_shouldYield=V,l.unstable_wrapCallback=function(O){var J=w;return function(){var I=w;w=J;try{return O.apply(this,arguments)}finally{w=I}}}})(Fu)),Fu}var ng;function Bx(){return ng||(ng=1,Iu.exports=Hx()),Iu.exports}/**
18
+ * @license React
19
+ * react-dom-client.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var ig;function Ux(){if(ig)return us;ig=1;var l=Bx(),n=Cb(),a=Mb();function s(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function f(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(c(e)!==e)throw Error(s(188))}function g(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(s(188));return t!==e?null:e}for(var i=e,o=t;;){var u=i.return;if(u===null)break;var d=u.alternate;if(d===null){if(o=u.return,o!==null){i=o;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===i)return p(u),e;if(d===o)return p(u),t;d=d.sibling}throw Error(s(188))}if(i.return!==o.return)i=u,o=d;else{for(var b=!1,C=u.child;C;){if(C===i){b=!0,i=u,o=d;break}if(C===o){b=!0,o=u,i=d;break}C=C.sibling}if(!b){for(C=d.child;C;){if(C===i){b=!0,i=d,o=u;break}if(C===o){b=!0,o=d,i=u;break}C=C.sibling}if(!b)throw Error(s(189))}}if(i.alternate!==o)throw Error(s(190))}if(i.tag!==3)throw Error(s(188));return i.stateNode.current===i?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,w=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),N=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),V=Symbol.for("react.memo_cache_sentinel"),te=Symbol.iterator;function Z(e){return e===null||typeof e!="object"?null:(e=te&&e[te]||e["@@iterator"],typeof e=="function"?e:null)}var ie=Symbol.for("react.client.reference");function re(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 T:return"Fragment";case k:return"Profiler";case A:return"StrictMode";case L:return"Suspense";case D:return"SuspenseList";case K:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case N:return e.displayName||"Context";case E:return(e._context.displayName||"Context")+".Consumer";case B:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case R:return t=e.displayName||null,t!==null?t:re(e.type)||"Memo";case z:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}var ce=Array.isArray,O=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},le=[],P=-1;function fe(e){return{current:e}}function ve(e){0>P||(e.current=le[P],le[P]=null,P--)}function X(e,t){P++,le[P]=e.current,e.current=t}var ue=fe(null),oe=fe(null),pe=fe(null),se=fe(null);function xe(e,t){switch(X(pe,t),X(oe,e),X(ue,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Sp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Sp(t),e=Cp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ve(ue),X(ue,e)}function ae(){ve(ue),ve(oe),ve(pe)}function we(e){e.memoizedState!==null&&X(se,e);var t=ue.current,i=Cp(t,e.type);t!==i&&(X(oe,e),X(ue,i))}function ke(e){oe.current===e&&(ve(ue),ve(oe)),se.current===e&&(ve(se),as._currentValue=I)}var Ie,tt;function Je(e){if(Ie===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ie=t&&t[1]||"",tt=-1<i.stack.indexOf(`
26
+ at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
27
+ `+Ie+e+tt}var Se=!1;function Me(e,t){if(!e||Se)return"";Se=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(t){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(q){var Y=q}Reflect.construct(e,[],ee)}else{try{ee.call()}catch(q){Y=q}e.call(ee.prototype)}}else{try{throw Error()}catch(q){Y=q}(ee=e())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(q){if(q&&Y&&typeof q.stack=="string")return[q.stack,Y.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=o.DetermineComponentFrameRoot(),b=d[0],C=d[1];if(b&&C){var _=b.split(`
28
+ `),G=C.split(`
29
+ `);for(u=o=0;o<_.length&&!_[o].includes("DetermineComponentFrameRoot");)o++;for(;u<G.length&&!G[u].includes("DetermineComponentFrameRoot");)u++;if(o===_.length||u===G.length)for(o=_.length-1,u=G.length-1;1<=o&&0<=u&&_[o]!==G[u];)u--;for(;1<=o&&0<=u;o--,u--)if(_[o]!==G[u]){if(o!==1||u!==1)do if(o--,u--,0>u||_[o]!==G[u]){var W=`
30
+ `+_[o].replace(" at new "," at ");return e.displayName&&W.includes("<anonymous>")&&(W=W.replace("<anonymous>",e.displayName)),W}while(1<=o&&0<=u);break}}}finally{Se=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?Je(i):""}function ot(e,t){switch(e.tag){case 26:case 27:case 5:return Je(e.type);case 16:return Je("Lazy");case 13:return e.child!==t&&t!==null?Je("Suspense Fallback"):Je("Suspense");case 19:return Je("SuspenseList");case 0:case 15:return Me(e.type,!1);case 11:return Me(e.type.render,!1);case 1:return Me(e.type,!0);case 31:return Je("Activity");default:return""}}function nt(e){try{var t="",i=null;do t+=ot(e,i),i=e,e=e.return;while(e);return t}catch(o){return`
31
+ Error generating stack: `+o.message+`
32
+ `+o.stack}}var bt=Object.prototype.hasOwnProperty,yn=l.unstable_scheduleCallback,vn=l.unstable_cancelCallback,Nn=l.unstable_shouldYield,qt=l.unstable_requestPaint,ut=l.unstable_now,_s=l.unstable_getCurrentPriorityLevel,pa=l.unstable_ImmediatePriority,ga=l.unstable_UserBlockingPriority,Di=l.unstable_NormalPriority,Ls=l.unstable_LowPriority,ba=l.unstable_IdlePriority,Rs=l.log,js=l.unstable_setDisableYieldValue,ti=null,Mt=null;function xn(e){if(typeof Rs=="function"&&js(e),Mt&&typeof Mt.setStrictMode=="function")try{Mt.setStrictMode(ti,e)}catch{}}var kt=Math.clz32?Math.clz32:qe,Os=Math.log,he=Math.LN2;function qe(e){return e>>>=0,e===0?32:31-(Os(e)/he|0)|0}var Nt=256,Kt=262144,ul=4194304;function _n(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 dl(e,t,i){var o=e.pendingLanes;if(o===0)return 0;var u=0,d=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var C=o&134217727;return C!==0?(o=C&~d,o!==0?u=_n(o):(b&=C,b!==0?u=_n(b):i||(i=C&~e,i!==0&&(u=_n(i))))):(C=o&~d,C!==0?u=_n(C):b!==0?u=_n(b):i||(i=o&~e,i!==0&&(u=_n(i)))),u===0?0:t!==0&&t!==u&&(t&d)===0&&(d=u&-u,i=t&-t,d>=i||d===32&&(i&4194048)!==0)?t:u}function ni(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ar(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ya(){var e=ul;return ul<<=1,(ul&62914560)===0&&(ul=4194304),e}function Er(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function va(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function v0(e,t,i,o,u,d){var b=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var C=e.entanglements,_=e.expirationTimes,G=e.hiddenUpdates;for(i=b&~i;0<i;){var W=31-kt(i),ee=1<<W;C[W]=0,_[W]=-1;var Y=G[W];if(Y!==null)for(G[W]=null,W=0;W<Y.length;W++){var q=Y[W];q!==null&&(q.lane&=-536870913)}i&=~ee}o!==0&&lf(e,o,0),d!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=d&~(b&~t))}function lf(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var o=31-kt(t);e.entangledLanes|=t,e.entanglements[o]=e.entanglements[o]|1073741824|i&261930}function af(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var o=31-kt(i),u=1<<o;u&t|e[o]&t&&(e[o]|=t),i&=~u}}function sf(e,t){var i=t&-t;return i=(i&42)!==0?1:kr(i),(i&(e.suspendedLanes|t))!==0?0:i}function kr(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 Nr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function of(){var e=J.p;return e!==0?e:(e=window.event,e===void 0?32:$p(e.type))}function rf(e,t){var i=J.p;try{return J.p=e,t()}finally{J.p=i}}var ii=Math.random().toString(36).slice(2),xt="__reactFiber$"+ii,Lt="__reactProps$"+ii,fl="__reactContainer$"+ii,_r="__reactEvents$"+ii,x0="__reactListeners$"+ii,w0="__reactHandles$"+ii,cf="__reactResources$"+ii,xa="__reactMarker$"+ii;function Lr(e){delete e[xt],delete e[Lt],delete e[_r],delete e[x0],delete e[w0]}function hl(e){var t=e[xt];if(t)return t;for(var i=e.parentNode;i;){if(t=i[fl]||i[xt]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=_p(e);e!==null;){if(i=e[xt])return i;e=_p(e)}return t}e=i,i=e.parentNode}return null}function ml(e){if(e=e[xt]||e[fl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function wa(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function pl(e){var t=e[cf];return t||(t=e[cf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function yt(e){e[xa]=!0}var uf=new Set,df={};function zi(e,t){gl(e,t),gl(e+"Capture",t)}function gl(e,t){for(df[e]=t,e=0;e<t.length;e++)uf.add(t[e])}var S0=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),ff={},hf={};function C0(e){return bt.call(hf,e)?!0:bt.call(ff,e)?!1:S0.test(e)?hf[e]=!0:(ff[e]=!0,!1)}function Ds(e,t,i){if(C0(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var o=t.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function zs(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function Ln(e,t,i,o){if(o===null)e.removeAttribute(i);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+o)}}function Xt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function T0(e,t,i){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,d=o.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(b){i=""+b,d.call(this,b)}}),Object.defineProperty(e,t,{enumerable:o.enumerable}),{getValue:function(){return i},setValue:function(b){i=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Rr(e){if(!e._valueTracker){var t=mf(e)?"checked":"value";e._valueTracker=T0(e,t,""+e[t])}}function pf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),o="";return e&&(o=mf(e)?e.checked?"true":"false":e.value),e=o,e!==i?(t.setValue(e),!0):!1}function Hs(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var M0=/[\n"\\]/g;function Zt(e){return e.replace(M0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function jr(e,t,i,o,u,d,b,C){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Xt(t)):e.value!==""+Xt(t)&&(e.value=""+Xt(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?Or(e,b,Xt(t)):i!=null?Or(e,b,Xt(i)):o!=null&&e.removeAttribute("value"),u==null&&d!=null&&(e.defaultChecked=!!d),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?e.name=""+Xt(C):e.removeAttribute("name")}function gf(e,t,i,o,u,d,b,C){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||i!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){Rr(e);return}i=i!=null?""+Xt(i):"",t=t!=null?""+Xt(t):i,C||t===e.value||(e.value=t),e.defaultValue=t}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=C?e.checked:!!o,e.defaultChecked=!!o,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),Rr(e)}function Or(e,t,i){t==="number"&&Hs(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function bl(e,t,i,o){if(e=e.options,t){t={};for(var u=0;u<i.length;u++)t["$"+i[u]]=!0;for(i=0;i<e.length;i++)u=t.hasOwnProperty("$"+e[i].value),e[i].selected!==u&&(e[i].selected=u),u&&o&&(e[i].defaultSelected=!0)}else{for(i=""+Xt(i),t=null,u=0;u<e.length;u++){if(e[u].value===i){e[u].selected=!0,o&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function bf(e,t,i){if(t!=null&&(t=""+Xt(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+Xt(i):""}function yf(e,t,i,o){if(t==null){if(o!=null){if(i!=null)throw Error(s(92));if(ce(o)){if(1<o.length)throw Error(s(93));o=o[0]}i=o}i==null&&(i=""),t=i}i=Xt(t),e.defaultValue=i,o=e.textContent,o===i&&o!==""&&o!==null&&(e.value=o),Rr(e)}function yl(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var A0=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function vf(e,t,i){var o=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?o?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":o?e.setProperty(t,i):typeof i!="number"||i===0||A0.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function xf(e,t,i){if(t!=null&&typeof t!="object")throw Error(s(62));if(e=e.style,i!=null){for(var o in i)!i.hasOwnProperty(o)||t!=null&&t.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var u in t)o=t[u],t.hasOwnProperty(u)&&i[u]!==o&&vf(e,u,o)}else for(var d in t)t.hasOwnProperty(d)&&vf(e,d,t[d])}function Dr(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 E0=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"]]),k0=/^[\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 Bs(e){return k0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Rn(){}var zr=null;function Hr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vl=null,xl=null;function wf(e){var t=ml(e);if(t&&(e=t.stateNode)){var i=e[Lt]||null;e:switch(e=t.stateNode,t.type){case"input":if(jr(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Zt(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var o=i[t];if(o!==e&&o.form===e.form){var u=o[Lt]||null;if(!u)throw Error(s(90));jr(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<i.length;t++)o=i[t],o.form===e.form&&pf(o)}break e;case"textarea":bf(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&bl(e,!!i.multiple,t,!1)}}}var Br=!1;function Sf(e,t,i){if(Br)return e(t,i);Br=!0;try{var o=e(t);return o}finally{if(Br=!1,(vl!==null||xl!==null)&&(Ao(),vl&&(t=vl,e=xl,xl=vl=null,wf(t),e)))for(t=0;t<e.length;t++)wf(e[t])}}function Sa(e,t){var i=e.stateNode;if(i===null)return null;var o=i[Lt]||null;if(o===null)return null;i=o[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(s(231,t,typeof i));return i}var jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ur=!1;if(jn)try{var Ca={};Object.defineProperty(Ca,"passive",{get:function(){Ur=!0}}),window.addEventListener("test",Ca,Ca),window.removeEventListener("test",Ca,Ca)}catch{Ur=!1}var li=null,Kr=null,Us=null;function Cf(){if(Us)return Us;var e,t=Kr,i=t.length,o,u="value"in li?li.value:li.textContent,d=u.length;for(e=0;e<i&&t[e]===u[e];e++);var b=i-e;for(o=1;o<=b&&t[i-o]===u[d-o];o++);return Us=u.slice(e,1<o?1-o:void 0)}function Ks(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 Is(){return!0}function Tf(){return!1}function Rt(e){function t(i,o,u,d,b){this._reactName=i,this._targetInst=u,this.type=o,this.nativeEvent=d,this.target=b,this.currentTarget=null;for(var C in e)e.hasOwnProperty(C)&&(i=e[C],this[C]=i?i(d):d[C]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Is:Tf,this.isPropagationStopped=Tf,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Is)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Is)},persist:function(){},isPersistent:Is}),t}var Hi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Fs=Rt(Hi),Ta=v({},Hi,{view:0,detail:0}),N0=Rt(Ta),Ir,Fr,Ma,Gs=v({},Ta,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yr,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"?(Ir=e.screenX-Ma.screenX,Fr=e.screenY-Ma.screenY):Fr=Ir=0,Ma=e),Ir)},movementY:function(e){return"movementY"in e?e.movementY:Fr}}),Mf=Rt(Gs),_0=v({},Gs,{dataTransfer:0}),L0=Rt(_0),R0=v({},Ta,{relatedTarget:0}),Gr=Rt(R0),j0=v({},Hi,{animationName:0,elapsedTime:0,pseudoElement:0}),O0=Rt(j0),D0=v({},Hi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),z0=Rt(D0),H0=v({},Hi,{data:0}),Af=Rt(H0),B0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},U0={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"},K0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function I0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=K0[e])?!!t[e]:!1}function Yr(){return I0}var F0=v({},Ta,{key:function(e){if(e.key){var t=B0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ks(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?U0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yr,charCode:function(e){return e.type==="keypress"?Ks(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ks(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),G0=Rt(F0),Y0=v({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ef=Rt(Y0),P0=v({},Ta,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yr}),$0=Rt(P0),V0=v({},Hi,{propertyName:0,elapsedTime:0,pseudoElement:0}),q0=Rt(V0),X0=v({},Gs,{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}),Z0=Rt(X0),W0=v({},Hi,{newState:0,oldState:0}),Q0=Rt(W0),J0=[9,13,27,32],Pr=jn&&"CompositionEvent"in window,Aa=null;jn&&"documentMode"in document&&(Aa=document.documentMode);var ev=jn&&"TextEvent"in window&&!Aa,kf=jn&&(!Pr||Aa&&8<Aa&&11>=Aa),Nf=" ",_f=!1;function Lf(e,t){switch(e){case"keyup":return J0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var wl=!1;function tv(e,t){switch(e){case"compositionend":return Rf(t);case"keypress":return t.which!==32?null:(_f=!0,Nf);case"textInput":return e=t.data,e===Nf&&_f?null:e;default:return null}}function nv(e,t){if(wl)return e==="compositionend"||!Pr&&Lf(e,t)?(e=Cf(),Us=Kr=li=null,wl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return kf&&t.locale!=="ko"?null:t.data;default:return null}}var iv={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function jf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!iv[e.type]:t==="textarea"}function Of(e,t,i,o){vl?xl?xl.push(o):xl=[o]:vl=o,t=jo(t,"onChange"),0<t.length&&(i=new Fs("onChange","change",null,i,o),e.push({event:i,listeners:t}))}var Ea=null,ka=null;function lv(e){gp(e,0)}function Ys(e){var t=wa(e);if(pf(t))return e}function Df(e,t){if(e==="change")return t}var zf=!1;if(jn){var $r;if(jn){var Vr="oninput"in document;if(!Vr){var Hf=document.createElement("div");Hf.setAttribute("oninput","return;"),Vr=typeof Hf.oninput=="function"}$r=Vr}else $r=!1;zf=$r&&(!document.documentMode||9<document.documentMode)}function Bf(){Ea&&(Ea.detachEvent("onpropertychange",Uf),ka=Ea=null)}function Uf(e){if(e.propertyName==="value"&&Ys(ka)){var t=[];Of(t,ka,e,Hr(e)),Sf(lv,t)}}function av(e,t,i){e==="focusin"?(Bf(),Ea=t,ka=i,Ea.attachEvent("onpropertychange",Uf)):e==="focusout"&&Bf()}function sv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ys(ka)}function ov(e,t){if(e==="click")return Ys(t)}function rv(e,t){if(e==="input"||e==="change")return Ys(t)}function cv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var It=typeof Object.is=="function"?Object.is:cv;function Na(e,t){if(It(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(o=0;o<i.length;o++){var u=i[o];if(!bt.call(t,u)||!It(e[u],t[u]))return!1}return!0}function Kf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function If(e,t){var i=Kf(e);e=0;for(var o;i;){if(i.nodeType===3){if(o=e+i.textContent.length,e<=t&&o>=t)return{node:i,offset:t-e};e=o}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Kf(i)}}function Ff(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ff(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Hs(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Hs(e.document)}return t}function qr(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 uv=jn&&"documentMode"in document&&11>=document.documentMode,Sl=null,Xr=null,_a=null,Zr=!1;function Yf(e,t,i){var o=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Zr||Sl==null||Sl!==Hs(o)||(o=Sl,"selectionStart"in o&&qr(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),_a&&Na(_a,o)||(_a=o,o=jo(Xr,"onSelect"),0<o.length&&(t=new Fs("onSelect","select",null,t,i),e.push({event:t,listeners:o}),t.target=Sl)))}function Bi(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Cl={animationend:Bi("Animation","AnimationEnd"),animationiteration:Bi("Animation","AnimationIteration"),animationstart:Bi("Animation","AnimationStart"),transitionrun:Bi("Transition","TransitionRun"),transitionstart:Bi("Transition","TransitionStart"),transitioncancel:Bi("Transition","TransitionCancel"),transitionend:Bi("Transition","TransitionEnd")},Wr={},Pf={};jn&&(Pf=document.createElement("div").style,"AnimationEvent"in window||(delete Cl.animationend.animation,delete Cl.animationiteration.animation,delete Cl.animationstart.animation),"TransitionEvent"in window||delete Cl.transitionend.transition);function Ui(e){if(Wr[e])return Wr[e];if(!Cl[e])return e;var t=Cl[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Pf)return Wr[e]=t[i];return e}var $f=Ui("animationend"),Vf=Ui("animationiteration"),qf=Ui("animationstart"),dv=Ui("transitionrun"),fv=Ui("transitionstart"),hv=Ui("transitioncancel"),Xf=Ui("transitionend"),Zf=new Map,Qr="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(" ");Qr.push("scrollEnd");function fn(e,t){Zf.set(e,t),zi(t,[e])}var Ps=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)},Wt=[],Tl=0,Jr=0;function $s(){for(var e=Tl,t=Jr=Tl=0;t<e;){var i=Wt[t];Wt[t++]=null;var o=Wt[t];Wt[t++]=null;var u=Wt[t];Wt[t++]=null;var d=Wt[t];if(Wt[t++]=null,o!==null&&u!==null){var b=o.pending;b===null?u.next=u:(u.next=b.next,b.next=u),o.pending=u}d!==0&&Wf(i,u,d)}}function Vs(e,t,i,o){Wt[Tl++]=e,Wt[Tl++]=t,Wt[Tl++]=i,Wt[Tl++]=o,Jr|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function ec(e,t,i,o){return Vs(e,t,i,o),qs(e)}function Ki(e,t){return Vs(e,null,null,t),qs(e)}function Wf(e,t,i){e.lanes|=i;var o=e.alternate;o!==null&&(o.lanes|=i);for(var u=!1,d=e.return;d!==null;)d.childLanes|=i,o=d.alternate,o!==null&&(o.childLanes|=i),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(u=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,u&&t!==null&&(u=31-kt(i),e=d.hiddenUpdates,o=e[u],o===null?e[u]=[t]:o.push(t),t.lane=i|536870912),d):null}function qs(e){if(50<Qa)throw Qa=0,cu=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ml={};function mv(e,t,i,o){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ft(e,t,i,o){return new mv(e,t,i,o)}function tc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function On(e,t){var i=e.alternate;return i===null?(i=Ft(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Qf(e,t){e.flags&=65011714;var i=e.alternate;return i===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=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Xs(e,t,i,o,u,d){var b=0;if(o=e,typeof e=="function")tc(e)&&(b=1);else if(typeof e=="string")b=vx(e,i,ue.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case K:return e=Ft(31,i,t,u),e.elementType=K,e.lanes=d,e;case T:return Ii(i.children,u,d,t);case A:b=8,u|=24;break;case k:return e=Ft(12,i,t,u|2),e.elementType=k,e.lanes=d,e;case L:return e=Ft(13,i,t,u),e.elementType=L,e.lanes=d,e;case D:return e=Ft(19,i,t,u),e.elementType=D,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case N:b=10;break e;case E:b=9;break e;case B:b=11;break e;case R:b=14;break e;case z:b=16,o=null;break e}b=29,i=Error(s(130,e===null?"null":typeof e,"")),o=null}return t=Ft(b,i,t,u),t.elementType=e,t.type=o,t.lanes=d,t}function Ii(e,t,i,o){return e=Ft(7,e,o,t),e.lanes=i,e}function nc(e,t,i){return e=Ft(6,e,null,t),e.lanes=i,e}function Jf(e){var t=Ft(18,null,null,0);return t.stateNode=e,t}function ic(e,t,i){return t=Ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var eh=new WeakMap;function Qt(e,t){if(typeof e=="object"&&e!==null){var i=eh.get(e);return i!==void 0?i:(t={value:e,source:t,stack:nt(t)},eh.set(e,t),t)}return{value:e,source:t,stack:nt(t)}}var Al=[],El=0,Zs=null,La=0,Jt=[],en=0,ai=null,wn=1,Sn="";function Dn(e,t){Al[El++]=La,Al[El++]=Zs,Zs=e,La=t}function th(e,t,i){Jt[en++]=wn,Jt[en++]=Sn,Jt[en++]=ai,ai=e;var o=wn;e=Sn;var u=32-kt(o)-1;o&=~(1<<u),i+=1;var d=32-kt(t)+u;if(30<d){var b=u-u%5;d=(o&(1<<b)-1).toString(32),o>>=b,u-=b,wn=1<<32-kt(t)+u|i<<u|o,Sn=d+e}else wn=1<<d|i<<u|o,Sn=e}function lc(e){e.return!==null&&(Dn(e,1),th(e,1,0))}function ac(e){for(;e===Zs;)Zs=Al[--El],Al[El]=null,La=Al[--El],Al[El]=null;for(;e===ai;)ai=Jt[--en],Jt[en]=null,Sn=Jt[--en],Jt[en]=null,wn=Jt[--en],Jt[en]=null}function nh(e,t){Jt[en++]=wn,Jt[en++]=Sn,Jt[en++]=ai,wn=t.id,Sn=t.overflow,ai=e}var wt=null,Xe=null,He=!1,si=null,tn=!1,sc=Error(s(519));function oi(e){var t=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ra(Qt(t,e)),sc}function ih(e){var t=e.stateNode,i=e.type,o=e.memoizedProps;switch(t[xt]=e,t[Lt]=o,i){case"dialog":Oe("cancel",t),Oe("close",t);break;case"iframe":case"object":case"embed":Oe("load",t);break;case"video":case"audio":for(i=0;i<es.length;i++)Oe(es[i],t);break;case"source":Oe("error",t);break;case"img":case"image":case"link":Oe("error",t),Oe("load",t);break;case"details":Oe("toggle",t);break;case"input":Oe("invalid",t),gf(t,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Oe("invalid",t);break;case"textarea":Oe("invalid",t),yf(t,o.value,o.defaultValue,o.children)}i=o.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||o.suppressHydrationWarning===!0||xp(t.textContent,i)?(o.popover!=null&&(Oe("beforetoggle",t),Oe("toggle",t)),o.onScroll!=null&&Oe("scroll",t),o.onScrollEnd!=null&&Oe("scrollend",t),o.onClick!=null&&(t.onclick=Rn),t=!0):t=!1,t||oi(e,!0)}function lh(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:tn=!1;return;case 27:case 3:tn=!0;return;default:wt=wt.return}}function kl(e){if(e!==wt)return!1;if(!He)return lh(e),He=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Tu(e.type,e.memoizedProps)),i=!i),i&&Xe&&oi(e),lh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Xe=Np(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Xe=Np(e)}else t===27?(t=Xe,wi(e.type)?(e=Nu,Nu=null,Xe=e):Xe=t):Xe=wt?ln(e.stateNode.nextSibling):null;return!0}function Fi(){Xe=wt=null,He=!1}function oc(){var e=si;return e!==null&&(zt===null?zt=e:zt.push.apply(zt,e),si=null),e}function Ra(e){si===null?si=[e]:si.push(e)}var rc=fe(null),Gi=null,zn=null;function ri(e,t,i){X(rc,t._currentValue),t._currentValue=i}function Hn(e){e._currentValue=rc.current,ve(rc)}function cc(e,t,i){for(;e!==null;){var o=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,o!==null&&(o.childLanes|=t)):o!==null&&(o.childLanes&t)!==t&&(o.childLanes|=t),e===i)break;e=e.return}}function uc(e,t,i,o){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var d=u.dependencies;if(d!==null){var b=u.child;d=d.firstContext;e:for(;d!==null;){var C=d;d=u;for(var _=0;_<t.length;_++)if(C.context===t[_]){d.lanes|=i,C=d.alternate,C!==null&&(C.lanes|=i),cc(d.return,i,e),o||(b=null);break e}d=C.next}}else if(u.tag===18){if(b=u.return,b===null)throw Error(s(341));b.lanes|=i,d=b.alternate,d!==null&&(d.lanes|=i),cc(b,i,e),b=null}else b=u.child;if(b!==null)b.return=u;else for(b=u;b!==null;){if(b===e){b=null;break}if(u=b.sibling,u!==null){u.return=b.return,b=u;break}b=b.return}u=b}}function Nl(e,t,i,o){e=null;for(var u=t,d=!1;u!==null;){if(!d){if((u.flags&524288)!==0)d=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var b=u.alternate;if(b===null)throw Error(s(387));if(b=b.memoizedProps,b!==null){var C=u.type;It(u.pendingProps.value,b.value)||(e!==null?e.push(C):e=[C])}}else if(u===se.current){if(b=u.alternate,b===null)throw Error(s(387));b.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(as):e=[as])}u=u.return}e!==null&&uc(t,e,i,o),t.flags|=262144}function Ws(e){for(e=e.firstContext;e!==null;){if(!It(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Yi(e){Gi=e,zn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return ah(Gi,e)}function Qs(e,t){return Gi===null&&Yi(e),ah(e,t)}function ah(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},zn===null){if(e===null)throw Error(s(308));zn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else zn=zn.next=t;return i}var pv=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,o){e.push(o)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},gv=l.unstable_scheduleCallback,bv=l.unstable_NormalPriority,dt={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function dc(){return{controller:new pv,data:new Map,refCount:0}}function ja(e){e.refCount--,e.refCount===0&&gv(bv,function(){e.controller.abort()})}var Oa=null,fc=0,_l=0,Ll=null;function yv(e,t){if(Oa===null){var i=Oa=[];fc=0,_l=pu(),Ll={status:"pending",value:void 0,then:function(o){i.push(o)}}}return fc++,t.then(sh,sh),t}function sh(){if(--fc===0&&Oa!==null){Ll!==null&&(Ll.status="fulfilled");var e=Oa;Oa=null,_l=0,Ll=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function vv(e,t){var i=[],o={status:"pending",value:null,reason:null,then:function(u){i.push(u)}};return e.then(function(){o.status="fulfilled",o.value=t;for(var u=0;u<i.length;u++)(0,i[u])(t)},function(u){for(o.status="rejected",o.reason=u,u=0;u<i.length;u++)(0,i[u])(void 0)}),o}var oh=O.S;O.S=function(e,t){Ym=ut(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&yv(e,t),oh!==null&&oh(e,t)};var Pi=fe(null);function hc(){var e=Pi.current;return e!==null?e:Ve.pooledCache}function Js(e,t){t===null?X(Pi,Pi.current):X(Pi,t.pool)}function rh(){var e=hc();return e===null?null:{parent:dt._currentValue,pool:e}}var Rl=Error(s(460)),mc=Error(s(474)),eo=Error(s(542)),to={then:function(){}};function ch(e){return e=e.status,e==="fulfilled"||e==="rejected"}function uh(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Rn,Rn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fh(e),e;default:if(typeof t.status=="string")t.then(Rn,Rn);else{if(e=Ve,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status="pending",e.then(function(o){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=o}},function(o){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=o}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fh(e),e}throw Vi=t,Rl}}function $i(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Vi=i,Rl):i}}var Vi=null;function dh(){if(Vi===null)throw Error(s(459));var e=Vi;return Vi=null,e}function fh(e){if(e===Rl||e===eo)throw Error(s(483))}var jl=null,Da=0;function no(e){var t=Da;return Da+=1,jl===null&&(jl=[]),uh(jl,e,t)}function za(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function io(e,t){throw t.$$typeof===w?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function hh(e){function t(U,j){if(e){var F=U.deletions;F===null?(U.deletions=[j],U.flags|=16):F.push(j)}}function i(U,j){if(!e)return null;for(;j!==null;)t(U,j),j=j.sibling;return null}function o(U){for(var j=new Map;U!==null;)U.key!==null?j.set(U.key,U):j.set(U.index,U),U=U.sibling;return j}function u(U,j){return U=On(U,j),U.index=0,U.sibling=null,U}function d(U,j,F){return U.index=F,e?(F=U.alternate,F!==null?(F=F.index,F<j?(U.flags|=67108866,j):F):(U.flags|=67108866,j)):(U.flags|=1048576,j)}function b(U){return e&&U.alternate===null&&(U.flags|=67108866),U}function C(U,j,F,Q){return j===null||j.tag!==6?(j=nc(F,U.mode,Q),j.return=U,j):(j=u(j,F),j.return=U,j)}function _(U,j,F,Q){var Ce=F.type;return Ce===T?W(U,j,F.props.children,Q,F.key):j!==null&&(j.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===z&&$i(Ce)===j.type)?(j=u(j,F.props),za(j,F),j.return=U,j):(j=Xs(F.type,F.key,F.props,null,U.mode,Q),za(j,F),j.return=U,j)}function G(U,j,F,Q){return j===null||j.tag!==4||j.stateNode.containerInfo!==F.containerInfo||j.stateNode.implementation!==F.implementation?(j=ic(F,U.mode,Q),j.return=U,j):(j=u(j,F.children||[]),j.return=U,j)}function W(U,j,F,Q,Ce){return j===null||j.tag!==7?(j=Ii(F,U.mode,Q,Ce),j.return=U,j):(j=u(j,F),j.return=U,j)}function ee(U,j,F){if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return j=nc(""+j,U.mode,F),j.return=U,j;if(typeof j=="object"&&j!==null){switch(j.$$typeof){case x:return F=Xs(j.type,j.key,j.props,null,U.mode,F),za(F,j),F.return=U,F;case S:return j=ic(j,U.mode,F),j.return=U,j;case z:return j=$i(j),ee(U,j,F)}if(ce(j)||Z(j))return j=Ii(j,U.mode,F,null),j.return=U,j;if(typeof j.then=="function")return ee(U,no(j),F);if(j.$$typeof===N)return ee(U,Qs(U,j),F);io(U,j)}return null}function Y(U,j,F,Q){var Ce=j!==null?j.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return Ce!==null?null:C(U,j,""+F,Q);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case x:return F.key===Ce?_(U,j,F,Q):null;case S:return F.key===Ce?G(U,j,F,Q):null;case z:return F=$i(F),Y(U,j,F,Q)}if(ce(F)||Z(F))return Ce!==null?null:W(U,j,F,Q,null);if(typeof F.then=="function")return Y(U,j,no(F),Q);if(F.$$typeof===N)return Y(U,j,Qs(U,F),Q);io(U,F)}return null}function q(U,j,F,Q,Ce){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return U=U.get(F)||null,C(j,U,""+Q,Ce);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case x:return U=U.get(Q.key===null?F:Q.key)||null,_(j,U,Q,Ce);case S:return U=U.get(Q.key===null?F:Q.key)||null,G(j,U,Q,Ce);case z:return Q=$i(Q),q(U,j,F,Q,Ce)}if(ce(Q)||Z(Q))return U=U.get(F)||null,W(j,U,Q,Ce,null);if(typeof Q.then=="function")return q(U,j,F,no(Q),Ce);if(Q.$$typeof===N)return q(U,j,F,Qs(j,Q),Ce);io(j,Q)}return null}function be(U,j,F,Q){for(var Ce=null,Be=null,ye=j,Le=j=0,ze=null;ye!==null&&Le<F.length;Le++){ye.index>Le?(ze=ye,ye=null):ze=ye.sibling;var Ue=Y(U,ye,F[Le],Q);if(Ue===null){ye===null&&(ye=ze);break}e&&ye&&Ue.alternate===null&&t(U,ye),j=d(Ue,j,Le),Be===null?Ce=Ue:Be.sibling=Ue,Be=Ue,ye=ze}if(Le===F.length)return i(U,ye),He&&Dn(U,Le),Ce;if(ye===null){for(;Le<F.length;Le++)ye=ee(U,F[Le],Q),ye!==null&&(j=d(ye,j,Le),Be===null?Ce=ye:Be.sibling=ye,Be=ye);return He&&Dn(U,Le),Ce}for(ye=o(ye);Le<F.length;Le++)ze=q(ye,U,Le,F[Le],Q),ze!==null&&(e&&ze.alternate!==null&&ye.delete(ze.key===null?Le:ze.key),j=d(ze,j,Le),Be===null?Ce=ze:Be.sibling=ze,Be=ze);return e&&ye.forEach(function(Ai){return t(U,Ai)}),He&&Dn(U,Le),Ce}function Te(U,j,F,Q){if(F==null)throw Error(s(151));for(var Ce=null,Be=null,ye=j,Le=j=0,ze=null,Ue=F.next();ye!==null&&!Ue.done;Le++,Ue=F.next()){ye.index>Le?(ze=ye,ye=null):ze=ye.sibling;var Ai=Y(U,ye,Ue.value,Q);if(Ai===null){ye===null&&(ye=ze);break}e&&ye&&Ai.alternate===null&&t(U,ye),j=d(Ai,j,Le),Be===null?Ce=Ai:Be.sibling=Ai,Be=Ai,ye=ze}if(Ue.done)return i(U,ye),He&&Dn(U,Le),Ce;if(ye===null){for(;!Ue.done;Le++,Ue=F.next())Ue=ee(U,Ue.value,Q),Ue!==null&&(j=d(Ue,j,Le),Be===null?Ce=Ue:Be.sibling=Ue,Be=Ue);return He&&Dn(U,Le),Ce}for(ye=o(ye);!Ue.done;Le++,Ue=F.next())Ue=q(ye,U,Le,Ue.value,Q),Ue!==null&&(e&&Ue.alternate!==null&&ye.delete(Ue.key===null?Le:Ue.key),j=d(Ue,j,Le),Be===null?Ce=Ue:Be.sibling=Ue,Be=Ue);return e&&ye.forEach(function(_x){return t(U,_x)}),He&&Dn(U,Le),Ce}function $e(U,j,F,Q){if(typeof F=="object"&&F!==null&&F.type===T&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case x:e:{for(var Ce=F.key;j!==null;){if(j.key===Ce){if(Ce=F.type,Ce===T){if(j.tag===7){i(U,j.sibling),Q=u(j,F.props.children),Q.return=U,U=Q;break e}}else if(j.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===z&&$i(Ce)===j.type){i(U,j.sibling),Q=u(j,F.props),za(Q,F),Q.return=U,U=Q;break e}i(U,j);break}else t(U,j);j=j.sibling}F.type===T?(Q=Ii(F.props.children,U.mode,Q,F.key),Q.return=U,U=Q):(Q=Xs(F.type,F.key,F.props,null,U.mode,Q),za(Q,F),Q.return=U,U=Q)}return b(U);case S:e:{for(Ce=F.key;j!==null;){if(j.key===Ce)if(j.tag===4&&j.stateNode.containerInfo===F.containerInfo&&j.stateNode.implementation===F.implementation){i(U,j.sibling),Q=u(j,F.children||[]),Q.return=U,U=Q;break e}else{i(U,j);break}else t(U,j);j=j.sibling}Q=ic(F,U.mode,Q),Q.return=U,U=Q}return b(U);case z:return F=$i(F),$e(U,j,F,Q)}if(ce(F))return be(U,j,F,Q);if(Z(F)){if(Ce=Z(F),typeof Ce!="function")throw Error(s(150));return F=Ce.call(F),Te(U,j,F,Q)}if(typeof F.then=="function")return $e(U,j,no(F),Q);if(F.$$typeof===N)return $e(U,j,Qs(U,F),Q);io(U,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,j!==null&&j.tag===6?(i(U,j.sibling),Q=u(j,F),Q.return=U,U=Q):(i(U,j),Q=nc(F,U.mode,Q),Q.return=U,U=Q),b(U)):i(U,j)}return function(U,j,F,Q){try{Da=0;var Ce=$e(U,j,F,Q);return jl=null,Ce}catch(ye){if(ye===Rl||ye===eo)throw ye;var Be=Ft(29,ye,null,U.mode);return Be.lanes=Q,Be.return=U,Be}finally{}}}var qi=hh(!0),mh=hh(!1),ci=!1;function pc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gc(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 ui(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function di(e,t,i){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Ke&2)!==0){var u=o.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),o.pending=t,t=qs(e),Wf(e,null,i),t}return Vs(e,o,t,i),qs(e)}function Ha(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var o=t.lanes;o&=e.pendingLanes,i|=o,t.lanes=i,af(e,i)}}function bc(e,t){var i=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,i===o)){var u=null,d=null;if(i=i.firstBaseUpdate,i!==null){do{var b={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};d===null?u=d=b:d=d.next=b,i=i.next}while(i!==null);d===null?u=d=t:d=d.next=t}else u=d=t;i={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:d,shared:o.shared,callbacks:o.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var yc=!1;function Ba(){if(yc){var e=Ll;if(e!==null)throw e}}function Ua(e,t,i,o){yc=!1;var u=e.updateQueue;ci=!1;var d=u.firstBaseUpdate,b=u.lastBaseUpdate,C=u.shared.pending;if(C!==null){u.shared.pending=null;var _=C,G=_.next;_.next=null,b===null?d=G:b.next=G,b=_;var W=e.alternate;W!==null&&(W=W.updateQueue,C=W.lastBaseUpdate,C!==b&&(C===null?W.firstBaseUpdate=G:C.next=G,W.lastBaseUpdate=_))}if(d!==null){var ee=u.baseState;b=0,W=G=_=null,C=d;do{var Y=C.lane&-536870913,q=Y!==C.lane;if(q?(De&Y)===Y:(o&Y)===Y){Y!==0&&Y===_l&&(yc=!0),W!==null&&(W=W.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var be=e,Te=C;Y=t;var $e=i;switch(Te.tag){case 1:if(be=Te.payload,typeof be=="function"){ee=be.call($e,ee,Y);break e}ee=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Te.payload,Y=typeof be=="function"?be.call($e,ee,Y):be,Y==null)break e;ee=v({},ee,Y);break e;case 2:ci=!0}}Y=C.callback,Y!==null&&(e.flags|=64,q&&(e.flags|=8192),q=u.callbacks,q===null?u.callbacks=[Y]:q.push(Y))}else q={lane:Y,tag:C.tag,payload:C.payload,callback:C.callback,next:null},W===null?(G=W=q,_=ee):W=W.next=q,b|=Y;if(C=C.next,C===null){if(C=u.shared.pending,C===null)break;q=C,C=q.next,q.next=null,u.lastBaseUpdate=q,u.shared.pending=null}}while(!0);W===null&&(_=ee),u.baseState=_,u.firstBaseUpdate=G,u.lastBaseUpdate=W,d===null&&(u.shared.lanes=0),gi|=b,e.lanes=b,e.memoizedState=ee}}function ph(e,t){if(typeof e!="function")throw Error(s(191,e));e.call(t)}function gh(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)ph(i[e],t)}var Ol=fe(null),lo=fe(0);function bh(e,t){e=$n,X(lo,e),X(Ol,t),$n=e|t.baseLanes}function vc(){X(lo,$n),X(Ol,Ol.current)}function xc(){$n=lo.current,ve(Ol),ve(lo)}var Gt=fe(null),nn=null;function fi(e){var t=e.alternate;X(rt,rt.current&1),X(Gt,e),nn===null&&(t===null||Ol.current!==null||t.memoizedState!==null)&&(nn=e)}function wc(e){X(rt,rt.current),X(Gt,e),nn===null&&(nn=e)}function yh(e){e.tag===22?(X(rt,rt.current),X(Gt,e),nn===null&&(nn=e)):hi()}function hi(){X(rt,rt.current),X(Gt,Gt.current)}function Yt(e){ve(Gt),nn===e&&(nn=null),ve(rt)}var rt=fe(0);function ao(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Eu(i)||ku(i)))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 Bn=0,Ne=null,Ye=null,ft=null,so=!1,Dl=!1,Xi=!1,oo=0,Ka=0,zl=null,xv=0;function lt(){throw Error(s(321))}function Sc(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!It(e[i],t[i]))return!1;return!0}function Cc(e,t,i,o,u,d){return Bn=d,Ne=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,O.H=e===null||e.memoizedState===null?tm:Bc,Xi=!1,d=i(o,u),Xi=!1,Dl&&(d=xh(t,i,o,u)),vh(e),d}function vh(e){O.H=Ga;var t=Ye!==null&&Ye.next!==null;if(Bn=0,ft=Ye=Ne=null,so=!1,Ka=0,zl=null,t)throw Error(s(300));e===null||ht||(e=e.dependencies,e!==null&&Ws(e)&&(ht=!0))}function xh(e,t,i,o){Ne=e;var u=0;do{if(Dl&&(zl=null),Ka=0,Dl=!1,25<=u)throw Error(s(301));if(u+=1,ft=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)}O.H=nm,d=t(i,o)}while(Dl);return d}function wv(){var e=O.H,t=e.useState()[0];return t=typeof t.then=="function"?Ia(t):t,e=e.useState()[0],(Ye!==null?Ye.memoizedState:null)!==e&&(Ne.flags|=1024),t}function Tc(){var e=oo!==0;return oo=0,e}function Mc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Ac(e){if(so){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}so=!1}Bn=0,ft=Ye=Ne=null,Dl=!1,Ka=oo=0,zl=null}function _t(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ft===null?Ne.memoizedState=ft=e:ft=ft.next=e,ft}function ct(){if(Ye===null){var e=Ne.alternate;e=e!==null?e.memoizedState:null}else e=Ye.next;var t=ft===null?Ne.memoizedState:ft.next;if(t!==null)ft=t,Ye=e;else{if(e===null)throw Ne.alternate===null?Error(s(467)):Error(s(310));Ye=e,e={memoizedState:Ye.memoizedState,baseState:Ye.baseState,baseQueue:Ye.baseQueue,queue:Ye.queue,next:null},ft===null?Ne.memoizedState=ft=e:ft=ft.next=e}return ft}function ro(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ia(e){var t=Ka;return Ka+=1,zl===null&&(zl=[]),e=uh(zl,e,t),t=Ne,(ft===null?t.memoizedState:ft.next)===null&&(t=t.alternate,O.H=t===null||t.memoizedState===null?tm:Bc),e}function co(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ia(e);if(e.$$typeof===N)return St(e)}throw Error(s(438,String(e)))}function Ec(e){var t=null,i=Ne.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var o=Ne.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(t={data:o.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=ro(),Ne.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),o=0;o<e;o++)i[o]=V;return t.index++,i}function Un(e,t){return typeof t=="function"?t(e):t}function uo(e){var t=ct();return kc(t,Ye,e)}function kc(e,t,i){var o=e.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=i;var u=e.baseQueue,d=o.pending;if(d!==null){if(u!==null){var b=u.next;u.next=d.next,d.next=b}t.baseQueue=u=d,o.pending=null}if(d=e.baseState,u===null)e.memoizedState=d;else{t=u.next;var C=b=null,_=null,G=t,W=!1;do{var ee=G.lane&-536870913;if(ee!==G.lane?(De&ee)===ee:(Bn&ee)===ee){var Y=G.revertLane;if(Y===0)_!==null&&(_=_.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),ee===_l&&(W=!0);else if((Bn&Y)===Y){G=G.next,Y===_l&&(W=!0);continue}else ee={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},_===null?(C=_=ee,b=d):_=_.next=ee,Ne.lanes|=Y,gi|=Y;ee=G.action,Xi&&i(d,ee),d=G.hasEagerState?G.eagerState:i(d,ee)}else Y={lane:ee,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},_===null?(C=_=Y,b=d):_=_.next=Y,Ne.lanes|=ee,gi|=ee;G=G.next}while(G!==null&&G!==t);if(_===null?b=d:_.next=C,!It(d,e.memoizedState)&&(ht=!0,W&&(i=Ll,i!==null)))throw i;e.memoizedState=d,e.baseState=b,e.baseQueue=_,o.lastRenderedState=d}return u===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Nc(e){var t=ct(),i=t.queue;if(i===null)throw Error(s(311));i.lastRenderedReducer=e;var o=i.dispatch,u=i.pending,d=t.memoizedState;if(u!==null){i.pending=null;var b=u=u.next;do d=e(d,b.action),b=b.next;while(b!==u);It(d,t.memoizedState)||(ht=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),i.lastRenderedState=d}return[d,o]}function wh(e,t,i){var o=Ne,u=ct(),d=He;if(d){if(i===void 0)throw Error(s(407));i=i()}else i=t();var b=!It((Ye||u).memoizedState,i);if(b&&(u.memoizedState=i,ht=!0),u=u.queue,Rc(Th.bind(null,o,u,e),[e]),u.getSnapshot!==t||b||ft!==null&&ft.memoizedState.tag&1){if(o.flags|=2048,Hl(9,{destroy:void 0},Ch.bind(null,o,u,i,t),null),Ve===null)throw Error(s(349));d||(Bn&127)!==0||Sh(o,t,i)}return i}function Sh(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Ne.updateQueue,t===null?(t=ro(),Ne.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function Ch(e,t,i,o){t.value=i,t.getSnapshot=o,Mh(t)&&Ah(e)}function Th(e,t,i){return i(function(){Mh(t)&&Ah(e)})}function Mh(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!It(e,i)}catch{return!0}}function Ah(e){var t=Ki(e,2);t!==null&&Ht(t,e,2)}function _c(e){var t=_t();if(typeof e=="function"){var i=e;if(e=i(),Xi){xn(!0);try{i()}finally{xn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Un,lastRenderedState:e},t}function Eh(e,t,i,o){return e.baseState=i,kc(e,Ye,typeof o=="function"?o:Un)}function Sv(e,t,i,o,u){if(mo(e))throw Error(s(485));if(e=t.action,e!==null){var d={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){d.listeners.push(b)}};O.T!==null?i(!0):d.isTransition=!1,o(d),i=t.pending,i===null?(d.next=t.pending=d,kh(t,d)):(d.next=i.next,t.pending=i.next=d)}}function kh(e,t){var i=t.action,o=t.payload,u=e.state;if(t.isTransition){var d=O.T,b={};O.T=b;try{var C=i(u,o),_=O.S;_!==null&&_(b,C),Nh(e,t,C)}catch(G){Lc(e,t,G)}finally{d!==null&&b.types!==null&&(d.types=b.types),O.T=d}}else try{d=i(u,o),Nh(e,t,d)}catch(G){Lc(e,t,G)}}function Nh(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(o){_h(e,t,o)},function(o){return Lc(e,t,o)}):_h(e,t,i)}function _h(e,t,i){t.status="fulfilled",t.value=i,Lh(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,kh(e,i)))}function Lc(e,t,i){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do t.status="rejected",t.reason=i,Lh(t),t=t.next;while(t!==o)}e.action=null}function Lh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Rh(e,t){return t}function jh(e,t){if(He){var i=Ve.formState;if(i!==null){e:{var o=Ne;if(He){if(Xe){t:{for(var u=Xe,d=tn;u.nodeType!==8;){if(!d){u=null;break t}if(u=ln(u.nextSibling),u===null){u=null;break t}}d=u.data,u=d==="F!"||d==="F"?u:null}if(u){Xe=ln(u.nextSibling),o=u.data==="F!";break e}}oi(o)}o=!1}o&&(t=i[0])}}return i=_t(),i.memoizedState=i.baseState=t,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rh,lastRenderedState:t},i.queue=o,i=Qh.bind(null,Ne,o),o.dispatch=i,o=_c(!1),d=Hc.bind(null,Ne,!1,o.queue),o=_t(),u={state:t,dispatch:null,action:e,pending:null},o.queue=u,i=Sv.bind(null,Ne,u,d,i),u.dispatch=i,o.memoizedState=e,[t,i,!1]}function Oh(e){var t=ct();return Dh(t,Ye,e)}function Dh(e,t,i){if(t=kc(e,t,Rh)[0],e=uo(Un)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var o=Ia(t)}catch(b){throw b===Rl?eo:b}else o=t;t=ct();var u=t.queue,d=u.dispatch;return i!==t.memoizedState&&(Ne.flags|=2048,Hl(9,{destroy:void 0},Cv.bind(null,u,i),null)),[o,d,e]}function Cv(e,t){e.action=t}function zh(e){var t=ct(),i=Ye;if(i!==null)return Dh(t,i,e);ct(),t=t.memoizedState,i=ct();var o=i.queue.dispatch;return i.memoizedState=e,[t,o,!1]}function Hl(e,t,i,o){return e={tag:e,create:i,deps:o,inst:t,next:null},t=Ne.updateQueue,t===null&&(t=ro(),Ne.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(o=i.next,i.next=e,e.next=o,t.lastEffect=e),e}function Hh(){return ct().memoizedState}function fo(e,t,i,o){var u=_t();Ne.flags|=e,u.memoizedState=Hl(1|t,{destroy:void 0},i,o===void 0?null:o)}function ho(e,t,i,o){var u=ct();o=o===void 0?null:o;var d=u.memoizedState.inst;Ye!==null&&o!==null&&Sc(o,Ye.memoizedState.deps)?u.memoizedState=Hl(t,d,i,o):(Ne.flags|=e,u.memoizedState=Hl(1|t,d,i,o))}function Bh(e,t){fo(8390656,8,e,t)}function Rc(e,t){ho(2048,8,e,t)}function Tv(e){Ne.flags|=4;var t=Ne.updateQueue;if(t===null)t=ro(),Ne.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Uh(e){var t=ct().memoizedState;return Tv({ref:t,nextImpl:e}),function(){if((Ke&2)!==0)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function Kh(e,t){return ho(4,2,e,t)}function Ih(e,t){return ho(4,4,e,t)}function Fh(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Gh(e,t,i){i=i!=null?i.concat([e]):null,ho(4,4,Fh.bind(null,t,e),i)}function jc(){}function Yh(e,t){var i=ct();t=t===void 0?null:t;var o=i.memoizedState;return t!==null&&Sc(t,o[1])?o[0]:(i.memoizedState=[e,t],e)}function Ph(e,t){var i=ct();t=t===void 0?null:t;var o=i.memoizedState;if(t!==null&&Sc(t,o[1]))return o[0];if(o=e(),Xi){xn(!0);try{e()}finally{xn(!1)}}return i.memoizedState=[o,t],o}function Oc(e,t,i){return i===void 0||(Bn&1073741824)!==0&&(De&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=$m(),Ne.lanes|=e,gi|=e,i)}function $h(e,t,i,o){return It(i,t)?i:Ol.current!==null?(e=Oc(e,i,o),It(e,t)||(ht=!0),e):(Bn&42)===0||(Bn&1073741824)!==0&&(De&261930)===0?(ht=!0,e.memoizedState=i):(e=$m(),Ne.lanes|=e,gi|=e,t)}function Vh(e,t,i,o,u){var d=J.p;J.p=d!==0&&8>d?d:8;var b=O.T,C={};O.T=C,Hc(e,!1,t,i);try{var _=u(),G=O.S;if(G!==null&&G(C,_),_!==null&&typeof _=="object"&&typeof _.then=="function"){var W=vv(_,o);Fa(e,t,W,Vt(e))}else Fa(e,t,o,Vt(e))}catch(ee){Fa(e,t,{then:function(){},status:"rejected",reason:ee},Vt())}finally{J.p=d,b!==null&&C.types!==null&&(b.types=C.types),O.T=b}}function Mv(){}function Dc(e,t,i,o){if(e.tag!==5)throw Error(s(476));var u=qh(e).queue;Vh(e,u,t,I,i===null?Mv:function(){return Xh(e),i(o)})}function qh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Un,lastRenderedState:I},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Un,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Xh(e){var t=qh(e);t.next===null&&(t=e.alternate.memoizedState),Fa(e,t.next.queue,{},Vt())}function zc(){return St(as)}function Zh(){return ct().memoizedState}function Wh(){return ct().memoizedState}function Av(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Vt();e=ui(i);var o=di(t,e,i);o!==null&&(Ht(o,t,i),Ha(o,t,i)),t={cache:dc()},e.payload=t;return}t=t.return}}function Ev(e,t,i){var o=Vt();i={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},mo(e)?Jh(t,i):(i=ec(e,t,i,o),i!==null&&(Ht(i,e,o),em(i,t,o)))}function Qh(e,t,i){var o=Vt();Fa(e,t,i,o)}function Fa(e,t,i,o){var u={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(mo(e))Jh(t,u);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var b=t.lastRenderedState,C=d(b,i);if(u.hasEagerState=!0,u.eagerState=C,It(C,b))return Vs(e,t,u,0),Ve===null&&$s(),!1}catch{}finally{}if(i=ec(e,t,u,o),i!==null)return Ht(i,e,o),em(i,t,o),!0}return!1}function Hc(e,t,i,o){if(o={lane:2,revertLane:pu(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},mo(e)){if(t)throw Error(s(479))}else t=ec(e,i,o,2),t!==null&&Ht(t,e,2)}function mo(e){var t=e.alternate;return e===Ne||t!==null&&t===Ne}function Jh(e,t){Dl=so=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function em(e,t,i){if((i&4194048)!==0){var o=t.lanes;o&=e.pendingLanes,i|=o,t.lanes=i,af(e,i)}}var Ga={readContext:St,use:co,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};Ga.useEffectEvent=lt;var tm={readContext:St,use:co,useCallback:function(e,t){return _t().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Bh,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,fo(4194308,4,Fh.bind(null,t,e),i)},useLayoutEffect:function(e,t){return fo(4194308,4,e,t)},useInsertionEffect:function(e,t){fo(4,2,e,t)},useMemo:function(e,t){var i=_t();t=t===void 0?null:t;var o=e();if(Xi){xn(!0);try{e()}finally{xn(!1)}}return i.memoizedState=[o,t],o},useReducer:function(e,t,i){var o=_t();if(i!==void 0){var u=i(t);if(Xi){xn(!0);try{i(t)}finally{xn(!1)}}}else u=t;return o.memoizedState=o.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},o.queue=e,e=e.dispatch=Ev.bind(null,Ne,e),[o.memoizedState,e]},useRef:function(e){var t=_t();return e={current:e},t.memoizedState=e},useState:function(e){e=_c(e);var t=e.queue,i=Qh.bind(null,Ne,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:jc,useDeferredValue:function(e,t){var i=_t();return Oc(i,e,t)},useTransition:function(){var e=_c(!1);return e=Vh.bind(null,Ne,e.queue,!0,!1),_t().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var o=Ne,u=_t();if(He){if(i===void 0)throw Error(s(407));i=i()}else{if(i=t(),Ve===null)throw Error(s(349));(De&127)!==0||Sh(o,t,i)}u.memoizedState=i;var d={value:i,getSnapshot:t};return u.queue=d,Bh(Th.bind(null,o,d,e),[e]),o.flags|=2048,Hl(9,{destroy:void 0},Ch.bind(null,o,d,i,t),null),i},useId:function(){var e=_t(),t=Ve.identifierPrefix;if(He){var i=Sn,o=wn;i=(o&~(1<<32-kt(o)-1)).toString(32)+i,t="_"+t+"R_"+i,i=oo++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=xv++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:zc,useFormState:jh,useActionState:jh,useOptimistic:function(e){var t=_t();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=Hc.bind(null,Ne,!0,i),i.dispatch=t,[e,t]},useMemoCache:Ec,useCacheRefresh:function(){return _t().memoizedState=Av.bind(null,Ne)},useEffectEvent:function(e){var t=_t(),i={impl:e};return t.memoizedState=i,function(){if((Ke&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}},Bc={readContext:St,use:co,useCallback:Yh,useContext:St,useEffect:Rc,useImperativeHandle:Gh,useInsertionEffect:Kh,useLayoutEffect:Ih,useMemo:Ph,useReducer:uo,useRef:Hh,useState:function(){return uo(Un)},useDebugValue:jc,useDeferredValue:function(e,t){var i=ct();return $h(i,Ye.memoizedState,e,t)},useTransition:function(){var e=uo(Un)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:Ia(e),t]},useSyncExternalStore:wh,useId:Zh,useHostTransitionStatus:zc,useFormState:Oh,useActionState:Oh,useOptimistic:function(e,t){var i=ct();return Eh(i,Ye,e,t)},useMemoCache:Ec,useCacheRefresh:Wh};Bc.useEffectEvent=Uh;var nm={readContext:St,use:co,useCallback:Yh,useContext:St,useEffect:Rc,useImperativeHandle:Gh,useInsertionEffect:Kh,useLayoutEffect:Ih,useMemo:Ph,useReducer:Nc,useRef:Hh,useState:function(){return Nc(Un)},useDebugValue:jc,useDeferredValue:function(e,t){var i=ct();return Ye===null?Oc(i,e,t):$h(i,Ye.memoizedState,e,t)},useTransition:function(){var e=Nc(Un)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:Ia(e),t]},useSyncExternalStore:wh,useId:Zh,useHostTransitionStatus:zc,useFormState:zh,useActionState:zh,useOptimistic:function(e,t){var i=ct();return Ye!==null?Eh(i,Ye,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Ec,useCacheRefresh:Wh};nm.useEffectEvent=Uh;function Uc(e,t,i,o){t=e.memoizedState,i=i(o,t),i=i==null?t:v({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Kc={enqueueSetState:function(e,t,i){e=e._reactInternals;var o=Vt(),u=ui(o);u.payload=t,i!=null&&(u.callback=i),t=di(e,u,o),t!==null&&(Ht(t,e,o),Ha(t,e,o))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var o=Vt(),u=ui(o);u.tag=1,u.payload=t,i!=null&&(u.callback=i),t=di(e,u,o),t!==null&&(Ht(t,e,o),Ha(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Vt(),o=ui(i);o.tag=2,t!=null&&(o.callback=t),t=di(e,o,i),t!==null&&(Ht(t,e,i),Ha(t,e,i))}};function im(e,t,i,o,u,d,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,d,b):t.prototype&&t.prototype.isPureReactComponent?!Na(i,o)||!Na(u,d):!0}function lm(e,t,i,o){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,o),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,o),t.state!==e&&Kc.enqueueReplaceState(t,t.state,null)}function Zi(e,t){var i=t;if("ref"in t){i={};for(var o in t)o!=="ref"&&(i[o]=t[o])}if(e=e.defaultProps){i===t&&(i=v({},i));for(var u in e)i[u]===void 0&&(i[u]=e[u])}return i}function am(e){Ps(e)}function sm(e){console.error(e)}function om(e){Ps(e)}function po(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(o){setTimeout(function(){throw o})}}function rm(e,t,i){try{var o=e.onCaughtError;o(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Ic(e,t,i){return i=ui(i),i.tag=3,i.payload={element:null},i.callback=function(){po(e,t)},i}function cm(e){return e=ui(e),e.tag=3,e}function um(e,t,i,o){var u=i.type.getDerivedStateFromError;if(typeof u=="function"){var d=o.value;e.payload=function(){return u(d)},e.callback=function(){rm(t,i,o)}}var b=i.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){rm(t,i,o),typeof u!="function"&&(bi===null?bi=new Set([this]):bi.add(this));var C=o.stack;this.componentDidCatch(o.value,{componentStack:C!==null?C:""})})}function kv(e,t,i,o,u){if(i.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(t=i.alternate,t!==null&&Nl(t,i,u,!0),i=Gt.current,i!==null){switch(i.tag){case 31:case 13:return nn===null?Eo():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=u,o===to?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([o]):t.add(o),fu(e,o,u)),!1;case 22:return i.flags|=65536,o===to?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([o])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([o]):i.add(o)),fu(e,o,u)),!1}throw Error(s(435,i.tag))}return fu(e,o,u),Eo(),!1}if(He)return t=Gt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,o!==sc&&(e=Error(s(422),{cause:o}),Ra(Qt(e,i)))):(o!==sc&&(t=Error(s(423),{cause:o}),Ra(Qt(t,i))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,o=Qt(o,i),u=Ic(e.stateNode,o,u),bc(e,u),at!==4&&(at=2)),!1;var d=Error(s(520),{cause:o});if(d=Qt(d,i),Wa===null?Wa=[d]:Wa.push(d),at!==4&&(at=2),t===null)return!0;o=Qt(o,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=u&-u,i.lanes|=e,e=Ic(i.stateNode,o,e),bc(i,e),!1;case 1:if(t=i.type,d=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(bi===null||!bi.has(d))))return i.flags|=65536,u&=-u,i.lanes|=u,u=cm(u),um(u,e,i,o),bc(i,u),!1}i=i.return}while(i!==null);return!1}var Fc=Error(s(461)),ht=!1;function Ct(e,t,i,o){t.child=e===null?mh(t,null,i,o):qi(t,e.child,i,o)}function dm(e,t,i,o,u){i=i.render;var d=t.ref;if("ref"in o){var b={};for(var C in o)C!=="ref"&&(b[C]=o[C])}else b=o;return Yi(t),o=Cc(e,t,i,b,d,u),C=Tc(),e!==null&&!ht?(Mc(e,t,u),Kn(e,t,u)):(He&&C&&lc(t),t.flags|=1,Ct(e,t,o,u),t.child)}function fm(e,t,i,o,u){if(e===null){var d=i.type;return typeof d=="function"&&!tc(d)&&d.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=d,hm(e,t,d,o,u)):(e=Xs(i.type,null,o,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Zc(e,u)){var b=d.memoizedProps;if(i=i.compare,i=i!==null?i:Na,i(b,o)&&e.ref===t.ref)return Kn(e,t,u)}return t.flags|=1,e=On(d,o),e.ref=t.ref,e.return=t,t.child=e}function hm(e,t,i,o,u){if(e!==null){var d=e.memoizedProps;if(Na(d,o)&&e.ref===t.ref)if(ht=!1,t.pendingProps=o=d,Zc(e,u))(e.flags&131072)!==0&&(ht=!0);else return t.lanes=e.lanes,Kn(e,t,u)}return Gc(e,t,i,o,u)}function mm(e,t,i,o){var u=o.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|i:i,e!==null){for(o=t.child=e.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~d}else o=0,t.child=null;return pm(e,t,d,i,o)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Js(t,d!==null?d.cachePool:null),d!==null?bh(t,d):vc(),yh(t);else return o=t.lanes=536870912,pm(e,t,d!==null?d.baseLanes|i:i,i,o)}else d!==null?(Js(t,d.cachePool),bh(t,d),hi(),t.memoizedState=null):(e!==null&&Js(t,null),vc(),hi());return Ct(e,t,u,i),t.child}function Ya(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function pm(e,t,i,o,u){var d=hc();return d=d===null?null:{parent:dt._currentValue,pool:d},t.memoizedState={baseLanes:i,cachePool:d},e!==null&&Js(t,null),vc(),yh(t),e!==null&&Nl(e,t,o,!0),t.childLanes=u,null}function go(e,t){return t=yo({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function gm(e,t,i){return qi(t,e.child,null,i),e=go(t,t.pendingProps),e.flags|=2,Yt(t),t.memoizedState=null,e}function Nv(e,t,i){var o=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(He){if(o.mode==="hidden")return e=go(t,o),t.lanes=536870912,Ya(null,e);if(wc(t),(e=Xe)?(e=kp(e,tn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ai!==null?{id:wn,overflow:Sn}:null,retryLane:536870912,hydrationErrors:null},i=Jf(e),i.return=t,t.child=i,wt=t,Xe=null)):e=null,e===null)throw oi(t);return t.lanes=536870912,null}return go(t,o)}var d=e.memoizedState;if(d!==null){var b=d.dehydrated;if(wc(t),u)if(t.flags&256)t.flags&=-257,t=gm(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558));else if(ht||Nl(e,t,i,!1),u=(i&e.childLanes)!==0,ht||u){if(o=Ve,o!==null&&(b=sf(o,i),b!==0&&b!==d.retryLane))throw d.retryLane=b,Ki(e,b),Ht(o,e,b),Fc;Eo(),t=gm(e,t,i)}else e=d.treeContext,Xe=ln(b.nextSibling),wt=t,He=!0,si=null,tn=!1,e!==null&&nh(t,e),t=go(t,o),t.flags|=4096;return t}return e=On(e.child,{mode:o.mode,children:o.children}),e.ref=t.ref,t.child=e,e.return=t,e}function bo(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(s(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function Gc(e,t,i,o,u){return Yi(t),i=Cc(e,t,i,o,void 0,u),o=Tc(),e!==null&&!ht?(Mc(e,t,u),Kn(e,t,u)):(He&&o&&lc(t),t.flags|=1,Ct(e,t,i,u),t.child)}function bm(e,t,i,o,u,d){return Yi(t),t.updateQueue=null,i=xh(t,o,i,u),vh(e),o=Tc(),e!==null&&!ht?(Mc(e,t,d),Kn(e,t,d)):(He&&o&&lc(t),t.flags|=1,Ct(e,t,i,d),t.child)}function ym(e,t,i,o,u){if(Yi(t),t.stateNode===null){var d=Ml,b=i.contextType;typeof b=="object"&&b!==null&&(d=St(b)),d=new i(o,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=o,d.state=t.memoizedState,d.refs={},pc(t),b=i.contextType,d.context=typeof b=="object"&&b!==null?St(b):Ml,d.state=t.memoizedState,b=i.getDerivedStateFromProps,typeof b=="function"&&(Uc(t,i,b,o),d.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(b=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),b!==d.state&&Kc.enqueueReplaceState(d,d.state,null),Ua(t,o,d,u),Ba(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),o=!0}else if(e===null){d=t.stateNode;var C=t.memoizedProps,_=Zi(i,C);d.props=_;var G=d.context,W=i.contextType;b=Ml,typeof W=="object"&&W!==null&&(b=St(W));var ee=i.getDerivedStateFromProps;W=typeof ee=="function"||typeof d.getSnapshotBeforeUpdate=="function",C=t.pendingProps!==C,W||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(C||G!==b)&&lm(t,d,o,b),ci=!1;var Y=t.memoizedState;d.state=Y,Ua(t,o,d,u),Ba(),G=t.memoizedState,C||Y!==G||ci?(typeof ee=="function"&&(Uc(t,i,ee,o),G=t.memoizedState),(_=ci||im(t,i,_,o,Y,G,b))?(W||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=o,t.memoizedState=G),d.props=o,d.state=G,d.context=b,o=_):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),o=!1)}else{d=t.stateNode,gc(e,t),b=t.memoizedProps,W=Zi(i,b),d.props=W,ee=t.pendingProps,Y=d.context,G=i.contextType,_=Ml,typeof G=="object"&&G!==null&&(_=St(G)),C=i.getDerivedStateFromProps,(G=typeof C=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b!==ee||Y!==_)&&lm(t,d,o,_),ci=!1,Y=t.memoizedState,d.state=Y,Ua(t,o,d,u),Ba();var q=t.memoizedState;b!==ee||Y!==q||ci||e!==null&&e.dependencies!==null&&Ws(e.dependencies)?(typeof C=="function"&&(Uc(t,i,C,o),q=t.memoizedState),(W=ci||im(t,i,W,o,Y,q,_)||e!==null&&e.dependencies!==null&&Ws(e.dependencies))?(G||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(o,q,_),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(o,q,_)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),t.memoizedProps=o,t.memoizedState=q),d.props=o,d.state=q,d.context=_,o=W):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),o=!1)}return d=o,bo(e,t),o=(t.flags&128)!==0,d||o?(d=t.stateNode,i=o&&typeof i.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&o?(t.child=qi(t,e.child,null,u),t.child=qi(t,null,i,u)):Ct(e,t,i,u),t.memoizedState=d.state,e=t.child):e=Kn(e,t,u),e}function vm(e,t,i,o){return Fi(),t.flags|=256,Ct(e,t,i,o),t.child}var Yc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Pc(e){return{baseLanes:e,cachePool:rh()}}function $c(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=$t),e}function xm(e,t,i){var o=t.pendingProps,u=!1,d=(t.flags&128)!==0,b;if((b=d)||(b=e!==null&&e.memoizedState===null?!1:(rt.current&2)!==0),b&&(u=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(He){if(u?fi(t):hi(),(e=Xe)?(e=kp(e,tn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ai!==null?{id:wn,overflow:Sn}:null,retryLane:536870912,hydrationErrors:null},i=Jf(e),i.return=t,t.child=i,wt=t,Xe=null)):e=null,e===null)throw oi(t);return ku(e)?t.lanes=32:t.lanes=536870912,null}var C=o.children;return o=o.fallback,u?(hi(),u=t.mode,C=yo({mode:"hidden",children:C},u),o=Ii(o,u,i,null),C.return=t,o.return=t,C.sibling=o,t.child=C,o=t.child,o.memoizedState=Pc(i),o.childLanes=$c(e,b,i),t.memoizedState=Yc,Ya(null,o)):(fi(t),Vc(t,C))}var _=e.memoizedState;if(_!==null&&(C=_.dehydrated,C!==null)){if(d)t.flags&256?(fi(t),t.flags&=-257,t=qc(e,t,i)):t.memoizedState!==null?(hi(),t.child=e.child,t.flags|=128,t=null):(hi(),C=o.fallback,u=t.mode,o=yo({mode:"visible",children:o.children},u),C=Ii(C,u,i,null),C.flags|=2,o.return=t,C.return=t,o.sibling=C,t.child=o,qi(t,e.child,null,i),o=t.child,o.memoizedState=Pc(i),o.childLanes=$c(e,b,i),t.memoizedState=Yc,t=Ya(null,o));else if(fi(t),ku(C)){if(b=C.nextSibling&&C.nextSibling.dataset,b)var G=b.dgst;b=G,o=Error(s(419)),o.stack="",o.digest=b,Ra({value:o,source:null,stack:null}),t=qc(e,t,i)}else if(ht||Nl(e,t,i,!1),b=(i&e.childLanes)!==0,ht||b){if(b=Ve,b!==null&&(o=sf(b,i),o!==0&&o!==_.retryLane))throw _.retryLane=o,Ki(e,o),Ht(b,e,o),Fc;Eu(C)||Eo(),t=qc(e,t,i)}else Eu(C)?(t.flags|=192,t.child=e.child,t=null):(e=_.treeContext,Xe=ln(C.nextSibling),wt=t,He=!0,si=null,tn=!1,e!==null&&nh(t,e),t=Vc(t,o.children),t.flags|=4096);return t}return u?(hi(),C=o.fallback,u=t.mode,_=e.child,G=_.sibling,o=On(_,{mode:"hidden",children:o.children}),o.subtreeFlags=_.subtreeFlags&65011712,G!==null?C=On(G,C):(C=Ii(C,u,i,null),C.flags|=2),C.return=t,o.return=t,o.sibling=C,t.child=o,Ya(null,o),o=t.child,C=e.child.memoizedState,C===null?C=Pc(i):(u=C.cachePool,u!==null?(_=dt._currentValue,u=u.parent!==_?{parent:_,pool:_}:u):u=rh(),C={baseLanes:C.baseLanes|i,cachePool:u}),o.memoizedState=C,o.childLanes=$c(e,b,i),t.memoizedState=Yc,Ya(e.child,o)):(fi(t),i=e.child,e=i.sibling,i=On(i,{mode:"visible",children:o.children}),i.return=t,i.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=i,t.memoizedState=null,i)}function Vc(e,t){return t=yo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function yo(e,t){return e=Ft(22,e,null,t),e.lanes=0,e}function qc(e,t,i){return qi(t,e.child,null,i),e=Vc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function wm(e,t,i){e.lanes|=t;var o=e.alternate;o!==null&&(o.lanes|=t),cc(e.return,t,i)}function Xc(e,t,i,o,u,d){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:o,tail:i,tailMode:u,treeForkCount:d}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=o,b.tail=i,b.tailMode=u,b.treeForkCount=d)}function Sm(e,t,i){var o=t.pendingProps,u=o.revealOrder,d=o.tail;o=o.children;var b=rt.current,C=(b&2)!==0;if(C?(b=b&1|2,t.flags|=128):b&=1,X(rt,b),Ct(e,t,o,i),o=He?La:0,!C&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&wm(e,i,t);else if(e.tag===19)wm(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(i=t.child,u=null;i!==null;)e=i.alternate,e!==null&&ao(e)===null&&(u=i),i=i.sibling;i=u,i===null?(u=t.child,t.child=null):(u=i.sibling,i.sibling=null),Xc(t,!1,u,i,d,o);break;case"backwards":case"unstable_legacy-backwards":for(i=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&ao(e)===null){t.child=u;break}e=u.sibling,u.sibling=i,i=u,u=e}Xc(t,!0,i,null,d,o);break;case"together":Xc(t,!1,null,null,void 0,o);break;default:t.memoizedState=null}return t.child}function Kn(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),gi|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Nl(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,i=On(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=On(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function Zc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ws(e)))}function _v(e,t,i){switch(t.tag){case 3:xe(t,t.stateNode.containerInfo),ri(t,dt,e.memoizedState.cache),Fi();break;case 27:case 5:we(t);break;case 4:xe(t,t.stateNode.containerInfo);break;case 10:ri(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,wc(t),null;break;case 13:var o=t.memoizedState;if(o!==null)return o.dehydrated!==null?(fi(t),t.flags|=128,null):(i&t.child.childLanes)!==0?xm(e,t,i):(fi(t),e=Kn(e,t,i),e!==null?e.sibling:null);fi(t);break;case 19:var u=(e.flags&128)!==0;if(o=(i&t.childLanes)!==0,o||(Nl(e,t,i,!1),o=(i&t.childLanes)!==0),u){if(o)return Sm(e,t,i);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),X(rt,rt.current),o)break;return null;case 22:return t.lanes=0,mm(e,t,i,t.pendingProps);case 24:ri(t,dt,e.memoizedState.cache)}return Kn(e,t,i)}function Cm(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)ht=!0;else{if(!Zc(e,i)&&(t.flags&128)===0)return ht=!1,_v(e,t,i);ht=(e.flags&131072)!==0}else ht=!1,He&&(t.flags&1048576)!==0&&th(t,La,t.index);switch(t.lanes=0,t.tag){case 16:e:{var o=t.pendingProps;if(e=$i(t.elementType),t.type=e,typeof e=="function")tc(e)?(o=Zi(e,o),t.tag=1,t=ym(null,t,e,o,i)):(t.tag=0,t=Gc(null,t,e,o,i));else{if(e!=null){var u=e.$$typeof;if(u===B){t.tag=11,t=dm(null,t,e,o,i);break e}else if(u===R){t.tag=14,t=fm(null,t,e,o,i);break e}}throw t=re(e)||e,Error(s(306,t,""))}}return t;case 0:return Gc(e,t,t.type,t.pendingProps,i);case 1:return o=t.type,u=Zi(o,t.pendingProps),ym(e,t,o,u,i);case 3:e:{if(xe(t,t.stateNode.containerInfo),e===null)throw Error(s(387));o=t.pendingProps;var d=t.memoizedState;u=d.element,gc(e,t),Ua(t,o,null,i);var b=t.memoizedState;if(o=b.cache,ri(t,dt,o),o!==d.cache&&uc(t,[dt],i,!0),Ba(),o=b.element,d.isDehydrated)if(d={element:o,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=vm(e,t,o,i);break e}else if(o!==u){u=Qt(Error(s(424)),t),Ra(u),t=vm(e,t,o,i);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=ln(e.firstChild),wt=t,He=!0,si=null,tn=!0,i=mh(t,null,o,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Fi(),o===u){t=Kn(e,t,i);break e}Ct(e,t,o,i)}t=t.child}return t;case 26:return bo(e,t),e===null?(i=Op(t.type,null,t.pendingProps,null))?t.memoizedState=i:He||(i=t.type,e=t.pendingProps,o=Oo(pe.current).createElement(i),o[xt]=t,o[Lt]=e,Tt(o,i,e),yt(o),t.stateNode=o):t.memoizedState=Op(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return we(t),e===null&&He&&(o=t.stateNode=Lp(t.type,t.pendingProps,pe.current),wt=t,tn=!0,u=Xe,wi(t.type)?(Nu=u,Xe=ln(o.firstChild)):Xe=u),Ct(e,t,t.pendingProps.children,i),bo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&He&&((u=o=Xe)&&(o=sx(o,t.type,t.pendingProps,tn),o!==null?(t.stateNode=o,wt=t,Xe=ln(o.firstChild),tn=!1,u=!0):u=!1),u||oi(t)),we(t),u=t.type,d=t.pendingProps,b=e!==null?e.memoizedProps:null,o=d.children,Tu(u,d)?o=null:b!==null&&Tu(u,b)&&(t.flags|=32),t.memoizedState!==null&&(u=Cc(e,t,wv,null,null,i),as._currentValue=u),bo(e,t),Ct(e,t,o,i),t.child;case 6:return e===null&&He&&((e=i=Xe)&&(i=ox(i,t.pendingProps,tn),i!==null?(t.stateNode=i,wt=t,Xe=null,e=!0):e=!1),e||oi(t)),null;case 13:return xm(e,t,i);case 4:return xe(t,t.stateNode.containerInfo),o=t.pendingProps,e===null?t.child=qi(t,null,o,i):Ct(e,t,o,i),t.child;case 11:return dm(e,t,t.type,t.pendingProps,i);case 7:return Ct(e,t,t.pendingProps,i),t.child;case 8:return Ct(e,t,t.pendingProps.children,i),t.child;case 12:return Ct(e,t,t.pendingProps.children,i),t.child;case 10:return o=t.pendingProps,ri(t,t.type,o.value),Ct(e,t,o.children,i),t.child;case 9:return u=t.type._context,o=t.pendingProps.children,Yi(t),u=St(u),o=o(u),t.flags|=1,Ct(e,t,o,i),t.child;case 14:return fm(e,t,t.type,t.pendingProps,i);case 15:return hm(e,t,t.type,t.pendingProps,i);case 19:return Sm(e,t,i);case 31:return Nv(e,t,i);case 22:return mm(e,t,i,t.pendingProps);case 24:return Yi(t),o=St(dt),e===null?(u=hc(),u===null&&(u=Ve,d=dc(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=i),u=d),t.memoizedState={parent:o,cache:u},pc(t),ri(t,dt,u)):((e.lanes&i)!==0&&(gc(e,t),Ua(t,null,null,i),Ba()),u=e.memoizedState,d=t.memoizedState,u.parent!==o?(u={parent:o,cache:o},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),ri(t,dt,o)):(o=d.cache,ri(t,dt,o),o!==u.cache&&uc(t,[dt],i,!0))),Ct(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function In(e){e.flags|=4}function Wc(e,t,i,o,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(Zm())e.flags|=8192;else throw Vi=to,mc}else e.flags&=-16777217}function Tm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Up(t))if(Zm())e.flags|=8192;else throw Vi=to,mc}function vo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ya():536870912,e.lanes|=t,Il|=t)}function Pa(e,t){if(!He)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var o=null;i!==null;)i.alternate!==null&&(o=i),i=i.sibling;o===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function Ze(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,o=0;if(t)for(var u=e.child;u!==null;)i|=u.lanes|u.childLanes,o|=u.subtreeFlags&65011712,o|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)i|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=o,e.childLanes=i,t}function Lv(e,t,i){var o=t.pendingProps;switch(ac(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(t),null;case 1:return Ze(t),null;case 3:return i=t.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),t.memoizedState.cache!==o&&(t.flags|=2048),Hn(dt),ae(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(kl(t)?In(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,oc())),Ze(t),null;case 26:var u=t.type,d=t.memoizedState;return e===null?(In(t),d!==null?(Ze(t),Tm(t,d)):(Ze(t),Wc(t,u,null,o,i))):d?d!==e.memoizedState?(In(t),Ze(t),Tm(t,d)):(Ze(t),t.flags&=-16777217):(e=e.memoizedProps,e!==o&&In(t),Ze(t),Wc(t,u,e,o,i)),null;case 27:if(ke(t),i=pe.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==o&&In(t);else{if(!o){if(t.stateNode===null)throw Error(s(166));return Ze(t),null}e=ue.current,kl(t)?ih(t):(e=Lp(u,o,i),t.stateNode=e,In(t))}return Ze(t),null;case 5:if(ke(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==o&&In(t);else{if(!o){if(t.stateNode===null)throw Error(s(166));return Ze(t),null}if(d=ue.current,kl(t))ih(t);else{var b=Oo(pe.current);switch(d){case 1:d=b.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:d=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":d=b.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":d=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":d=b.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof o.is=="string"?b.createElement("select",{is:o.is}):b.createElement("select"),o.multiple?d.multiple=!0:o.size&&(d.size=o.size);break;default:d=typeof o.is=="string"?b.createElement(u,{is:o.is}):b.createElement(u)}}d[xt]=t,d[Lt]=o;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)d.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=d;e:switch(Tt(d,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&In(t)}}return Ze(t),Wc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==o&&In(t);else{if(typeof o!="string"&&t.stateNode===null)throw Error(s(166));if(e=pe.current,kl(t)){if(e=t.stateNode,i=t.memoizedProps,o=null,u=wt,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}e[xt]=t,e=!!(e.nodeValue===i||o!==null&&o.suppressHydrationWarning===!0||xp(e.nodeValue,i)),e||oi(t,!0)}else e=Oo(e).createTextNode(o),e[xt]=t,t.stateNode=e}return Ze(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(o=kl(t),i!==null){if(e===null){if(!o)throw Error(s(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[xt]=t}else Fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),e=!1}else i=oc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Yt(t),t):(Yt(t),null);if((t.flags&128)!==0)throw Error(s(558))}return Ze(t),null;case 13:if(o=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=kl(t),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(s(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(s(317));u[xt]=t}else Fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),u=!1}else u=oc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Yt(t),t):(Yt(t),null)}return Yt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=o!==null,e=e!==null&&e.memoizedState!==null,i&&(o=t.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),d=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),d!==u&&(o.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),vo(t,t.updateQueue),Ze(t),null);case 4:return ae(),e===null&&vu(t.stateNode.containerInfo),Ze(t),null;case 10:return Hn(t.type),Ze(t),null;case 19:if(ve(rt),o=t.memoizedState,o===null)return Ze(t),null;if(u=(t.flags&128)!==0,d=o.rendering,d===null)if(u)Pa(o,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=ao(e),d!==null){for(t.flags|=128,Pa(o,!1),e=d.updateQueue,t.updateQueue=e,vo(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Qf(i,e),i=i.sibling;return X(rt,rt.current&1|2),He&&Dn(t,o.treeForkCount),t.child}e=e.sibling}o.tail!==null&&ut()>To&&(t.flags|=128,u=!0,Pa(o,!1),t.lanes=4194304)}else{if(!u)if(e=ao(d),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,vo(t,e),Pa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!d.alternate&&!He)return Ze(t),null}else 2*ut()-o.renderingStartTime>To&&i!==536870912&&(t.flags|=128,u=!0,Pa(o,!1),t.lanes=4194304);o.isBackwards?(d.sibling=t.child,t.child=d):(e=o.last,e!==null?e.sibling=d:t.child=d,o.last=d)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=ut(),e.sibling=null,i=rt.current,X(rt,u?i&1|2:i&1),He&&Dn(t,o.treeForkCount),e):(Ze(t),null);case 22:case 23:return Yt(t),xc(),o=t.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(t.flags|=8192):o&&(t.flags|=8192),o?(i&536870912)!==0&&(t.flags&128)===0&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),i=t.updateQueue,i!==null&&vo(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),o=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),o!==i&&(t.flags|=2048),e!==null&&ve(Pi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Hn(dt),Ze(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Rv(e,t){switch(ac(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hn(dt),ae(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ke(t),null;case 31:if(t.memoizedState!==null){if(Yt(t),t.alternate===null)throw Error(s(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Yt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ve(rt),null;case 4:return ae(),null;case 10:return Hn(t.type),null;case 22:case 23:return Yt(t),xc(),e!==null&&ve(Pi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Hn(dt),null;case 25:return null;default:return null}}function Mm(e,t){switch(ac(t),t.tag){case 3:Hn(dt),ae();break;case 26:case 27:case 5:ke(t);break;case 4:ae();break;case 31:t.memoizedState!==null&&Yt(t);break;case 13:Yt(t);break;case 19:ve(rt);break;case 10:Hn(t.type);break;case 22:case 23:Yt(t),xc(),e!==null&&ve(Pi);break;case 24:Hn(dt)}}function $a(e,t){try{var i=t.updateQueue,o=i!==null?i.lastEffect:null;if(o!==null){var u=o.next;i=u;do{if((i.tag&e)===e){o=void 0;var d=i.create,b=i.inst;o=d(),b.destroy=o}i=i.next}while(i!==u)}}catch(C){Ge(t,t.return,C)}}function mi(e,t,i){try{var o=t.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var d=u.next;o=d;do{if((o.tag&e)===e){var b=o.inst,C=b.destroy;if(C!==void 0){b.destroy=void 0,u=t;var _=i,G=C;try{G()}catch(W){Ge(u,_,W)}}}o=o.next}while(o!==d)}}catch(W){Ge(t,t.return,W)}}function Am(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{gh(t,i)}catch(o){Ge(e,e.return,o)}}}function Em(e,t,i){i.props=Zi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(o){Ge(e,t,o)}}function Va(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof i=="function"?e.refCleanup=i(o):i.current=o}}catch(u){Ge(e,t,u)}}function Cn(e,t){var i=e.ref,o=e.refCleanup;if(i!==null)if(typeof o=="function")try{o()}catch(u){Ge(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(u){Ge(e,t,u)}else i.current=null}function km(e){var t=e.type,i=e.memoizedProps,o=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&o.focus();break e;case"img":i.src?o.src=i.src:i.srcSet&&(o.srcset=i.srcSet)}}catch(u){Ge(e,e.return,u)}}function Qc(e,t,i){try{var o=e.stateNode;ex(o,e.type,i,t),o[Lt]=t}catch(u){Ge(e,e.return,u)}}function Nm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&wi(e.type)||e.tag===4}function Jc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Nm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&wi(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 eu(e,t,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Rn));else if(o!==4&&(o===27&&wi(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(eu(e,t,i),e=e.sibling;e!==null;)eu(e,t,i),e=e.sibling}function xo(e,t,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(o!==4&&(o===27&&wi(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(xo(e,t,i),e=e.sibling;e!==null;)xo(e,t,i),e=e.sibling}function _m(e){var t=e.stateNode,i=e.memoizedProps;try{for(var o=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Tt(t,o,i),t[xt]=e,t[Lt]=i}catch(d){Ge(e,e.return,d)}}var Fn=!1,mt=!1,tu=!1,Lm=typeof WeakSet=="function"?WeakSet:Set,vt=null;function jv(e,t){if(e=e.containerInfo,Su=Io,e=Gf(e),qr(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var o=i.getSelection&&i.getSelection();if(o&&o.rangeCount!==0){i=o.anchorNode;var u=o.anchorOffset,d=o.focusNode;o=o.focusOffset;try{i.nodeType,d.nodeType}catch{i=null;break e}var b=0,C=-1,_=-1,G=0,W=0,ee=e,Y=null;t:for(;;){for(var q;ee!==i||u!==0&&ee.nodeType!==3||(C=b+u),ee!==d||o!==0&&ee.nodeType!==3||(_=b+o),ee.nodeType===3&&(b+=ee.nodeValue.length),(q=ee.firstChild)!==null;)Y=ee,ee=q;for(;;){if(ee===e)break t;if(Y===i&&++G===u&&(C=b),Y===d&&++W===o&&(_=b),(q=ee.nextSibling)!==null)break;ee=Y,Y=ee.parentNode}ee=q}i=C===-1||_===-1?null:{start:C,end:_}}else i=null}i=i||{start:0,end:0}}else i=null;for(Cu={focusedElem:e,selectionRange:i},Io=!1,vt=t;vt!==null;)if(t=vt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,vt=e;else for(;vt!==null;){switch(t=vt,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(i=0;i<e.length;i++)u=e[i],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,i=t,u=d.memoizedProps,d=d.memoizedState,o=i.stateNode;try{var be=Zi(i.type,u);e=o.getSnapshotBeforeUpdate(be,d),o.__reactInternalSnapshotBeforeUpdate=e}catch(Te){Ge(i,i.return,Te)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Au(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Au(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(s(163))}if(e=t.sibling,e!==null){e.return=t.return,vt=e;break}vt=t.return}}function Rm(e,t,i){var o=i.flags;switch(i.tag){case 0:case 11:case 15:Yn(e,i),o&4&&$a(5,i);break;case 1:if(Yn(e,i),o&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(b){Ge(i,i.return,b)}else{var u=Zi(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){Ge(i,i.return,b)}}o&64&&Am(i),o&512&&Va(i,i.return);break;case 3:if(Yn(e,i),o&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{gh(e,t)}catch(b){Ge(i,i.return,b)}}break;case 27:t===null&&o&4&&_m(i);case 26:case 5:Yn(e,i),t===null&&o&4&&km(i),o&512&&Va(i,i.return);break;case 12:Yn(e,i);break;case 31:Yn(e,i),o&4&&Dm(e,i);break;case 13:Yn(e,i),o&4&&zm(e,i),o&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Fv.bind(null,i),rx(e,i))));break;case 22:if(o=i.memoizedState!==null||Fn,!o){t=t!==null&&t.memoizedState!==null||mt,u=Fn;var d=mt;Fn=o,(mt=t)&&!d?Pn(e,i,(i.subtreeFlags&8772)!==0):Yn(e,i),Fn=u,mt=d}break;case 30:break;default:Yn(e,i)}}function jm(e){var t=e.alternate;t!==null&&(e.alternate=null,jm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Lr(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var et=null,jt=!1;function Gn(e,t,i){for(i=i.child;i!==null;)Om(e,t,i),i=i.sibling}function Om(e,t,i){if(Mt&&typeof Mt.onCommitFiberUnmount=="function")try{Mt.onCommitFiberUnmount(ti,i)}catch{}switch(i.tag){case 26:mt||Cn(i,t),Gn(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:mt||Cn(i,t);var o=et,u=jt;wi(i.type)&&(et=i.stateNode,jt=!1),Gn(e,t,i),ns(i.stateNode),et=o,jt=u;break;case 5:mt||Cn(i,t);case 6:if(o=et,u=jt,et=null,Gn(e,t,i),et=o,jt=u,et!==null)if(jt)try{(et.nodeType===9?et.body:et.nodeName==="HTML"?et.ownerDocument.body:et).removeChild(i.stateNode)}catch(d){Ge(i,t,d)}else try{et.removeChild(i.stateNode)}catch(d){Ge(i,t,d)}break;case 18:et!==null&&(jt?(e=et,Ap(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),Xl(e)):Ap(et,i.stateNode));break;case 4:o=et,u=jt,et=i.stateNode.containerInfo,jt=!0,Gn(e,t,i),et=o,jt=u;break;case 0:case 11:case 14:case 15:mi(2,i,t),mt||mi(4,i,t),Gn(e,t,i);break;case 1:mt||(Cn(i,t),o=i.stateNode,typeof o.componentWillUnmount=="function"&&Em(i,t,o)),Gn(e,t,i);break;case 21:Gn(e,t,i);break;case 22:mt=(o=mt)||i.memoizedState!==null,Gn(e,t,i),mt=o;break;default:Gn(e,t,i)}}function Dm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Xl(e)}catch(i){Ge(t,t.return,i)}}}function zm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Xl(e)}catch(i){Ge(t,t.return,i)}}function Ov(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Lm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Lm),t;default:throw Error(s(435,e.tag))}}function wo(e,t){var i=Ov(e);t.forEach(function(o){if(!i.has(o)){i.add(o);var u=Gv.bind(null,e,o);o.then(u,u)}})}function Ot(e,t){var i=t.deletions;if(i!==null)for(var o=0;o<i.length;o++){var u=i[o],d=e,b=t,C=b;e:for(;C!==null;){switch(C.tag){case 27:if(wi(C.type)){et=C.stateNode,jt=!1;break e}break;case 5:et=C.stateNode,jt=!1;break e;case 3:case 4:et=C.stateNode.containerInfo,jt=!0;break e}C=C.return}if(et===null)throw Error(s(160));Om(d,b,u),et=null,jt=!1,d=u.alternate,d!==null&&(d.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Hm(t,e),t=t.sibling}var hn=null;function Hm(e,t){var i=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ot(t,e),Dt(e),o&4&&(mi(3,e,e.return),$a(3,e),mi(5,e,e.return));break;case 1:Ot(t,e),Dt(e),o&512&&(mt||i===null||Cn(i,i.return)),o&64&&Fn&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?o:i.concat(o))));break;case 26:var u=hn;if(Ot(t,e),Dt(e),o&512&&(mt||i===null||Cn(i,i.return)),o&4){var d=i!==null?i.memoizedState:null;if(o=e.memoizedState,i===null)if(o===null)if(e.stateNode===null){e:{o=e.type,i=e.memoizedProps,u=u.ownerDocument||u;t:switch(o){case"title":d=u.getElementsByTagName("title")[0],(!d||d[xa]||d[xt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=u.createElement(o),u.head.insertBefore(d,u.querySelector("head > title"))),Tt(d,o,i),d[xt]=e,yt(d),o=d;break e;case"link":var b=Hp("link","href",u).get(o+(i.href||""));if(b){for(var C=0;C<b.length;C++)if(d=b[C],d.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&d.getAttribute("rel")===(i.rel==null?null:i.rel)&&d.getAttribute("title")===(i.title==null?null:i.title)&&d.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){b.splice(C,1);break t}}d=u.createElement(o),Tt(d,o,i),u.head.appendChild(d);break;case"meta":if(b=Hp("meta","content",u).get(o+(i.content||""))){for(C=0;C<b.length;C++)if(d=b[C],d.getAttribute("content")===(i.content==null?null:""+i.content)&&d.getAttribute("name")===(i.name==null?null:i.name)&&d.getAttribute("property")===(i.property==null?null:i.property)&&d.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&d.getAttribute("charset")===(i.charSet==null?null:i.charSet)){b.splice(C,1);break t}}d=u.createElement(o),Tt(d,o,i),u.head.appendChild(d);break;default:throw Error(s(468,o))}d[xt]=e,yt(d),o=d}e.stateNode=o}else Bp(u,e.type,e.stateNode);else e.stateNode=zp(u,o,e.memoizedProps);else d!==o?(d===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):d.count--,o===null?Bp(u,e.type,e.stateNode):zp(u,o,e.memoizedProps)):o===null&&e.stateNode!==null&&Qc(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ot(t,e),Dt(e),o&512&&(mt||i===null||Cn(i,i.return)),i!==null&&o&4&&Qc(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ot(t,e),Dt(e),o&512&&(mt||i===null||Cn(i,i.return)),e.flags&32){u=e.stateNode;try{yl(u,"")}catch(be){Ge(e,e.return,be)}}o&4&&e.stateNode!=null&&(u=e.memoizedProps,Qc(e,u,i!==null?i.memoizedProps:u)),o&1024&&(tu=!0);break;case 6:if(Ot(t,e),Dt(e),o&4){if(e.stateNode===null)throw Error(s(162));o=e.memoizedProps,i=e.stateNode;try{i.nodeValue=o}catch(be){Ge(e,e.return,be)}}break;case 3:if(Ho=null,u=hn,hn=Do(t.containerInfo),Ot(t,e),hn=u,Dt(e),o&4&&i!==null&&i.memoizedState.isDehydrated)try{Xl(t.containerInfo)}catch(be){Ge(e,e.return,be)}tu&&(tu=!1,Bm(e));break;case 4:o=hn,hn=Do(e.stateNode.containerInfo),Ot(t,e),Dt(e),hn=o;break;case 12:Ot(t,e),Dt(e);break;case 31:Ot(t,e),Dt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,wo(e,o)));break;case 13:Ot(t,e),Dt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Co=ut()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,wo(e,o)));break;case 22:u=e.memoizedState!==null;var _=i!==null&&i.memoizedState!==null,G=Fn,W=mt;if(Fn=G||u,mt=W||_,Ot(t,e),mt=W,Fn=G,Dt(e),o&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(i===null||_||Fn||mt||Wi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){_=i=t;try{if(d=_.stateNode,u)b=d.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{C=_.stateNode;var ee=_.memoizedProps.style,Y=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;C.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(be){Ge(_,_.return,be)}}}else if(t.tag===6){if(i===null){_=t;try{_.stateNode.nodeValue=u?"":_.memoizedProps}catch(be){Ge(_,_.return,be)}}}else if(t.tag===18){if(i===null){_=t;try{var q=_.stateNode;u?Ep(q,!0):Ep(_.stateNode,!1)}catch(be){Ge(_,_.return,be)}}}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;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}o&4&&(o=e.updateQueue,o!==null&&(i=o.retryQueue,i!==null&&(o.retryQueue=null,wo(e,i))));break;case 19:Ot(t,e),Dt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,wo(e,o)));break;case 30:break;case 21:break;default:Ot(t,e),Dt(e)}}function Dt(e){var t=e.flags;if(t&2){try{for(var i,o=e.return;o!==null;){if(Nm(o)){i=o;break}o=o.return}if(i==null)throw Error(s(160));switch(i.tag){case 27:var u=i.stateNode,d=Jc(e);xo(e,d,u);break;case 5:var b=i.stateNode;i.flags&32&&(yl(b,""),i.flags&=-33);var C=Jc(e);xo(e,C,b);break;case 3:case 4:var _=i.stateNode.containerInfo,G=Jc(e);eu(e,G,_);break;default:throw Error(s(161))}}catch(W){Ge(e,e.return,W)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Bm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Bm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Yn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Rm(e,t.alternate,t),t=t.sibling}function Wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:mi(4,t,t.return),Wi(t);break;case 1:Cn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&Em(t,t.return,i),Wi(t);break;case 27:ns(t.stateNode);case 26:case 5:Cn(t,t.return),Wi(t);break;case 22:t.memoizedState===null&&Wi(t);break;case 30:Wi(t);break;default:Wi(t)}e=e.sibling}}function Pn(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var o=t.alternate,u=e,d=t,b=d.flags;switch(d.tag){case 0:case 11:case 15:Pn(u,d,i),$a(4,d);break;case 1:if(Pn(u,d,i),o=d,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(G){Ge(o,o.return,G)}if(o=d,u=o.updateQueue,u!==null){var C=o.stateNode;try{var _=u.shared.hiddenCallbacks;if(_!==null)for(u.shared.hiddenCallbacks=null,u=0;u<_.length;u++)ph(_[u],C)}catch(G){Ge(o,o.return,G)}}i&&b&64&&Am(d),Va(d,d.return);break;case 27:_m(d);case 26:case 5:Pn(u,d,i),i&&o===null&&b&4&&km(d),Va(d,d.return);break;case 12:Pn(u,d,i);break;case 31:Pn(u,d,i),i&&b&4&&Dm(u,d);break;case 13:Pn(u,d,i),i&&b&4&&zm(u,d);break;case 22:d.memoizedState===null&&Pn(u,d,i),Va(d,d.return);break;case 30:break;default:Pn(u,d,i)}t=t.sibling}}function nu(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&ja(i))}function iu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ja(e))}function mn(e,t,i,o){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Um(e,t,i,o),t=t.sibling}function Um(e,t,i,o){var u=t.flags;switch(t.tag){case 0:case 11:case 15:mn(e,t,i,o),u&2048&&$a(9,t);break;case 1:mn(e,t,i,o);break;case 3:mn(e,t,i,o),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ja(e)));break;case 12:if(u&2048){mn(e,t,i,o),e=t.stateNode;try{var d=t.memoizedProps,b=d.id,C=d.onPostCommit;typeof C=="function"&&C(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(_){Ge(t,t.return,_)}}else mn(e,t,i,o);break;case 31:mn(e,t,i,o);break;case 13:mn(e,t,i,o);break;case 23:break;case 22:d=t.stateNode,b=t.alternate,t.memoizedState!==null?d._visibility&2?mn(e,t,i,o):qa(e,t):d._visibility&2?mn(e,t,i,o):(d._visibility|=2,Bl(e,t,i,o,(t.subtreeFlags&10256)!==0||!1)),u&2048&&nu(b,t);break;case 24:mn(e,t,i,o),u&2048&&iu(t.alternate,t);break;default:mn(e,t,i,o)}}function Bl(e,t,i,o,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,b=t,C=i,_=o,G=b.flags;switch(b.tag){case 0:case 11:case 15:Bl(d,b,C,_,u),$a(8,b);break;case 23:break;case 22:var W=b.stateNode;b.memoizedState!==null?W._visibility&2?Bl(d,b,C,_,u):qa(d,b):(W._visibility|=2,Bl(d,b,C,_,u)),u&&G&2048&&nu(b.alternate,b);break;case 24:Bl(d,b,C,_,u),u&&G&2048&&iu(b.alternate,b);break;default:Bl(d,b,C,_,u)}t=t.sibling}}function qa(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,o=t,u=o.flags;switch(o.tag){case 22:qa(i,o),u&2048&&nu(o.alternate,o);break;case 24:qa(i,o),u&2048&&iu(o.alternate,o);break;default:qa(i,o)}t=t.sibling}}var Xa=8192;function Ul(e,t,i){if(e.subtreeFlags&Xa)for(e=e.child;e!==null;)Km(e,t,i),e=e.sibling}function Km(e,t,i){switch(e.tag){case 26:Ul(e,t,i),e.flags&Xa&&e.memoizedState!==null&&xx(i,hn,e.memoizedState,e.memoizedProps);break;case 5:Ul(e,t,i);break;case 3:case 4:var o=hn;hn=Do(e.stateNode.containerInfo),Ul(e,t,i),hn=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=Xa,Xa=16777216,Ul(e,t,i),Xa=o):Ul(e,t,i));break;default:Ul(e,t,i)}}function Im(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Za(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var o=t[i];vt=o,Gm(o,e)}Im(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Fm(e),e=e.sibling}function Fm(e){switch(e.tag){case 0:case 11:case 15:Za(e),e.flags&2048&&mi(9,e,e.return);break;case 3:Za(e);break;case 12:Za(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,So(e)):Za(e);break;default:Za(e)}}function So(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var o=t[i];vt=o,Gm(o,e)}Im(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:mi(8,t,t.return),So(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,So(t));break;default:So(t)}e=e.sibling}}function Gm(e,t){for(;vt!==null;){var i=vt;switch(i.tag){case 0:case 11:case 15:mi(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var o=i.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:ja(i.memoizedState.cache)}if(o=i.child,o!==null)o.return=i,vt=o;else e:for(i=e;vt!==null;){o=vt;var u=o.sibling,d=o.return;if(jm(o),o===i){vt=null;break e}if(u!==null){u.return=d,vt=u;break e}vt=d}}}var Dv={getCacheForType:function(e){var t=St(dt),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return St(dt).controller.signal}},zv=typeof WeakMap=="function"?WeakMap:Map,Ke=0,Ve=null,je=null,De=0,Fe=0,Pt=null,pi=!1,Kl=!1,lu=!1,$n=0,at=0,gi=0,Qi=0,au=0,$t=0,Il=0,Wa=null,zt=null,su=!1,Co=0,Ym=0,To=1/0,Mo=null,bi=null,pt=0,yi=null,Fl=null,Vn=0,ou=0,ru=null,Pm=null,Qa=0,cu=null;function Vt(){return(Ke&2)!==0&&De!==0?De&-De:O.T!==null?pu():of()}function $m(){if($t===0)if((De&536870912)===0||He){var e=Kt;Kt<<=1,(Kt&3932160)===0&&(Kt=262144),$t=e}else $t=536870912;return e=Gt.current,e!==null&&(e.flags|=32),$t}function Ht(e,t,i){(e===Ve&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(Gl(e,0),vi(e,De,$t,!1)),va(e,i),((Ke&2)===0||e!==Ve)&&(e===Ve&&((Ke&2)===0&&(Qi|=i),at===4&&vi(e,De,$t,!1)),Tn(e))}function Vm(e,t,i){if((Ke&6)!==0)throw Error(s(327));var o=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ni(e,t),u=o?Uv(e,t):du(e,t,!0),d=o;do{if(u===0){Kl&&!o&&vi(e,t,0,!1);break}else{if(i=e.current.alternate,d&&!Hv(i)){u=du(e,t,!1),d=!1;continue}if(u===2){if(d=t,e.errorRecoveryDisabledLanes&d)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var C=e;u=Wa;var _=C.current.memoizedState.isDehydrated;if(_&&(Gl(C,b).flags|=256),b=du(C,b,!1),b!==2){if(lu&&!_){C.errorRecoveryDisabledLanes|=d,Qi|=d,u=4;break e}d=zt,zt=u,d!==null&&(zt===null?zt=d:zt.push.apply(zt,d))}u=b}if(d=!1,u!==2)continue}}if(u===1){Gl(e,0),vi(e,t,0,!0);break}e:{switch(o=e,d=u,d){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:vi(o,t,$t,!pi);break e;case 2:zt=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(u=Co+300-ut(),10<u)){if(vi(o,t,$t,!pi),dl(o,0,!0)!==0)break e;Vn=t,o.timeoutHandle=Tp(qm.bind(null,o,i,zt,Mo,su,t,$t,Qi,Il,pi,d,"Throttled",-0,0),u);break e}qm(o,i,zt,Mo,su,t,$t,Qi,Il,pi,d,null,-0,0)}}break}while(!0);Tn(e)}function qm(e,t,i,o,u,d,b,C,_,G,W,ee,Y,q){if(e.timeoutHandle=-1,ee=t.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Rn},Km(t,d,ee);var be=(d&62914560)===d?Co-ut():(d&4194048)===d?Ym-ut():0;if(be=wx(ee,be),be!==null){Vn=d,e.cancelPendingCommit=be(np.bind(null,e,t,d,i,o,u,b,C,_,W,ee,null,Y,q)),vi(e,d,b,!G);return}}np(e,t,d,i,o,u,b,C,_)}function Hv(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var o=0;o<i.length;o++){var u=i[o],d=u.getSnapshot;u=u.value;try{if(!It(d(),u))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;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 vi(e,t,i,o){t&=~au,t&=~Qi,e.suspendedLanes|=t,e.pingedLanes&=~t,o&&(e.warmLanes|=t),o=e.expirationTimes;for(var u=t;0<u;){var d=31-kt(u),b=1<<d;o[d]=-1,u&=~b}i!==0&&lf(e,i,t)}function Ao(){return(Ke&6)===0?(Ja(0),!1):!0}function uu(){if(je!==null){if(Fe===0)var e=je.return;else e=je,zn=Gi=null,Ac(e),jl=null,Da=0,e=je;for(;e!==null;)Mm(e.alternate,e),e=e.return;je=null}}function Gl(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,ix(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),Vn=0,uu(),Ve=e,je=i=On(e.current,null),De=t,Fe=0,Pt=null,pi=!1,Kl=ni(e,t),lu=!1,Il=$t=au=Qi=gi=at=0,zt=Wa=null,su=!1,(t&8)!==0&&(t|=t&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=t;0<o;){var u=31-kt(o),d=1<<u;t|=e[u],o&=~d}return $n=t,$s(),i}function Xm(e,t){Ne=null,O.H=Ga,t===Rl||t===eo?(t=dh(),Fe=3):t===mc?(t=dh(),Fe=4):Fe=t===Fc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Pt=t,je===null&&(at=1,po(e,Qt(t,e.current)))}function Zm(){var e=Gt.current;return e===null?!0:(De&4194048)===De?nn===null:(De&62914560)===De||(De&536870912)!==0?e===nn:!1}function Wm(){var e=O.H;return O.H=Ga,e===null?Ga:e}function Qm(){var e=O.A;return O.A=Dv,e}function Eo(){at=4,pi||(De&4194048)!==De&&Gt.current!==null||(Kl=!0),(gi&134217727)===0&&(Qi&134217727)===0||Ve===null||vi(Ve,De,$t,!1)}function du(e,t,i){var o=Ke;Ke|=2;var u=Wm(),d=Qm();(Ve!==e||De!==t)&&(Mo=null,Gl(e,t)),t=!1;var b=at;e:do try{if(Fe!==0&&je!==null){var C=je,_=Pt;switch(Fe){case 8:uu(),b=6;break e;case 3:case 2:case 9:case 6:Gt.current===null&&(t=!0);var G=Fe;if(Fe=0,Pt=null,Yl(e,C,_,G),i&&Kl){b=0;break e}break;default:G=Fe,Fe=0,Pt=null,Yl(e,C,_,G)}}Bv(),b=at;break}catch(W){Xm(e,W)}while(!0);return t&&e.shellSuspendCounter++,zn=Gi=null,Ke=o,O.H=u,O.A=d,je===null&&(Ve=null,De=0,$s()),b}function Bv(){for(;je!==null;)Jm(je)}function Uv(e,t){var i=Ke;Ke|=2;var o=Wm(),u=Qm();Ve!==e||De!==t?(Mo=null,To=ut()+500,Gl(e,t)):Kl=ni(e,t);e:do try{if(Fe!==0&&je!==null){t=je;var d=Pt;t:switch(Fe){case 1:Fe=0,Pt=null,Yl(e,t,d,1);break;case 2:case 9:if(ch(d)){Fe=0,Pt=null,ep(t);break}t=function(){Fe!==2&&Fe!==9||Ve!==e||(Fe=7),Tn(e)},d.then(t,t);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:ch(d)?(Fe=0,Pt=null,ep(t)):(Fe=0,Pt=null,Yl(e,t,d,7));break;case 5:var b=null;switch(je.tag){case 26:b=je.memoizedState;case 5:case 27:var C=je;if(b?Up(b):C.stateNode.complete){Fe=0,Pt=null;var _=C.sibling;if(_!==null)je=_;else{var G=C.return;G!==null?(je=G,ko(G)):je=null}break t}}Fe=0,Pt=null,Yl(e,t,d,5);break;case 6:Fe=0,Pt=null,Yl(e,t,d,6);break;case 8:uu(),at=6;break e;default:throw Error(s(462))}}Kv();break}catch(W){Xm(e,W)}while(!0);return zn=Gi=null,O.H=o,O.A=u,Ke=i,je!==null?0:(Ve=null,De=0,$s(),at)}function Kv(){for(;je!==null&&!Nn();)Jm(je)}function Jm(e){var t=Cm(e.alternate,e,$n);e.memoizedProps=e.pendingProps,t===null?ko(e):je=t}function ep(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=bm(i,t,t.pendingProps,t.type,void 0,De);break;case 11:t=bm(i,t,t.pendingProps,t.type.render,t.ref,De);break;case 5:Ac(t);default:Mm(i,t),t=je=Qf(t,$n),t=Cm(i,t,$n)}e.memoizedProps=e.pendingProps,t===null?ko(e):je=t}function Yl(e,t,i,o){zn=Gi=null,Ac(t),jl=null,Da=0;var u=t.return;try{if(kv(e,u,t,i,De)){at=1,po(e,Qt(i,e.current)),je=null;return}}catch(d){if(u!==null)throw je=u,d;at=1,po(e,Qt(i,e.current)),je=null;return}t.flags&32768?(He||o===1?e=!0:Kl||(De&536870912)!==0?e=!1:(pi=e=!0,(o===2||o===9||o===3||o===6)&&(o=Gt.current,o!==null&&o.tag===13&&(o.flags|=16384))),tp(t,e)):ko(t)}function ko(e){var t=e;do{if((t.flags&32768)!==0){tp(t,pi);return}e=t.return;var i=Lv(t.alternate,t,$n);if(i!==null){je=i;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);at===0&&(at=5)}function tp(e,t){do{var i=Rv(e.alternate,e);if(i!==null){i.flags&=32767,je=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){je=e;return}je=e=i}while(e!==null);at=6,je=null}function np(e,t,i,o,u,d,b,C,_){e.cancelPendingCommit=null;do No();while(pt!==0);if((Ke&6)!==0)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(d=t.lanes|t.childLanes,d|=Jr,v0(e,i,d,b,C,_),e===Ve&&(je=Ve=null,De=0),Fl=t,yi=e,Vn=i,ou=d,ru=u,Pm=o,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Yv(Di,function(){return op(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||o){o=O.T,O.T=null,u=J.p,J.p=2,b=Ke,Ke|=4;try{jv(e,t,i)}finally{Ke=b,J.p=u,O.T=o}}pt=1,ip(),lp(),ap()}}function ip(){if(pt===1){pt=0;var e=yi,t=Fl,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=O.T,O.T=null;var o=J.p;J.p=2;var u=Ke;Ke|=4;try{Hm(t,e);var d=Cu,b=Gf(e.containerInfo),C=d.focusedElem,_=d.selectionRange;if(b!==C&&C&&C.ownerDocument&&Ff(C.ownerDocument.documentElement,C)){if(_!==null&&qr(C)){var G=_.start,W=_.end;if(W===void 0&&(W=G),"selectionStart"in C)C.selectionStart=G,C.selectionEnd=Math.min(W,C.value.length);else{var ee=C.ownerDocument||document,Y=ee&&ee.defaultView||window;if(Y.getSelection){var q=Y.getSelection(),be=C.textContent.length,Te=Math.min(_.start,be),$e=_.end===void 0?Te:Math.min(_.end,be);!q.extend&&Te>$e&&(b=$e,$e=Te,Te=b);var U=If(C,Te),j=If(C,$e);if(U&&j&&(q.rangeCount!==1||q.anchorNode!==U.node||q.anchorOffset!==U.offset||q.focusNode!==j.node||q.focusOffset!==j.offset)){var F=ee.createRange();F.setStart(U.node,U.offset),q.removeAllRanges(),Te>$e?(q.addRange(F),q.extend(j.node,j.offset)):(F.setEnd(j.node,j.offset),q.addRange(F))}}}}for(ee=[],q=C;q=q.parentNode;)q.nodeType===1&&ee.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<ee.length;C++){var Q=ee[C];Q.element.scrollLeft=Q.left,Q.element.scrollTop=Q.top}}Io=!!Su,Cu=Su=null}finally{Ke=u,J.p=o,O.T=i}}e.current=t,pt=2}}function lp(){if(pt===2){pt=0;var e=yi,t=Fl,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=O.T,O.T=null;var o=J.p;J.p=2;var u=Ke;Ke|=4;try{Rm(e,t.alternate,t)}finally{Ke=u,J.p=o,O.T=i}}pt=3}}function ap(){if(pt===4||pt===3){pt=0,qt();var e=yi,t=Fl,i=Vn,o=Pm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?pt=5:(pt=0,Fl=yi=null,sp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(bi=null),Nr(i),t=t.stateNode,Mt&&typeof Mt.onCommitFiberRoot=="function")try{Mt.onCommitFiberRoot(ti,t,void 0,(t.current.flags&128)===128)}catch{}if(o!==null){t=O.T,u=J.p,J.p=2,O.T=null;try{for(var d=e.onRecoverableError,b=0;b<o.length;b++){var C=o[b];d(C.value,{componentStack:C.stack})}}finally{O.T=t,J.p=u}}(Vn&3)!==0&&No(),Tn(e),u=e.pendingLanes,(i&261930)!==0&&(u&42)!==0?e===cu?Qa++:(Qa=0,cu=e):Qa=0,Ja(0)}}function sp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ja(t)))}function No(){return ip(),lp(),ap(),op()}function op(){if(pt!==5)return!1;var e=yi,t=ou;ou=0;var i=Nr(Vn),o=O.T,u=J.p;try{J.p=32>i?32:i,O.T=null,i=ru,ru=null;var d=yi,b=Vn;if(pt=0,Fl=yi=null,Vn=0,(Ke&6)!==0)throw Error(s(331));var C=Ke;if(Ke|=4,Fm(d.current),Um(d,d.current,b,i),Ke=C,Ja(0,!1),Mt&&typeof Mt.onPostCommitFiberRoot=="function")try{Mt.onPostCommitFiberRoot(ti,d)}catch{}return!0}finally{J.p=u,O.T=o,sp(e,t)}}function rp(e,t,i){t=Qt(i,t),t=Ic(e.stateNode,t,2),e=di(e,t,2),e!==null&&(va(e,2),Tn(e))}function Ge(e,t,i){if(e.tag===3)rp(e,e,i);else for(;t!==null;){if(t.tag===3){rp(t,e,i);break}else if(t.tag===1){var o=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(bi===null||!bi.has(o))){e=Qt(i,e),i=cm(2),o=di(t,i,2),o!==null&&(um(i,o,t,e),va(o,2),Tn(o));break}}t=t.return}}function fu(e,t,i){var o=e.pingCache;if(o===null){o=e.pingCache=new zv;var u=new Set;o.set(t,u)}else u=o.get(t),u===void 0&&(u=new Set,o.set(t,u));u.has(i)||(lu=!0,u.add(i),e=Iv.bind(null,e,t,i),t.then(e,e))}function Iv(e,t,i){var o=e.pingCache;o!==null&&o.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Ve===e&&(De&i)===i&&(at===4||at===3&&(De&62914560)===De&&300>ut()-Co?(Ke&2)===0&&Gl(e,0):au|=i,Il===De&&(Il=0)),Tn(e)}function cp(e,t){t===0&&(t=ya()),e=Ki(e,t),e!==null&&(va(e,t),Tn(e))}function Fv(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),cp(e,i)}function Gv(e,t){var i=0;switch(e.tag){case 31:case 13:var o=e.stateNode,u=e.memoizedState;u!==null&&(i=u.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(t),cp(e,i)}function Yv(e,t){return yn(e,t)}var _o=null,Pl=null,hu=!1,Lo=!1,mu=!1,xi=0;function Tn(e){e!==Pl&&e.next===null&&(Pl===null?_o=Pl=e:Pl=Pl.next=e),Lo=!0,hu||(hu=!0,$v())}function Ja(e,t){if(!mu&&Lo){mu=!0;do for(var i=!1,o=_o;o!==null;){if(e!==0){var u=o.pendingLanes;if(u===0)var d=0;else{var b=o.suspendedLanes,C=o.pingedLanes;d=(1<<31-kt(42|e)+1)-1,d&=u&~(b&~C),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(i=!0,hp(o,d))}else d=De,d=dl(o,o===Ve?d:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(d&3)===0||ni(o,d)||(i=!0,hp(o,d));o=o.next}while(i);mu=!1}}function Pv(){up()}function up(){Lo=hu=!1;var e=0;xi!==0&&nx()&&(e=xi);for(var t=ut(),i=null,o=_o;o!==null;){var u=o.next,d=dp(o,t);d===0?(o.next=null,i===null?_o=u:i.next=u,u===null&&(Pl=i)):(i=o,(e!==0||(d&3)!==0)&&(Lo=!0)),o=u}pt!==0&&pt!==5||Ja(e),xi!==0&&(xi=0)}function dp(e,t){for(var i=e.suspendedLanes,o=e.pingedLanes,u=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var b=31-kt(d),C=1<<b,_=u[b];_===-1?((C&i)===0||(C&o)!==0)&&(u[b]=Ar(C,t)):_<=t&&(e.expiredLanes|=C),d&=~C}if(t=Ve,i=De,i=dl(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,i===0||e===t&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&vn(o),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ni(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(o!==null&&vn(o),Nr(i)){case 2:case 8:i=ga;break;case 32:i=Di;break;case 268435456:i=ba;break;default:i=Di}return o=fp.bind(null,e),i=yn(i,o),e.callbackPriority=t,e.callbackNode=i,t}return o!==null&&o!==null&&vn(o),e.callbackPriority=2,e.callbackNode=null,2}function fp(e,t){if(pt!==0&&pt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(No()&&e.callbackNode!==i)return null;var o=De;return o=dl(e,e===Ve?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(Vm(e,o,t),dp(e,ut()),e.callbackNode!=null&&e.callbackNode===i?fp.bind(null,e):null)}function hp(e,t){if(No())return null;Vm(e,t,!0)}function $v(){lx(function(){(Ke&6)!==0?yn(pa,Pv):up()})}function pu(){if(xi===0){var e=_l;e===0&&(e=Nt,Nt<<=1,(Nt&261888)===0&&(Nt=256)),xi=e}return xi}function mp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Bs(""+e)}function pp(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Vv(e,t,i,o,u){if(t==="submit"&&i&&i.stateNode===u){var d=mp((u[Lt]||null).action),b=o.submitter;b&&(t=(t=b[Lt]||null)?mp(t.formAction):b.getAttribute("formAction"),t!==null&&(d=t,b=null));var C=new Fs("action","action",null,o,u);e.push({event:C,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(xi!==0){var _=b?pp(u,b):new FormData(u);Dc(i,{pending:!0,data:_,method:u.method,action:d},null,_)}}else typeof d=="function"&&(C.preventDefault(),_=b?pp(u,b):new FormData(u),Dc(i,{pending:!0,data:_,method:u.method,action:d},d,_))},currentTarget:u}]})}}for(var gu=0;gu<Qr.length;gu++){var bu=Qr[gu],qv=bu.toLowerCase(),Xv=bu[0].toUpperCase()+bu.slice(1);fn(qv,"on"+Xv)}fn($f,"onAnimationEnd"),fn(Vf,"onAnimationIteration"),fn(qf,"onAnimationStart"),fn("dblclick","onDoubleClick"),fn("focusin","onFocus"),fn("focusout","onBlur"),fn(dv,"onTransitionRun"),fn(fv,"onTransitionStart"),fn(hv,"onTransitionCancel"),fn(Xf,"onTransitionEnd"),gl("onMouseEnter",["mouseout","mouseover"]),gl("onMouseLeave",["mouseout","mouseover"]),gl("onPointerEnter",["pointerout","pointerover"]),gl("onPointerLeave",["pointerout","pointerover"]),zi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),zi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),zi("onBeforeInput",["compositionend","keypress","textInput","paste"]),zi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),zi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),zi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var es="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Zv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(es));function gp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var o=e[i],u=o.event;o=o.listeners;e:{var d=void 0;if(t)for(var b=o.length-1;0<=b;b--){var C=o[b],_=C.instance,G=C.currentTarget;if(C=C.listener,_!==d&&u.isPropagationStopped())break e;d=C,u.currentTarget=G;try{d(u)}catch(W){Ps(W)}u.currentTarget=null,d=_}else for(b=0;b<o.length;b++){if(C=o[b],_=C.instance,G=C.currentTarget,C=C.listener,_!==d&&u.isPropagationStopped())break e;d=C,u.currentTarget=G;try{d(u)}catch(W){Ps(W)}u.currentTarget=null,d=_}}}}function Oe(e,t){var i=t[_r];i===void 0&&(i=t[_r]=new Set);var o=e+"__bubble";i.has(o)||(bp(t,e,2,!1),i.add(o))}function yu(e,t,i){var o=0;t&&(o|=4),bp(i,e,o,t)}var Ro="_reactListening"+Math.random().toString(36).slice(2);function vu(e){if(!e[Ro]){e[Ro]=!0,uf.forEach(function(i){i!=="selectionchange"&&(Zv.has(i)||yu(i,!1,e),yu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ro]||(t[Ro]=!0,yu("selectionchange",!1,t))}}function bp(e,t,i,o){switch($p(t)){case 2:var u=Tx;break;case 8:u=Mx;break;default:u=Ou}i=u.bind(null,t,i,e),u=void 0,!Ur||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),o?u!==void 0?e.addEventListener(t,i,{capture:!0,passive:u}):e.addEventListener(t,i,!0):u!==void 0?e.addEventListener(t,i,{passive:u}):e.addEventListener(t,i,!1)}function xu(e,t,i,o,u){var d=o;if((t&1)===0&&(t&2)===0&&o!==null)e:for(;;){if(o===null)return;var b=o.tag;if(b===3||b===4){var C=o.stateNode.containerInfo;if(C===u)break;if(b===4)for(b=o.return;b!==null;){var _=b.tag;if((_===3||_===4)&&b.stateNode.containerInfo===u)return;b=b.return}for(;C!==null;){if(b=hl(C),b===null)return;if(_=b.tag,_===5||_===6||_===26||_===27){o=d=b;continue e}C=C.parentNode}}o=o.return}Sf(function(){var G=d,W=Hr(i),ee=[];e:{var Y=Zf.get(e);if(Y!==void 0){var q=Fs,be=e;switch(e){case"keypress":if(Ks(i)===0)break e;case"keydown":case"keyup":q=G0;break;case"focusin":be="focus",q=Gr;break;case"focusout":be="blur",q=Gr;break;case"beforeblur":case"afterblur":q=Gr;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":q=Mf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":q=L0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":q=$0;break;case $f:case Vf:case qf:q=O0;break;case Xf:q=q0;break;case"scroll":case"scrollend":q=N0;break;case"wheel":q=Z0;break;case"copy":case"cut":case"paste":q=z0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":q=Ef;break;case"toggle":case"beforetoggle":q=Q0}var Te=(t&4)!==0,$e=!Te&&(e==="scroll"||e==="scrollend"),U=Te?Y!==null?Y+"Capture":null:Y;Te=[];for(var j=G,F;j!==null;){var Q=j;if(F=Q.stateNode,Q=Q.tag,Q!==5&&Q!==26&&Q!==27||F===null||U===null||(Q=Sa(j,U),Q!=null&&Te.push(ts(j,Q,F))),$e)break;j=j.return}0<Te.length&&(Y=new q(Y,be,null,i,W),ee.push({event:Y,listeners:Te}))}}if((t&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",q=e==="mouseout"||e==="pointerout",Y&&i!==zr&&(be=i.relatedTarget||i.fromElement)&&(hl(be)||be[fl]))break e;if((q||Y)&&(Y=W.window===W?W:(Y=W.ownerDocument)?Y.defaultView||Y.parentWindow:window,q?(be=i.relatedTarget||i.toElement,q=G,be=be?hl(be):null,be!==null&&($e=c(be),Te=be.tag,be!==$e||Te!==5&&Te!==27&&Te!==6)&&(be=null)):(q=null,be=G),q!==be)){if(Te=Mf,Q="onMouseLeave",U="onMouseEnter",j="mouse",(e==="pointerout"||e==="pointerover")&&(Te=Ef,Q="onPointerLeave",U="onPointerEnter",j="pointer"),$e=q==null?Y:wa(q),F=be==null?Y:wa(be),Y=new Te(Q,j+"leave",q,i,W),Y.target=$e,Y.relatedTarget=F,Q=null,hl(W)===G&&(Te=new Te(U,j+"enter",be,i,W),Te.target=F,Te.relatedTarget=$e,Q=Te),$e=Q,q&&be)t:{for(Te=Wv,U=q,j=be,F=0,Q=U;Q;Q=Te(Q))F++;Q=0;for(var Ce=j;Ce;Ce=Te(Ce))Q++;for(;0<F-Q;)U=Te(U),F--;for(;0<Q-F;)j=Te(j),Q--;for(;F--;){if(U===j||j!==null&&U===j.alternate){Te=U;break t}U=Te(U),j=Te(j)}Te=null}else Te=null;q!==null&&yp(ee,Y,q,Te,!1),be!==null&&$e!==null&&yp(ee,$e,be,Te,!0)}}e:{if(Y=G?wa(G):window,q=Y.nodeName&&Y.nodeName.toLowerCase(),q==="select"||q==="input"&&Y.type==="file")var Be=Df;else if(jf(Y))if(zf)Be=rv;else{Be=sv;var ye=av}else q=Y.nodeName,!q||q.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?G&&Dr(G.elementType)&&(Be=Df):Be=ov;if(Be&&(Be=Be(e,G))){Of(ee,Be,i,W);break e}ye&&ye(e,Y,G),e==="focusout"&&G&&Y.type==="number"&&G.memoizedProps.value!=null&&Or(Y,"number",Y.value)}switch(ye=G?wa(G):window,e){case"focusin":(jf(ye)||ye.contentEditable==="true")&&(Sl=ye,Xr=G,_a=null);break;case"focusout":_a=Xr=Sl=null;break;case"mousedown":Zr=!0;break;case"contextmenu":case"mouseup":case"dragend":Zr=!1,Yf(ee,i,W);break;case"selectionchange":if(uv)break;case"keydown":case"keyup":Yf(ee,i,W)}var Le;if(Pr)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 wl?Lf(e,i)&&(ze="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(ze="onCompositionStart");ze&&(kf&&i.locale!=="ko"&&(wl||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&wl&&(Le=Cf()):(li=W,Kr="value"in li?li.value:li.textContent,wl=!0)),ye=jo(G,ze),0<ye.length&&(ze=new Af(ze,e,null,i,W),ee.push({event:ze,listeners:ye}),Le?ze.data=Le:(Le=Rf(i),Le!==null&&(ze.data=Le)))),(Le=ev?tv(e,i):nv(e,i))&&(ze=jo(G,"onBeforeInput"),0<ze.length&&(ye=new Af("onBeforeInput","beforeinput",null,i,W),ee.push({event:ye,listeners:ze}),ye.data=Le)),Vv(ee,e,G,i,W)}gp(ee,t)})}function ts(e,t,i){return{instance:e,listener:t,currentTarget:i}}function jo(e,t){for(var i=t+"Capture",o=[];e!==null;){var u=e,d=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||d===null||(u=Sa(e,i),u!=null&&o.unshift(ts(e,u,d)),u=Sa(e,t),u!=null&&o.push(ts(e,u,d))),e.tag===3)return o;e=e.return}return[]}function Wv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function yp(e,t,i,o,u){for(var d=t._reactName,b=[];i!==null&&i!==o;){var C=i,_=C.alternate,G=C.stateNode;if(C=C.tag,_!==null&&_===o)break;C!==5&&C!==26&&C!==27||G===null||(_=G,u?(G=Sa(i,d),G!=null&&b.unshift(ts(i,G,_))):u||(G=Sa(i,d),G!=null&&b.push(ts(i,G,_)))),i=i.return}b.length!==0&&e.push({event:t,listeners:b})}var Qv=/\r\n?/g,Jv=/\u0000|\uFFFD/g;function vp(e){return(typeof e=="string"?e:""+e).replace(Qv,`
33
+ `).replace(Jv,"")}function xp(e,t){return t=vp(t),vp(e)===t}function Pe(e,t,i,o,u,d){switch(i){case"children":typeof o=="string"?t==="body"||t==="textarea"&&o===""||yl(e,o):(typeof o=="number"||typeof o=="bigint")&&t!=="body"&&yl(e,""+o);break;case"className":zs(e,"class",o);break;case"tabIndex":zs(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":zs(e,i,o);break;case"style":xf(e,o,d);break;case"data":if(t!=="object"){zs(e,"data",o);break}case"src":case"href":if(o===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(i);break}o=Bs(""+o),e.setAttribute(i,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(i,"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"&&(i==="formAction"?(t!=="input"&&Pe(e,t,"name",u.name,u,null),Pe(e,t,"formEncType",u.formEncType,u,null),Pe(e,t,"formMethod",u.formMethod,u,null),Pe(e,t,"formTarget",u.formTarget,u,null)):(Pe(e,t,"encType",u.encType,u,null),Pe(e,t,"method",u.method,u,null),Pe(e,t,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(i);break}o=Bs(""+o),e.setAttribute(i,o);break;case"onClick":o!=null&&(e.onclick=Rn);break;case"onScroll":o!=null&&Oe("scroll",e);break;case"onScrollEnd":o!=null&&Oe("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(i=o.__html,i!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=i}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}i=Bs(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,""+o):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":o===!0?e.setAttribute(i,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,o):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(i,o):e.removeAttribute(i);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(i):e.setAttribute(i,o);break;case"popover":Oe("beforetoggle",e),Oe("toggle",e),Ds(e,"popover",o);break;case"xlinkActuate":Ln(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Ln(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Ln(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Ln(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Ln(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Ln(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Ln(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Ln(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Ln(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Ds(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=E0.get(i)||i,Ds(e,i,o))}}function wu(e,t,i,o,u,d){switch(i){case"style":xf(e,o,d);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(i=o.__html,i!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=i}}break;case"children":typeof o=="string"?yl(e,o):(typeof o=="number"||typeof o=="bigint")&&yl(e,""+o);break;case"onScroll":o!=null&&Oe("scroll",e);break;case"onScrollEnd":o!=null&&Oe("scrollend",e);break;case"onClick":o!=null&&(e.onclick=Rn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!df.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(u=i.endsWith("Capture"),t=i.slice(2,u?i.length-7:void 0),d=e[Lt]||null,d=d!=null?d[i]:null,typeof d=="function"&&e.removeEventListener(t,d,u),typeof o=="function")){typeof d!="function"&&d!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,o,u);break e}i in e?e[i]=o:o===!0?e.setAttribute(i,""):Ds(e,i,o)}}}function Tt(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Oe("error",e),Oe("load",e);var o=!1,u=!1,d;for(d in i)if(i.hasOwnProperty(d)){var b=i[d];if(b!=null)switch(d){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:Pe(e,t,d,b,i,null)}}u&&Pe(e,t,"srcSet",i.srcSet,i,null),o&&Pe(e,t,"src",i.src,i,null);return;case"input":Oe("invalid",e);var C=d=b=u=null,_=null,G=null;for(o in i)if(i.hasOwnProperty(o)){var W=i[o];if(W!=null)switch(o){case"name":u=W;break;case"type":b=W;break;case"checked":_=W;break;case"defaultChecked":G=W;break;case"value":d=W;break;case"defaultValue":C=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(s(137,t));break;default:Pe(e,t,o,W,i,null)}}gf(e,d,C,_,G,b,u,!1);return;case"select":Oe("invalid",e),o=b=d=null;for(u in i)if(i.hasOwnProperty(u)&&(C=i[u],C!=null))switch(u){case"value":d=C;break;case"defaultValue":b=C;break;case"multiple":o=C;default:Pe(e,t,u,C,i,null)}t=d,i=b,e.multiple=!!o,t!=null?bl(e,!!o,t,!1):i!=null&&bl(e,!!o,i,!0);return;case"textarea":Oe("invalid",e),d=u=o=null;for(b in i)if(i.hasOwnProperty(b)&&(C=i[b],C!=null))switch(b){case"value":o=C;break;case"defaultValue":u=C;break;case"children":d=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(s(91));break;default:Pe(e,t,b,C,i,null)}yf(e,o,u,d);return;case"option":for(_ in i)if(i.hasOwnProperty(_)&&(o=i[_],o!=null))switch(_){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Pe(e,t,_,o,i,null)}return;case"dialog":Oe("beforetoggle",e),Oe("toggle",e),Oe("cancel",e),Oe("close",e);break;case"iframe":case"object":Oe("load",e);break;case"video":case"audio":for(o=0;o<es.length;o++)Oe(es[o],e);break;case"image":Oe("error",e),Oe("load",e);break;case"details":Oe("toggle",e);break;case"embed":case"source":case"link":Oe("error",e),Oe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in i)if(i.hasOwnProperty(G)&&(o=i[G],o!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:Pe(e,t,G,o,i,null)}return;default:if(Dr(t)){for(W in i)i.hasOwnProperty(W)&&(o=i[W],o!==void 0&&wu(e,t,W,o,i,void 0));return}}for(C in i)i.hasOwnProperty(C)&&(o=i[C],o!=null&&Pe(e,t,C,o,i,null))}function ex(e,t,i,o){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,d=null,b=null,C=null,_=null,G=null,W=null;for(q in i){var ee=i[q];if(i.hasOwnProperty(q)&&ee!=null)switch(q){case"checked":break;case"value":break;case"defaultValue":_=ee;default:o.hasOwnProperty(q)||Pe(e,t,q,null,o,ee)}}for(var Y in o){var q=o[Y];if(ee=i[Y],o.hasOwnProperty(Y)&&(q!=null||ee!=null))switch(Y){case"type":d=q;break;case"name":u=q;break;case"checked":G=q;break;case"defaultChecked":W=q;break;case"value":b=q;break;case"defaultValue":C=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(s(137,t));break;default:q!==ee&&Pe(e,t,Y,q,o,ee)}}jr(e,b,C,_,G,W,d,u);return;case"select":q=b=C=Y=null;for(d in i)if(_=i[d],i.hasOwnProperty(d)&&_!=null)switch(d){case"value":break;case"multiple":q=_;default:o.hasOwnProperty(d)||Pe(e,t,d,null,o,_)}for(u in o)if(d=o[u],_=i[u],o.hasOwnProperty(u)&&(d!=null||_!=null))switch(u){case"value":Y=d;break;case"defaultValue":C=d;break;case"multiple":b=d;default:d!==_&&Pe(e,t,u,d,o,_)}t=C,i=b,o=q,Y!=null?bl(e,!!i,Y,!1):!!o!=!!i&&(t!=null?bl(e,!!i,t,!0):bl(e,!!i,i?[]:"",!1));return;case"textarea":q=Y=null;for(C in i)if(u=i[C],i.hasOwnProperty(C)&&u!=null&&!o.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Pe(e,t,C,null,o,u)}for(b in o)if(u=o[b],d=i[b],o.hasOwnProperty(b)&&(u!=null||d!=null))switch(b){case"value":Y=u;break;case"defaultValue":q=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(s(91));break;default:u!==d&&Pe(e,t,b,u,o,d)}bf(e,Y,q);return;case"option":for(var be in i)if(Y=i[be],i.hasOwnProperty(be)&&Y!=null&&!o.hasOwnProperty(be))switch(be){case"selected":e.selected=!1;break;default:Pe(e,t,be,null,o,Y)}for(_ in o)if(Y=o[_],q=i[_],o.hasOwnProperty(_)&&Y!==q&&(Y!=null||q!=null))switch(_){case"selected":e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:Pe(e,t,_,Y,o,q)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Te in i)Y=i[Te],i.hasOwnProperty(Te)&&Y!=null&&!o.hasOwnProperty(Te)&&Pe(e,t,Te,null,o,Y);for(G in o)if(Y=o[G],q=i[G],o.hasOwnProperty(G)&&Y!==q&&(Y!=null||q!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(s(137,t));break;default:Pe(e,t,G,Y,o,q)}return;default:if(Dr(t)){for(var $e in i)Y=i[$e],i.hasOwnProperty($e)&&Y!==void 0&&!o.hasOwnProperty($e)&&wu(e,t,$e,void 0,o,Y);for(W in o)Y=o[W],q=i[W],!o.hasOwnProperty(W)||Y===q||Y===void 0&&q===void 0||wu(e,t,W,Y,o,q);return}}for(var U in i)Y=i[U],i.hasOwnProperty(U)&&Y!=null&&!o.hasOwnProperty(U)&&Pe(e,t,U,null,o,Y);for(ee in o)Y=o[ee],q=i[ee],!o.hasOwnProperty(ee)||Y===q||Y==null&&q==null||Pe(e,t,ee,Y,o,q)}function wp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function tx(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),o=0;o<i.length;o++){var u=i[o],d=u.transferSize,b=u.initiatorType,C=u.duration;if(d&&C&&wp(b)){for(b=0,C=u.responseEnd,o+=1;o<i.length;o++){var _=i[o],G=_.startTime;if(G>C)break;var W=_.transferSize,ee=_.initiatorType;W&&wp(ee)&&(_=_.responseEnd,b+=W*(_<C?1:(C-G)/(_-G)))}if(--o,t+=8*(d+b)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Su=null,Cu=null;function Oo(e){return e.nodeType===9?e:e.ownerDocument}function Sp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Cp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Tu(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 nx(){var e=window.event;return e&&e.type==="popstate"?e===Mu?!1:(Mu=e,!0):(Mu=null,!1)}var Tp=typeof setTimeout=="function"?setTimeout:void 0,ix=typeof clearTimeout=="function"?clearTimeout:void 0,Mp=typeof Promise=="function"?Promise:void 0,lx=typeof queueMicrotask=="function"?queueMicrotask:typeof Mp<"u"?function(e){return Mp.resolve(null).then(e).catch(ax)}:Tp;function ax(e){setTimeout(function(){throw e})}function wi(e){return e==="head"}function Ap(e,t){var i=t,o=0;do{var u=i.nextSibling;if(e.removeChild(i),u&&u.nodeType===8)if(i=u.data,i==="/$"||i==="/&"){if(o===0){e.removeChild(u),Xl(t);return}o--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")o++;else if(i==="html")ns(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,ns(i);for(var d=i.firstChild;d;){var b=d.nextSibling,C=d.nodeName;d[xa]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&d.rel.toLowerCase()==="stylesheet"||i.removeChild(d),d=b}}else i==="body"&&ns(e.ownerDocument.body);i=u}while(i);Xl(t)}function Ep(e,t){var i=e;e=0;do{var o=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),o&&o.nodeType===8)if(i=o.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=o}while(i)}function Au(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Au(i),Lr(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function sx(e,t,i,o){for(;e.nodeType===1;){var u=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[xa])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=ln(e.nextSibling),e===null)break}return null}function ox(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=ln(e.nextSibling),e===null))return null;return e}function kp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ln(e.nextSibling),e===null))return null;return e}function Eu(e){return e.data==="$?"||e.data==="$~"}function ku(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function rx(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var o=function(){t(),i.removeEventListener("DOMContentLoaded",o)};i.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function ln(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 Nu=null;function Np(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return ln(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function _p(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Lp(e,t,i){switch(t=Oo(i),e){case"html":if(e=t.documentElement,!e)throw Error(s(452));return e;case"head":if(e=t.head,!e)throw Error(s(453));return e;case"body":if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function ns(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Lr(e)}var an=new Map,Rp=new Set;function Do(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var qn=J.d;J.d={f:cx,r:ux,D:dx,C:fx,L:hx,m:mx,X:gx,S:px,M:bx};function cx(){var e=qn.f(),t=Ao();return e||t}function ux(e){var t=ml(e);t!==null&&t.tag===5&&t.type==="form"?Xh(t):qn.r(e)}var $l=typeof document>"u"?null:document;function jp(e,t,i){var o=$l;if(o&&typeof t=="string"&&t){var u=Zt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof i=="string"&&(u+='[crossorigin="'+i+'"]'),Rp.has(u)||(Rp.add(u),e={rel:e,crossOrigin:i,href:t},o.querySelector(u)===null&&(t=o.createElement("link"),Tt(t,"link",e),yt(t),o.head.appendChild(t)))}}function dx(e){qn.D(e),jp("dns-prefetch",e,null)}function fx(e,t){qn.C(e,t),jp("preconnect",e,t)}function hx(e,t,i){qn.L(e,t,i);var o=$l;if(o&&e&&t){var u='link[rel="preload"][as="'+Zt(t)+'"]';t==="image"&&i&&i.imageSrcSet?(u+='[imagesrcset="'+Zt(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(u+='[imagesizes="'+Zt(i.imageSizes)+'"]')):u+='[href="'+Zt(e)+'"]';var d=u;switch(t){case"style":d=Vl(e);break;case"script":d=ql(e)}an.has(d)||(e=v({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),an.set(d,e),o.querySelector(u)!==null||t==="style"&&o.querySelector(is(d))||t==="script"&&o.querySelector(ls(d))||(t=o.createElement("link"),Tt(t,"link",e),yt(t),o.head.appendChild(t)))}}function mx(e,t){qn.m(e,t);var i=$l;if(i&&e){var o=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Zt(o)+'"][href="'+Zt(e)+'"]',d=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=ql(e)}if(!an.has(d)&&(e=v({rel:"modulepreload",href:e},t),an.set(d,e),i.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ls(d)))return}o=i.createElement("link"),Tt(o,"link",e),yt(o),i.head.appendChild(o)}}}function px(e,t,i){qn.S(e,t,i);var o=$l;if(o&&e){var u=pl(o).hoistableStyles,d=Vl(e);t=t||"default";var b=u.get(d);if(!b){var C={loading:0,preload:null};if(b=o.querySelector(is(d)))C.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},i),(i=an.get(d))&&_u(e,i);var _=b=o.createElement("link");yt(_),Tt(_,"link",e),_._p=new Promise(function(G,W){_.onload=G,_.onerror=W}),_.addEventListener("load",function(){C.loading|=1}),_.addEventListener("error",function(){C.loading|=2}),C.loading|=4,zo(b,t,o)}b={type:"stylesheet",instance:b,count:1,state:C},u.set(d,b)}}}function gx(e,t){qn.X(e,t);var i=$l;if(i&&e){var o=pl(i).hoistableScripts,u=ql(e),d=o.get(u);d||(d=i.querySelector(ls(u)),d||(e=v({src:e,async:!0},t),(t=an.get(u))&&Lu(e,t),d=i.createElement("script"),yt(d),Tt(d,"link",e),i.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},o.set(u,d))}}function bx(e,t){qn.M(e,t);var i=$l;if(i&&e){var o=pl(i).hoistableScripts,u=ql(e),d=o.get(u);d||(d=i.querySelector(ls(u)),d||(e=v({src:e,async:!0,type:"module"},t),(t=an.get(u))&&Lu(e,t),d=i.createElement("script"),yt(d),Tt(d,"link",e),i.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},o.set(u,d))}}function Op(e,t,i,o){var u=(u=pe.current)?Do(u):null;if(!u)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=Vl(i.href),i=pl(u).hoistableStyles,o=i.get(t),o||(o={type:"style",instance:null,count:0,state:null},i.set(t,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=Vl(i.href);var d=pl(u).hoistableStyles,b=d.get(e);if(b||(u=u.ownerDocument||u,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,b),(d=u.querySelector(is(e)))&&!d._p&&(b.instance=d,b.state.loading=5),an.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},an.set(e,i),d||yx(u,e,i,b.state))),t&&o===null)throw Error(s(528,""));return b}if(t&&o!==null)throw Error(s(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ql(i),i=pl(u).hoistableScripts,o=i.get(t),o||(o={type:"script",instance:null,count:0,state:null},i.set(t,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Vl(e){return'href="'+Zt(e)+'"'}function is(e){return'link[rel="stylesheet"]['+e+"]"}function Dp(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function yx(e,t,i,o){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?o.loading=1:(t=e.createElement("link"),o.preload=t,t.addEventListener("load",function(){return o.loading|=1}),t.addEventListener("error",function(){return o.loading|=2}),Tt(t,"link",i),yt(t),e.head.appendChild(t))}function ql(e){return'[src="'+Zt(e)+'"]'}function ls(e){return"script[async]"+e}function zp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var o=e.querySelector('style[data-href~="'+Zt(i.href)+'"]');if(o)return t.instance=o,yt(o),o;var u=v({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),yt(o),Tt(o,"style",u),zo(o,i.precedence,e),t.instance=o;case"stylesheet":u=Vl(i.href);var d=e.querySelector(is(u));if(d)return t.state.loading|=4,t.instance=d,yt(d),d;o=Dp(i),(u=an.get(u))&&_u(o,u),d=(e.ownerDocument||e).createElement("link"),yt(d);var b=d;return b._p=new Promise(function(C,_){b.onload=C,b.onerror=_}),Tt(d,"link",o),t.state.loading|=4,zo(d,i.precedence,e),t.instance=d;case"script":return d=ql(i.src),(u=e.querySelector(ls(d)))?(t.instance=u,yt(u),u):(o=i,(u=an.get(d))&&(o=v({},i),Lu(o,u)),e=e.ownerDocument||e,u=e.createElement("script"),yt(u),Tt(u,"link",o),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(s(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(o=t.instance,t.state.loading|=4,zo(o,i.precedence,e));return t.instance}function zo(e,t,i){for(var o=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,d=u,b=0;b<o.length;b++){var C=o[b];if(C.dataset.precedence===t)d=C;else if(d!==u)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function _u(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Lu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ho=null;function Hp(e,t,i){if(Ho===null){var o=new Map,u=Ho=new Map;u.set(i,o)}else u=Ho,o=u.get(i),o||(o=new Map,u.set(i,o));if(o.has(e))return o;for(o.set(e,null),i=i.getElementsByTagName(e),u=0;u<i.length;u++){var d=i[u];if(!(d[xa]||d[xt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var b=d.getAttribute(t)||"";b=e+b;var C=o.get(b);C?C.push(d):o.set(b,[d])}}return o}function Bp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function vx(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Up(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function xx(e,t,i,o){if(i.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var u=Vl(o.href),d=t.querySelector(is(u));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Bo.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=d,yt(d);return}d=t.ownerDocument||t,o=Dp(o),(u=an.get(u))&&_u(o,u),d=d.createElement("link"),yt(d);var b=d;b._p=new Promise(function(C,_){b.onload=C,b.onerror=_}),Tt(d,"link",o),i.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=Bo.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Ru=0;function wx(e,t){return e.stylesheets&&e.count===0&&Ko(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var o=setTimeout(function(){if(e.stylesheets&&Ko(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Ru===0&&(Ru=62500*tx());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ko(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Ru?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Bo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ko(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Uo=null;function Ko(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Uo=new Map,t.forEach(Sx,e),Uo=null,Bo.call(e))}function Sx(e,t){if(!(t.state.loading&4)){var i=Uo.get(e);if(i)var o=i.get(null);else{i=new Map,Uo.set(e,i);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<u.length;d++){var b=u[d];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(i.set(b.dataset.precedence,b),o=b)}o&&i.set(null,o)}u=t.instance,b=u.getAttribute("data-precedence"),d=i.get(b)||o,d===o&&i.set(null,u),i.set(b,u),this.count++,o=Bo.bind(this),u.addEventListener("load",o),u.addEventListener("error",o),d?d.parentNode.insertBefore(u,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var as={$$typeof:N,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function Cx(e,t,i,o,u,d,b,C,_){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Er(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Er(0),this.hiddenUpdates=Er(null),this.identifierPrefix=o,this.onUncaughtError=u,this.onCaughtError=d,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=_,this.incompleteTransitions=new Map}function Kp(e,t,i,o,u,d,b,C,_,G,W,ee){return e=new Cx(e,t,i,b,_,G,W,ee,C),t=1,d===!0&&(t|=24),d=Ft(3,null,null,t),e.current=d,d.stateNode=e,t=dc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:o,isDehydrated:i,cache:t},pc(d),e}function Ip(e){return e?(e=Ml,e):Ml}function Fp(e,t,i,o,u,d){u=Ip(u),o.context===null?o.context=u:o.pendingContext=u,o=ui(t),o.payload={element:i},d=d===void 0?null:d,d!==null&&(o.callback=d),i=di(e,o,t),i!==null&&(Ht(i,e,t),Ha(i,e,t))}function Gp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function ju(e,t){Gp(e,t),(e=e.alternate)&&Gp(e,t)}function Yp(e){if(e.tag===13||e.tag===31){var t=Ki(e,67108864);t!==null&&Ht(t,e,67108864),ju(e,67108864)}}function Pp(e){if(e.tag===13||e.tag===31){var t=Vt();t=kr(t);var i=Ki(e,t);i!==null&&Ht(i,e,t),ju(e,t)}}var Io=!0;function Tx(e,t,i,o){var u=O.T;O.T=null;var d=J.p;try{J.p=2,Ou(e,t,i,o)}finally{J.p=d,O.T=u}}function Mx(e,t,i,o){var u=O.T;O.T=null;var d=J.p;try{J.p=8,Ou(e,t,i,o)}finally{J.p=d,O.T=u}}function Ou(e,t,i,o){if(Io){var u=Du(o);if(u===null)xu(e,t,o,Fo,i),Vp(e,o);else if(Ex(u,e,t,i,o))o.stopPropagation();else if(Vp(e,o),t&4&&-1<Ax.indexOf(e)){for(;u!==null;){var d=ml(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var b=_n(d.pendingLanes);if(b!==0){var C=d;for(C.pendingLanes|=2,C.entangledLanes|=2;b;){var _=1<<31-kt(b);C.entanglements[1]|=_,b&=~_}Tn(d),(Ke&6)===0&&(To=ut()+500,Ja(0))}}break;case 31:case 13:C=Ki(d,2),C!==null&&Ht(C,d,2),Ao(),ju(d,2)}if(d=Du(o),d===null&&xu(e,t,o,Fo,i),d===u)break;u=d}u!==null&&o.stopPropagation()}else xu(e,t,o,null,i)}}function Du(e){return e=Hr(e),zu(e)}var Fo=null;function zu(e){if(Fo=null,e=hl(e),e!==null){var t=c(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=f(t),e!==null)return e;e=null}else if(i===31){if(e=m(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Fo=e,null}function $p(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(_s()){case pa:return 2;case ga:return 8;case Di:case Ls:return 32;case ba:return 268435456;default:return 32}default:return 32}}var Hu=!1,Si=null,Ci=null,Ti=null,ss=new Map,os=new Map,Mi=[],Ax="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Vp(e,t){switch(e){case"focusin":case"focusout":Si=null;break;case"dragenter":case"dragleave":Ci=null;break;case"mouseover":case"mouseout":Ti=null;break;case"pointerover":case"pointerout":ss.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":os.delete(t.pointerId)}}function rs(e,t,i,o,u,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:i,eventSystemFlags:o,nativeEvent:d,targetContainers:[u]},t!==null&&(t=ml(t),t!==null&&Yp(t)),e):(e.eventSystemFlags|=o,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Ex(e,t,i,o,u){switch(t){case"focusin":return Si=rs(Si,e,t,i,o,u),!0;case"dragenter":return Ci=rs(Ci,e,t,i,o,u),!0;case"mouseover":return Ti=rs(Ti,e,t,i,o,u),!0;case"pointerover":var d=u.pointerId;return ss.set(d,rs(ss.get(d)||null,e,t,i,o,u)),!0;case"gotpointercapture":return d=u.pointerId,os.set(d,rs(os.get(d)||null,e,t,i,o,u)),!0}return!1}function qp(e){var t=hl(e.target);if(t!==null){var i=c(t);if(i!==null){if(t=i.tag,t===13){if(t=f(i),t!==null){e.blockedOn=t,rf(e.priority,function(){Pp(i)});return}}else if(t===31){if(t=m(i),t!==null){e.blockedOn=t,rf(e.priority,function(){Pp(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Go(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=Du(e.nativeEvent);if(i===null){i=e.nativeEvent;var o=new i.constructor(i.type,i);zr=o,i.target.dispatchEvent(o),zr=null}else return t=ml(i),t!==null&&Yp(t),e.blockedOn=i,!1;t.shift()}return!0}function Xp(e,t,i){Go(e)&&i.delete(t)}function kx(){Hu=!1,Si!==null&&Go(Si)&&(Si=null),Ci!==null&&Go(Ci)&&(Ci=null),Ti!==null&&Go(Ti)&&(Ti=null),ss.forEach(Xp),os.forEach(Xp)}function Yo(e,t){e.blockedOn===t&&(e.blockedOn=null,Hu||(Hu=!0,l.unstable_scheduleCallback(l.unstable_NormalPriority,kx)))}var Po=null;function Zp(e){Po!==e&&(Po=e,l.unstable_scheduleCallback(l.unstable_NormalPriority,function(){Po===e&&(Po=null);for(var t=0;t<e.length;t+=3){var i=e[t],o=e[t+1],u=e[t+2];if(typeof o!="function"){if(zu(o||i)===null)continue;break}var d=ml(i);d!==null&&(e.splice(t,3),t-=3,Dc(d,{pending:!0,data:u,method:i.method,action:o},o,u))}}))}function Xl(e){function t(_){return Yo(_,e)}Si!==null&&Yo(Si,e),Ci!==null&&Yo(Ci,e),Ti!==null&&Yo(Ti,e),ss.forEach(t),os.forEach(t);for(var i=0;i<Mi.length;i++){var o=Mi[i];o.blockedOn===e&&(o.blockedOn=null)}for(;0<Mi.length&&(i=Mi[0],i.blockedOn===null);)qp(i),i.blockedOn===null&&Mi.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(o=0;o<i.length;o+=3){var u=i[o],d=i[o+1],b=u[Lt]||null;if(typeof d=="function")b||Zp(i);else if(b){var C=null;if(d&&d.hasAttribute("formAction")){if(u=d,b=d[Lt]||null)C=b.formAction;else if(zu(u)!==null)continue}else C=b.action;typeof C=="function"?i[o+1]=C:(i.splice(o,3),o-=3),Zp(i)}}}function Wp(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(b){return u=b})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),o||setTimeout(i,20)}function i(){if(!o&&!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 o=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function Bu(e){this._internalRoot=e}$o.prototype.render=Bu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var i=t.current,o=Vt();Fp(i,o,e,t,null,null)},$o.prototype.unmount=Bu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fp(e.current,2,null,e,null,null),Ao(),t[fl]=null}};function $o(e){this._internalRoot=e}$o.prototype.unstable_scheduleHydration=function(e){if(e){var t=of();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Mi.length&&t!==0&&t<Mi[i].priority;i++);Mi.splice(i,0,e),i===0&&qp(e)}};var Qp=n.version;if(Qp!=="19.2.8")throw Error(s(527,Qp,"19.2.8"));J.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=g(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var Nx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:O,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Vo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vo.isDisabled&&Vo.supportsFiber)try{ti=Vo.inject(Nx),Mt=Vo}catch{}}return us.createRoot=function(e,t){if(!r(e))throw Error(s(299));var i=!1,o="",u=am,d=sm,b=om;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(o=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=Kp(e,1,!1,null,null,i,o,null,u,d,b,Wp),e[fl]=t.current,vu(e),new Bu(t)},us.hydrateRoot=function(e,t,i){if(!r(e))throw Error(s(299));var o=!1,u="",d=am,b=sm,C=om,_=null;return i!=null&&(i.unstable_strictMode===!0&&(o=!0),i.identifierPrefix!==void 0&&(u=i.identifierPrefix),i.onUncaughtError!==void 0&&(d=i.onUncaughtError),i.onCaughtError!==void 0&&(b=i.onCaughtError),i.onRecoverableError!==void 0&&(C=i.onRecoverableError),i.formState!==void 0&&(_=i.formState)),t=Kp(e,1,!0,t,i??null,o,u,_,d,b,C,Wp),t.context=Ip(null),i=t.current,o=Vt(),o=kr(o),u=ui(o),u.callback=null,di(i,u,o),i=o,t.current.lanes=i,va(t,i),Tn(t),e[fl]=t.current,vu(e),new $o(t)},us.version="19.2.8",us}var lg;function Kx(){if(lg)return Ku.exports;lg=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(n){console.error(n)}}return l(),Ku.exports=Ux(),Ku.exports}var Ix=Kx();const Fx=Tb(Ix),Ut="/ws/client",Ab={header:{appName:"Herdr",tagline:"remote terminal client",terminalTab:"Terminal",adminTab:"Admin",rttMs:"{rtt}ms",hostLabel:"Host",clientIdLabel:"ID:",copyClientIdTitle:"Click to copy Client ID",languageToggleTitle:"Interface language",settingsTitle:"Terminal settings",latencyTitle:"Round-trip latency (RTT)",mainNavigationAria:"Main Navigation",actionSettings:"cfg"},common:{connecting:"Connecting...",connected:"Connected",reconnecting:"Reconnecting...",disconnected:"Disconnected",error:"Error",save:"Save",cancel:"Cancel",close:"Close",done:"Done",retry:"Retry",connect:"Connect",disconnect:"Disconnect",copy:"Copy",copied:"Copied",loading:"Loading...",offline:"Offline",role:"Role",host:"Host",status:"Status",settings:"Settings",admin:"Admin",terminal:"Terminal",keyBar:"Key bar",quickInput:"Quick input",dismissNotification:"Dismiss notification",closeDialog:"Close dialog",clickToCopy:"Click to copy",controller:"Controller",viewer:"Viewer",live:"Live"},connection:{live:"Live",connecting:"Connecting",reconnecting:"Reconnecting",reconnectNow:"Reconnect now",error:"Error",offline:"Offline",connect:"Connect",retry:"Retry"},role:{controllerMode:"Controller mode active",controlActive:"Full Control",viewerWithController:"Viewer (Active: {controllerId})",sharedControl:"Full control",sharedWindows:"{count} windows",modeLabel:"Input mode",controlHint:"Keys, paste and clicks go to the terminal",observerHint:"Watch only: input is held back, scrolling still works",thisWindow:"Window",claimControl:"Claim Control",claimControlTitle:"Claim terminal control",releaseControl:"Release",releaseControlTitle:"Switch to viewer mode",takeoverControl:"Takeover",takeoverControlTitle:"Take over control from {controllerId}",takeoverModalTitle:"Confirm Control Takeover",takeoverModalDesc:"Another client is controlling this terminal.",takeoverModalWarning:"Input focus will transfer to this window.",confirmTakeover:"Confirm Takeover"},statusBanner:{connecting:"Connecting to relay...",reconnectingDefault:"Connection lost. Reconnecting...",reconnectNow:"Reconnect Now",errorDefault:"Unable to connect to relay",disconnected:"Terminal disconnected"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ restart for {version}",toast:"herdr-remote {version} is out for this workstation",toastRestart:"herdr-remote {version} is installed; restart it to apply",title:"herdr-remote update",running:"Running",installed:"Installed",latest:"Latest",restartPending:"{version} is installed but not running yet. Restart herdr-remote on the workstation:",stepTui:'On the workstation, open herdr-remote (the TUI), go to "Language & about" and press Enter on the update row.',stepCli:"Or run on the workstation:",restartNote:"Restarting reconnects this window after a few seconds.",ignore:"Skip this version",chipOutdated:"↑ update herdr-remote",toastOutdated:"{host} runs an old herdr-remote; please update it",thisHost:"this workstation",outdatedVersion:"too old to tell",outdated:"This workstation runs a herdr-remote too old to report its version or check for updates, and it lacks recent features and fixes. On the workstation, run:",windowsStop:"On Windows, first stop the running herdr-remote in PowerShell:"},herdrLaunch:{title:"Herdr is not running",body:"Herdr is not running on {host}. Start it on that workstation?",scope:"Only this paired workstation's own Herdr starts, as that workstation's user. No other machine is touched.",start:"Start Herdr",starting:"Starting Herdr on {host}…",failedTitle:"Herdr did not start",timeout:"The workstation did not answer within 30 seconds. Its herdr-remote may be too old to start Herdr from a browser.",thisHost:"this workstation"},onboarding:{title:"Pair with Herdr Remote",subtitle:"Connect your mobile or browser to your local terminal session",description:"Control Herdr sessions from any browser or phone.",firstTimeSetup:"First-time Setup",authRequired:"Authorization Required",authRequiredDesc:"Pair your device or provide a valid access token.",step1Title:"Generate Pairing Code on Host",step1Desc:"Run on the host running Herdr:",step1TuiNote:"Interactive TUI config:",step2Title:"Enter 6-character Pairing Code",step2Placeholder:"e.g. 7X9K2A",step2Note:"Pairing code expires in 10 minutes; credentials are saved automatically.",connectAndPair:"Connect & Pair",connectingAndPairing:"Pairing with Relay...",advancedTitle:"Advanced Options",manualTokenLabel:"Authentication Token",manualTokenPlaceholder:"Optional token (skips pairing code)",wsEndpointLabel:"Relay WebSocket Endpoint",wsEndpointPlaceholder:"/ws/client or wss://your-relay-host/ws/client",clientIdLabel:"Device Client Identifier"},pairing:{addTitle:"Add Herdr Instance",addSubtitle:"A pairing code is all it takes",advancedTitle:"Advanced",advancedHint:"another relay, or a device token",pairAndConnect:"Pair & Connect",credentialsRequired:"Enter a pairing code or device token.",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A2B3C4",pairCodeHelp:'Run "herdr-remote pair" on host.',tokenLabel:"Access Token",tokenNote:"(Device secret)",wsUrlLabel:"Relay WebSocket Endpoint URL"},settings:{title:"Terminal Preferences",subtitle:"Interface, font, input and alerts",subtitleInstance:"Only for {name}",tabGeneral:"General",sectionInterface:"Interface",sectionFont:"Font",sectionInput:"Input",sectionAdmin:"Administration",toggleOn:"On",toggleOff:"Off",hostFontLabel:"Workstation font",adminEntry:"Relay dashboard",adminEntryHint:"Hosts, devices and traffic; needs the admin token",adminEntryOpen:"Open",tabVirtualKeys:"Virtual Keys",tabAgentKeymaps:"Agent Keys",fontFamilyLabel:"Monospace Font",fontSizeHint:"This window only",fontSizeLabel:"Terminal Text Size ({size}px)",predictiveEchoLabel:"Predictive Echo",predictiveEchoAuto:"Auto",predictiveEchoAlways:"Always On",predictiveEchoOff:"Off",predictiveEchoDesc:"Show typing before the echo returns on slow links",touchKeyToolbar:"Touch Key Toolbar",touchKeyToolbarDesc:"Modifier and arrow keys",touchHaptics:"Haptic Feedback",touchHapticsDesc:"Vibrate on key press",agentAlertsLabel:"Agent alerts",agentAlertBadge:"Title and icon badge",agentAlertBadgeDesc:"Count waiting and finished agents in the tab title",agentAlertVibrate:"Vibrate",agentAlertVibrateDesc:"When an agent waits or finishes (page on screen)",agentAlertSound:"Chime",agentAlertSoundDesc:"In the background; works after your next tap",agentAlertNotify:"System notification",agentAlertNotifyDesc:"In the background (HTTPS only)",languageLabel:"Language",languageHint:"Shared by every instance",resetDefaults:"Reset to Defaults",resetDefaultsToast:"Settings reset to defaults",fontSizeFollowHost:"Same size as the workstation terminal ({size}px)",fontSizeFollowHostUnknown:"Same size as the workstation terminal (not reported)",hostFontSync:"Sync host font",hostGlyphLine:"CJK: {family} · {status}",hostGlyphStatus:{none:"",checking:"Checking…",installed:"Installed on this device",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading common characters",ready:"{count} characters on this device; others load as they appear",failed:"Could not be loaded"},hostFontStatus:{none:"The workstation did not report its terminal font",checking:"Checking…",installed:"Installed on this device",loaded:"Loaded from the workstation",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading {percent}%",failed:"Could not be loaded",unavailable:"No font file to load; drawn by name where installed"}},agentKeymaps:{keymapLabel:"Keymap",auto:"Auto",shell:"Shell",agentGroup:"Agent",listGroup:"{profile} shortcuts",genericGroup:"General",profileRowLabel:"Agent to edit",settingsProfileLabel:"Agent profile",autoProfile:"Auto · {profile}",pinnedProfile:"Pinned · {profile}",barGroup:"Key bar",barHint:"Tap to choose which {profile} shortcuts appear on the key bar ({count} shown); base keys are on the Virtual Keys tab.",restoreBar:"Restore default keys",customizeBar:"Choose which shortcuts the key bar shows",shortcutLabel:"Shortcut",comboPlaceholder:"e.g. ctrl+e or esc esc",invalidCombo:"Invalid shortcut: {error}",defaultCombo:"Default: {combo}",resetAction:"Reset",moveUp:"Move up",moveDown:"Move down",unverified:"Unverified",addCustom:"Custom key",customLabel:"Function name",customCombo:"Key combo",comboPickerTitle:"Choose shortcut",comboPickerHint:"Select modifiers, then choose a key. Add more keys to create a sequence.",comboPickerSelection:"Shortcut",comboPickerModifiers:"Modifiers for the next key",comboPickerKeyboard:"Virtual keyboard",comboPickerEmpty:"Select a key or modifier to start.",comboPickerClear:"Clear",comboPickerRemoveStep:"Remove step {step}",comboPickerApply:"Use shortcut",addAction:"Add custom key",restoreProfile:"Restore this agent defaults",removeCustom:"Remove custom key",configHint:"Agent config: {path}",noAgentActions:"No agent-specific shortcuts.",errors:{empty:"Enter at least one key.",tooManySteps:"A shortcut can have at most {count} steps.",invalidStepSyntax:"Step {step} has invalid syntax. Use ctrl+o or esc esc.",duplicateModifier:"Step {step} repeats {modifier}.",missingKey:"Step {step} needs a key after the modifiers.",multipleKeys:"Step {step} can have only one key.",unsupportedKey:"Step {step} does not support “{key}”."}},agentActions:{mode:"Mode",rewind:"Rewind",details:"Details",model:"Model",thinking:"Thinking",todos:"Tasks",background:"Background",editor:"Editor",history:"History",stash:"Stash",pasteImage:"Paste image",newline:"New line",interrupt:"Interrupt",editPrevious:"Edit previous",queue:"Queue prompt",copy:"Copy",clear:"Clear",yolo:"YOLO mode",expand:"Expand",undo:"Undo",agent:"Next agent",agentBack:"Previous agent",palette:"Command palette",recentModel:"Recent model",variant:"Model variant",newSession:"New session",sessions:"Sessions",thinkingMode:"Thinking mode",nextModel:"Next model",modelPicker:"Model picker",tools:"Tools",thinkingBlocks:"Thinking blocks",followup:"Follow-up",dequeue:"Remove from queue",plan:"Plan mode",temporaryModel:"Temporary model",expandAll:"Expand all",reasoning:"Reasoning effort",review:"Review",specMode:"Spec mode",autonomy:"Autonomy",undoPicker:"Undo picker",steer:"Steer",sidebar:"Sidebar",agents:"Agents",permissionMode:"Permission mode",bypass:"Bypass permissions",tasks:"Tasks",interject:"Interject",multiline:"Multiline input",shortcuts:"Shortcuts",approve:"Approve",eof:"End of input",suspend:"Suspend",startOfLine:"Line start",endOfLine:"Line end",killToEnd:"Delete to line end",agentSwap:"Switch agent",activity:"Activity",planAct:"Plan / Act",autoApprove:"Auto-approve",search:"Search"},virtualKeyboard:{collapseToolbar:"Collapse Toolbar",expandToolbar:"Expand Toolbar",customizeTitle:"Custom Key Toolbar",customizeDesc:"Reorder, enable, or disable keys for your toolbar.",enabledKeysCount:"{count} keys enabled",resetLayout:"Reset to Default",addKey:"Add Key",availableKeys:"Available Keys",moveUp:"Move Up",moveDown:"Move Down",enableKey:"Enable Key",disableKey:"Disable Key",deleteKeyTitle:"Remove Key",keyTypeModifier:"Modifier",keyTypeNav:"Navigation",keyTypeAction:"Action",keyTypeChord:"Chord",keyTypeFn:"Function",keyTypeSymbol:"Symbol",fnDrawerTitle:"Function Keys (F1-F12)",chordsDrawerTitle:"Control Chords (^C, ^D, ^Z)",symbolsDrawerTitle:"Symbols (~, |, /, \\)",touchKeyboardShortcuts:"Shortcuts Toolbar",ctrlCTitle:"Ctrl+C (SIGINT)",ctrlDTitle:"Ctrl+D (EOF)",ctrlZTitle:"Ctrl+Z (SIGTSTP)",ctrlLTitle:"Ctrl+L (Clear)",ctrlRTitle:"Ctrl+R (Search)",ctrlATitle:"Ctrl+A (Start of line)",ctrlETitle:"Ctrl+E (End of line)",ctrlKTitle:"Ctrl+K (Kill to end)",badgeSigint:"SIGINT",badgeEof:"EOF",badgeTstp:"SIGTSTP",badgeClear:"CLEAR",badgeSearch:"SEARCH",badgeStart:"START",badgeEnd:"END",badgeKill:"KILL",uploadImage:"Upload Image",uploadImageTitle:"Select and upload image to terminal",uploadProgressReading:"Reading...",uploadProgressProcessing:"Compressing...",uploadProgressSending:"Uploading...",uploadProgressWaitingHost:"Waiting for host...",uploadProgressCompleted:"Completed",uploadProgressFailed:"Upload failed"},profiles:{title:"Herdr instances",switcherLabel:"Switch Herdr instance",current:"current",empty:"No paired Herdr instances yet.",addHost:"Add Herdr instance",rename:"Rename instance",remove:"Remove locally",removeConfirm:"Remove this saved connection from this browser?"},mobile:{sessionControls:"Session controls",closeSessionControls:"Close session controls",terminalControlAria:"Terminal control",inputControl:"Input control",settingsAria:"Terminal settings",keybarAria:"Toggle key toolbar",quickInputAria:"Toggle quick commands",menu:"Menu",statusBarAria:"Session status bar"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"Connected to Herdr session.",windowAriaLabel:"Terminal Window",bufferAriaLabel:"Terminal Buffer",offlineStatusAria:"Offline Status",releaseControlAria:"Release Control",takeoverControlAria:"Takeover Control",claimControlAria:"Claim Control",newAdminTerminal:"Open an administrator PowerShell tab in Herdr",adminTerminalSetup:"On the Windows host, open the herdr-remote TUI, go to Keep-alive, and choose Set up admin terminal access. Approve the one-time Windows prompt under the same account as Herdr Remote.",adminTerminalUpdate:"Update the relay and Windows host connector before opening an administrator terminal."},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab (Claude Code: cycle modes)",ctrl:"Ctrl modifier (tap to toggle, long-press to combine)",alt:"Alt modifier (tap to toggle, long-press to combine)",shift:"Shift modifier (tap to toggle, long-press to combine)",meta:"Meta / Cmd",enter:"Enter",backspace:"Backspace",delete:"Delete",left:"Left (←)",up:"Up (↑)",down:"Down (↓)",right:"Right (→)",home:"Home",end:"End",page_up:"Page Up",page_down:"Page Down",insert:"Insert",drawer_chords:"Ctrl Chords",drawer_agent:"Agent shortcuts",drawer_symbols:"Symbols",drawer_fn:"Function Keys (F1-F12)",ctrl_c:"Ctrl+C (SIGINT)",ctrl_d:"Ctrl+D (EOF)",ctrl_z:"Ctrl+Z (SIGTSTP)",ctrl_l:"Ctrl+L (Clear)",ctrl_a:"Ctrl+A (Start of line)",ctrl_e:"Ctrl+E (End of line)",ctrl_k:"Ctrl+K (Kill to end)",ctrl_r:"Ctrl+R (Search history)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"Pipe (|)",sym_tilde:"Tilde (~)",sym_slash:"Slash (/)",sym_backslash:"Backslash (\\)",sym_dash:"Dash (-)",sym_underscore:"Underscore (_)",sym_dollar:"Dollar ($)",sym_ampersand:"Ampersand (&)",sym_quote:'Quote (")',sym_backtick:"Backtick (`)"},admin:{returnToTerminal:"Return to Terminal",terminalShells:"terminal sessions",startedAt:"Started at {time}",acrossWindows:"across {count} windows",perSecond:"{value}/s",unitDay:"d",unitHour:"h",unitMinute:"m",unitSecond:"s",startedRecently:"Started recently",updatedAt:"Updated at {time}",autoRefresh:"Auto refresh",paused:"Paused",refreshNow:"Refresh",connectedHosts:"Connected Hosts",activeUsers:"Active Users",activePtys:"Active PTYs",activeController:"Active Controller",uptime:"Uptime",none:"None",noHost:"No host connected",tabOverview:"Overview",tabClients:"Clients ({count})",tabPtys:"PTY Sessions ({count})",tabDevices:"Paired Devices ({count})",hostsTitle:"Hosts ({count})",noHosts:"No hosts connected or paired",hostConnectedDevices:"{count} connected",hostPairedDevices:"{count} paired",hostStatusOnline:"Online",hostStatusBusy:"In use",hostStatusReconnecting:"Reconnecting",hostStatusOffline:"Offline",hostRosterOperatorOnly:"Device list is visible to the relay operator only.",connectedClientsTitle:"Connected Clients ({count})",noClients:"No clients connected",colClientId:"Client ID",colDevice:"Device",colLastSeen:"Last Seen",colActions:"Actions",unknownDevice:"Unknown Device",pairedDevicesTitle:"Paired Devices ({count})",noDevices:"No paired devices",revokeDevice:"Revoke",revokeConfirm:"Confirm Revocation",revokeFailed:"Revocation failed",colRole:"Role",colIp:"IP Address",colConnectedAt:"Connected At",colTraffic:"Traffic ↓in / ↑out",activePtysTitle:"Active PTY Sessions ({count})",noPtys:"No active PTY sessions",colPtyId:"PTY ID",colPid:"PID",colCommand:"Command",colGrid:"Grid",colCwd:"Working Directory",colViewers:"Windows",copiedJson:"Copied",unauthorizedTitle:"Unauthorized (401/403)",unauthorizedDesc:"GET /api/status requires an authorized device token.",pairingStepsTitle:"Device Pairing:",pairingStepsHelp:"Run pairing command on host to get a code, then enter it here.",enterPairCodeBtn:"Enter Pairing Code",retryFetchBtn:"Retry Status",errorConnecting:"Failed to fetch GET /api/status: {error}",loadingStatus:"Loading status from /api/status...",remoteRelayTitle:"Remote Relay Administration",remoteRelayNotice:"Connected to remote relay. For server metrics, access the operator dashboard.",remoteRelayEndpoint:"Remote WebSocket Endpoint:",remoteRelayAdminUrl:"Remote Admin URL:",openRemoteAdminBtn:"Open Remote Admin",relayAdminTitle:"Relay Operator Dashboard",relayAdminTokenLabel:"Relay Admin Token (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"Enter RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"RELAY_ADMIN_TOKEN is not configured on this relay.",relayAdminLoginBtn:"Verify & View Metrics",relayAdminAuthError:"Invalid or unauthorized admin token.",remoteRelayClientNotice:"Terminal client connection. For server metrics, use the operator dashboard.",openOperatorPortal:"Open Operator Dashboard",localWorkstationBadge:"Local Relay",modeLocal:"Local Mode",modeRemote:"Remote Mode",hintTabs:"switch tabs",hintRefresh:"refresh status",hintBack:"return to terminal",relJustNow:"just now",relMinutes:"{count}m ago",relHours:"{count}h ago",relDays:"{count}d ago",statInbound:"Inbound",statOutbound:"Outbound",statTotal:"{value} total",hostsOfflineSub:"{count} more offline",colHost:"Host",colStatus:"Status",deviceWindows:"{count} windows open",hostPtys:"{count} PTY",hostVersion:"herdr-remote {version}",hostVersionBehind:"herdr-remote {version} → {latest}",hostVersionUnknown:"herdr-remote too old",relayAdminPrompt:"Enter RELAY_ADMIN_TOKEN to see this relay's hosts, devices and traffic."},toasts:{connected:"Connected to relay",connectionError:"Connection error",controlGranted:"Control granted",pairedSuccess:"Paired successfully",sessionEnded:"Session ended",controlReleased:"Control released",viewerModeWarning:"This window is in viewer mode. Switch to Full control to type.",clientIdCopied:"Client ID copied: {id}",switchedLanguage:"Language switched to {lang}",settingsReset:"Settings reset to default",fontReset:"Font reset to default",commandCopied:"Command copied",keyLayoutReset:"Key layout reset"},shortcuts:{title:"Shortcuts",help:"Active outside terminal input area:",terminalInputNote:"Terminal shortcuts pass directly to host PTY."},serverErrors:{auth_required:"Pairing required: enter a pairing code, or a device token that is still valid.",unauthorized:"This device is not authorised for that workstation.",host_offline:"The paired workstation is not connected to this relay.",host_disconnected:"The workstation disconnected.",stale_host:"The workstation stopped answering and was dropped.",too_many_clients:"That workstation has reached its window limit.",rate_limited:"Too many pairing attempts. Wait a minute and try again.",invalid_handshake:"The relay rejected the handshake. Reload the page.",device_revoked:"This device was revoked by the relay operator.",connection_closed:"Connection closed. Reconnecting…",connection_stale:"The connection went quiet while the page was away. Reconnecting…",connection_stalled:"Connecting took too long. Trying again…",connection_failed:"Could not open a connection to the relay.",host_reconnecting:"The Herdr host is reconnecting.",host_reconnect_timeout:"The Herdr host did not reconnect in time.",host_replaced:"The Herdr host connection was replaced.",slow_client:"This browser was disconnected because it could not keep up.",client_send_failed:"The relay could not send data to this browser.",too_many_hosts:"This relay has reached its host limit.",paste_file_unsupported:"Unsupported image format for paste.",paste_file_too_large:"Pasted image 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.",admin_broker_unavailable:"The administrator terminal broker is not running. On the Windows host, open the herdr-remote TUI, go to Keep-alive, and choose Set up admin terminal access, then tap Admin again.",admin_terminal_unsupported:"This relay or Windows host connector cannot open administrator terminals. Upgrade both, then try again.",admin_tab_failed:"Could not open the administrator tab in Herdr. The host connector log has the details."},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"}},Gx={header:{appName:"Herdr",tagline:"远程终端客户端",terminalTab:"终端",adminTab:"管理面板",rttMs:"{rtt}ms",hostLabel:"主机",clientIdLabel:"客户端 ID:",copyClientIdTitle:"点击复制客户端 ID",languageToggleTitle:"界面语言",settingsTitle:"终端设置",latencyTitle:"网络延迟 (RTT)",mainNavigationAria:"主导航菜单",actionSettings:"设置"},common:{connecting:"连接中...",connected:"已连接",reconnecting:"重连中...",disconnected:"已断开",error:"错误",save:"保存",cancel:"取消",close:"关闭",done:"完成",retry:"重试",connect:"连接",disconnect:"断开连接",copy:"复制",copied:"已复制",loading:"加载中...",offline:"离线",role:"角色",host:"主机",status:"连接状态",settings:"设置",admin:"管理面板",terminal:"终端",keyBar:"按键条",quickInput:"快捷输入",dismissNotification:"关闭通知",closeDialog:"关闭对话框",clickToCopy:"点击复制",controller:"控制端",viewer:"观察者",live:"运行中"},connection:{live:"在线",connecting:"连接中",reconnecting:"正在重连",reconnectNow:"立即重连",error:"连接错误",offline:"离线",connect:"发起连接",retry:"重试"},role:{controllerMode:"控制模式",controlActive:"控制端",viewerWithController:"观察者(控制者: {controllerId})",sharedControl:"完全控制",sharedWindows:"{count} 个窗口",modeLabel:"输入模式",controlHint:"按键、粘贴和点击都会发送到终端",observerHint:"只看不动:输入被拦下,仍可滚动",thisWindow:"本窗口",claimControl:"获取控制权",claimControlTitle:"获取终端控制权",releaseControl:"释放控制权",releaseControlTitle:"切回观察者模式",takeoverControl:"强占控制权",takeoverControlTitle:"从 {controllerId} 接管控制权",takeoverModalTitle:"确认接管终端控制权?",takeoverModalDesc:"当前已有其他客户端控制该终端。",takeoverModalWarning:"接管后输入焦点切换至当前窗口。",confirmTakeover:"确认接管"},statusBanner:{connecting:"连接 Relay 服务中...",reconnectingDefault:"连接断开,正在重连...",reconnectNow:"立即重连",errorDefault:"无法连接 Relay 服务",disconnected:"会话已断开"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ 重启以应用 {version}",toast:"宿主机的 herdr-remote 有新版本 {version}",toastRestart:"herdr-remote {version} 已安装,重启后生效",title:"herdr-remote 更新",running:"正在运行",installed:"已安装",latest:"最新版本",restartPending:"{version} 已安装但尚未运行。在宿主机上重启 herdr-remote:",stepTui:"在宿主机打开 herdr-remote(TUI),进入「语言与关于」,在更新一行按 Enter。",stepCli:"或在宿主机上执行:",restartNote:"重启后这个窗口会在几秒内自动重连。",ignore:"忽略此版本",chipOutdated:"↑ 升级 herdr-remote",toastOutdated:"{host} 的 herdr-remote 版本过旧,请升级",thisHost:"这台宿主机",outdatedVersion:"过旧,无法获知版本",outdated:"这台宿主机的 herdr-remote 太旧,不会报告版本,也不会检查更新,还缺少近期的功能和修复。在宿主机上执行:",windowsStop:"Windows 上先在 PowerShell 里结束正在运行的 herdr-remote:"},herdrLaunch:{title:"Herdr 未运行",body:"{host} 上没有正在运行的 Herdr。要在这台宿主机上启动吗?",scope:"只会以这台已配对宿主机自己的用户身份,启动它自己的 Herdr,不会碰其他任何机器。",start:"启动 Herdr",starting:"正在 {host} 上启动 Herdr…",failedTitle:"Herdr 没有启动",timeout:"宿主机 30 秒内没有回应。它的 herdr-remote 可能版本过旧,不支持从浏览器启动 Herdr。",thisHost:"这台宿主机"},onboarding:{title:"配对 Herdr Remote",subtitle:"连接手机或浏览器至本地终端会话",description:"在浏览器或移动设备中控制 Herdr 会话。",firstTimeSetup:"首次配对",authRequired:"需要认证",authRequiredDesc:"使用配对码配对设备,或提供有效访问令牌。",step1Title:"在 Herdr 宿主机生成配对码",step1Desc:"在运行 Herdr 的主机终端执行:",step1TuiNote:"交互式 TUI 配置:",step2Title:"输入 6 位配对码",step2Placeholder:"例如:7X9K2A",step2Note:"配对码 10 分钟内有效,连接后自动保存凭据。",connectAndPair:"连接并完成配对",connectingAndPairing:"配对中...",advancedTitle:"高级选项",manualTokenLabel:"认证 Token",manualTokenPlaceholder:"可选 Token(跳过配对码)",wsEndpointLabel:"Relay WebSocket 端点",wsEndpointPlaceholder:"/ws/client 或 wss://relay-host/ws/client",clientIdLabel:"客户端标识 (Client ID)"},pairing:{addTitle:"添加 Herdr 实例",addSubtitle:"只需输入配对码",advancedTitle:"高级选项",advancedHint:"其他 Relay 或已有设备 Token",pairAndConnect:"配对并连接",credentialsRequired:"请输入配对码或设备令牌。",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A2B3C4",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',tokenLabel:"访问 Token",tokenNote:"(设备凭据)",wsUrlLabel:"Relay WebSocket 端点"},settings:{title:"终端设置",subtitle:"界面、字体、输入与提醒",subtitleInstance:"仅对 {name} 生效",tabGeneral:"通用",sectionInterface:"界面",sectionFont:"字体",sectionInput:"输入",sectionAdmin:"管理",toggleOn:"开",toggleOff:"关",hostFontLabel:"宿主机字体",adminEntry:"Relay 管理面板",adminEntryHint:"主机、设备与流量;需要管理员令牌",adminEntryOpen:"打开",tabVirtualKeys:"虚拟按键",tabAgentKeymaps:"智能体按键",fontFamilyLabel:"等宽字体",fontSizeHint:"只影响当前窗口",fontSizeLabel:"终端字号 ({size}px)",predictiveEchoLabel:"预测回显",predictiveEchoAuto:"自动",predictiveEchoAlways:"始终开启",predictiveEchoOff:"关闭",predictiveEchoDesc:"高延迟时先显示输入,回显到达后校正",touchKeyToolbar:"底部触控按键条",touchKeyToolbarDesc:"修饰键与方向键",touchHaptics:"触控振动反馈",touchHapticsDesc:"按键时轻微震动",agentAlertsLabel:"智能体提醒",agentAlertBadge:"标题与图标角标",agentAlertBadgeDesc:"标签页标题显示等待与完成数",agentAlertVibrate:"震动",agentAlertVibrateDesc:"等待确认或完成时(页面在前台)",agentAlertSound:"提示音",agentAlertSoundDesc:"页面在后台时播放,下次点击后生效",agentAlertNotify:"系统通知",agentAlertNotifyDesc:"页面在后台时通知(仅 HTTPS)",languageLabel:"显示语言",languageHint:"所有实例共用",resetDefaults:"恢复默认设置",resetDefaultsToast:"设置已恢复默认",fontSizeFollowHost:"与宿主机终端同字号({size}px)",fontSizeFollowHostUnknown:"与宿主机终端同字号(宿主机未报告)",hostFontSync:"同步宿主机字体",hostGlyphLine:"中文:{family} · {status}",hostGlyphStatus:{none:"",checking:"检查中…",installed:"本机已安装",available:"未加载",declined:"未加载,正在使用本机字体",loading:"正在加载常用字",ready:"本机已有 {count} 字,其余出现时自动补齐",failed:"加载失败"},hostFontStatus:{none:"宿主机未报告终端字体",checking:"检查中…",installed:"本机已安装",loaded:"已从宿主机加载",available:"未加载",declined:"未加载,正在使用本机字体",loading:"加载中 {percent}%",failed:"加载失败",unavailable:"没有可传输的字体文件,已安装该字体的设备按名称显示"}},agentKeymaps:{keymapLabel:"按键方案",auto:"自动",shell:"Shell",agentGroup:"智能体",listGroup:"{profile} 快捷键",genericGroup:"通用",profileRowLabel:"编辑的智能体",settingsProfileLabel:"智能体方案",autoProfile:"自动 · {profile}",pinnedProfile:"固定 · {profile}",barGroup:"按键栏显示",barHint:"点选要在按键栏显示的 {profile} 快捷键(已显示 {count} 个);ESC、方向键在「虚拟按键」页。",restoreBar:"恢复默认显示",customizeBar:"自定义按键栏显示哪些快捷键",shortcutLabel:"快捷键",comboPlaceholder:"例如 ctrl+e 或 esc esc",invalidCombo:"快捷键无效:{error}",defaultCombo:"默认:{combo}",resetAction:"重置",moveUp:"上移",moveDown:"下移",unverified:"未验证",addCustom:"自定义按键",customLabel:"功能名称",customCombo:"按键组合",comboPickerTitle:"选择快捷键",comboPickerHint:"先选择修饰键,再选择按键;继续选择按键可组成按键序列。",comboPickerSelection:"快捷键组合",comboPickerModifiers:"下一按键的修饰键",comboPickerKeyboard:"虚拟键盘",comboPickerEmpty:"选择按键或修饰键以开始组合。",comboPickerClear:"清空",comboPickerRemoveStep:"移除第 {step} 步",comboPickerApply:"使用此组合",addAction:"添加自定义按键",restoreProfile:"恢复此智能体默认设置",removeCustom:"删除自定义按键",configHint:"智能体配置:{path}",noAgentActions:"此智能体没有专用快捷键。",errors:{empty:"至少输入一个按键。",tooManySteps:"快捷键最多包含 {count} 个步骤。",invalidStepSyntax:"第 {step} 步格式无效。可输入 ctrl+o 或 esc esc。",duplicateModifier:"第 {step} 步重复使用了 {modifier}。",missingKey:"第 {step} 步需要在修饰键后输入一个按键。",multipleKeys:"第 {step} 步只能包含一个按键。",unsupportedKey:"第 {step} 步不支持按键“{key}”。"}},agentActions:{mode:"模式",rewind:"回退",details:"详情",model:"模型",thinking:"思考",todos:"任务",background:"后台运行",editor:"编辑器",history:"历史",stash:"暂存",pasteImage:"粘贴图片",newline:"换行",interrupt:"中断",editPrevious:"编辑上一条",queue:"排队发送",copy:"复制",clear:"清屏",yolo:"YOLO 模式",expand:"展开",undo:"撤销",agent:"下一个智能体",agentBack:"上一个智能体",palette:"命令面板",recentModel:"最近模型",variant:"模型变体",newSession:"新会话",sessions:"会话列表",thinkingMode:"思考模式",nextModel:"下一个模型",modelPicker:"模型选择器",tools:"工具",thinkingBlocks:"思考内容",followup:"后续提问",dequeue:"移出队列",plan:"计划模式",temporaryModel:"临时模型",expandAll:"全部展开",reasoning:"推理强度",review:"代码审查",specMode:"规格模式",autonomy:"自主模式",undoPicker:"撤销菜单",steer:"引导",sidebar:"侧栏",agents:"智能体列表",permissionMode:"权限模式",bypass:"绕过权限",tasks:"任务",interject:"插话",multiline:"多行输入",shortcuts:"快捷键",approve:"批准",eof:"结束输入",suspend:"挂起",startOfLine:"行首",endOfLine:"行尾",killToEnd:"删除至行尾",agentSwap:"切换智能体",activity:"活动面板",planAct:"计划 / 执行",autoApprove:"自动批准",search:"搜索"},virtualKeyboard:{collapseToolbar:"收起按键栏",expandToolbar:"展开按键栏",customizeTitle:"自定义虚拟按键",customizeDesc:"调整按键顺序与启禁用状态。",enabledKeysCount:"已启用 {count} 个按键",resetLayout:"恢复默认布局",addKey:"添加按键",availableKeys:"可选按键库",moveUp:"前移",moveDown:"后移",enableKey:"启用按键",disableKey:"禁用按键",deleteKeyTitle:"删除按键",keyTypeModifier:"修饰键",keyTypeNav:"导航键",keyTypeAction:"动作键",keyTypeChord:"组合键",keyTypeFn:"功能键",keyTypeSymbol:"符号",fnDrawerTitle:"功能键 (F1-F12)",chordsDrawerTitle:"控制组合键 (^C, ^D, ^Z)",symbolsDrawerTitle:"终端常用符号 (~, |, /, \\)",touchKeyboardShortcuts:"快捷键工具栏",ctrlCTitle:"Ctrl+C (中断)",ctrlDTitle:"Ctrl+D (退出)",ctrlZTitle:"Ctrl+Z (挂起)",ctrlLTitle:"Ctrl+L (清屏)",ctrlRTitle:"Ctrl+R (搜索)",ctrlATitle:"Ctrl+A (行首)",ctrlETitle:"Ctrl+E (行尾)",ctrlKTitle:"Ctrl+K (剪切)",badgeSigint:"中断",badgeEof:"退出",badgeTstp:"挂起",badgeClear:"清屏",badgeSearch:"搜索",badgeStart:"行首",badgeEnd:"行尾",badgeKill:"剪切",uploadImage:"上传图片",uploadImageTitle:"选择图片并上传至终端",uploadProgressReading:"读取中...",uploadProgressProcessing:"处理压缩中...",uploadProgressSending:"上传中...",uploadProgressWaitingHost:"等待工作站保存...",uploadProgressCompleted:"完成",uploadProgressFailed:"上传失败"},profiles:{title:"Herdr 实例",switcherLabel:"切换 Herdr 实例",current:"当前",empty:"还没有已配对的 Herdr 实例。",addHost:"添加 Herdr 实例",rename:"重命名实例",remove:"仅本地移除",removeConfirm:"确认从此浏览器移除已保存的连接?"},mobile:{sessionControls:"会话控制",closeSessionControls:"关闭会话控制面板",terminalControlAria:"终端控制权",inputControl:"输入控制权",settingsAria:"终端设置",keybarAria:"切换触控按键条",quickInputAria:"切换快捷命令",menu:"菜单",statusBarAria:"会话状态栏"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"已连接至 Herdr 会话。",windowAriaLabel:"远程终端窗口",bufferAriaLabel:"xterm 终端缓冲区",offlineStatusAria:"离线状态",releaseControlAria:"释放终端控制权",takeoverControlAria:"强占终端控制权",claimControlAria:"获取终端控制权",newAdminTerminal:"在 Herdr 中新建管理员 PowerShell 标签页",adminTerminalSetup:"请在 Windows 主机打开 herdr-remote TUI,进入「保活」并选择「设置管理员终端」,再使用运行 Herdr Remote 的同一账户批准一次 Windows 提权提示。",adminTerminalUpdate:"请先升级 relay 和 Windows 主机连接器,再新建管理员终端。"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab(Claude Code 切换模式)",ctrl:"Ctrl 修饰键(点按切换,长按组合)",alt:"Alt 修饰键(点按切换,长按组合)",shift:"Shift 修饰键(点按切换,长按组合)",meta:"Meta / 命令键",enter:"回车 (Enter)",backspace:"退格 (Backspace)",delete:"删除 (Delete)",left:"左箭头 (←)",up:"上箭头 (↑)",down:"下箭头 (↓)",right:"右箭头 (→)",home:"行首 (Home)",end:"行尾 (End)",page_up:"向上翻页 (Page Up)",page_down:"向下翻页 (Page Down)",insert:"插入 (Insert)",drawer_chords:"常用 Ctrl 组合键",drawer_agent:"智能体快捷键",drawer_symbols:"常用特殊符号",drawer_fn:"功能键 (F1-F12)",ctrl_c:"Ctrl+C (中断)",ctrl_d:"Ctrl+D (退出)",ctrl_z:"Ctrl+Z (挂起)",ctrl_l:"Ctrl+L (清屏)",ctrl_a:"Ctrl+A (行首)",ctrl_e:"Ctrl+E (行尾)",ctrl_k:"Ctrl+K (剪切)",ctrl_r:"Ctrl+R (历史搜索)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"管道符 (|)",sym_tilde:"波浪号 (~)",sym_slash:"正斜杠 (/)",sym_backslash:"反斜杠 (\\)",sym_dash:"连字符 (-)",sym_underscore:"下划线 (_)",sym_dollar:"美元符 ($)",sym_ampersand:"与符号 (&)",sym_quote:'双引号 (")',sym_backtick:"反引号 (`)"},admin:{returnToTerminal:"返回终端",terminalShells:"终端会话",startedAt:"启动于 {time}",acrossWindows:"共 {count} 个窗口",perSecond:"{value}/秒",unitDay:" 天",unitHour:" 小时",unitMinute:" 分",unitSecond:" 秒",startedRecently:"最近启动",updatedAt:"更新于 {time}",autoRefresh:"自动刷新",paused:"暂停刷新",refreshNow:"立即刷新",connectedHosts:"接入主机",activeUsers:"活跃用户",activePtys:"活动 PTY",activeController:"活跃控制者",uptime:"运行时间",none:"无",noHost:"未连接主机",tabOverview:"概览",tabClients:"客户端 ({count})",tabPtys:"PTY ({count})",tabDevices:"设备 ({count})",hostsTitle:"主机 ({count})",noHosts:"暂无接入或配对的主机",hostConnectedDevices:"{count} 台在线",hostPairedDevices:"{count} 台已配对",hostStatusOnline:"在线",hostStatusBusy:"使用中",hostStatusReconnecting:"重连中",hostStatusOffline:"离线",hostRosterOperatorOnly:"设备清单仅 Relay 操作员可见。",connectedClientsTitle:"已连接客户端 ({count})",noClients:"当前暂无客户端连接",colClientId:"客户端 ID",colDevice:"设备",colLastSeen:"最近活动",colActions:"操作",unknownDevice:"未知设备",pairedDevicesTitle:"已配对设备 ({count})",noDevices:"尚未配对任何设备",revokeDevice:"撤销",revokeConfirm:"确认撤销",revokeFailed:"撤销失败",colRole:"角色",colIp:"IP 地址",colConnectedAt:"连接于",colTraffic:"流量 ↓入 / ↑出",activePtysTitle:"活动 PTY 终端会话 ({count})",noPtys:"当前无活跃的 PTY 会话",colPtyId:"PTY 标识",colPid:"进程 PID",colCommand:"运行命令",colGrid:"网格规格",colCwd:"工作目录",colViewers:"窗口数",copiedJson:"已复制",unauthorizedTitle:"管理接口未授权 (401/403)",unauthorizedDesc:"访问 GET /api/status 需要已授权的设备 Token。",pairingStepsTitle:"设备配对指引:",pairingStepsHelp:"在主机运行配对命令获取配对码后输入。",enterPairCodeBtn:"输入配对码",retryFetchBtn:"重新获取状态",errorConnecting:"连接 GET /api/status 失败:{error}",loadingStatus:"正在加载系统状态...",remoteRelayTitle:"远程 Relay 服务管理",remoteRelayNotice:"当前连接至远程独立 Relay 服务。如需查看服务端指标,请使用操作员后台。",remoteRelayEndpoint:"远程端点:",remoteRelayAdminUrl:"远程后台地址:",openRemoteAdminBtn:"前往远程管理后台",relayAdminTitle:"Relay 操作员管理后台",relayAdminTokenLabel:"Relay 管理员令牌 (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"请输入 RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"该 Relay 服务未配置 RELAY_ADMIN_TOKEN。",relayAdminLoginBtn:"验证并查看服务端指标",relayAdminAuthError:"管理员令牌无效或未授权。",remoteRelayClientNotice:"当前为终端客户端连接。如需查看服务端指标,请访问操作员后台。",openOperatorPortal:"打开服务端管理后台",localWorkstationBadge:"本地宿主 Relay",modeLocal:"本地模式",modeRemote:"远程模式",hintTabs:"切换标签页",hintRefresh:"刷新状态",hintBack:"返回终端",relJustNow:"刚刚",relMinutes:"{count} 分钟前",relHours:"{count} 小时前",relDays:"{count} 天前",statInbound:"入站流量",statOutbound:"出站流量",statTotal:"累计 {value}",hostsOfflineSub:"另有 {count} 台离线",colHost:"主机",colStatus:"状态",deviceWindows:"{count} 个窗口在线",hostPtys:"PTY {count}",hostVersion:"herdr-remote {version}",hostVersionBehind:"herdr-remote {version} → {latest}",hostVersionUnknown:"herdr-remote 过旧",relayAdminPrompt:"输入 RELAY_ADMIN_TOKEN,查看本 Relay 的主机、设备与流量。"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"本窗口处于观察者模式,切到「完全控制」才能输入",clientIdCopied:"客户端 ID 已复制: {id}",switchedLanguage:"语言已切换为 {lang}",settingsReset:"设置已恢复默认",fontReset:"字体已恢复默认",commandCopied:"命令已复制",keyLayoutReset:"虚拟按键布局已恢复默认"},shortcuts:{title:"WebUI 快捷键",help:"以下快捷键仅在非终端输入区域生效:",terminalInputNote:"终端操作快捷键直接透传至宿主 PTY。"},serverErrors:{auth_required:"需要配对:请输入配对码,或填写仍然有效的设备令牌。",unauthorized:"该设备无权访问此工作站。",host_offline:"已配对的工作站未连接到该 relay。",host_disconnected:"工作站已断开连接。",stale_host:"工作站长时间无响应,已被断开。",too_many_clients:"该工作站的窗口数量已达上限。",rate_limited:"配对尝试过于频繁,请稍后再试。",invalid_handshake:"relay 拒绝了握手,请刷新页面。",device_revoked:"该设备已被 relay 管理员撤销。",connection_closed:"连接已断开,正在重连…",connection_stale:"页面回到前台时连接已无响应,正在重连…",connection_stalled:"连接超时,正在重试…",connection_failed:"无法建立到 relay 的连接。",host_reconnecting:"Herdr 主机正在重连。",host_reconnect_timeout:"Herdr 主机未能及时恢复连接。",host_replaced:"Herdr 主机连接已被替换。",slow_client:"由于浏览器处理速度过慢,连接已关闭。",client_send_failed:"Relay 无法向此浏览器发送数据。",too_many_hosts:"此 relay 已达到主机数量上限。",paste_file_unsupported:"不支持的粘贴图片格式。",paste_file_too_large:"粘贴图片超过 3 MB 上限。",paste_file_write_failed:"工作站保存图片失败。",paste_file_empty:"粘贴图片内容为空。",paste_file_corrupt:"粘贴图片数据损坏或与声明格式不符。",viewer_mode:"观察者模式无法粘贴到终端。",no_session:"终端会话未准备就绪。",admin_broker_unavailable:"管理员终端 broker 尚未运行。请在 Windows 主机打开 herdr-remote TUI,进入「保活」并选择「设置管理员终端」,然后再点一次「管理员」。",admin_terminal_unsupported:"当前 relay 或 Windows 主机连接器不支持管理员终端。请升级两端后再试。",admin_tab_failed:"无法在 Herdr 中打开管理员标签页,详情见主机连接器日志。"},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:"移除图片"}},Gu={en:Ab,zh:Gx};function Dd(l,n,a){const s=Gu[l]||Gu.en,r=n.split(".");let c=s;for(const f of r)if(c&&typeof c=="object"&&f in c)c=c[f];else{let m=Gu.en;for(const p of r)if(m&&typeof m=="object"&&p in m)m=m[p];else return n;c=m;break}if(typeof c!="string")return n;if(a){let f=c;for(const[m,p]of Object.entries(a))f=f.replaceAll(`{${m}}`,String(p));return f}return c}function Yu(l){return typeof l=="string"&&Object.hasOwn(Ab.serverErrors,l)}const de={ESC:"\x1B",TAB:" ",SHIFT_TAB:"\x1B[Z",ENTER:"\r",BACKSPACE:"",UP:"\x1B[A",DOWN:"\x1B[B",RIGHT:"\x1B[C",LEFT:"\x1B[D",HOME:"\x1B[H",END:"\x1B[F",PAGE_UP:"\x1B[5~",PAGE_DOWN:"\x1B[6~",INSERT:"\x1B[2~",DELETE:"\x1B[3~",CTRL_C:"",CTRL_D:"",CTRL_Z:"",CTRL_L:"\f",CTRL_A:"",CTRL_E:"",CTRL_K:"\v",CTRL_R:"",CTRL_W:"",CTRL_U:"",CTRL_X:"",CTRL_N:"",CTRL_P:"",F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F5:"\x1B[15~",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~",F11:"\x1B[23~",F12:"\x1B[24~"},Yx=new TextEncoder;function zd(l){return Yx.encode(l)}function Hd(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 Px(l){return`\x1B${l}`}function ag({ctrl:l,alt:n,shift:a}){return 1+(a?1:0)+(n?2:0)+(l?4:0)}const Eb=/^\x1b[[O]([ABCDHF])$/,kb=/^\x1bO([PQRS])$/,Nb=/^\x1b\[(\d+)~$/;function sr(l,n){const{ctrl:a=!1,alt:s=!1,shift:r=!1}=n;if(!a&&!s&&!r)return l;const c=ag(n),f=s&&!a&&!r,m=Eb.exec(l);if(m)return`\x1B[1;${c}${m[1]}`;const p=kb.exec(l);if(p)return`\x1B[1;${c}${p[1]}`;const g=Nb.exec(l);if(g)return`\x1B[${g[1]};${c}~`;switch(l){case de.TAB:return r&&!a&&!s?de.SHIFT_TAB:f?`\x1B${l}`:`\x1B[9;${c}u`;case de.SHIFT_TAB:return!a&&!s?l:`\x1B[9;${ag({...n,shift:!0})}u`;case de.ENTER:return f?`\x1B${l}`:`\x1B[13;${c}u`;case de.BACKSPACE:return a&&!s&&!r?"\b":f?`\x1B${l}`:`\x1B[127;${c}u`;case de.ESC:return f?`\x1B${l}`:`\x1B[27;${c}u`}let y=l;return r&&l.length===1&&!a&&(y=l.toUpperCase()),a&&(y=Hd(y)),s&&(y=Px(y)),y}function $x(l){return[...l].length===1?!0:Eb.test(l)||kb.test(l)||Nb.test(l)||l===de.SHIFT_TAB}class pn extends Error{constructor(a,s={}){super(a);$(this,"code");$(this,"params");this.name="KeyComboError",this.code=a,this.params=s}}const Vx={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},sg={esc:de.ESC,tab:de.TAB,enter:de.ENTER,backspace:de.BACKSPACE,delete:de.DELETE,left:de.LEFT,right:de.RIGHT,up:de.UP,down:de.DOWN,home:de.HOME,end:de.END,pageup:de.PAGE_UP,pagedown:de.PAGE_DOWN,insert:de.INSERT,space:" ","+":"+"},qx={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},Xx={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function _b(l,n){const a=l.toLowerCase().split("+");if(a.some(p=>!p))throw new pn("invalidStepSyntax",{step:n+1});const s={};let r;for(const p of a)if(p==="ctrl"||p==="control"){if(s.ctrl)throw new pn("duplicateModifier",{step:n+1,modifier:"Ctrl"});s.ctrl=!0}else if(p==="alt"||p==="option"){if(s.alt)throw new pn("duplicateModifier",{step:n+1,modifier:"Alt"});s.alt=!0}else if(p==="shift"){if(s.shift)throw new pn("duplicateModifier",{step:n+1,modifier:"Shift"});s.shift=!0}else if(r===void 0)r=p;else throw new pn("multipleKeys",{step:n+1});if(!r)throw new pn("missingKey",{step:n+1});const c=Vx[r]||r,f=/^f(?:[1-9]|1[0-2])$/.exec(c);let m;if(f)m=de[c.toUpperCase()];else if(Object.hasOwn(sg,c))m=sg[c];else if([...c].length===1&&/^[\x21-\x7e]$/.test(c))m=c;else throw new pn("unsupportedKey",{step:n+1,key:c});return{key:m,keyName:c,modifiers:s,sequence:Wx(m,c,s)}}function Zx(l){return 1+(l.shift?1:0)+(l.alt?2:0)+(l.ctrl?4:0)}function og(l,n){const a=[...l][0].codePointAt(0);return a===void 0?"":`\x1B[${a};${Zx(n)}u`}function Wx(l,n,a){if(!a.ctrl)return sr(l,a);if(n.length===1&&/^[\x20-\x7e]$/.test(n)){const s=n.toLowerCase();if(a.alt||a.shift||s==="m"||s==="i")return og(s,a);if(s==="-"||s==="/"||s==="_")return"";const r=Hd(s);return r!==s?r:og(s,a)}return sr(l,a)}function cn(l){if(typeof l!="string"||!l.trim())throw new pn("empty");const n=l.trim().split(/\s+/);if(n.length>8)throw new pn("tooManySteps",{count:8});return n.map((a,s)=>_b(a,s).sequence)}function na(l){const n=l.trim().split(/\s+/);return n.length>1&&n.every(a=>["esc","escape"].includes(a.toLowerCase()))?`ESC${Xx[n.length]||` ×${n.length}`}`:n.map((a,s)=>{const{keyName:r,modifiers:c}=_b(a,s),f=qx[r]||(/^f\d+$/.test(r),r.toUpperCase());return c.ctrl&&c.alt&&c.shift?`Ctrl+Alt+⇧${f}`:c.ctrl&&c.alt?`Ctrl+Alt+${f}`:c.ctrl&&c.shift?`^⇧${f}`:c.ctrl?`^${f}`:c.alt&&c.shift?`Alt+⇧${f}`:c.alt?`Alt+${f}`:c.shift?`⇧${f}`:f}).join(" ")}const H=(l,n,a,s=!0)=>({id:l,labelKey:n,combo:a,verified:s}),Lb={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:[]}},nl=Lb,Qx=Object.keys(Lb),rg={pi:"pi",claude:"claude","claude-code":"claude",codex:"codex",gemini:"gemini",cursor:"cursor","cursor-agent":"cursor",devin:"devin","devin-cli":"devin","devin cli":"devin",agy:"agy",antigravity:"agy","antigravity-cli":"agy",cline:"cline",".cline":"cline",omp:"omp",mastracode:"mastracode","mastra-code":"mastracode","mastra code":"mastracode",opencode:"opencode",opencode2:"opencode","open-code":"opencode",copilot:"copilot","github-copilot":"copilot",ghcs:"copilot",kimi:"kimi","kimi-code":"kimi","kimi code":"kimi",kiro:"kiro","kiro-cli":"kiro",droid:"droid",amp:"amp","amp-local":"amp",grok:"grok","grok-build":"grok",hermes:"hermes","hermes-agent":"hermes",kilo:"kilo","kilo-code":"kilo","kilo code":"kilo",qodercli:"qodercli",qoderclicn:"qodercli",qoder:"qodercli",qodercn:"qodercli",qwen:"qwen","qwen-code":"qwen","qwen code":"qwen",letta:"letta","letta-code":"letta","letta code":"letta",maki:"maki",muse:"muse","muse-code":"muse","muse-cli":"muse",shell:"shell"};function Jx(l){return l&&l.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function cg(l){const n=Jx(l);return rg[n]?rg[n]:/^muse-bin-\d/.test(n)?"muse":null}function ew(l,n="auto"){return n&&n!=="auto"?cg(n)||"shell":cg(l)||"shell"}const vs=[H("genericCtrlC","interrupt","ctrl+c"),H("genericCtrlD","eof","ctrl+d"),H("genericCtrlZ","suspend","ctrl+z"),H("genericCtrlL","clear","ctrl+l"),H("genericCtrlR","history","ctrl+r"),H("genericCtrlA","startOfLine","ctrl+a"),H("genericCtrlE","endOfLine","ctrl+e"),H("genericCtrlK","killToEnd","ctrl+k")],ug=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],tw=["genericCtrlC"],nw=vs.filter(({id:l})=>l!=="genericCtrlD"&&l!=="genericCtrlZ"),iw=vs.filter(({id:l})=>l==="genericCtrlC"||l==="genericCtrlZ").map(l=>l.id==="genericCtrlZ"?{...l,labelKey:"eof"}:l),lw={posix:vs,"git-bash":vs,cmd:iw,powershell:nw},aw={posix:ug,"git-bash":ug,cmd:["genericCtrlC","genericCtrlZ"],powershell:["genericCtrlC","genericCtrlL","genericCtrlR"]};function sw(l,n){var r,c;const a=l.map(f=>{var g;const m=(g=n==null?void 0:n.actions)==null?void 0:g[f.id];let p=typeof(m==null?void 0:m.keys)=="string"?m.keys:f.combo;try{cn(p)}catch{p=f.combo}return{...f,defaultCombo:f.combo,combo:p,hidden:typeof(m==null?void 0:m.hidden)=="boolean"?m.hidden:f.defaultHidden===!0,custom:!1}}),s=new Set(a.map(f=>f.id));for(const f of(n==null?void 0:n.custom)||[]){if(!f||typeof f.id!="string"||s.has(f.id))continue;const m=f.keys;try{cn(m)}catch{continue}a.push({id:f.id,labelKey:"custom",defaultCombo:m,combo:m,verified:!0,hidden:((c=(r=n==null?void 0:n.actions)==null?void 0:r[f.id])==null?void 0:c.hidden)===!0,custom:!0,customLabel:f.label}),s.add(f.id)}if(Array.isArray(n==null?void 0:n.order)){const f=new Map(n.order.map((m,p)=>[m,p]));a.sort((m,p)=>(f.get(m.id)??Number.MAX_SAFE_INTEGER)-(f.get(p.id)??Number.MAX_SAFE_INTEGER))}return a}function ow(l,n){const a=new Set(l.map(s=>s.combo.trim().toLowerCase()));return n.filter(s=>!a.has(s.combo.trim().toLowerCase()))}const gs=l=>l.id.startsWith("generic");function Rb(l,n,a="posix"){const s=nl[l],r=l==="shell"?lw[a]:vs,c=new Set([...s.bar||[],...l==="shell"?aw[a]:tw]),f=[...s.actions,...r].map(m=>({...m,defaultHidden:!c.has(m.id)}));return sw(f,n)}function jb(l,n,a="posix"){const s=Rb(l,n,a),r=s.filter(f=>!gs(f)),c=new Set(ow(r,s.filter(gs)));return s.filter(f=>!gs(f)||c.has(f))}function rw(l,n,a="posix"){const s=jb(l,n,a).filter(r=>!r.hidden);return{agentActions:s.filter(r=>!gs(r)),genericActions:s.filter(gs)}}function cw(l){const n={};for(const[a,s]of Object.entries(l.actions||{})){const r={...s};delete r.hidden,Object.keys(r).length>0&&(n[a]=r)}return{...l,actions:n}}function Ob(l){if(!l||typeof l!="object"||Array.isArray(l))return{};const n=Object.create(null);for(const[a,s]of Object.entries(l).slice(0,32)){if(!/^[a-z][a-z0-9_-]{0,31}$/i.test(a)||["__proto__","constructor","prototype"].includes(a)||!s||typeof s!="object"||Array.isArray(s))continue;const r=s,c={};if(Array.isArray(r.order)&&(c.order=[...new Set(r.order.filter(f=>typeof f=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(f)))].slice(0,256)),r.actions&&typeof r.actions=="object"&&!Array.isArray(r.actions)){const f=Object.create(null);for(const[m,p]of Object.entries(r.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(m)||!p||typeof p!="object"||Array.isArray(p))continue;const g=p,y={};if(typeof g.keys=="string"&&g.keys.trim()){const v=g.keys.trim().slice(0,80);try{cn(v),y.keys=v}catch{}}typeof g.hidden=="boolean"&&(y.hidden=g.hidden),Object.keys(y).length>0&&(f[m]=y)}c.actions=f}if(Array.isArray(r.custom)){const f=new Set;c.custom=r.custom.slice(0,64).flatMap(m=>{if(!m||typeof m!="object"||Array.isArray(m))return[];const p=m;if(typeof p.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(p.id)||["__proto__","constructor","prototype"].includes(p.id)||f.has(p.id))return[];if(typeof p.label!="string"||!p.label.trim()||typeof p.keys!="string"||!p.keys.trim())return[];const g=p.keys.trim().slice(0,80);try{cn(g)}catch{return[]}return f.add(p.id),[{id:p.id,label:p.label.trim().slice(0,64),keys:g}]})}n[a]=c}return n}const uw=10,dw=24,xs=15,or=13,Bd=640;function fw(){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 oa()<Bd}function oa(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function pd(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function ra(l,n=xs){const a=typeof l=="number"?l:Number(l);return!Number.isFinite(a)||a<=0?n:Math.min(dw,Math.max(uw,Math.round(a)))}function dg(l,n=oa()){if(n<Bd){const s=ra(l,or);return Math.min(15,Math.max(12,s))}return ra(l,xs)}const fg="#11111b",Ud=['"Maple Mono NF CN"','"Herdr Maple Mono"'],hw=['"Symbols Nerd Font Mono"','"Herdr Maple Mono"','"Sarasa Mono SC"','"Noto Sans Mono CJK SC"','"Noto Sans Mono CJK TC"','"Microsoft YaHei Mono"','"PingFang SC"',"monospace"],Kd=["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"'],gd=[{id:"host",name:"Host terminal font",faces:[]},{id:"maple-mono",name:"Maple Mono NF CN",faces:Ud},{id:"system",name:"System monospace",faces:Kd},{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"']}],Db="host",mw='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',pw='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',gw="JetBrains Mono, Menlo, Monaco, Consolas, monospace",bw={[mw]:"host",[pw]:"host",[gw]:"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 Pu(l){return typeof l!="string"||!l.trim()?Db:bw[l]??l}const yw=[[/^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 vw(l){const n=yw.find(([a])=>a.test(l.trim()));return n?n[1]:null}function ds(l){return`"${l.replace(/["\\]/g,"")}"`}function rr(l){return[...new Set([...l,...hw])].join(", ")}rr(Kd);const xw=rr(Ud);function ww(l,n){const a=typeof l=="string"?l.trim():"";if(!a||a==="host"){if(!(n!=null&&n.family))return xw;const c=[],f=n.glyphs;(f==null?void 0:f.scope)==="all"&&f.alias&&c.push(ds(f.alias)),n.alias&&c.push(ds(n.alias)),c.push(ds(n.family));const m=vw(n.family);return m&&c.push(m),(f==null?void 0:f.scope)==="cjk"&&(f.alias&&c.push(ds(f.alias)),c.push(ds(f.family))),rr([...c,...Ud])}const s=gd.find(c=>c.id===a);if(s)return rr([...s.faces,...Kd]);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 Sw(l){if(!l)return null;const n={};return l.background&&(n.background=l.background,n.cursorAccent=l.background),l.foreground&&(n.foreground=l.foreground),l.cursor&&(n.cursor=l.cursor),l.ansi&&Object.assign(n,l.ansi),Object.keys(n).length===0?null:n}function zb(){if(typeof document>"u")return;const l=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",l==null||l.setAttribute("content",fg),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=fg}const At={settings:"herdr_remote_settings_v1",sessionView:"herdr_remote_session_view_v1",ignoredUpdate:"herdr_remote_ignored_update_v1",hostFontConsent:"herdr_remote_host_font_consent_v1",rendererProbe:"herdr_remote_renderer_probe_v3"},bd={local:{},session:{}};function ws(l,n){if(typeof window>"u")return bd[l][n]||null;try{return(l==="local"?window.localStorage:window.sessionStorage).getItem(n)}catch{return bd[l][n]||null}}function Li(l,n,a){if(bd[l][n]=a,!(typeof window>"u"))try{(l==="local"?window.localStorage:window.sessionStorage).setItem(n,a)}catch(s){console.warn(`Failed to write to ${l}Storage:`,s)}}const hg=["啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆","榜膀绑棒磅蚌镑傍谤苞胞包褒剥薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁","便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍","舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称","城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤","垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮怠耽担丹单郸掸胆旦氮","但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟","蝶迭谍叠丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅","俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿","愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感","秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤","姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍","旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖弧虎唬护互沪","户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸","击圾基机畸稽积箕肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰","奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节","桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎","就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤","靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊","辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐痢立","粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫","馏留刘瘤流柳六龙聋咙笼窿隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落","洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥","米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜","纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕","呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬篇偏片","骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣","讫掐恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷","秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉","柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢","捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓","逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕","朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔獭挞蹋踏胎苔抬台","泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳","贴铁帖厅听烃汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完","碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬","屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔","舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣","辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡","殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶摇尧遥窑","谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音","阴姻吟银淫寅饮尹引隐印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔","隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载","再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐","账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨","纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑住注祝驻抓爪拽专砖转撰赚篆桩","庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"," 、。〃〄々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〡〢〣〤〥〦〧〨〩〪〭〮〯〫〬〰〱〲〳〴〵〶〷〸〹〺〻〼〽〾〿!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¬ ̄¦¥₩"].join(""),$u=256*1024,Cw=2,Tw={regular:{weight:"400",style:"normal"},bold:{weight:"700",style:"normal"},italic:{weight:"400",style:"italic"},boldItalic:{weight:"700",style:"italic"}};function Ji(l){return l?[l.family,...l.faces.map(n=>n.sha256),...(l.subsets||[]).map(n=>n.sha256)].join("|"):null}function mg(l){const n=l==null?void 0:l.faces.find(a=>a.style==="regular");return n?`Herdr Host ${n.sha256.slice(0,12)}`:null}function pg(l){return l?l.faces.reduce((n,a)=>n+a.bytes,0):0}function Vu(l){return l>=1024*1024?`${(l/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(l/1024))} KB`}function Mw(l){if(typeof document>"u")return!1;let n=null;try{n=document.createElement("canvas").getContext("2d")}catch{return!1}if(!n)return!1;const a="mmmmmmmmmmlli10OQ@#WWww";for(const s of["serif","sans-serif"]){n.font=`72px ${s}`;const r=n.measureText(a).width;if(n.font=`72px "${l}", ${s}`,n.measureText(a).width!==r)return!0}return!1}const Aw="herdr-remote-fonts",ca="faces",ua="subsets",Hb=new Map,yd=new Map;function wr(){return new Promise(l=>{if(typeof indexedDB>"u"){l(null);return}try{const n=indexedDB.open(Aw,2);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(ca)||n.result.createObjectStore(ca),n.result.objectStoreNames.contains(ua)||n.result.createObjectStore(ua)},n.onsuccess=()=>l(n.result),n.onerror=()=>l(null),n.onblocked=()=>l(null)}catch{l(null)}})}async function Ew(l){const n=Hb.get(l);if(n)return n;const a=await wr();return a?new Promise(s=>{try{const r=a.transaction(ca,"readonly").objectStore(ca).get(l);r.onsuccess=()=>{const c=r.result;s(c instanceof ArrayBuffer?c:null)},r.onerror=()=>s(null)}catch{s(null)}finally{a.close()}}):null}async function kw(l,n){Hb.set(l,n);const a=await wr();a&&await new Promise(s=>{try{const r=a.transaction(ca,"readwrite");r.objectStore(ca).put(n,l),r.oncomplete=()=>s(),r.onerror=()=>s(),r.onabort=()=>s()}catch{s()}finally{a.close()}})}async function Nw(l){const n=await wr();return n?new Promise(a=>{try{const s=IDBKeyRange.bound(`${l}:`,`${l}:￿`),r=n.transaction(ua,"readonly").objectStore(ua).getAll(s);r.onsuccess=()=>{const c=Array.isArray(r.result)?r.result:[];a(c.filter(f=>f&&f.data instanceof ArrayBuffer&&Array.isArray(f.codepoints)))},r.onerror=()=>a([])}catch{a([])}finally{n.close()}}):yd.get(l)??[]}async function _w(l,n){yd.set(l,[...yd.get(l)??[],n]);const a=await wr();a&&await new Promise(s=>{try{const r=a.transaction(ua,"readwrite");r.objectStore(ua).put(n,`${l}:${n.subsetSha}`),r.oncomplete=()=>s(),r.onerror=()=>s(),r.onabort=()=>s()}catch{s()}finally{a.close()}})}function qu(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 Bb(l,n){return n<32||n>=127&&n<160||n>=9472&&n<=9631?!1:l==="all"||Lw(n)}function Rw(l){const n=[...new Set(l)].sort((s,r)=>s-r),a=[];for(let s=0;s<n.length;s+=1){const r=n[s];let c=r;for(;s+1<n.length&&n[s+1]===c+1;)c=n[s+1],s+=1;const f=m=>m.toString(16).toUpperCase();a.push(r===c?`U+${f(r)}`:`U+${f(r)}-${f(c)}`)}return a.join(", ")}async function jw(l,n){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const a=new FontFace(l,n.data,{weight:"400",style:"normal",unicodeRange:Rw(n.codepoints)});document.fonts.add(await a.load())}const vd=new Set;function Ow(l){return!!(l&&vd.has(l))}async function Dw(l,n){if(vd.has(l))return;if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const a=await Promise.all(n.map(({face:s,data:r})=>new FontFace(l,r,Tw[s.style]).load()));for(const s of a)document.fonts.add(s);vd.add(l)}function gg(l){const n=atob(l),a=new Uint8Array(n.length);for(let s=0;s<n.length;s+=1)a[s]=n.charCodeAt(s);return a}async function Ub(l,n,a){const s=Math.ceil(l.bytes/$u),r=new Uint8Array(l.bytes);let c=0;const f=async()=>{for(;c<s;){const m=c;c+=1;const p=await n(l.sha256,m),g=m*$u,y=Math.min($u,l.bytes-g);if(p.length!==y)throw new Error("host_font_corrupt");r.set(p,g),a(p.length)}};return await Promise.all(Array.from({length:Math.min(Cw,s)},f)),r.buffer}function Kb(){try{const l=JSON.parse(ws("local",At.hostFontConsent)||"{}");return l&&typeof l=="object"&&!Array.isArray(l)?l:{}}catch{return{}}}function bg(l,n){const a=Kb()[l];return a&&a.fingerprint===n?a.decision:null}function yg(l,n,a){const s=Kb();s[l]={fingerprint:n,decision:a},Li("local",At.hostFontConsent,JSON.stringify(s))}const Ib={source:null,status:"none",alias:null,covered:0},Xu={font:null,status:"none",alias:null,receivedBytes:0,totalBytes:0,error:null,glyphs:Ib,interactive:!1,glyphRevision:0},zw=String.fromCodePoint(...Array.from({length:95},(l,n)=>32+n),...Array.from({length:96},(l,n)=>160+n),...Array.from({length:112},(l,n)=>8192+n));function vg(l){const n=(l==null?void 0:l.subsets)??[];return n.find(a=>a.scope==="all")??n.find(a=>a.scope==="cjk")??null}function Hw(l,n){const a=new Set;for(const s of l){const r=s.codePointAt(0);Bb(n,r)&&a.add(r)}return[...a]}const xg=3e4;function Bw(l){const n=M.useRef(new Map),a=M.useRef(new Map),s=M.useRef(new Map),r=M.useCallback(m=>{for(const p of[n.current,a.current]){for(const g of p.values())clearTimeout(g.timer),g.reject(new Error(m));p.clear()}},[]),c=M.useCallback((m,p)=>new Promise((g,y)=>{if(!l){y(new Error("disconnected"));return}const v=`${m}:${p}`,w=setTimeout(()=>{n.current.delete(v),y(new Error("host_font_timeout"))},xg);n.current.set(v,{resolve:g,reject:y,timer:w}),l.sendHostFontChunkRequest(m,p)}),[l]),f=M.useCallback((m,p,g)=>new Promise((y,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"))},xg);a.current.set(w,{resolve:S=>y({...S,codepoints:p}),reject:v,timer:x}),s.current.set(w,g),l.sendHostFontSubsetRequest(m.sha256,String.fromCodePoint(...p),w)}),[l]);return M.useEffect(()=>{if(!l)return;const m=n.current,p=a.current,g=l.on("hostFontChunk",x=>{const S=`${x.sha256}:${x.index}`,T=m.get(S);if(T){m.delete(S),clearTimeout(T.timer);try{T.resolve(gg(x.dataBase64))}catch{T.reject(new Error("host_font_corrupt"))}}}),y=l.on("hostFontSubset",x=>{const S=p.get(x.requestId);if(!S)return;p.delete(x.requestId),clearTimeout(S.timer);const T=s.current.get(x.requestId)??(()=>{});if(s.current.delete(x.requestId),x.dataBase64!==void 0){try{const k=gg(x.dataBase64);T(k.length,k.length),S.resolve({subsetSha:x.subsetSha,data:k.buffer,codepoints:[]})}catch{S.reject(new Error("host_font_corrupt"))}return}T(0,x.bytes);const A={bytes:x.bytes,sha256:x.subsetSha};Ub(A,c,k=>T(k,x.bytes)).then(k=>S.resolve({subsetSha:x.subsetSha,data:k,codepoints:[]})).catch(k=>S.reject(k instanceof Error?k: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(),y(),v(),w(),r("disconnected")}},[l,r,c]),{requestChunk:c,requestSubset:f,rejectPending:r}}const Uw=15e3,Kw=80,Iw=2e3;function Fw(l,n={}){const[a,s]=M.useState(Xu),r=M.useRef(a);r.current=a;const c=M.useRef(n);c.current=n;const f=M.useRef(0),m=M.useRef(0),p=M.useRef(new Set),g=M.useRef(new Set),y=M.useRef(new Set),v=M.useRef(null),{requestChunk:w,requestSubset:x,rejectPending:S}=Bw(l),T=M.useCallback(()=>({isInstalled:c.current.isInstalled??Mw,readCached:c.current.readCached??Ew,writeCached:c.current.writeCached??kw,register:c.current.register??Dw,isRegistered:c.current.isRegistered??Ow,readSubsets:c.current.readSubsets??Nw,writeSubset:c.current.writeSubset??_w,registerGlyphs:c.current.registerGlyphs??jw}),[]),A=M.useCallback(()=>(l==null?void 0:l.getHostId())||"default",[l]),k=M.useCallback((K,V)=>{K===f.current&&s(te=>({...te,glyphs:{...te.glyphs,...V}}))},[]),E=M.useCallback(async(K,V,te)=>{const{registerGlyphs:Z}=T();for(const ie of te){if(await Z(V,ie),K!==f.current)return;for(const re of ie.codepoints)p.current.add(re)}K!==f.current||!te.length||s(ie=>({...ie,glyphs:{...ie.glyphs,alias:V,covered:p.current.size},glyphRevision:ie.glyphRevision+1}))},[T]),N=M.useCallback(async(K,V,te)=>{const Z=qu(V),ie=V.scope==="all"?zw+hg:hg,re=Hw(ie,V.scope).filter(O=>!p.current.has(O));if(!re.length)return;for(const O of re)g.current.add(O);const ce=await x(V,re,te);K===f.current&&(await T().writeSubset(V.sha256,ce),await E(K,Z,[ce]))},[x,T,E]),B=M.useCallback(async(K,{interactive:V=!0}={})=>{const te=K??r.current.font,Z=Ji(te);if(!te||!Z)return;const ie=r.current,re=Ji(ie.font)===Z;if(re&&(ie.status==="loading"||ie.glyphs.status==="loading"))return;const ce=f.current,{isInstalled:O,isRegistered:J,readCached:I,writeCached:le,register:P}=T();yg(A(),Z,"accepted");const fe=mg(te),ve=vg(te),X=!!(fe&&!J(fe)&&!O(te.family)),ue=re?ie.glyphs:{...Ib,source:ve},oe=!!(ve&&!["installed","ready","none"].includes(ue.status));let pe=X?pg(te):0,se=0;const xe=()=>{ce===f.current&&s(ae=>({...ae,receivedBytes:se,totalBytes:pe}))};if(s(ae=>({...ae,font:te,interactive:V,receivedBytes:0,totalBytes:pe,error:null,status:X?"loading":ae.status,glyphs:oe?{...ue,status:"loading"}:ue})),X&&fe)try{const ae=[];for(const we of te.faces){let ke=await I(we.sha256);if(ke?(se+=we.bytes,xe()):(ke=await Ub(we,w,Ie=>{se+=Ie,xe()}),await le(we.sha256,ke)),ce!==f.current)return;ae.push({face:we,data:ke})}if(await P(fe,ae),ce!==f.current)return;s(we=>({...we,status:"loaded",alias:fe}))}catch(ae){if(ce!==f.current)return;const we=ae instanceof Error&&ae.message?ae.message:"host_font_failed";s(ke=>({...ke,status:"failed",alias:null,error:we}))}if(oe&&ve){let ae=0;try{await N(ce,ve,(we,ke)=>{ke&&!ae&&(ae=ke,pe+=ke),se+=we,xe()}),k(ce,{status:"ready"})}catch(we){if(ce!==f.current)return;const ke=we instanceof Error&&we.message?we.message:"host_font_failed";s(Ie=>({...Ie,error:Ie.error??ke,glyphs:{...Ie.glyphs,status:"failed"}}))}}},[w,N,T,A,k]),L=M.useCallback(async K=>{const V=Ji(K)!==Ji(r.current.font);V&&(S("superseded"),p.current=new Set,g.current=new Set,y.current=new Set);const te=++f.current;if(!K){s(Xu);return}const{isInstalled:Z,readCached:ie,register:re,isRegistered:ce,readSubsets:O}=T(),J=mg(K),I=Ji(K),le=vg(K);let P="checking";J&&ce(J)?P="loaded":Z(K.family)?P="installed":J||(P="unavailable");let fe="checking";if(le?(le.scope==="cjk"?Z(le.family):P==="installed")&&(fe="installed"):fe="none",s(oe=>({...Xu,font:K,status:P==="checking"?"checking":P,alias:P==="loaded"?J:null,totalBytes:pg(K),glyphs:{source:le,status:fe,alias:V?null:oe.glyphs.alias,covered:p.current.size},glyphRevision:oe.glyphRevision})),P==="checking"&&J){const oe=await Promise.all(K.faces.map(pe=>ie(pe.sha256)));if(te!==f.current)return;if(P="needs",oe.every(Boolean))try{if(await re(J,K.faces.map((pe,se)=>({face:pe,data:oe[se]}))),te!==f.current)return;P="loaded",s(pe=>({...pe,status:"loaded",alias:J}))}catch{}}if(fe==="checking"&&le){const oe=await O(le.sha256);if(te!==f.current)return;if(oe.length)try{await E(te,qu(le),oe),fe="cached"}catch{fe="needs"}else fe="needs";if(te!==f.current)return}const ve=bg(A(),I),X=ve==="accepted"||fe==="cached"||Date.now()<m.current;if(fe==="cached"&&(fe="ready",k(te,{status:"ready"}),N(te,le,()=>{}).catch(()=>{})),P!=="needs"&&fe!=="needs")return;if(X){B(K,{interactive:!1});return}const ue=ve==="declined"?"declined":"available";s(oe=>({...oe,status:P==="needs"?ue:oe.status,glyphs:fe==="needs"?{...oe.glyphs,status:ue}:oe.glyphs}))},[B,S,A,k,N,T,E]),D=M.useCallback(()=>{const K=Ji(r.current.font);K&&yg(A(),K,"declined"),s(V=>({...V,interactive:!1,status:["available","failed"].includes(V.status)?"declined":V.status,glyphs:["available","failed"].includes(V.glyphs.status)?{...V.glyphs,status:"declined"}:V.glyphs}))},[A]),R=M.useCallback(()=>{m.current=Date.now()+Uw,l==null||l.sendHostFontRefresh();const K=r.current,V=["available","declined","failed"];K.font&&(V.includes(K.status)||V.includes(K.glyphs.status))&&B(K.font,{interactive:!1})},[l,B]),z=M.useCallback(K=>{const{glyphs:V}=r.current;if(V.status!=="ready"||!V.source)return;const te=V.source;for(const Z of K){const ie=Z.codePointAt(0);ie<128&&te.scope!=="all"||Bb(te.scope,ie)&&(p.current.has(ie)||g.current.has(ie)||y.current.add(ie))}!y.current.size||v.current||(v.current=setTimeout(()=>{v.current=null;const Z=f.current,ie=[...y.current].slice(0,Iw);for(const re of ie)y.current.delete(re),g.current.add(re);(async()=>{const re=await x(te,ie,()=>{});Z===f.current&&(await T().writeSubset(te.sha256,re),await E(Z,qu(te),[re]))})().catch(()=>{})},Kw))},[x,T,E]);return M.useEffect(()=>{if(!l)return;const K=l.on("terminalFont",V=>{L(V)});return()=>{K(),v.current&&clearTimeout(v.current),v.current=null}},[l,L]),M.useEffect(()=>{const K=V=>{if(V.key!==At.hostFontConsent)return;const te=r.current,Z=Ji(te.font),ie=te.status==="available"||te.glyphs.status==="available";if(!Z||!ie)return;const re=bg(A(),Z);re==="accepted"?B(te.font,{interactive:!1}):re==="declined"&&D()};return window.addEventListener("storage",K),()=>window.removeEventListener("storage",K)},[B,D,A]),{hostFont:a,loadHostFont:B,declineHostFont:D,syncHostFont:R,ensureHostGlyphs:z}}function Gw(l,n=window,a=document){const s=g=>{var y;((y=n.navigator)==null?void 0:y.onLine)!==!1&&l.wake(g)},r=()=>{a.visibilityState==="visible"&&s("visible")},c=()=>s("pageshow"),f=()=>s("online"),m=()=>s("focus"),p=()=>s("resume");return a.addEventListener("visibilitychange",r),a.addEventListener("resume",p),n.addEventListener("pageshow",c),n.addEventListener("online",f),n.addEventListener("focus",m),()=>{a.removeEventListener("visibilitychange",r),a.removeEventListener("resume",p),n.removeEventListener("pageshow",c),n.removeEventListener("online",f),n.removeEventListener("focus",m)}}function qo(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}}function wg(l,n){return n||(l==="win32"?"powershell":"posix")}function Yw(l,n){if(n!=="win32")return n?"posix":null;for(const a of l.slice(-8).reverse()){if(/\b(?:MINGW32|MINGW64|MSYS)\b/i.test(a))return"git-bash";if(/^\s*PS\s+[a-z]:\\[^>]*>/i.test(a))return"powershell";if(/^\s*(?:[a-z]:\\[^>]*|\\\\[^\\]+\\[^>]+)>/i.test(a))return"cmd"}return null}const Pw={connectionState:"disconnected",role:"viewer",shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1,terminalResetVersion:0,agentStatus:null,lastPairedAt:null},Sg={role:"viewer",controllerId:void 0,hostname:void 0,platform:void 0,adminTerminalSupported:void 0,hostVersion:void 0,herdrPrefixKeys:void 0,shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1};function $w(l,n){switch(n.type){case"stateChange":return{...l,connectionState:n.state,stateCode:n.code,stateDetail:n.detail,agentStatus:n.state==="connected"?l.agentStatus:null};case"ready":{const{message:a}=n;return{...l,terminalResetVersion:l.terminalResetVersion+(n.resetTerminal?1:0),role:a.role,controllerId:a.controllerId,hostId:a.hostId,hostname:a.hostname,platform:a.platform,adminTerminalSupported:a.adminTerminalSupported,hostVersion:a.hostVersion,herdrPrefixKeys:a.herdrPrefixKeys,shellProfile:wg(a.platform,a.shellProfile),assignedClientId:a.clientId||l.assignedClientId,hostPalette:a.terminalPalette||null}}case"hostReconnecting":return{...l,...Sg,stateCode:n.code,stateDetail:n.detail};case"sessionRestarted":return{...l,hostname:n.hostname,platform:n.platform,adminTerminalSupported:n.adminTerminalSupported,hostVersion:n.hostVersion,herdrPrefixKeys:n.herdrPrefixKeys,shellProfile:wg(n.platform,n.shellProfile),hostPalette:n.palette||null,terminalResetVersion:l.terminalResetVersion+1};case"roleChange":return{...l,role:n.role,controllerId:n.controllerId,hostId:n.hostId||l.hostId,assignedClientId:n.assignedClientId||l.assignedClientId};case"controlGranted":return{...l,role:"controller"};case"paired":return{...l,lastPairedAt:n.at};case"rtt":return{...l,rttMs:n.rttMs};case"peerCount":return{...l,sharedWindowCount:Math.max(1,n.count)};case"sessionReady":return{...l,connectionState:"connected"};case"agentStatus":return{...l,agentStatus:n.status};case"shellProfile":return l.shellProfile===n.profile?l:{...l,shellProfile:n.profile};case"reset":return{...l,...Sg,hostId:void 0,platform:void 0,assignedClientId:void 0,terminalResetVersion:l.terminalResetVersion+(n.resetTerminal?1:0)}}}const Vw=3e4;function qw(l,n){const[a,s]=M.useState(null),r=M.useRef(null),c=M.useRef(null),f=M.useCallback(y=>{(y==null?void 0:y.phase)!=="starting"&&c.current&&(clearTimeout(c.current),c.current=null),r.current=y,s(y)},[]),m=M.useCallback(()=>{const y=l.current;y&&(f({phase:"starting"}),y.sendHerdrStart(),c.current=setTimeout(()=>{var v;c.current=null,((v=r.current)==null?void 0:v.phase)==="starting"&&f({phase:"failed",message:n.current("herdrLaunch.timeout")})},Vw))},[l,n,f]),p=M.useCallback(y=>{var v;return y.code==="herdr_not_running"?(((v=r.current)==null?void 0:v.phase)!=="starting"&&f({phase:"stopped"}),!0):y.code==="herdr_start_failed"&&r.current?(f({phase:"failed",message:y.message||""}),!0):!1},[f]),g=M.useCallback(()=>f(null),[f]);return M.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]),{herdrLaunch:a,startHerdr:m,handleLaunchError:p,forgetHerdrLaunch:g}}class Xw{constructor(){$(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(n,a){return this.listeners[n].add(a),()=>{this.listeners[n].delete(a)}}emit(n,...a){this.listeners[n].forEach(r=>{try{r(...a)}catch(c){console.error(`Error in event listener for ${n}:`,c)}})}}const Fb=27,Gb=91,Zw=60,Cg=59,Yb=77,Pb=48,Ww=57,Qw=64,Jw=-30,Zu=32,Tg=255;function $b(l){return Number.isInteger(l)&&(l&Jw)===Qw}function e1(l){return l>=Pb&&l<=Ww}function Wu(l,n){let a=n,s=0;for(;a<l.length&&e1(l[a]);){if(s=s*10+(l[a]-Pb),s>65535)return null;a+=1}return a===n?null:{value:s,next:a}}function t1(l,n){if(l[n]!==Fb||l[n+1]!==Gb||l[n+2]!==Zw)return-1;const a=Wu(l,n+3);if(!a||!$b(a.value)||l[a.next]!==Cg)return-1;const s=Wu(l,a.next+1);if(!s||l[s.next]!==Cg)return-1;const r=Wu(l,s.next+1);return!r||l[r.next]!==Yb?-1:r.next+1}function n1(l,n){if(l[n]!==Fb||l[n+1]!==Gb||l[n+2]!==Yb||n+6>l.length)return-1;const a=l[n+3]-Zu,s=l[n+4],r=l[n+5];return!$b(a)||s<Zu||s>Tg||r<Zu||r>Tg?-1:n+6}function cr(l){if(!l)return!1;const n=l instanceof Uint8Array?l:new Uint8Array(l);if(n.length===0)return!1;let a=0;for(;a<n.length;){const s=t1(n,a);if(s>a){a=s;continue}const r=n1(n,a);if(r>a){a=r;continue}return!1}return!0}class i1{constructor(n){$(this,"segments",[]);$(this,"flushScheduled",!1);this.getSocket=n}push(n){const a=n instanceof Uint8Array?n:new Uint8Array(n);a.length!==0&&(this.segments.push(a),this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flush())))}flush(){if(this.flushScheduled=!1,this.segments.length===0)return;let n=this.segments;this.segments=[];const a=this.getSocket();if(a&&(a.bufferedAmount??0)>256*1024&&(n=n.filter(r=>!cr(r))),n.length===0)return;let s;if(n.length===1)s=n[0];else{let r=0;for(let f=0;f<n.length;f++)r+=n[f].byteLength;s=new Uint8Array(r);let c=0;for(let f=0;f<n.length;f++)s.set(n[f],c),c+=n[f].byteLength}a&&a.readyState===WebSocket.OPEN&&a.send(s)}clear(){this.segments=[],this.flushScheduled=!1}}const l1=3e3,a1=1e4,s1=1500;class o1 extends Xw{constructor(a){super();$(this,"ws",null);$(this,"config");$(this,"state","disconnected");$(this,"reconnectAttempts",0);$(this,"reconnectTimer",null);$(this,"pingTimer",null);$(this,"pingTimestamp",null);$(this,"lastInboundAt",0);$(this,"pingSentAt",null);$(this,"connectStartedAt",0);$(this,"lastWakeConnectAt",0);$(this,"probeTimer",null);$(this,"rejectedByRelay",!1);$(this,"isManuallyClosed",!1);$(this,"authFailureDetail",null);$(this,"authFailureCode",null);$(this,"temporaryFailureCode",null);$(this,"input",new i1(()=>this.ws));$(this,"terminalCols",80);$(this,"terminalRows",24);this.config={...a}}updateConfig(a){this.config={...this.config,...a}}getConfig(){return{...this.config}}getState(){return this.state}setState(a,s,r){this.state!==a&&(this.state=a,this.emit("stateChange",a,s,r))}connect(a){if(a&&(this.terminalCols=a.cols,this.terminalRows=a.rows),!(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))){this.teardownSocket(1e3,"Replaced by a new connection"),this.isManuallyClosed=!1,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.rejectedByRelay=!1,this.clearTimers(),this.setState("connecting");try{const s=r1(this.config.wsUrl),r=new WebSocket(s);this.ws=r,this.connectStartedAt=Date.now(),r.binaryType="arraybuffer",r.onopen=()=>{this.isStaleSocket(r)||this.handleOpen()},r.onmessage=c=>{this.isStaleSocket(r)||this.handleMessage(c)},r.onerror=c=>{this.isStaleSocket(r)||this.handleError(c)},r.onclose=c=>{this.isStaleSocket(r)||this.handleClose(c)}}catch(s){this.setState("error",s instanceof Error?s.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(a){return this.ws!==a}teardownSocket(a=1e3,s="Client closed the connection"){this.input.clear();const r=this.ws;if(r){this.ws=null,r.onopen=null,r.onmessage=null,r.onerror=null,r.onclose=null;try{(r.readyState===WebSocket.OPEN||r.readyState===WebSocket.CONNECTING)&&r.close(a,s)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.input.clear(),this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(a){this.updateConfig(a),this.clearTimers(),this.teardownSocket(1e3,"Reconnecting with new credentials"),this.isManuallyClosed=!1,this.reconnectAttempts=0,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.connect()}wake(a){if(this.isManuallyClosed||!this.config.autoReconnect||this.authFailureDetail||this.rejectedByRelay)return;const s=Date.now(),r=this.ws;if(!r){if(s-this.lastWakeConnectAt<s1)return;this.lastWakeConnectAt=s,this.reconnectAttempts=0,this.connect();return}if(r.readyState===WebSocket.CONNECTING){s-this.connectStartedAt>a1&&this.dropStaleSocket("connection_stalled");return}r.readyState===WebSocket.OPEN&&s-this.lastInboundAt>this.pingIntervalMs()+2e3&&this.probeLiveness()}pingIntervalMs(){return this.config.pingIntervalMs||1e4}probeLiveness(){const a=this.ws;if(!a||a.readyState!==WebSocket.OPEN||this.probeTimer)return;const s=Date.now();this.sendPing(),this.probeTimer=setTimeout(()=>{this.probeTimer=null,this.ws===a&&this.lastInboundAt<s&&this.dropStaleSocket("connection_stale")},l1)}dropStaleSocket(a){this.clearTimers(),this.teardownSocket(4e3,"Connection went silent"),this.setState("reconnecting","The connection went silent. Reconnecting...",a),this.reconnectAttempts=0,this.lastWakeConnectAt=Date.now(),this.connect()}handleOpen(){this.lastInboundAt=Date.now(),this.sendHello(),this.startHeartbeat()}async handleMessage(a){if(this.lastInboundAt=Date.now(),typeof a.data=="string")try{const s=JSON.parse(a.data);s.type==="pong"?this.handlePong():this.handleServerMessage(s)}catch(s){console.warn("Received unparseable text frame from server:",s)}else if(a.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(a.data));else if(typeof Blob<"u"&&a.data instanceof Blob)try{const s=await a.data.arrayBuffer();this.emit("binaryData",new Uint8Array(s))}catch(s){console.error("Failed to convert Blob to ArrayBuffer:",s)}}handlePong(){if(this.pingTimestamp){const a=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(a))}}handleError(a){console.error("WebSocket error:",a),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(a){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(a.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",a.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(a.code===1008){this.rejectedByRelay=!0,this.setState("error",a.reason||"The relay rejected the connection",String(a.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${a.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${a.reason||a.code}`,"connection_closed")}scheduleReconnect(){if(this.isManuallyClosed||!this.config.autoReconnect)return;if(this.config.maxReconnectAttempts>0&&this.reconnectAttempts>=this.config.maxReconnectAttempts){this.setState("error","Max reconnect attempts reached");return}this.reconnectAttempts++;const a=this.config.reconnectIntervalMs||2e3,r=Math.min(3e4,Math.floor(a*1.5**(this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},r)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const a=this.pingIntervalMs();this.pingSentAt=null,this.pingTimer=setInterval(()=>{if(!(!this.ws||this.ws.readyState!==WebSocket.OPEN)){if(this.pingSentAt!==null&&this.lastInboundAt<this.pingSentAt&&Date.now()-this.pingSentAt>=a){this.probeLiveness();return}this.sendPing()}},a)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=null),this.probeTimer&&(clearTimeout(this.probeTimer),this.probeTimer=null)}sendPing(){this.pingTimestamp=performance.now(),this.pingSentAt=Date.now();const a={type:"ping"};this.sendJson(a)}sendJson(a){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(a))}sendInput(a){this.input.push(a)}flushInput(){this.input.flush()}sendBinary(a){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(a)}sendText(a){const s=zd(a);this.sendInput(s)}}function r1(l){if(/^wss?:\/\//i.test(l))return l;if(/^https?:\/\//i.test(l)){const n=new URL(l);return n.protocol=n.protocol==="https:"?"wss:":"ws:",(!n.pathname||n.pathname==="/")&&(n.pathname=Ut),n.toString()}if(typeof window<"u"&&window.location){const a=window.location.protocol==="https:"?"wss:":"ws:",s=window.location.host,r=l.startsWith("/")?l:`/${l}`;return`${a}//${s}${r}`}return"ws://127.0.0.1:8787/ws/client"}class c1 extends o1{constructor(){super(...arguments);$(this,"currentRole","viewer");$(this,"controllerId");$(this,"hostId");$(this,"assignedClientId")}getRole(){return this.currentRole}getControllerId(){return this.controllerId}getHostId(){return this.hostId}getAssignedClientId(){return this.assignedClientId}handleServerMessage(a){switch(a.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=a.role,this.controllerId=a.controllerId,this.hostId=a.hostId,this.assignedClientId=a.clientId,this.emit("ready",a),this.emit("roleChange",a.role,a.controllerId,a.hostId,a.clientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount),this.emit("terminalFont",a.terminalFont??null);break}case"paired":{this.emit("paired",{token:a.token,deviceId:a.deviceId,hostId:a.hostId,expiresAt:a.expiresAt});break}case"control_state":{this.currentRole=a.role,this.controllerId=a.controllerId,this.emit("controlState",a.role,a.controllerId),this.emit("roleChange",a.role,a.controllerId,this.hostId,this.assignedClientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",a.code||"host_reconnecting"),this.emit("hostReconnecting",a.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",a.cols,a.rows,a.terminalPalette,a.hostname,a.platform,a.shellProfile,a.adminTerminalSupported,a.hostVersion,a.herdrPrefixKeys),this.emit("terminalFont",a.terminalFont??null);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",a);break}case"exit":{this.emit("exit",a.code,a.reason);break}case"control_granted":{this.currentRole="controller",this.controllerId=this.assignedClientId||this.config.clientId,this.emit("controlGranted"),this.emit("roleChange","controller",this.controllerId,this.hostId,this.assignedClientId);break}case"error":{a.code==="host_offline"||a.code==="host_reconnecting"||a.code==="host_reconnect_timeout"||a.code==="rate_limited"?(this.temporaryFailureCode=String(a.code),this.setState("reconnecting",a.message,String(a.code))):(a.code==="auth_required"||a.code==="unauthorized"||a.code==="device_revoked"||a.code==="invalid_handshake"||a.code==="too_many_hosts"||a.code===401||a.code===403)&&(this.authFailureDetail=a.message,this.authFailureCode=String(a.code),this.setState("error",a.message,this.authFailureCode)),this.emit("error",{code:a.code,message:a.message});break}case"paste_file_ready":{this.emit("pasteFileReady",a.path);break}case"agent_status":{this.emit("agentStatus",a);break}case"update_status":{this.emit("updateStatus",a);break}case"terminal_font":{this.emit("terminalFont",a.terminalFont??null);break}case"host_font_chunk":{this.emit("hostFontChunk",a);break}case"host_font_subset_ready":{this.emit("hostFontSubset",a);break}}}sendHello(){const a={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(a.token=this.config.token),this.config.pairCode&&(a.pairCode=this.config.pairCode),this.sendJson(a)}claimControl(a=!1){const s={type:"claim_control",...a?{force:!0}:{}};this.sendJson(s)}releaseControl(){const a={type:"release_control"};this.sendJson(a)}sendResize(a,s){this.terminalCols=a,this.terminalRows=s;const r={type:"resize",cols:a,rows:s};this.sendJson(r)}sendPasteFile(a,s){this.sendJson({type:"paste_file",mime:a,dataBase64:s})}sendHostFontChunkRequest(a,s){this.sendJson({type:"host_font_chunk_request",sha256:a,index:s})}sendHostFontSubsetRequest(a,s,r){this.sendJson({type:"host_font_subset_request",sha256:a,text:s,requestId:r})}sendHostFontRefresh(){this.sendJson({type:"host_font_refresh"})}sendHerdrStart(){this.sendJson({type:"herdr_start"})}sendAdminTabOpen(){this.sendJson({type:"admin_tab_open"})}}function u1(l,n,a){const s=M.useRef(a);if(s.current=a,!l.current){const r=new c1(n());for(const c of Object.keys(a)){const f=(...m)=>{var p,g;return(g=(p=s.current)[c])==null?void 0:g.call(p,...m)};r.on(c,f)}l.current=r}return l.current}const d1=3*1024*1024,Vb=1568,f1=[.85,.7,.55,.4],Xo={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function h1(l,n,a=Vb){if(l<=0||n<=0)return{width:Math.max(1,l),height:Math.max(1,n)};const s=Math.max(l,n);if(s<=a)return{width:l,height:n};const r=a/s;return{width:Math.max(1,Math.round(l*r)),height:Math.max(1,Math.round(n*r))}}function m1(l){if(typeof l!="string"||l.length===0)return 0;const n=l.length;let a=0;l.endsWith("==")?a=2:l.endsWith("=")&&(a=1);const s=Math.floor(n*3/4)-a;return Number.isFinite(s)&&s>0?s:0}function p1(l){return l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/(1024*1024)).toFixed(1)} MB`}async function g1(l){if(typeof createImageBitmap=="function")try{const n=await createImageBitmap(l,{imageOrientation:"from-image"});return{source:n,width:n.width,height:n.height,cleanup:()=>{typeof n.close=="function"&&n.close()}}}catch{try{const n=await createImageBitmap(l);return{source:n,width:n.width,height:n.height,cleanup:()=>{typeof n.close=="function"&&n.close()}}}catch{}}return new Promise((n,a)=>{if(typeof Image>"u")return a(new Error("Image decoding not supported in this environment"));const s=new Image,r=URL.createObjectURL(l);s.onload=()=>{n({source:s,width:s.naturalWidth||s.width,height:s.naturalHeight||s.height,cleanup:()=>{try{URL.revokeObjectURL(r)}catch{}}})},s.onerror=()=>{try{URL.revokeObjectURL(r)}catch{}a(new Error("Failed to decode image source"))},s.src=r})}async function qb(l,n=Vb,a=d1){var r;if(!l||l.size===0||l.type&&!l.type.startsWith("image/"))return null;let s;try{s=await g1(l)}catch(c){return console.warn("Failed to decode image for paste:",c),null}try{const{width:c,height:f}=h1(s.width,s.height,n),m=document.createElement("canvas");m.width=c,m.height=f;const p=m.getContext("2d");if(!p)return null;p.drawImage(s.source,0,0,c,f);let g="image/webp";try{m.toDataURL("image/webp",.85).startsWith("data:image/webp")||(g="image/jpeg")}catch{g="image/jpeg"}for(const y of f1){let v;try{v=m.toDataURL(g,y)}catch{continue}if(!(v!=null&&v.startsWith("data:")))continue;const w=v.indexOf(","),x=w!==-1?v.slice(w+1):"",S=m1(x);if(S<=a)return{mime:g,dataBase64:x,dataUrl:v,byteLength:S,width:c,height:f}}return null}finally{(r=s.cleanup)==null||r.call(s)}}const b1=3e4,y1=1200;function v1({adapterRef:l,role:n,connectionState:a,warnViewerMode:s,addToast:r,t:c,sendPasteFile:f}){const[m,p]=M.useState(Xo),g=M.useRef(null),y=M.useRef(0),v=M.useRef(null),w=M.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null)},[]),x=M.useCallback(()=>{w(),g.current=null,p(Xo)},[w]),S=M.useCallback(()=>{g.current!==null&&x()},[x]),T=M.useCallback(()=>{const k=g.current;k!==null&&(w(),p({active:!0,phase:"completed",ratio:1,percent:100,statusText:c("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{g.current===k&&(g.current=null,p(Xo))},y1))},[w,c]);M.useEffect(()=>{a!=="connected"&&S()},[a,S]),M.useEffect(()=>w,[w]);const A=M.useCallback(async k=>{if(n!=="controller")return s(),!1;if(!l.current||a!=="connected")return r("error",c("serverErrors.host_offline")),!1;if(g.current!==null)return!1;const E=++y.current;g.current=E,w();const N=L=>(L&&r("error",L),g.current=null,p(Xo),!1),B="dataBase64"in k&&typeof k.dataBase64=="string";try{let L;if(B)L=k;else{const R=k;if(p({active:!0,phase:"reading",ratio:.1,percent:10,statusText:c("virtualKeyboard.uploadProgressReading")}),!R||R.size===0)return N(c("clipboard.fileEmpty"));if(R.type&&!R.type.startsWith("image/"))return N(c("clipboard.unsupportedType"));p({active:!0,phase:"processing",ratio:.35,percent:35,statusText:c("virtualKeyboard.uploadProgressProcessing")});const z=await qb(R);if(g.current!==E)return!1;if(!z)return N(c("clipboard.imageTooLarge"));L=z,p({active:!0,phase:"processing",ratio:.6,percent:60,statusText:c("virtualKeyboard.uploadProgressProcessing")})}p({active:!0,phase:"sending",ratio:.75,percent:75,statusText:c("virtualKeyboard.uploadProgressSending")});const D=f(L.mime,L.dataBase64);return g.current!==E?!1:D?(p({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:c("virtualKeyboard.uploadProgressWaitingHost")}),v.current=setTimeout(()=>{g.current===E&&N(c("serverErrors.paste_file_write_failed"))},b1),!0):N()}catch(L){return console.error("Failed to process/upload image:",L),g.current===E&&N(c("clipboard.imageTooLarge")),!1}},[l,n,a,s,r,c,f,w]);return{uploadProgress:m,uploadImage:A,resetUploadProgress:x,abortUpload:S,completeUpload:T}}const x1=4096,w1=8*1024*1024;function S1(){const l=M.useRef(null),n=M.useRef([]),a=M.useRef(0),s=M.useCallback(p=>{for(n.current.push(p),a.current+=p.byteLength;n.current.length>x1||a.current>w1;){const g=n.current.shift();if(!g)break;a.current-=g.byteLength}},[]),r=M.useCallback(p=>{const g=l.current;if(g)try{g(p);return}catch(y){console.debug("Terminal output sink threw, buffering chunk instead:",y)}s(p)},[s]),c=M.useCallback(p=>{l.current=p;const g=n.current;n.current=[],a.current=0;for(let y=0;y<g.length;y++)try{p(g[y])}catch(v){console.debug("Terminal sink threw while flushing, re-buffering the tail:",v);for(let w=y;w<g.length;w++)s(g[w]);break}return()=>{l.current===p&&(l.current=null)}},[s]),f=M.useCallback(()=>n.current.length,[]),m=M.useCallback(()=>{n.current=[],a.current=0},[]);return{receiveOutput:r,subscribeToOutput:c,getPendingOutputChunkCount:f,clearPendingOutput:m}}const Mg=["fontSize","fontSizeFollowsHost","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify"],C1=["agentKeymaps"],T1=64;function M1(l,n){const a=l,s={};for(const r of n)a[r]!==void 0&&(s[r]=a[r]);return s}function aa(l,n){return M1(l,n==="local"?[...Mg,...C1]:Mg)}function ur(l,n,a){const s=Object.create(null);if(!l||typeof l!="object"||Array.isArray(l))return s;for(const[r,c]of Object.entries(l).slice(0,T1))(r===""?n.length>0:!n.includes(r))||!c||typeof c!="object"||Array.isArray(c)||(s[r]=aa(c,a));return s}const Xb=64,Ss=4096;function Id(){const l=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${l}`}function A1(l,n){return(typeof l=="string"?l.trim().slice(0,Xb):"")||n}function dr(l,n){if(!l||typeof l!="object"||Array.isArray(l))return null;const a=l,s=typeof a.wsUrl=="string"?a.wsUrl.trim().slice(0,2048):"",r=typeof a.token=="string"?a.token.slice(0,Ss):"",c=typeof a.pairCode=="string"?a.pairCode.trim().toUpperCase().slice(0,32):"";if(!s||!s.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(s)||!r&&!c)return null;const f=Date.now(),m=typeof a.id=="string"&&a.id.length>0?a.id.slice(0,128):Id(),p=typeof a.hostname=="string"&&a.hostname.trim()?a.hostname.trim().slice(0,Xb):`Herdr ${n+1}`;return{id:m,displayName:A1(a.displayName,p),wsUrl:s,token:r,...c?{pairCode:c}:{},...typeof a.hostId=="string"&&a.hostId.trim()?{hostId:a.hostId.trim().slice(0,128)}:{},...typeof a.hostname=="string"&&a.hostname.trim()?{hostname:a.hostname.trim().slice(0,128)}:{},...typeof a.deviceId=="string"&&a.deviceId.trim()?{deviceId:a.deviceId.trim().slice(0,128)}:{},autoReconnect:a.autoReconnect!==!1,createdAt:Number.isFinite(a.createdAt)?Number(a.createdAt):f,lastUsedAt:Number.isFinite(a.lastUsedAt)?Number(a.lastUsedAt):f}}function Ag(l,n=0){const a=dr({...l,id:l.id||Id()},n);if(!a)throw new Error("a connection profile requires a relay URL and token or pairing code");return a}function Eg(l){let n=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="",n=a.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${n}::${l.hostId||""}`}function Zb(l){var c;const n=[];if((Array.isArray(l.profiles)?l.profiles.slice(0,64):[]).forEach((f,m)=>{const p=dr(f,m);p&&!n.some(g=>g.id===p.id)&&n.push(p)}),n.length===0&&(typeof l.token=="string"&&l.token||typeof l.pairCode=="string"&&l.pairCode)){const f=dr({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof l.wsUrl=="string"&&l.wsUrl.trim()?l.wsUrl:Ut,token:l.token||"",pairCode:l.pairCode||"",autoReconnect:l.autoReconnect!==!1},0);f&&n.push(f)}const s=typeof l.activeProfileId=="string"?l.activeProfileId:"",r=n.some(f=>f.id===s)?s:((c=n[0])==null?void 0:c.id)||"";return{profiles:n,activeProfileId:r}}const Wb=[{id:"esc",label:"ESC",code:de.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:de.TAB,type:"key",enabled:!0,title:"Tab"},{id:"ctrl",label:"CTRL",code:"",type:"modifier",enabled:!0,modifierType:"ctrl",title:"Toggle Ctrl modifier latch"},{id:"alt",label:"ALT",code:"",type:"modifier",enabled:!0,modifierType:"alt",title:"Toggle Alt modifier latch"},{id:"left",label:"←",code:de.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:de.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:de.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:de.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"drawer_symbols",label:"~|/",code:"",type:"drawer",enabled:!0,drawerType:"symbols",title:"Special Symbols"},{id:"drawer_fn",label:"Fn",code:"",type:"drawer",enabled:!0,drawerType:"fn",title:"Function Keys (F1-F12)"},{id:"enter",label:"Enter",code:de.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],E1=[{id:"ctrl",label:"CTRL",code:"",type:"modifier",enabled:!0,modifierType:"ctrl",title:"Toggle Ctrl modifier latch"},{id:"alt",label:"ALT",code:"",type:"modifier",enabled:!0,modifierType:"alt",title:"Toggle Alt modifier latch"},{id:"shift",label:"SHIFT",code:"",type:"modifier",enabled:!0,modifierType:"shift",title:"Toggle Shift modifier latch"},{id:"meta",label:"META",code:"\x1B",type:"modifier",enabled:!0,modifierType:"meta",title:"Meta / Cmd key"},{id:"esc",label:"ESC",code:de.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:de.TAB,type:"key",enabled:!0,title:"Tab"},{id:"shift_tab",label:"⇧TAB",code:de.SHIFT_TAB,type:"key",enabled:!0,title:"Shift+Tab"},{id:"enter",label:"Enter",code:de.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:de.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:de.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:de.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:de.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:de.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:de.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:de.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:de.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:de.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:de.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:de.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:de.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:de.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:de.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:de.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:de.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:de.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:de.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:de.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:de.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:de.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:de.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:de.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:de.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:de.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:de.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:de.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:de.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:de.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:de.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:de.F12,type:"fn",enabled:!0,title:"F12"},{id:"drawer_chords",label:"^C",code:"",type:"drawer",enabled:!0,drawerType:"chords",title:"Quick Ctrl Chords"},{id:"drawer_symbols",label:"~|/",code:"",type:"drawer",enabled:!0,drawerType:"symbols",title:"Special Symbols"},{id:"drawer_fn",label:"Fn",code:"",type:"drawer",enabled:!0,drawerType:"fn",title:"Function Keys (F1-F12)"},{id:"sym_pipe",label:"|",code:"|",type:"symbol",enabled:!0,isPlainChar:!0,title:"Pipe (|)"},{id:"sym_tilde",label:"~",code:"~",type:"symbol",enabled:!0,isPlainChar:!0,title:"Tilde (~)"},{id:"sym_slash",label:"/",code:"/",type:"symbol",enabled:!0,isPlainChar:!0,title:"Slash (/)"},{id:"sym_backslash",label:"\\",code:"\\",type:"symbol",enabled:!0,isPlainChar:!0,title:"Backslash (\\)"},{id:"sym_dash",label:"-",code:"-",type:"symbol",enabled:!0,isPlainChar:!0,title:"Dash (-)"},{id:"sym_underscore",label:"_",code:"_",type:"symbol",enabled:!0,isPlainChar:!0,title:"Underscore (_)"},{id:"sym_dollar",label:"$",code:"$",type:"symbol",enabled:!0,isPlainChar:!0,title:"Dollar ($)"},{id:"sym_ampersand",label:"&",code:"&",type:"symbol",enabled:!0,isPlainChar:!0,title:"Ampersand (&)"},{id:"sym_quote",label:'"',code:'"',type:"symbol",enabled:!0,isPlainChar:!0,title:'Double Quote (")'},{id:"sym_backtick",label:"`",code:"`",type:"symbol",enabled:!0,isPlainChar:!0,title:"Backtick (`)"}];function Cs(){return JSON.parse(JSON.stringify(Wb))}const k1=[["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 N1(l){return k1.some(n=>l.length===n.length&&l.every((a,s)=>a.id===n[s]&&a.enabled!==!1))}function _1(l){if(!Array.isArray(l)||l.length===0)return Cs();const n=l.filter(a=>typeof a=="object"&&a!==null&&typeof a.id=="string"&&typeof a.label=="string"&&typeof a.code=="string");return N1(n)?Cs():n.filter(a=>a.id!=="drawer_agent")}function xd(l,n){if(n){const a=`keyTitles.${l.id}`,s=n(a);if(s&&s!==a)return s}return l.title||l.label}const kg="herdr-remote.ignoredUpdate";function L1(){const l=ws("local",At.ignoredUpdate);if(l!==null)return l;const n=ws("local",kg);if(n===null)return null;Qb(n);try{window.localStorage.removeItem(kg)}catch{}return n}function Qb(l){Li("local",At.ignoredUpdate,l)}function R1(){return`client-${Math.random().toString(36).substring(2,8)}`}function Jb(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function ey(){const l=typeof window<"u"&&window.innerWidth<640;return{wsUrl:Ut,token:"",pairCode:"",clientId:R1(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:l?or:xs,fontSizeFollowsHost:!0,fontFamily:Db,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:Jb(),virtualKeys:Cs(),agentKeymaps:{},observerMode:!1,adminToken:"",adminTokens:{}}}const j1=["wsUrl","token","pairCode","clientId","autoReconnect","language"],O1=["wsUrl","token","pairCode","autoReconnect"],Ng=["theme","colorMode"];function ty(l){const n=l;if(!Ng.some(r=>n[r]!==void 0))return{data:l,changed:!1};const s={...n};for(const r of Ng)delete s[r];return{data:s,changed:!0}}function ny(l){if(!l||typeof l!="object"||Array.isArray(l))return{};const n={};for(const[a,s]of Object.entries(l).slice(0,32))typeof s!="string"||s.length===0||(n[a.slice(0,512)]=s.slice(0,Ss));return n}function fr(l,n){const a=ws(l,n);if(!a)return{};try{const s=JSON.parse(a);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch(s){return console.warn(`Failed to parse ${l}Storage settings:`,s),{}}}function hr(){const l=ey();if(typeof window>"u")return l;let n=fr("local",At.settings);const a=ty(n);a.changed&&(n=a.data,Li("local",At.settings,JSON.stringify(n)));const s=fr("session",At.sessionView),r=Zb(n),c=r.profiles.map(te=>te.id),f=typeof s.activeProfileId=="string"&&c.includes(s.activeProfileId)?s.activeProfileId:r.activeProfileId,m=r.profiles.find(te=>te.id===f),p={...aa(n,"local"),...ur(n.instances,c,"local")[f]},g=ur(s.instances,c,"session");let y=g[f];y||(y=aa({...p,...aa(s,"session")},"session"),g[f]=y,Li("session",At.sessionView,JSON.stringify({activeProfileId:f,instances:g,observerMode:s.observerMode,adminToken:s.adminToken,adminTokens:s.adminTokens})));const v={...p,...y},w=Pu(v.fontFamily??l.fontFamily),x=window.innerWidth<640?or:xs,S=v.fontSize??l.fontSize,T=ra(S,x),A=v.fontSizeFollowsHost,k=typeof A=="boolean"?A:T===xs||T===or,E=_1(v.virtualKeys??l.virtualKeys),N=n.language??l.language,B=N==="zh"||N==="en"?N:Jb(),L=te=>{const Z=v[te];return typeof Z=="boolean"?Z:l[te]},D=v.predictiveEcho??l.predictiveEcho,R=D==="always"||D==="off"||D==="auto"?D:"auto",z=typeof s.adminToken=="string"?s.adminToken.slice(0,Ss):typeof n.adminToken=="string"?n.adminToken.slice(0,Ss):l.adminToken,K=ny(s.adminTokens),V={...l,wsUrl:(m==null?void 0:m.wsUrl)||(typeof n.wsUrl=="string"?n.wsUrl:l.wsUrl),token:(m==null?void 0:m.token)||"",pairCode:(m==null?void 0:m.pairCode)||"",autoReconnect:(m==null?void 0:m.autoReconnect)??l.autoReconnect,profiles:r.profiles,activeProfileId:f,clientId:typeof n.clientId=="string"&&n.clientId.trim()?n.clientId.trim().slice(0,128):l.clientId,fontFamily:w,fontSize:T,fontSizeFollowsHost:k,toolbarVisible:v.toolbarVisible??l.toolbarVisible,toolbarPosition:v.toolbarPosition??l.toolbarPosition,vibrateOnKeyPress:v.vibrateOnKeyPress??l.vibrateOnKeyPress,predictiveEcho:R,virtualKeys:E,agentKeymaps:Ob(v.agentKeymaps),agentAlertBadge:L("agentAlertBadge"),agentAlertSound:L("agentAlertSound"),agentAlertVibrate:L("agentAlertVibrate"),agentAlertNotify:L("agentAlertNotify"),language:B,observerMode:s.observerMode===!0,adminToken:z,adminTokens:K};return typeof n.fontFamily=="string"&&Pu(n.fontFamily)!==n.fontFamily&&(n.fontFamily=Pu(n.fontFamily),Li("local",At.settings,JSON.stringify(n))),V}function Ei(l){var T;const n=hr(),a={...n,...l};a.agentKeymaps=Ob(a.agentKeymaps),a.adminTokens=ny(a.adminTokens),typeof a.adminToken=="string"&&(a.adminToken=a.adminToken.slice(0,Ss)),l.fontSize!==void 0&&(a.fontSize=ra(l.fontSize)),l.predictiveEcho!==void 0&&(l.predictiveEcho==="auto"||l.predictiveEcho==="always"||l.predictiveEcho==="off"?a.predictiveEcho=l.predictiveEcho:a.predictiveEcho="auto");const s=Zb(a);let r=s.profiles,c=s.activeProfileId;if(O1.some(A=>l[A]!==void 0)){const A=r.findIndex(N=>N.id===c),k=A>=0?{...r[A]}:{id:Id(),displayName:`Herdr ${r.length+1}`,wsUrl:a.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};k.wsUrl=a.wsUrl,k.token=a.token,k.pairCode=a.pairCode||void 0,k.autoReconnect=a.autoReconnect,k.lastUsedAt=Date.now();const E=dr(k,Math.max(A,0));E?A>=0?r[A]=E:(r.push(E),c=E.id):A>=0&&(r=r.filter(N=>N.id!==c),c=((T=r[0])==null?void 0:T.id)||"")}r.length>0&&!r.some(A=>A.id===c)&&(c=r[0].id);const m=r.find(A=>A.id===c);a.wsUrl=(m==null?void 0:m.wsUrl)||a.wsUrl||Ut,a.token=(m==null?void 0:m.token)||"",a.pairCode=(m==null?void 0:m.pairCode)||"",a.autoReconnect=(m==null?void 0:m.autoReconnect)??a.autoReconnect;const p=r.map(A=>A.id),g=ty(fr("local",At.settings)).data,y=fr("session",At.sessionView),v=ur(g.instances,p,"local"),w=ur(y.instances,p,"session"),S=c===n.activeProfileId||!n.activeProfileId?a:l;v[c]={...v[c],...aa(S,"local")},w[c]={...w[c],...aa(S,"session")};for(const A of j1)a[A]!==void 0&&(g[A]=a[A]);return g.profiles=r,g.instances=v,(c!==n.activeProfileId||!p.includes(g.activeProfileId??""))&&(g.activeProfileId=c),Li("local",At.settings,JSON.stringify(g)),Li("session",At.sessionView,JSON.stringify({activeProfileId:c,instances:w,observerMode:a.observerMode===!0,adminToken:a.adminToken,adminTokens:a.adminTokens})),hr()}function D1(l){const[n,a]=M.useState(hr),s=M.useRef(n);s.current=n;const r=M.useRef(l);r.current=l;const c=M.useCallback(x=>{const S=Ei(x);s.current=S,a(S)},[]),f=M.useCallback(x=>{s.current=x,a(x)},[]),m=M.useCallback(x=>{const S=s.current,T=Ag({...x,wsUrl:x.wsUrl||Ut,token:x.token||"",displayName:x.displayName||`Herdr ${S.profiles.length+1}`,autoReconnect:x.autoReconnect!==!1},S.profiles.length),A=Ei({profiles:[...S.profiles,T],activeProfileId:T.id,wsUrl:T.wsUrl,token:T.token,pairCode:T.pairCode||"",autoReconnect:T.autoReconnect});f(A),r.current(A)},[f]),p=M.useCallback(x=>{const S=s.current,T=S.profiles.find(k=>k.id===x);if(!T||T.id===S.activeProfileId)return;const A=Ei({activeProfileId:T.id,wsUrl:T.wsUrl,token:T.token,pairCode:T.pairCode||"",autoReconnect:T.autoReconnect,profiles:S.profiles.map(k=>k.id===T.id?{...k,lastUsedAt:Date.now()}:k)});f(A),r.current(A)},[f]),g=M.useCallback((x,S)=>{const T=s.current;if(!T.profiles.find(N=>N.id===x))return;const k=S.trim().slice(0,64);if(!k)return;const E=Ei({profiles:T.profiles.map(N=>N.id===x?{...N,displayName:k}:N)});f(E)},[f]),y=M.useCallback(x=>{const S=s.current;if(!S.profiles.some(E=>E.id===x))return;const T=S.profiles.filter(E=>E.id!==x),A=T.find(E=>E.id===S.activeProfileId)||T[0],k=Ei(A?{profiles:T,activeProfileId:A.id,wsUrl:A.wsUrl,token:A.token,pairCode:A.pairCode||"",autoReconnect:A.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:Ut,token:"",pairCode:""});f(k),x===S.activeProfileId&&r.current(k)},[f]),v=M.useCallback(x=>{const S=s.current,T=S.profiles.find(z=>z.id===S.activeProfileId),A=x.hostId?Eg({wsUrl:S.wsUrl,hostId:x.hostId}):null,k=A?S.profiles.findIndex(z=>Eg(z)===A):-1,E=k>=0?k:Math.max(0,S.profiles.findIndex(z=>z.id===S.activeProfileId)),B={...S.profiles[E]||T||Ag({wsUrl:S.wsUrl||Ut,token:"",pairCode:S.pairCode||"PENDING",displayName:`Herdr ${S.profiles.length+1}`},S.profiles.length),token:x.token,pairCode:void 0,...x.hostId?{hostId:x.hostId}:{},...x.deviceId?{deviceId:x.deviceId}:{},lastUsedAt:Date.now()};let L=[...S.profiles];E>=0&&E<L.length?L[E]=B:L.push(B);const D=T==null?void 0:T.id;L=L.filter((z,K)=>K===E||z.id===B.id?!0:!(k>=0&&D&&z.id===D));const R=Ei({profiles:L,activeProfileId:B.id,wsUrl:B.wsUrl,token:B.token,pairCode:"",autoReconnect:B.autoReconnect});return f(R),R},[f]),w=M.useCallback(x=>{const S=s.current,T=S.profiles.find(N=>N.id===S.activeProfileId);if(!T||!x.hostId&&!x.hostname)return;const A=/^Herdr \d+$/.test(T.displayName),k={...T,...x.hostId?{hostId:x.hostId}:{},...x.hostname?{hostname:x.hostname}:{},...x.hostname&&A?{displayName:x.hostname}:{}},E=Ei({profiles:S.profiles.map(N=>N.id===T.id?k:N)});f(E)},[f]);return{settings:n,updateSettings:c,addProfileAndConnect:m,switchProfile:p,renameProfile:g,removeProfile:y,savePairedProfile:v,noteReadyProfile:w}}const Zo={ctrl:!1,alt:!1,shift:!1};function z1({adapterRef:l,role:n,addToast:a,tRef:s}){const[r,c]=M.useState({cols:80,rows:24}),f=M.useRef(r);f.current=r;const m=M.useRef(new Set),p=M.useRef(new Set),g=M.useRef(!0);M.useEffect(()=>{n==="controller"&&(g.current=!0)},[n]);const y=M.useCallback(()=>{g.current&&(g.current=!1,a("warning",s.current("toasts.viewerModeWarning")))},[a,s]),v=M.useCallback(R=>{if(n!=="controller"){y();return}const z=l.current;if(!z)return;const K=zd(R);for(const V of p.current)try{V(K)}catch(te){console.debug("Key input observer threw:",te)}z.sendInput(K)},[l,n,y]),w=M.useCallback(R=>(p.current.add(R),()=>{p.current.delete(R)}),[]),[x,S]=M.useState(Zo),T=M.useRef(Zo),A=M.useCallback(R=>{const z={...T.current,[R]:!T.current[R]};T.current=z,S(z)},[]),k=M.useCallback(()=>{const R=T.current;return!R.ctrl&&!R.alt&&!R.shift?null:(T.current=Zo,S(Zo),R)},[]),E=M.useCallback(R=>{var z;n!=="controller"&&!cr(R)||(z=l.current)==null||z.sendInput(R)},[l,n]),N=M.useCallback((R,z)=>{var K;f.current={cols:R,rows:z},c({cols:R,rows:z}),(K=l.current)==null||K.sendResize(R,z)},[l]),B=M.useCallback((R,z)=>n!=="controller"?(y(),!1):l.current?(l.current.sendPasteFile(R,z),!0):!1,[l,n,y]),L=M.useCallback(R=>(m.current.add(R),()=>{m.current.delete(R)}),[]),D=M.useCallback(R=>{for(const z of m.current)try{z(R)}catch(K){console.error("Error in pasteFileReady listener:",K)}},[]);return{terminalDimensions:r,dimensionsRef:f,warnViewerMode:y,sendKey:v,observeKeyInput:w,modifierLatch:x,toggleModifierLatch:A,consumeModifierLatch:k,sendBinary:E,sendResize:N,sendPasteFile:B,subscribeToPasteFileReady:L,notifyPasteFileReady:D}}const H1=4e3,B1=3;function U1(){const[l,n]=M.useState([]),a=M.useRef([]),s=M.useRef(new Map),r=M.useCallback(m=>{a.current=m,n(m)},[]),c=M.useCallback(m=>{const p=s.current.get(m);p&&(clearTimeout(p),s.current.delete(m)),r(a.current.filter(g=>g.id!==m))},[r]),f=M.useCallback((m,p)=>{const g=Date.now(),y=a.current,v=y.find(T=>T.type===m&&T.message===p),w=v?v.id:`${g}-${Math.random().toString(36).substring(2,6)}`;let x;if(v)x=y.map(T=>T.id===w?{...T,count:T.count+1,timestamp:g}:T);else for(x=[...y,{id:w,type:m,message:p,timestamp:g,count:1}];x.length>B1;){const[T,...A]=x,k=s.current.get(T.id);k&&(clearTimeout(k),s.current.delete(T.id)),x=A}r(x);const S=s.current.get(w);S&&clearTimeout(S),s.current.set(w,setTimeout(()=>c(w),H1))},[r,c]);return M.useEffect(()=>{const m=s.current;return()=>{for(const p of m.values())clearTimeout(p);m.clear()}},[]),{toasts:l,addToast:f,removeToast:c}}function K1(l,n){const[a,s]=M.useState(null),[r,c]=M.useState(L1),f=M.useRef(r),m=M.useRef(new Set),p=M.useCallback(w=>{f.current=w,c(w),Qb(w)},[]),g=M.useCallback(w=>{if(s(w),!w.updateAvailable||f.current===w.latest)return;const x=`${w.latest}:${w.restartPending?"restart":"update"}`;m.current.has(x)||(m.current.add(x),l("info",w.restartPending?n.current("update.toastRestart",{version:w.latest}):n.current("update.toast",{version:w.latest})))},[l,n]),y=M.useCallback(()=>s(null),[]),v=M.useCallback((w,x)=>{if(w!==null)return;const S=`outdated:${x||""}`;m.current.has(S)||(m.current.add(S),l("warning",n.current("update.toastOutdated",{host:x||n.current("update.thisHost")})))},[l,n]);return{updateStatus:a,ignoredUpdate:r,ignoreUpdate:p,receiveUpdateStatus:g,forgetUpdateStatus:y,noteHostVersion:v}}const iy=M.createContext(null),ly=M.createContext(null),ay=M.createContext(null),sy=M.createContext(null),oy=M.createContext(null),I1=({children:l})=>{var Os;const[n,a]=M.useReducer($w,Pw),s=M.useRef(null),r=M.useRef(!1);M.useEffect(()=>{zb()},[]);const{receiveOutput:c,subscribeToOutput:f,getPendingOutputChunkCount:m,clearPendingOutput:p}=S1(),{toasts:g,addToast:y,removeToast:v}=U1(),w=M.useCallback(()=>{p(),a({type:"reset",resetTerminal:!0})},[p]),{settings:x,updateSettings:S,addProfileAndConnect:T,switchProfile:A,renameProfile:k,removeProfile:E,savePairedProfile:N,noteReadyProfile:B}=D1(he=>{var qe;w(),(qe=s.current)==null||qe.reconnectWith(qo(he))}),L=M.useCallback((he,qe)=>Dd(x.language,he,qe),[x.language]),D=M.useRef(L);D.current=L;const{herdrLaunch:R,startHerdr:z,handleLaunchError:K,forgetHerdrLaunch:V}=qw(s,D),{updateStatus:te,ignoredUpdate:Z,ignoreUpdate:ie,receiveUpdateStatus:re,forgetUpdateStatus:ce,noteHostVersion:O}=K1(y,D),J=x.observerMode?"viewer":n.role,I=z1({adapterRef:s,role:J,addToast:y,tRef:D}),{uploadProgress:le,uploadImage:P,resetUploadProgress:fe,abortUpload:ve,completeUpload:X}=v1({adapterRef:s,role:J,connectionState:n.connectionState,warnViewerMode:I.warnViewerMode,addToast:y,t:L,sendPasteFile:I.sendPasteFile}),ue=u1(s,()=>qo(x),{stateChange:(he,qe,Nt)=>{const Kt=Yu(Nt)?L(`serverErrors.${Nt}`):qe;a({type:"stateChange",state:he,detail:Kt,code:Nt}),he==="connected"?y("success",L("toasts.connected")):he==="error"&&y("error",Kt||L("toasts.connectionError")),he!=="connected"&&V()},ready:he=>{const qe=r.current;qe&&p(),r.current=!0,V(),ce(),a({type:"ready",message:he,resetTerminal:qe}),B(he),O(he.hostVersion,he.hostname||he.hostId)},hostReconnecting:he=>{a({type:"hostReconnecting",code:he||"host_reconnecting",detail:L(`serverErrors.${Yu(he)?he:"host_reconnecting"}`)}),p()},sessionRestarted:(he,qe,Nt,Kt,ul,_n,dl,ni,Ar)=>{var ya;p(),a({type:"sessionRestarted",hostname:Kt,palette:Nt,platform:ul,shellProfile:_n,adminTerminalSupported:dl,hostVersion:ni,herdrPrefixKeys:Ar}),O(ni,Kt),B({hostId:(ya=s.current)==null?void 0:ya.getHostId(),hostname:Kt})},roleChange:(he,qe,Nt,Kt)=>{a({type:"roleChange",role:he,controllerId:qe,hostId:Nt,assignedClientId:Kt})},controlGranted:()=>{a({type:"controlGranted"}),y("success",L("toasts.controlGranted"))},paired:he=>{var Nt;const qe=N(he);y("success",L("toasts.pairedSuccess")),a({type:"paired",at:Date.now()}),(Nt=s.current)==null||Nt.reconnectWith(qo(qe))},exit:(he,qe)=>{y("info",`${L("toasts.sessionEnded")}${qe?`: ${qe}`:""}${he!=null?` (${he})`:""}`)},error:he=>{if(K(he)||he.code==="host_font_unavailable")return;ve();const qe=Yu(he.code)?L(`serverErrors.${he.code}`):he.message||`[${he.code}]`;y("error",qe)},pasteFileReady:he=>{X(),I.notifyPasteFileReady(he)},rttUpdate:he=>a({type:"rtt",rttMs:he}),peerCount:he=>a({type:"peerCount",count:he}),sessionReady:()=>{a({type:"sessionReady"}),V()},agentStatus:he=>a({type:"agentStatus",status:he}),updateStatus:re,binaryData:c}),{activeProfileId:oe}=x,pe=x.profiles.find(he=>he.id===oe),{hostFont:se,loadHostFont:xe,declineHostFont:ae,syncHostFont:we,ensureHostGlyphs:ke}=Fw(ue),Ie=M.useCallback(()=>{xe()},[xe]),tt=ww(x.fontFamily,se.font?{family:se.font.family,alias:se.status==="loaded"?se.alias:null,glyphs:se.glyphs.source?{family:se.glyphs.source.family,scope:se.glyphs.source.scope,alias:se.glyphs.alias}:null}:null),Je=x.fontSizeFollowsHost&&((Os=se.font)!=null&&Os.sizePx)?ra(se.font.sizePx,x.fontSize):x.fontSize;M.useEffect(()=>{var he;(he=s.current)==null||he.updateConfig(qo(x))},[x]),M.useEffect(()=>{const he=s.current;return he?Gw(he):void 0},[]);const{dimensionsRef:Se}=I,Me=M.useCallback(he=>{s.current&&(he&&s.current.updateConfig(he),s.current.connect(Se.current))},[Se]),ot=M.useCallback(()=>{var he;(he=s.current)==null||he.disconnect()},[]),nt=M.useCallback((he=!1)=>{var qe;(qe=s.current)==null||qe.claimControl(he)},[]),bt=M.useCallback(()=>{var he;(he=s.current)==null||he.releaseControl()},[]),yn=M.useCallback(he=>S({language:he}),[S]),vn=M.useMemo(()=>({settings:x,updateSettings:S,language:x.language,setLanguage:yn,t:L,profiles:x.profiles,activeProfileId:oe,activeProfile:pe,switchProfile:A,addProfileAndConnect:T,renameProfile:k,removeProfile:E,hostFont:se,loadHostFont:Ie,declineHostFont:ae,syncHostFont:we,ensureHostGlyphs:ke,terminalFontFamily:tt,terminalFontSize:Je}),[x,S,yn,L,oe,pe,A,T,k,E,se,Ie,ae,we,ke,tt,Je]),Nn=M.useMemo(()=>{var he;return{...n,role:J,isController:J==="controller",agentProfile:ew((he=n.agentStatus)==null?void 0:he.focusedAgent,"auto"),reportShellProfile:qe=>a({type:"shellProfile",profile:qe}),adapter:ue,connect:Me,disconnect:ot,claimControl:nt,releaseControl:bt,herdrLaunch:R,startHerdr:z,updateStatus:te,ignoredUpdate:Z,ignoreUpdate:ie}},[n,J,ue,Me,ot,nt,bt,R,z,te,Z,ie]),qt=M.useMemo(()=>({toasts:g,addToast:y,removeToast:v}),[g,y,v]),{terminalDimensions:ut,sendKey:_s,observeKeyInput:pa,modifierLatch:ga,toggleModifierLatch:Di,consumeModifierLatch:Ls,sendBinary:ba,sendResize:Rs,warnViewerMode:js,sendPasteFile:ti,subscribeToPasteFileReady:Mt}=I,xn=M.useMemo(()=>({terminalDimensions:ut,sendKey:_s,observeKeyInput:pa,modifierLatch:ga,toggleModifierLatch:Di,consumeModifierLatch:Ls,sendBinary:ba,sendResize:Rs,warnViewerMode:js,sendPasteFile:ti,subscribeToPasteFileReady:Mt,subscribeToOutput:f,getPendingOutputChunkCount:m}),[ut,_s,pa,ga,Di,Ls,ba,Rs,js,ti,Mt,f,m]),kt=M.useMemo(()=>({uploadProgress:le,uploadImage:P,resetUploadProgress:fe}),[le,P,fe]);return h.jsx(iy.Provider,{value:vn,children:h.jsx(ly.Provider,{value:Nn,children:h.jsx(ay.Provider,{value:qt,children:h.jsx(sy.Provider,{value:xn,children:h.jsx(oy.Provider,{value:kt,children:l})})})})})};function ks(l,n){const a=M.useContext(l);if(!a)throw new Error(`${n} must be used within a TerminalProvider`);return a}const Ee=()=>ks(iy,"useSettings"),it=()=>ks(ly,"useConnection"),dn=()=>ks(ay,"useToasts"),Sr=()=>ks(sy,"useTerminalIO"),Cr=()=>ks(oy,"useUpload");function Ts(l){var n,a;return l?{blocked:((n=l.counts)==null?void 0:n.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 G1(l){if(!l)return"";const n=[];return l.blocked>0&&n.push(`${l.blocked}⚠`),l.done>0&&n.push(`${l.done}✓`),n.length>0?`(${n.join(" ")})`:""}function Y1(l,n){if(!l||!n)return null;const a=new Map(l.agents.map(f=>[f.paneId,f.status]));let s=null;for(const f of n.agents)if(!(f.status!=="blocked"&&f.status!=="done")&&a.get(f.paneId)!==f.status){if(f.status==="blocked")return"blocked";s="done"}const r=Ts(l),c=Ts(n);return c.blocked>r.blocked?"blocked":(!s&&c.done>r.done&&(s="done"),s)}const P1={blocked:"%23f9e2af",done:"%23a6e3a1"};function $1(l){return`<circle cx='19' cy='5' r='4.5' fill='${P1[l]}' stroke='%2311111b' stroke-width='1.5'/>`}function V1(l,n){return!n||!l.includes("</svg>")?l:l.replace("</svg>",`${$1(n)}</svg>`)}function _g(l,n=document){const a=n.querySelector('link[rel~="icon"]');if(!a)return;a.dataset.baseHref===void 0&&(a.dataset.baseHref=a.getAttribute("href")??"");const s=V1(a.dataset.baseHref,l);a.getAttribute("href")!==s&&a.setAttribute("href",s)}let on=null;function q1(){if(typeof window>"u")return null;const l=window;return l.AudioContext??l.webkitAudioContext??null}function ry(){const l=q1();if(l)try{on=on??new l,on.state==="suspended"&&on.resume()}catch{on=null}}function X1(l=window){const n=()=>{ry(),a()},a=()=>{l.removeEventListener("pointerdown",n),l.removeEventListener("keydown",n)};return l.addEventListener("pointerdown",n),l.addEventListener("keydown",n),a}const Z1={blocked:[880,660],done:[660,880]};function cy(l){if((on==null?void 0:on.state)==="running")try{const n=on.currentTime;Z1[l].forEach((a,s)=>{const r=on.createOscillator(),c=on.createGain(),f=n+s*.11;r.type="sine",r.frequency.value=a,c.gain.setValueAtTime(1e-4,f),c.gain.exponentialRampToValueAtTime(.06,f+.01),c.gain.exponentialRampToValueAtTime(1e-4,f+.09),r.connect(c),c.connect(on.destination),r.start(f),r.stop(f+.1)})}catch{}}const W1=15e3,Q1={blocked:[70,50,70],done:[40]};function J1(){const{settings:l,t:n}=Ee(),{agentStatus:a}=it(),s=M.useRef(l);s.current=l;const r=M.useRef(n);r.current=n;const c=M.useRef(null),f=M.useRef(Number.NEGATIVE_INFINITY);M.useEffect(()=>{_g(l.agentAlertBadge?F1(Ts(a)):null)},[a,l.agentAlertBadge]),M.useEffect(()=>()=>_g(null),[]),M.useEffect(()=>{if(!(!l.agentAlertSound||typeof window>"u"))return X1(window)},[l.agentAlertSound]),M.useEffect(()=>{const m=c.current;c.current=a;const p=Y1(m,a);if(!p)return;const g=Date.now();if(g-f.current<W1)return;f.current=g;const y=s.current,v=typeof document<"u"&&document.visibilityState==="hidden",w=v||typeof document<"u"&&!document.hasFocus();if(y.agentAlertVibrate&&!v&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(Q1[p])}catch{}if(y.agentAlertSound&&w&&cy(p),y.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const x=Ts(a),S=p==="blocked"?r.current("agents.notifyBlocked",{count:x.blocked}):r.current("agents.notifyDone",{count:x.done});try{new Notification("Herdr Remote",{body:S,tag:"herdr-agents"})}catch{}}},[a])}function uy(l){var n,a,s="";if(typeof l=="string"||typeof l=="number")s+=l;else if(typeof l=="object")if(Array.isArray(l)){var r=l.length;for(n=0;n<r;n++)l[n]&&(a=uy(l[n]))&&(s&&(s+=" "),s+=a)}else for(a in l)l[a]&&(s&&(s+=" "),s+=a);return s}function eS(){for(var l,n,a=0,s="",r=arguments.length;a<r;a++)(l=arguments[a])&&(n=uy(l))&&(s&&(s+=" "),s+=n);return s}const tS=(l,n)=>{const a=new Array(l.length+n.length);for(let s=0;s<l.length;s++)a[s]=l[s];for(let s=0;s<n.length;s++)a[l.length+s]=n[s];return a},nS=(l,n)=>({classGroupId:l,validator:n}),dy=(l=new Map,n=null,a)=>({nextPart:l,validators:n,classGroupId:a}),mr="-",Lg=[],iS="arbitrary..",lS=l=>{const n=sS(l),{conflictingClassGroups:a,conflictingClassGroupModifiers:s}=l;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return aS(f);const m=f.split(mr),p=m[0]===""&&m.length>1?1:0;return fy(m,p,n)},getConflictingClassGroupIds:(f,m)=>{if(m){const p=s[f],g=a[f];return p?g?tS(g,p):p:g||Lg}return a[f]||Lg}}},fy=(l,n,a)=>{if(l.length-n===0)return a.classGroupId;const r=l[n],c=a.nextPart.get(r);if(c){const g=fy(l,n+1,c);if(g)return g}const f=a.validators;if(f===null)return;const m=n===0?l.join(mr):l.slice(n).join(mr),p=f.length;for(let g=0;g<p;g++){const y=f[g];if(y.validator(m))return y.classGroupId}},aS=l=>l.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const n=l.slice(1,-1),a=n.indexOf(":"),s=n.slice(0,a);return s?iS+s:void 0})(),sS=l=>{const{theme:n,classGroups:a}=l;return oS(a,n)},oS=(l,n)=>{const a=dy();for(const s in l){const r=l[s];Fd(r,a,s,n)}return a},Fd=(l,n,a,s)=>{const r=l.length;for(let c=0;c<r;c++){const f=l[c];rS(f,n,a,s)}},rS=(l,n,a,s)=>{if(typeof l=="string"){cS(l,n,a);return}if(typeof l=="function"){uS(l,n,a,s);return}dS(l,n,a,s)},cS=(l,n,a)=>{const s=l===""?n:hy(n,l);s.classGroupId=a},uS=(l,n,a,s)=>{if(fS(l)){Fd(l(s),n,a,s);return}n.validators===null&&(n.validators=[]),n.validators.push(nS(a,l))},dS=(l,n,a,s)=>{const r=Object.entries(l),c=r.length;for(let f=0;f<c;f++){const[m,p]=r[f];Fd(p,hy(n,m),a,s)}},hy=(l,n)=>{let a=l;const s=n.split(mr),r=s.length;for(let c=0;c<r;c++){const f=s[c];let m=a.nextPart.get(f);m||(m=dy(),a.nextPart.set(f,m)),a=m}return a},fS=l=>"isThemeGetter"in l&&l.isThemeGetter===!0,hS=l=>{if(l<1)return{get:()=>{},set:()=>{}};let n=0,a=Object.create(null),s=Object.create(null);const r=(c,f)=>{a[c]=f,n++,n>l&&(n=0,s=a,a=Object.create(null))};return{get(c){let f=a[c];if(f!==void 0)return f;if((f=s[c])!==void 0)return r(c,f),f},set(c,f){c in a?a[c]=f:r(c,f)}}},wd="!",Rg=":",mS=[],jg=(l,n,a,s,r)=>({modifiers:l,hasImportantModifier:n,baseClassName:a,maybePostfixModifierPosition:s,isExternal:r}),pS=l=>{const{prefix:n,experimentalParseClassName:a}=l;let s=r=>{const c=[];let f=0,m=0,p=0,g;const y=r.length;for(let T=0;T<y;T++){const A=r[T];if(f===0&&m===0){if(A===Rg){c.push(r.slice(p,T)),p=T+1;continue}if(A==="/"){g=T;continue}}A==="["?f++:A==="]"?f--:A==="("?m++:A===")"&&m--}const v=c.length===0?r:r.slice(p);let w=v,x=!1;v.endsWith(wd)?(w=v.slice(0,-1),x=!0):v.startsWith(wd)&&(w=v.slice(1),x=!0);const S=g&&g>p?g-p:void 0;return jg(c,x,w,S)};if(n){const r=n+Rg,c=s;s=f=>f.startsWith(r)?c(f.slice(r.length)):jg(mS,!1,f,void 0,!0)}if(a){const r=s;s=c=>a({className:c,parseClassName:r})}return s},gS=l=>{const n=new Map;return l.orderSensitiveModifiers.forEach((a,s)=>{n.set(a,1e6+s)}),a=>{const s=[];let r=[];for(let c=0;c<a.length;c++){const f=a[c],m=f[0]==="[",p=n.has(f);m||p?(r.length>0&&(r.sort(),s.push(...r),r=[]),s.push(f)):r.push(f)}return r.length>0&&(r.sort(),s.push(...r)),s}},bS=l=>({cache:hS(l.cacheSize),parseClassName:pS(l),sortModifiers:gS(l),postfixLookupClassGroupIds:yS(l),...lS(l)}),yS=l=>{const n=Object.create(null),a=l.postfixLookupClassGroups;if(a)for(let s=0;s<a.length;s++)n[a[s]]=!0;return n},vS=/\s+/,xS=(l,n)=>{const{parseClassName:a,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:c,postfixLookupClassGroupIds:f}=n,m=[],p=l.trim().split(vS);let g="";for(let y=p.length-1;y>=0;y-=1){const v=p[y],{isExternal:w,modifiers:x,hasImportantModifier:S,baseClassName:T,maybePostfixModifierPosition:A}=a(v);if(w){g=v+(g.length>0?" "+g:g);continue}let k=!!A,E;if(k){const R=T.substring(0,A);E=s(R);const z=E&&f[E]?s(T):void 0;z&&z!==E&&(E=z,k=!1)}else E=s(T);if(!E){if(!k){g=v+(g.length>0?" "+g:g);continue}if(E=s(T),!E){g=v+(g.length>0?" "+g:g);continue}k=!1}const N=x.length===0?"":x.length===1?x[0]:c(x).join(":"),B=S?N+wd:N,L=B+E;if(m.indexOf(L)>-1)continue;m.push(L);const D=r(E,k);for(let R=0;R<D.length;++R){const z=D[R];m.push(B+z)}g=v+(g.length>0?" "+g:g)}return g},wS=(...l)=>{let n=0,a,s,r="";for(;n<l.length;)(a=l[n++])&&(s=my(a))&&(r&&(r+=" "),r+=s);return r},my=l=>{if(typeof l=="string")return l;let n,a="";for(let s=0;s<l.length;s++)l[s]&&(n=my(l[s]))&&(a&&(a+=" "),a+=n);return a},Og=(l,...n)=>{let a,s,r,c;const f=p=>{const g=n.reduce((y,v)=>v(y),l());return a=bS(g),s=a.cache.get,r=a.cache.set,c=m,m(p)},m=p=>{const g=s(p);if(g)return g;const y=xS(p,a);return r(p,y),y};return c=f,(...p)=>c(wS(...p))},SS=[],gt=l=>{const n=a=>a[l]||SS;return n.isThemeGetter=!0,n},py=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,CS=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,TS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,MS=/\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$/,AS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ES=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ki=l=>CS.test(l),Re=l=>!!l&&!Number.isNaN(Number(l)),Mn=l=>!!l&&Number.isInteger(Number(l)),Qu=l=>l.endsWith("%")&&Re(l.slice(0,-1)),Xn=l=>TS.test(l),by=()=>!0,NS=l=>MS.test(l)&&!AS.test(l),Gd=()=>!1,_S=l=>ES.test(l),LS=l=>kS.test(l),RS=l=>!me(l)&&!ge(l),jS=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)),OS=l=>Oi(l,xy,Gd),me=l=>py.test(l),el=l=>Oi(l,wy,NS),Dg=l=>Oi(l,FS,Re),DS=l=>Oi(l,Cy,by),zS=l=>Oi(l,Sy,Gd),zg=l=>Oi(l,yy,Gd),HS=l=>Oi(l,vy,LS),Wo=l=>Oi(l,Ty,_S),ge=l=>gy.test(l),fs=l=>cl(l,wy),BS=l=>cl(l,Sy),Hg=l=>cl(l,yy),US=l=>cl(l,xy),KS=l=>cl(l,vy),Qo=l=>cl(l,Ty,!0),IS=l=>cl(l,Cy,!0),Oi=(l,n,a)=>{const s=py.exec(l);return s?s[1]?n(s[1]):a(s[2]):!1},cl=(l,n,a=!1)=>{const s=gy.exec(l);return s?s[1]?n(s[1]):a:!1},yy=l=>l==="position"||l==="percentage",vy=l=>l==="image"||l==="url",xy=l=>l==="length"||l==="size"||l==="bg-size",wy=l=>l==="length",FS=l=>l==="number",Sy=l=>l==="family-name",Cy=l=>l==="number"||l==="weight",Ty=l=>l==="shadow",Bg=()=>{const l=gt("color"),n=gt("font"),a=gt("text"),s=gt("font-weight"),r=gt("tracking"),c=gt("leading"),f=gt("breakpoint"),m=gt("container"),p=gt("spacing"),g=gt("radius"),y=gt("shadow"),v=gt("inset-shadow"),w=gt("text-shadow"),x=gt("drop-shadow"),S=gt("blur"),T=gt("perspective"),A=gt("aspect"),k=gt("ease"),E=gt("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...B(),ge,me],D=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],z=()=>[ge,me,p],K=()=>[ki,"full","auto",...z()],V=()=>[Mn,"none","subgrid",ge,me],te=()=>["auto",{span:["full",Mn,ge,me]},Mn,ge,me],Z=()=>[Mn,"auto",ge,me],ie=()=>["auto","min","max","fr",ge,me],re=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ce=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...z()],J=()=>[ki,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],I=()=>[ki,"screen","full","dvw","lvw","svw","min","max","fit",...z()],le=()=>[ki,"screen","full","lh","dvh","lvh","svh","min","max","fit",...z()],P=()=>[l,ge,me],fe=()=>[...B(),Hg,zg,{position:[ge,me]}],ve=()=>["no-repeat",{repeat:["","x","y","space","round"]}],X=()=>["auto","cover","contain",US,OS,{size:[ge,me]}],ue=()=>[Qu,fs,el],oe=()=>["","none","full",g,ge,me],pe=()=>["",Re,fs,el],se=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[Re,Qu,Hg,zg],we=()=>["","none",S,ge,me],ke=()=>["none",Re,ge,me],Ie=()=>["none",Re,ge,me],tt=()=>[Re,ge,me],Je=()=>[ki,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xn],breakpoint:[Xn],color:[by],container:[Xn],"drop-shadow":[Xn],ease:["in","out","in-out"],font:[RS],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xn],shadow:[Xn],spacing:["px",Re],text:[Xn],"text-shadow":[Xn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ki,me,ge,A]}],container:["container"],"container-type":[{"@container":["","normal","size",ge,me]}],"container-named":[jS],columns:[{columns:[Re,me,ge,m]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"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:L()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],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:[Mn,"auto",ge,me]}],basis:[{basis:[ki,"full","auto",m,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Re,ki,"auto","initial","none",me]}],grow:[{grow:["",Re,ge,me]}],shrink:[{shrink:["",Re,ge,me]}],order:[{order:[Mn,"first","last","none",ge,me]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...re(),"normal"]}],"justify-items":[{"justify-items":[...ce(),"normal"]}],"justify-self":[{"justify-self":["auto",...ce()]}],"align-content":[{content:["normal",...re()]}],"align-items":[{items:[...ce(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ce(),{baseline:["","last"]}]}],"place-content":[{"place-content":re()}],"place-items":[{"place-items":[...ce(),"baseline"]}],"place-self":[{"place-self":["auto",...ce()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pbs:[{pbs:z()}],pbe:[{pbe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:J()}],"inline-size":[{inline:["auto",...I()]}],"min-inline-size":[{"min-inline":["auto",...I()]}],"max-inline-size":[{"max-inline":["none",...I()]}],"block-size":[{block:["auto",...le()]}],"min-block-size":[{"min-block":["auto",...le()]}],"max-block-size":[{"max-block":["none",...le()]}],w:[{w:[m,"screen",...J()]}],"min-w":[{"min-w":[m,"screen","none",...J()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[f]},...J()]}],h:[{h:["screen","lh",...J()]}],"min-h":[{"min-h":["screen","lh","none",...J()]}],"max-h":[{"max-h":["screen","lh",...J()]}],"font-size":[{text:["base",a,fs,el]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,IS,DS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Qu,me]}],"font-family":[{font:[BS,zS,n]}],"font-features":[{"font-features":[me]}],"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,ge,me]}],"line-clamp":[{"line-clamp":[Re,"none",ge,Dg]}],leading:[{leading:[c,...z()]}],"list-image":[{"list-image":["none",ge,me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ge,me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[Re,"from-font","auto",ge,el]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Re,"auto",ge,me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"tab-size":[{tab:[Mn,ge,me]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge,me]}],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",ge,me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:fe()}],"bg-repeat":[{bg:ve()}],"bg-size":[{bg:X()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Mn,ge,me],radial:["",ge,me],conic:[Mn,ge,me]},KS,HS]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:pe()}],"border-w-x":[{"border-x":pe()}],"border-w-y":[{"border-y":pe()}],"border-w-s":[{"border-s":pe()}],"border-w-e":[{"border-e":pe()}],"border-w-bs":[{"border-bs":pe()}],"border-w-be":[{"border-be":pe()}],"border-w-t":[{"border-t":pe()}],"border-w-r":[{"border-r":pe()}],"border-w-b":[{"border-b":pe()}],"border-w-l":[{"border-l":pe()}],"divide-x":[{"divide-x":pe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":pe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Re,ge,me]}],"outline-w":[{outline:["",Re,fs,el]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",y,Qo,Wo]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",v,Qo,Wo]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:pe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Re,el]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":pe()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",w,Qo,Wo]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Re,ge,me]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"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":[Re]}],"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":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"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":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"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":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"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":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"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":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"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":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"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":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[ge,me]}],"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":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"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":B()}],"mask-image-conic-pos":[{"mask-conic":[Re]}],"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":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:fe()}],"mask-repeat":[{mask:ve()}],"mask-size":[{mask:X()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ge,me]}],filter:[{filter:["","none",ge,me]}],blur:[{blur:we()}],brightness:[{brightness:[Re,ge,me]}],contrast:[{contrast:[Re,ge,me]}],"drop-shadow":[{"drop-shadow":["","none",x,Qo,Wo]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",Re,ge,me]}],"hue-rotate":[{"hue-rotate":[Re,ge,me]}],invert:[{invert:["",Re,ge,me]}],saturate:[{saturate:[Re,ge,me]}],sepia:[{sepia:["",Re,ge,me]}],"backdrop-filter":[{"backdrop-filter":["","none",ge,me]}],"backdrop-blur":[{"backdrop-blur":we()}],"backdrop-brightness":[{"backdrop-brightness":[Re,ge,me]}],"backdrop-contrast":[{"backdrop-contrast":[Re,ge,me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Re,ge,me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Re,ge,me]}],"backdrop-invert":[{"backdrop-invert":["",Re,ge,me]}],"backdrop-opacity":[{"backdrop-opacity":[Re,ge,me]}],"backdrop-saturate":[{"backdrop-saturate":[Re,ge,me]}],"backdrop-sepia":[{"backdrop-sepia":["",Re,ge,me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ge,me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Re,"initial",ge,me]}],ease:[{ease:["linear","initial",k,ge,me]}],delay:[{delay:[Re,ge,me]}],animate:[{animate:["none",E,ge,me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[T,ge,me]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:ke()}],"rotate-x":[{"rotate-x":ke()}],"rotate-y":[{"rotate-y":ke()}],"rotate-z":[{"rotate-z":ke()}],scale:[{scale:Ie()}],"scale-x":[{"scale-x":Ie()}],"scale-y":[{"scale-y":Ie()}],"scale-z":[{"scale-z":Ie()}],"scale-3d":["scale-3d"],skew:[{skew:tt()}],"skew-x":[{"skew-x":tt()}],"skew-y":[{"skew-y":tt()}],transform:[{transform:[ge,me,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Je()}],"translate-x":[{"translate-x":Je()}],"translate-y":[{"translate-y":Je()}],"translate-z":[{"translate-z":Je()}],"translate-none":["translate-none"],zoom:[{zoom:[Mn,ge,me]}],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"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",ge,me]}],"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":P()}],"scrollbar-track-color":[{"scrollbar-track":P()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mbs":[{"scroll-mbs":z()}],"scroll-mbe":[{"scroll-mbe":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pbs":[{"scroll-pbs":z()}],"scroll-pbe":[{"scroll-pbe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"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",ge,me]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[Re,fs,el,Dg]}],stroke:[{stroke:["none",...P()]}],"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"]}},GS=(l,{cacheSize:n,prefix:a,experimentalParseClassName:s,extend:r={},override:c={}})=>(Jl(l,"cacheSize",n),Jl(l,"prefix",a),Jl(l,"experimentalParseClassName",s),Jo(l.theme,c.theme),Jo(l.classGroups,c.classGroups),Jo(l.conflictingClassGroups,c.conflictingClassGroups),Jo(l.conflictingClassGroupModifiers,c.conflictingClassGroupModifiers),Jl(l,"postfixLookupClassGroups",c.postfixLookupClassGroups),Jl(l,"orderSensitiveModifiers",c.orderSensitiveModifiers),er(l.theme,r.theme),er(l.classGroups,r.classGroups),er(l.conflictingClassGroups,r.conflictingClassGroups),er(l.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),Sd(l,r,"postfixLookupClassGroups"),Sd(l,r,"orderSensitiveModifiers"),l),Jl=(l,n,a)=>{a!==void 0&&(l[n]=a)},Jo=(l,n)=>{if(n)for(const a in n)Jl(l,a,n[a])},er=(l,n)=>{if(n)for(const a in n)Sd(l,n,a)},Sd=(l,n,a)=>{const s=n[a];s!==void 0&&(l[a]=l[a]?l[a].concat(s):s)},YS=(l,...n)=>typeof l=="function"?Og(Bg,l,...n):Og(()=>GS(Bg(),l),...n),PS=YS({extend:{classGroups:{"font-size":[{text:["tui","tui-sm","tui-lg"]}]}}});function ne(...l){return PS(eS(l))}const _e={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},rn={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"}},ha={ok:rn.ok.text,warn:rn.warn.text,bad:rn.bad.text,idle:rn.idle.text,accent:rn.accent.text,alt:rn.alt.text,info:rn.info.text},bn=({level:l,className:n})=>h.jsx("span",{"aria-hidden":"true",className:ne("select-none leading-none",ha[l],n),children:l==="idle"?_e.off:_e.on}),Yd=({className:l})=>h.jsx("span",{"aria-hidden":"true",className:ne("select-none text-tui-faint",l),children:_e.dot}),My={ok:"bg-tui-ok",warn:"bg-tui-warn",bad:"bg-tui-bad",idle:"bg-tui-border",accent:"bg-tui-accent",alt:"bg-tui-alt",info:"bg-tui-info"},Et=({title:l,aside:n,tone:a="accent",className:s,bodyClassName:r,children:c,...f})=>h.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",s),...f,children:[l?h.jsx("legend",{className:ne("flex items-center gap-2 text-tui font-bold",ha[a]),children:h.jsx("span",{children:l})}):null,n?h.jsx("span",{className:"pointer-events-none absolute -top-[10px] right-2 max-w-[60%] truncate bg-tui-base px-1 text-tui-sm text-tui-faint",children:n}):null,h.jsx("div",{className:ne("min-w-0",r),children:c})]}),An=({label:l,labelWidth:n=16,className:a,children:s})=>h.jsxs("div",{className:ne("flex items-baseline gap-2 text-tui",a),children:[h.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${n}ch`},title:typeof l=="string"?l:void 0,children:l}),h.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:s})]}),$S=({className:l,label:n})=>n?h.jsxs("div",{className:ne("flex items-center gap-2",l),children:[h.jsx("span",{className:"h-px w-3 bg-tui-border-dim","aria-hidden":"true"}),h.jsx("span",{className:"text-tui-sm text-tui-faint",children:n}),h.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):h.jsx("div",{className:ne("h-px w-full bg-tui-border-dim",l),"aria-hidden":"true"}),Ri=({tone:l="accent",className:n,children:a,action:s})=>{const r=l==="ok"?_e.check:l==="bad"?_e.cross:l==="warn"?_e.warn:"›",c=rn[l].edgeL;return h.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",c,n),children:[h.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",ha[l]),children:r}),h.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:a}),s?h.jsx("div",{className:"shrink-0",children:s}):null]})},VS={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"},Ae=({variant:l="default",brackets:n=!0,glyph:a,block:s=!1,className:r,children:c,type:f="button",...m})=>h.jsxs("button",{type:f,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",VS[l],s&&"w-full",r),...m,children:[n?h.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,a?h.jsx("span",{"aria-hidden":"true",className:"leading-none",children:a}):null,h.jsx("span",{className:"truncate",children:c}),n?h.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),Ay=({tone:l="accent",dot:n=!1,className:a,children:s})=>h.jsxs("span",{className:ne("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",ha[l],a),children:[n?h.jsx(bn,{level:l}):null,s]}),Pd=({tabs:l,activeId:n,onSelect:a,ariaLabel:s,className:r,labelClassName:c})=>h.jsx("nav",{className:ne("flex items-center gap-2",r),"aria-label":s,children:l.map((f,m)=>{const p=f.id===n;return h.jsxs(Jn.Fragment,{children:[m>0?h.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:_e.tabDivider}):null,h.jsxs("button",{type:"button",onClick:()=>a(f.id),"aria-current":p?"page":void 0,"aria-label":f.ariaLabel??f.label,title:f.title,className:ne("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",p?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[f.index!==void 0?h.jsx("span",{"aria-hidden":"true",className:ne("text-tui-faint",p&&"text-tui-accent"),children:f.index}):null,h.jsx("span",{"aria-hidden":"true",className:ne("ml-1",c),children:f.label})]})]},f.id)})}),Ey=({hints:l,className:n})=>h.jsx("div",{className:ne("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",n),children:l.map(a=>h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx("kbd",{className:"border border-tui-border-dim px-1 not-italic text-tui-muted",children:a.keys}),h.jsx("span",{children:a.action})]},`${a.keys} ${a.action}`))}),pr=({active:l=!1,className:n,children:a})=>h.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",n),children:a}),sl=({htmlFor:l,hint:n,className:a,children:s})=>h.jsxs("label",{htmlFor:l,className:ne("block text-tui-sm font-bold text-tui-muted",a),children:[s,n?h.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:n}):null]}),un=Jn.forwardRef(({className:l,...n},a)=>h.jsx("input",{ref:a,className:ne("tui-input w-full px-2 py-1 text-tui",l),...n}));un.displayName="Input";const Tr=Jn.forwardRef(({className:l,children:n,...a},s)=>h.jsx("select",{ref:s,className:ne("tui-input w-full px-2 py-1 text-tui",l),...a,children:n}));Tr.displayName="Select";const Mr="h-8",gn=({title:l,aside:n,className:a,children:s})=>h.jsxs("section",{className:ne("min-w-0",a),children:[h.jsxs("div",{className:"flex min-h-[var(--tui-row)] items-center gap-2 border-b border-tui-border pb-1",children:[h.jsx("h3",{className:"text-tui font-bold text-tui-accent",children:l}),n?h.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:n}):null]}),h.jsx("div",{className:"divide-y divide-tui-border-dim",children:s})]}),Bt=({label:l,hint:n,htmlFor:a,control:s,className:r})=>h.jsxs("div",{className:ne("flex flex-col gap-1 py-1.5 sm:flex-row sm:items-center sm:gap-4",r),children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[a?h.jsx("label",{htmlFor:a,className:"block text-tui text-tui-text",children:l}):h.jsx("span",{className:"block text-tui text-tui-text",children:l}),n?h.jsx("span",{className:"block text-tui-sm leading-snug text-tui-faint",children:n}):null]}),h.jsx("div",{className:"w-full shrink-0 sm:w-[20rem]",children:s})]}),Cd="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",Td="text-tui-muted hover:bg-tui-selection hover:text-tui-text";function gr({name:l,value:n,options:a,onChange:s,tone:r="accent",size:c="md",className:f,"aria-label":m}){return h.jsx("div",{role:"radiogroup","aria-label":m,className:ne("grid w-full border border-tui-border bg-tui-mantle",Mr,f),style:{gridTemplateColumns:`repeat(${a.length}, minmax(max-content, 1fr))`},children:a.map((p,g)=>{const y=p.value===n;return h.jsxs("label",{className:ne(Cd,c==="sm"&&"px-1.5 text-tui-sm",g>0&&"border-l border-tui-border",y?ne(My[r],"font-bold text-tui-crust"):Td),children:[h.jsx("input",{type:"radio",name:l,value:p.value,className:"sr-only",checked:y,onChange:()=>s(p.value)}),h.jsx("span",{className:"whitespace-nowrap",children:p.label})]},p.value)})})}const Ni=({checked:l,onChange:n,label:a,offLabel:s,onLabel:r,disabled:c=!1,className:f})=>{const m=p=>g=>{g.preventDefault(),!(c||p===l)&&n(p)};return h.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",Mr,c&&"cursor-not-allowed opacity-60",f),children:[h.jsx("input",{type:"checkbox",className:"sr-only","aria-label":a,checked:l,disabled:c,onChange:p=>n(p.target.checked)}),h.jsx("span",{"aria-hidden":"true",onClick:m(!1),className:ne(Cd,l?Td:"bg-tui-selection font-bold text-tui-text"),children:s}),h.jsx("span",{"aria-hidden":"true",onClick:m(!0),className:ne(Cd,"border-l border-tui-border",l?"bg-tui-ok font-bold text-tui-crust":Td),children:r})]})},ll=({variant:l="neutral",className:n,type:a="button",children:s,...r})=>h.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",n),...r,children:s}),qS=({value:l,width:n=20,tone:a="accent",className:s})=>{const r=Number.isFinite(l)?Math.min(1,Math.max(0,l)):0,c=Math.round(r*n);return h.jsxs("span",{className:ne("inline-flex select-none whitespace-pre font-mono leading-none",s),role:"presentation",children:[h.jsx("span",{className:ha[a],children:_e.meterFull.repeat(c)}),h.jsx("span",{className:"text-tui-border",children:_e.meterEmpty.repeat(Math.max(0,n-c))})]})},XS=({ratio:l,label:n,tone:a="accent",className:s,...r})=>{const c=Number.isFinite(l)?Math.min(1,Math.max(0,l)):0;return h.jsxs("div",{className:ne("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",s),role:"progressbar","aria-valuenow":Math.round(c*100),"aria-valuemin":0,"aria-valuemax":100,...r,children:[h.jsx("div",{className:ne("absolute inset-y-0 left-0",My[a]),style:{width:`${c*100}%`},"aria-hidden":"true"}),n!==void 0?h.jsx("span",{className:"absolute inset-0 flex items-center justify-center whitespace-nowrap px-1 text-tui font-bold text-tui-text mix-blend-difference",children:n}):null]})},Zl=({label:l,value:n,sub:a,tone:s,title:r,className:c})=>h.jsxs("div",{className:ne("min-w-0 border border-tui-border bg-tui-base px-2.5 py-1.5",c),title:r,children:[h.jsx("div",{className:"truncate text-tui-sm text-tui-muted",children:l}),h.jsx("div",{className:ne("truncate text-tui-lg font-bold",s?ha[s]:"text-tui-text"),children:n}),h.jsx("div",{className:"truncate text-tui-sm text-tui-faint",children:a||" "})]}),Ug=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],ol=({className:l,label:n})=>{const[a,s]=Jn.useState(0);return Jn.useEffect(()=>{const r=setInterval(()=>s(c=>(c+1)%Ug.length),90);return()=>clearInterval(r)},[]),h.jsxs("span",{className:ne("inline-flex items-center gap-1.5",l),role:"status",children:[h.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:Ug[a]}),n?h.jsx("span",{children:n}):null]})};function $d({columns:l,items:n,rowKey:a,empty:s,className:r}){return n.length===0?h.jsx("div",{className:ne("px-1 py-4 text-center text-tui text-tui-faint",r),children:s}):h.jsx("div",{className:ne("w-full overflow-x-auto",r),children:h.jsxs("table",{className:"w-full border-collapse text-tui",children:[h.jsx("thead",{children:h.jsx("tr",{className:"border-b border-tui-border",children:l.map(c=>h.jsx("th",{scope:"col",style:c.width?{width:`${c.width}ch`}:void 0,className:ne("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",c.align==="right"?"text-right":"text-left",c.className),children:c.header},c.key))})}),h.jsx("tbody",{children:n.map((c,f)=>h.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:l.map(m=>h.jsx("td",{className:ne("px-2 py-1 align-top text-tui-text",m.align==="right"?"text-right":"text-left",m.className),children:m.render(c,f)},m.key))},a(c,f)))})]})})}var ZS=Mb();const ma=({isOpen:l,onClose:n,title:a,subtitle:s,closeLabel:r,footer:c,hints:f,size:m="md",fixedHeight:p=!1,className:g,children:y})=>{if(!l)return null;const v=m==="sm"?"max-w-md":m==="lg"?"max-w-3xl":"max-w-xl",w=`tui-modal-${a.replace(/\s+/g,"-").toLowerCase()}`,x=h.jsx("div",{className:"fixed inset-0 inset-x-0 z-50 flex items-center justify-center overflow-hidden bg-tui-crust/85 p-3 sm:p-6",style:{height:"var(--app-height, 100dvh)",width:"100vw"},role:"dialog","aria-modal":"true","aria-labelledby":w,onMouseDown:S=>{S.target===S.currentTarget&&n()},children:h.jsxs("div",{className:ne("relative flex max-h-full w-full flex-col border border-tui-border bg-tui-base",v,p&&"h-[46rem]",g),children:[h.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-tui-border bg-tui-mantle px-3 py-1.5",children:[h.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2",children:[h.jsx("h2",{id:w,className:"break-words text-tui font-bold text-tui-accent",children:a}),s?h.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint",children:s}):null]}),h.jsx(Ae,{variant:"ghost",onClick:n,"aria-label":r,title:r,children:"esc"})]}),h.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-3",children:y}),c||f?h.jsxs("footer",{className:"flex shrink-0 flex-wrap items-center justify-between gap-2 border-t border-tui-border bg-tui-mantle px-3 py-1.5",children:[f?h.jsx(Ey,{hints:f}):h.jsx("span",{}),c?h.jsx("div",{className:"flex items-center gap-2",children:c}):null]}):null]})});return typeof document>"u"?x:ZS.createPortal(x,document.body)},Md=({items:l,className:n,"data-testid":a})=>{const s=l.filter(Boolean);return h.jsx("span",{"data-testid":a,className:ne("flex min-w-0 items-center gap-1.5",n),children:s.map((r,c)=>h.jsxs(Jn.Fragment,{children:[c>0?h.jsx(Yd,{className:"shrink-0"}):null,r]},c))})},ky=({left:l,right:n,className:a})=>h.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:[h.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:l}),h.jsx("div",{className:"flex shrink-0 items-center gap-3",children:n})]}),WS=({name:l,tagline:n,aside:a,tabs:s,activeTabId:r,onSelectTab:c,tabsAriaLabel:f,toolbarStart:m,toolbarAside:p,hints:g,footerAside:y,bodyClassName:v,className:w,children:x})=>{const S=!!(s&&s.length>0&&r!==void 0&&c);return h.jsxs("div",{className:ne("flex h-full min-h-0 w-full flex-col bg-tui-crust",w),children:[l?h.jsxs("div",{className:"flex h-[var(--tui-row)] shrink-0 items-center justify-between gap-3 overflow-hidden border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[h.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[h.jsx("span",{className:"shrink-0 font-bold text-tui-accent",children:l}),n?h.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:n}):null]}),a?h.jsx("span",{className:"flex shrink-0 items-center gap-2",children:a}):null]}):null,S||m||p?h.jsxs("div",{className:"flex min-h-[var(--tui-row)] shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border bg-tui-mantle px-2 py-1",children:[m?h.jsx("div",{className:"flex shrink-0 items-center",children:m}):null,S?h.jsx("div",{className:"scrollbar-none order-last min-w-0 basis-full overflow-x-auto sm:order-none sm:basis-auto",children:h.jsx(Pd,{tabs:s,activeId:r,onSelect:c,ariaLabel:f,className:"gap-3"})}):null,p?h.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:p}):null]}):null,h.jsx("div",{className:ne("min-h-0 flex-1 overflow-y-auto p-2",v),children:x}),g||y?h.jsx(ky,{left:g?h.jsx(Ey,{hints:g}):null,right:y}):null]})},QS="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",JS="text-tui-muted hover:border-tui-border hover:text-tui-accent",eC=({currentView:l,onNavigate:n,onOpenSettings:a})=>{const{language:s,setLanguage:r,t:c}=Ee(),{addToast:f}=dn(),m=g=>{g!==s&&(r(g),f("info",Dd(g,"toasts.switchedLanguage",{lang:g==="zh"?"简体中文":"English"})))},p=[{id:"terminal",label:c("header.terminalTab"),index:1,ariaLabel:c("header.terminalTab")},...l==="admin"?[{id:"admin",label:c("header.adminTab"),index:2,ariaLabel:c("header.adminTab")}]:[]];return h.jsx("header",{className:"z-30 w-full shrink-0 select-none overflow-hidden border-b border-tui-border bg-tui-mantle px-2 pt-[max(env(safe-area-inset-top,0px),0.125rem)]",children:h.jsxs("div",{className:"scrollbar-none flex min-h-[var(--tui-row)] items-center gap-2 overflow-x-auto text-tui",children:[h.jsxs("span",{className:"flex shrink-0 items-baseline gap-2",children:[h.jsx("span",{className:"font-bold text-tui-accent",children:"herdr-remote"}),h.jsx("span",{className:"hidden text-tui-sm text-tui-faint sm:inline",children:c("header.tagline")})]}),h.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),h.jsx(Pd,{tabs:p,activeId:l,onSelect:g=>n(g),ariaLabel:c("header.mainNavigationAria"),className:"shrink-0 gap-3"}),h.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),h.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[h.jsx(gr,{name:"header-language",value:s,onChange:m,options:[{value:"zh",label:"中"},{value:"en",label:"EN"}],size:"sm",className:"h-[var(--tui-row)] w-auto","aria-label":c("header.languageToggleTitle")}),h.jsx("button",{type:"button",onClick:a,className:ne(QS,JS),title:c("header.settingsTitle"),"aria-label":c("header.settingsTitle"),children:c("header.actionSettings")})]})]})})},tr=({tone:l,glyph:n,message:a,assertive:s=!1,action:r})=>h.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",rn[l].edgeB),"aria-live":s?"assertive":"polite",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[h.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",rn[l].text),children:n}),h.jsx("span",{className:"truncate text-tui-text",children:a})]}),r]}),tC=()=>{const{settings:l,t:n}=Ee(),{connectionState:a,stateDetail:s,connect:r}=it();return a==="connected"||!l.token&&!l.pairCode&&a==="disconnected"?null:a==="connecting"?h.jsx(tr,{tone:"accent",glyph:h.jsx(ol,{}),message:n("statusBanner.connecting")}):a==="reconnecting"?h.jsx(tr,{tone:"warn",glyph:h.jsx(ol,{}),assertive:!0,message:s||n("statusBanner.reconnectingDefault"),action:h.jsx(Ae,{variant:"warn",onClick:()=>r(),className:"shrink-0",children:n("statusBanner.reconnectNow")})}):a==="error"?h.jsx(tr,{tone:"bad",glyph:_e.cross,assertive:!0,message:s||n("statusBanner.errorDefault"),action:h.jsx(Ae,{variant:"danger",onClick:()=>r(),className:"shrink-0",children:n("common.retry")})}):a==="disconnected"?h.jsx(tr,{tone:"idle",glyph:_e.off,message:n("statusBanner.disconnected"),action:h.jsx(Ae,{variant:"primary",onClick:()=>r(),className:"shrink-0",children:n("common.connect")})}):null},Ju="Herdr Remote",Kg=80,nC=/[\u0000-\u001F\u007F-\u009F]/g;function Ad(l){if(typeof l!="string")return"";const n=l.replace(nC," ").replace(/\s+/g," ").trim();return n.length<=Kg?n:`${n.slice(0,Kg-1).trimEnd()}…`}function iC(l,n,a){const s=G1(a??null),r=s?`${s} `:"",c=Ad(l);if(c)return`${r}${c} · ${Ju}`;const f=Ad(n);return f?`${r}${f} · ${Ju}`:`${r}${Ju}`}function lC(l,n,a){const s=iC(l,n,a);return typeof document<"u"&&(document.title=s),s}const aC=new Set(["http:","https:","mailto:"]),ed=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,sC=/[.,;:!?'"]+$/,Ig=8;function Vd(l){return/^www\./i.test(l)?`https://${l}`:l}function oC(l){const n=(r,c)=>r.split(c).length-1;let a=l.replace(sC,"");const s=[["(",")"],["[","]"],["{","}"]];for(const[r,c]of s)for(;a.endsWith(c)&&n(a,c)>n(a,r);)a=a.slice(0,-1);return a}function Ny(l){if(typeof l!="string"||l.length===0)return!1;try{return aC.has(new URL(Vd(l)).protocol)}catch{return!1}}function rC(l,n){if(typeof l!="string"||n<0)return null;ed.lastIndex=0;for(let a=ed.exec(l);a;a=ed.exec(l)){const s=oC(a[0]);if(!s)continue;const r=a.index,c=r+s.length;if(n>=r&&n<c&&Ny(s))return s}return null}function cC(l,n,a){var m;const s=(m=l==null?void 0:l.buffer)==null?void 0:m.active;if(!s||typeof s.getLine!="function"||!s.getLine(a))return null;let r=a;for(let p=0;p<Ig;p+=1){const g=s.getLine(r);if(!(g!=null&&g.isWrapped)||r===0)break;r-=1}let c="",f=-1;for(let p=r;p<r+Ig;p+=1){const g=s.getLine(p);if(!g||p>r&&!g.isWrapped)break;p===a&&(f=c.length+n),c+=g.translateToString(!1)}return f<0?null:{text:c,index:f}}function uC(l,n,a){const s=cC(l,n,a);return s?rC(s.text,s.index):null}function dC(l){try{const n=new URL(Vd(l));return n.host||n.pathname}catch{return""}}function Ed(l){return!Ny(l)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(Vd(l),"_blank","noopener,noreferrer"),!0)}async function qd(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 n=null,a=null,s=null;try{if(n=document.createElement("textarea"),n.style.userSelect="text",n.style.webkitUserSelect="text",n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="1px",n.style.height="1px",n.style.padding="0",n.style.border="none",n.style.outline="none",n.style.boxShadow="none",n.style.background="transparent",n.style.opacity="0",n.style.fontSize="16px",n.setAttribute("readonly",""),n.setAttribute("aria-hidden","true"),n.value=l,typeof window<"u"&&typeof window.getSelection=="function"&&(s=window.getSelection(),s&&s.rangeCount>0&&(a=s.getRangeAt(0))),document.body.appendChild(n),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const f=document.createRange();f.selectNodeContents(n),s&&(s.removeAllRanges(),s.addRange(f)),n.setSelectionRange(0,l.length)}else n.focus({preventScroll:!0}),n.select();if(document.execCommand("copy"))return"exec"}catch{}finally{n!=null&&n.parentNode&&n.parentNode.removeChild(n),s&&(s.removeAllRanges(),a&&s.addRange(a))}}return"failed"}async function fC(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const n=await navigator.clipboard.readText();return!n||n.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:n}}catch(n){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(n==null?void 0:n.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function hC(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const n=await navigator.clipboard.read();if(!n||n.length===0)return{ok:!1,reason:"empty"};for(const a of n){const s=a.types.find(r=>r.startsWith("image/"));if(s){const r=await a.getType(s);if(r&&r.size>0)return{ok:!0,blob:r}}}return{ok:!1,reason:"empty"}}catch(n){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const a=n==null?void 0:n.name;return a==="SecurityError"?{ok:!1,reason:"insecure"}:a==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function _y(l){const n=l.clipboardData;if(!n)return null;if(n.files&&n.files.length>0)for(let a=0;a<n.files.length;a++){const s=n.files[a];if(s!=null&&s.type.startsWith("image/"))return s}if(n.items&&n.items.length>0)for(let a=0;a<n.items.length;a++){const s=n.items[a];if(s!=null&&s.type.startsWith("image/")){const r=s.getAsFile();if(r)return r}}return null}function mC(l){if(!l||l.length===0)return null;for(let n=0;n<l.length;n++){const a=l[n];if(a&&(a.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(a.name)))return a}return null}const pC=({isOpen:l,onClose:n,onSend:a,onSendImage:s})=>{const{t:r}=Ee(),{addToast:c}=dn(),[f,m]=M.useState(""),[p,g]=M.useState(null),[y,v]=M.useState(!1),w=M.useRef(null),x=M.useRef(null),S=M.useRef(null),T=async D=>{if(D.size===0){c("error",r("clipboard.fileEmpty"));return}v(!0);try{const R=await qb(D);R?(g(R),m("")):c("error",r("clipboard.imageTooLarge"))}catch(R){console.error("Failed to process image:",R),c("error",r("clipboard.imageTooLarge"))}finally{v(!1)}},A=async D=>{const R=_y(D);R&&(D.preventDefault(),await T(R))},k=async D=>{const R=mC(D.target.files);D.target.value="",R&&await T(R)},E=D=>{const R=D.target.value;m(R),R&&p&&g(null)},N=()=>{g(null),w.current&&(w.current.value=""),x.current&&(x.current.value="")},B=()=>{p?(s==null||s(p),n()):f.trim()&&(a(f),n())},L=!!(f.trim()||p);return h.jsx(ma,{isOpen:l,onClose:n,title:r("clipboard.pasteTitle"),closeLabel:r("clipboard.cancel"),size:"sm",footer:h.jsxs("div",{className:"flex items-center justify-end gap-2",children:[h.jsx(Ae,{variant:"ghost",onClick:n,children:r("clipboard.cancel")}),h.jsx(Ae,{variant:"primary",onClick:B,disabled:!L||y,children:r("clipboard.pasteSend")})]}),children:h.jsxs("div",{className:"flex flex-col gap-3 p-3 font-mono select-text",children:[h.jsxs("div",{className:"flex flex-col gap-1.5",children:[h.jsx("label",{htmlFor:"paste-fallback-input",className:"text-tui-sm text-tui-muted font-sans font-medium",children:r("clipboard.pasteHint")}),h.jsx("textarea",{ref:S,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:r("clipboard.pasteHint"),value:f,onChange:E,onPaste:A,disabled:!!p||y,className:"tui-input min-h-[90px] w-full resize-none p-2 text-tui font-mono rounded border border-tui-border bg-tui-bg focus:outline-none focus:ring-1 focus:ring-tui-accent disabled:opacity-50"})]}),h.jsxs("div",{className:"relative my-1",children:[h.jsx("div",{className:"absolute inset-0 flex items-center",children:h.jsx("div",{className:"w-full border-t border-tui-border"})}),h.jsx("div",{className:"relative flex justify-center text-tui-xs uppercase",children:h.jsx("span",{className:"bg-tui-bg px-2 text-tui-muted font-sans",children:r("clipboard.imageSectionTitle")})})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("input",{ref:w,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:k}),h.jsx("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:k}),p?h.jsxs("div",{className:"flex flex-col items-center gap-2 p-3 border border-tui-border bg-tui-bg rounded",children:[h.jsx("img",{src:p.dataUrl,alt:"Pasted preview","data-testid":"pasted-image-preview",className:"max-h-40 max-w-full object-contain rounded border border-tui-border"}),h.jsxs("div",{className:"flex items-center justify-between w-full text-tui-xs text-tui-muted pt-1",children:[h.jsx("span",{children:r("clipboard.imageCompressedSize",{size:p1(p.byteLength)})}),h.jsx(Ae,{variant:"ghost",onClick:N,"aria-label":r("clipboard.removeImage"),children:r("clipboard.cancel")})]})]}):h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx(Ae,{variant:"default",onClick:()=>{var D;return(D=w.current)==null?void 0:D.click()},disabled:y||!!f.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.chooseImage"),children:r("clipboard.chooseImage")}),h.jsx(Ae,{variant:"default",onClick:()=>{var D;return(D=x.current)==null?void 0:D.click()},disabled:y||!!f.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.takePhoto"),children:r("clipboard.takePhoto")})]}),y&&h.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:h.jsx("span",{children:r("clipboard.imageCompressing")})})]})]})})},Wl="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",gC=({anchorPoint:l,hasSelection:n,isController:a,vibrateOnKeyPress:s=!1,linkUrl:r=null,onOpenLink:c,onCopySelection:f,onCopyLine:m,onCopyScreen:p,onPaste:g,onClose:y})=>{const{t:v}=Ee(),w=M.useRef(null),[x,S]=M.useState(null);M.useEffect(()=>{if(s&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[s]),M.useLayoutEffect(()=>{const E=w.current;if(!(E!=null&&E.parentElement))return;const N=E.parentElement.getBoundingClientRect(),B=E.getBoundingClientRect(),L=B.width||208,D=B.height||220,R=N.width,z=N.height;let K=l.x-L/2;K=Math.max(8,Math.min(Math.max(8,R-L-8),K));let V=l.y-D-8;V<8&&(V=l.y+8),V=Math.max(8,Math.min(Math.max(8,z-D-8),V)),S({x:K,y:V})},[l.x,l.y,n,a,r]);const T=Math.max(8,l.x-104),A=Math.max(8,l.y-200),k={position:"absolute",left:`${x?x.x:T}px`,top:`${x?x.y:A}px`,visibility:x?"visible":"hidden"};return h.jsx("div",{ref:w,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:k,onMouseDown:E=>E.stopPropagation(),onTouchStart:E=>E.stopPropagation(),onPointerDown:E=>E.stopPropagation(),children:h.jsxs(Et,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[r&&c&&h.jsxs("button",{type:"button",role:"menuitem",className:ne(Wl,Ql),onClick:()=>{c(r),y()},children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:_e.cursor}),h.jsx("span",{className:"truncate",children:v("clipboard.openLink")}),h.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:dC(r)})]}),n&&h.jsxs("button",{type:"button",role:"menuitem",className:ne(Wl,Ql),onClick:()=>{f(),y()},children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:_e.cursor}),h.jsx("span",{className:"truncate",children:v("clipboard.copySelection")})]}),h.jsxs("button",{type:"button",role:"menuitem",className:ne(Wl,Ql),onClick:()=>{m(),y()},children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:_e.cursor}),h.jsx("span",{className:"truncate",children:v("clipboard.copyLine")})]}),h.jsxs("button",{type:"button",role:"menuitem",className:ne(Wl,Ql),onClick:()=>{p(),y()},children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:_e.cursor}),h.jsx("span",{className:"truncate",children:v("clipboard.copyScreen")})]}),a&&h.jsxs("button",{type:"button",role:"menuitem",className:ne(Wl,Ql),onClick:()=>{g(),y()},children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:_e.cursor}),h.jsx("span",{className:"truncate",children:v("clipboard.paste")})]}),h.jsxs("button",{type:"button",role:"menuitem",className:ne(Wl,Ql),onClick:y,children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:_e.cursor}),h.jsx("span",{className:"truncate",children:v("clipboard.cancel")})]})]})})},bC={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 yC(){return typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1"}function vC(l){const n=M.useRef([]),[a,s]=M.useState({framesPerSec:0,bytesPerSec:0}),r=M.useCallback(f=>{const m=f-1e3,p=n.current;for(;p.length>0&&p[0].time<m;)p.shift()},[]);M.useEffect(()=>{if(!l)return;const f=setInterval(()=>{r(performance.now());let m=0;for(const p of n.current)m+=p.bytes;s({framesPerSec:n.current.length,bytesPerSec:m})},1e3);return()=>clearInterval(f)},[l,r]);const c=M.useCallback(f=>{const m=performance.now();n.current.push({time:m,bytes:f}),r(m)},[r]);return{metrics:a,record:c}}function xC(l){return l?`${l.kind} row ${l.row} cols ${l.startCol}-${l.endCol} caret ${l.caretCol}`:"none"}function wC(l){var s;const n=(s=l==null?void 0:l.canvas)==null?void 0:s.stats;if(!n)return`paint: ${(l==null?void 0:l.kind)??"-"} renderer
34
+ `;const a=n.lastInputToPaintMs!==null?`${n.lastInputToPaintMs.toFixed(1)}ms`:"-";return`paint: ${n.lastPaintMs.toFixed(2)}ms cells: ${n.lastCells} frames: ${n.frames} held: ${n.heldFrames} key→paint: ${a}
35
+ `}function SC(l){const n=(l==null?void 0:l.getTrace())??[];return n.length===0?"trace: -":`trace:
36
+ ${n.slice(-6).map(a=>` ${a.event}${a.count>1?` ×${a.count}`:""}`).join(`
37
+ `)}`}const CC=({debug:l,rttMs:n,metrics:a,rendererKind:s,predictiveEcho:r,predictor:c,field:f,renderer:m})=>{const p=c==null?void 0:c.getEchoSrttMs();return h.jsxs("pre",{"data-testid":"terminal-touch-debug",className:"pointer-events-none absolute left-1 top-1 z-50 border border-tui-border bg-tui-crust/90 px-2 py-1 font-mono text-tui-sm leading-relaxed text-tui-muted","aria-hidden":"true",children:[`gesture: ${l.state}
38
+ `,`deltaY: ${l.deltaY} lines: ${l.lines}
39
+ `,`viewportY: ${l.viewportY??"-"} focus: ${l.focused}
40
+ `,`buffer: ${l.bufferType??"-"} base: ${l.baseY??"-"} cursor: ${l.cursorY??"-"} scrollback: ${l.hasScrollback??"-"}
41
+ `,`scroll: ${l.scrollTop??"-"} / ${l.scrollHeight??"-"} (h ${l.clientHeight??"-"}) moved: ${l.moved}
42
+ `,`mode: ${l.scrollMode} calls: ${l.scrollCalls} lines: ${l.lastScrollLines??"-"} mouse: ${l.mouseTracking}
43
+ `,`event: ${l.lastInputEvent||"-"} pointer: ${l.pointerEvents} touch: ${l.touchEvents}
44
+ `,`rtt: ${n!==null?`${n}ms`:"-"} frames/s: ${a.framesPerSec} bytes/s: ${a.bytesPerSec} renderer: ${s??"-"}
45
+ `,`prediction: ${(c==null?void 0:c.getState())??"-"} mode: ${r} pending: ${(c==null?void 0:c.getVisiblePredictions().length)??0} srtt: ${p!=null?`${Math.round(p)}ms`:"-"}
46
+ `,`field: ${xC(f)} mismatches: ${(c==null?void 0:c.getMismatchCount())??0}
47
+ `,wC(m),SC(c)]})};function En(l){const n=M.useRef(l);return n.current=l,n}function TC(l){const n=En(l),{termRef:a,subscribeToPasteFileReady:s}=l,[r,c]=M.useState(!1),f=M.useCallback((v,w)=>{n.current.onPaste(),v.paste(w),n.current.addToast("success",n.current.t("clipboard.pasted"))},[n]),m=M.useCallback(()=>{const v=a.current;return v?n.current.isController?v:(n.current.warnViewerMode(),null):null},[a,n]),p=M.useCallback(async()=>{const v=m();if(v){try{const w=await hC();if(w.ok){await n.current.uploadImage(w.blob);return}}catch{}try{const w=await fC();if(w.ok){f(v,w.text);return}else if(w.reason==="empty"){n.current.addToast("info",n.current.t("clipboard.pasteUnavailable"));return}}catch{}c(!0)}},[m,f,n]),g=M.useCallback(v=>{const w=m();w&&f(w,v)},[m,f]),y=M.useCallback(v=>{m()&&n.current.uploadImage(v)},[m,n]);return M.useEffect(()=>s(v=>{const w=a.current;w&&f(w,v)}),[s,a,f]),{isPasteFallbackOpen:r,closePasteFallback:()=>c(!1),handlePaste:p,handleFallbackPasteSend:g,handleFallbackImageSend:y}}const lr=new Set(["│","┃","║","▐","▕","▏","▌"]),br=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),MC=new Set(["╭","┌","┏","╔"]),AC=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),EC=new Set(["╮","┐","┓","╗"]),kC=new Set(["╰","└","┗","╚"]),NC=new Set(["╯","┘","┛","╝"]),td=new Set(["─","━","═","╌","┄"]),Ly=new Set(["❯","›",">","!"]),Fg=new Set(["$","#","%",">","❯","›","➜","λ","»"]);function kn(l){return l===""||l===" "||l===" "}class _C{constructor(n){$(this,"cell");$(this,"top");$(this,"bottom");var a;this.screen=n,this.cell=(a=n.getNullCell)==null?void 0:a.call(n),this.top=n.baseY,this.bottom=n.baseY+n.rows-1}get cols(){return this.screen.cols}at(n,a){var s;if(!(n<this.top||n>this.bottom||a<0||a>=this.screen.cols))return(s=this.screen.getLine(n))==null?void 0:s.getCell(a,this.cell)}char(n,a){var s;return((s=this.at(n,a))==null?void 0:s.getChars())??""}dim(n,a){var s,r;return!!((r=(s=this.at(n,a))==null?void 0:s.isDim)!=null&&r.call(s))}text(n,a,s){var r;return n<this.top||n>this.bottom?"":((r=this.screen.getLine(n))==null?void 0:r.translateToString(!0,a,s))??""}isEdge(n,a){if(!lr.has(this.char(n,a)))return!1;const s=this.char(n-1,a),r=this.char(n+1,a);return lr.has(s)||br.has(s)||lr.has(r)||br.has(r)}blankOrDim(n,a,s){var r;for(let c=a;c<s;c++){const f=this.at(n,c);if(f&&!kn(f.getChars())&&!((r=f.isDim)!=null&&r.call(f)))return!1}return!0}}function LC(l,n,a){if(l.isEdge(n,a))return null;let s=0;for(let c=a-1;c>=0;c--)if(l.isEdge(n,c)){s=c+1;break}let r=l.cols;for(let c=a+1;c<l.cols;c++)if(l.isEdge(n,c)){r=c;break}return s<r?{start:s,end:r}:null}const kd=8,RC=12,Nd=2,Gg=1,jC=4,OC=3,DC=20,Yg=/-- INSERT --/,zC=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,HC=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,BC=/^\s*\d+[.)]\s/;function Pg(l,n,a){if(!td.has(l.char(n,a.start))||!td.has(l.char(n,a.end-1))||br.has(l.char(n,a.start-1)))return!1;const s=a.end-a.start;let r=0;for(let c=a.start;c<a.end;c++)if(td.has(l.char(n,c)))r++;else if(c-a.start-r>s*.1)return!1;return r>=s*.9}function da(l){return`${l.start}-${l.end}`}function Ry(l,n,a){if(a.start===0)return l.top;for(let s=n-1;s>=l.top;s--)if(AC.has(l.char(s,a.start-1)))return s;return l.top}function UC(l,n,a){const s=a.start-1,r=a.end,{row:c}=n;if(s<0||r>=l.cols)return null;const f=l.char(c,s);if(!lr.has(f)||l.char(c,r)!==f)return null;let m=c-1;for(;m>=l.top&&l.char(m,s)===f;)m--;let p=c+1;for(;p<=l.bottom&&l.char(p,s)===f;)p++;if(p-m-1>kd||!MC.has(l.char(m,s))||!EC.has(l.char(m,r))||!kC.has(l.char(p,s))||!NC.has(l.char(p,r))||l.dim(c,s))return null;const g=a.start+Gg,y=a.end-Gg;return n.col<g||n.col>=y?null:{kind:"frame",key:`frame:${da(a)}`,region:da(a),layout:`${m}`,row:c,caretCol:n.col,startCol:g,endCol:y,empty:m+2===p&&n.col===g&&l.blankOrDim(c,g,y),agentLike:!0,vimInsert:null,modal:!1,midWord:!1}}function KC(l,n,a){const{row:s}=n;let r=-1;for(let y=s-1;y>=Math.max(l.top,s-kd);y--)if(Pg(l,y,a)){r=y;break}if(r<0)return null;let c=-1;for(let y=s+1;y<=Math.min(l.bottom,s+kd);y++)if(Pg(l,y,a)){c=y;break}if(c<0)return null;const f=r+1;let m=-1;for(let y=a.start;y<Math.min(a.end,a.start+3);y++){const v=l.char(f,y);if(!kn(v)){Ly.has(v)&&kn(l.char(f,y+1))&&(m=y);break}}if(m<0||l.dim(f,m)||BC.test(l.text(f,m+1,a.end)))return null;for(let y=f+1;y<c;y++)for(let v=a.start;v<a.start+Nd;v++)if(!kn(l.char(y,v)))return null;let p="";for(let y=c+1;y<=Math.min(l.bottom,c+RC)&&!br.has(l.char(y,a.start-1));y++)p+=`${l.text(y,a.start,a.end)}
48
+ `;if(HC.test(p)||zC.test(p))return null;const g=s===f?m+2:a.start+Nd;return n.col<g||n.col>=a.end?null:{kind:"rule",key:`rule:${da(a)}:${Ry(l,r,a)}`,region:da(a),layout:`${r}`,row:s,caretCol:n.col,startCol:g,endCol:a.end,empty:c-r===2&&n.col===g&&l.blankOrDim(s,g,a.end),agentLike:!0,vimInsert:Yg.test(p),modal:Yg.test(p),midWord:!1}}function IC(l,n,a){if(n.hidden)return null;const{row:s,col:r}=n,c=FC(l,n,a);if(c!==void 0)return c;for(let f=r-1;f>=a.start;f--){if(l.char(s,f)!==">")continue;const m=l.text(s,a.start,f+1).trimStart();if(/^(?:[a-z]:\\.*|\\\\[^\\]+\\[^\\]+.*|PS\s+[a-z]:\\.*)>$/i.test(m))return ar(l,n,a,s,f+1,!1)}for(let f=r-2;f>=a.start;f--)if(!(!Fg.has(l.char(s,f))||!kn(l.char(s,f+1))))return l.dim(s,f)?null:ar(l,n,a,s,f+2,f===a.start);for(let f=s-1;f>=Math.max(l.top,s-OC);f--){let m=a.end-1;for(;m>=a.start&&kn(l.char(f,m));)m--;if(m>=a.end-1-jC&&Fg.has(l.char(f,m)))return l.dim(f,m)?null:ar(l,n,a,f,a.start,!1);if(m<a.end-1)return null}return null}function FC(l,n,a){const{row:s}=n,r=a.start+Nd,c=f=>kn(l.char(f,a.start))&&kn(l.char(f,a.start+1));if(c(s))for(let f=s-1;f>=Math.max(l.top,s-DC);f--){if(Ly.has(l.char(f,a.start))&&kn(l.char(f,a.start+1)))return l.dim(f,a.start)?null:ar(l,n,a,f,r,!0,r);if(!c(f)||l.blankOrDim(f,r,a.end))return}}function ar(l,n,a,s,r,c,f=a.start){const m=n.row===s?r:f;if(n.col<m||n.col>=a.end)return null;const p=a.end-2,g=n.row>s&&f>a.start&&n.col===m&&!kn(l.char(n.row-1,p));return{kind:"prompt",key:`prompt:${da(a)}:${Ry(l,s,a)}`,region:da(a),layout:`${s}`,row:n.row,caretCol:n.col,startCol:m,endCol:a.end,empty:n.row===s&&n.col===m&&l.blankOrDim(n.row,m,a.end),agentLike:c,vimInsert:null,modal:!1,midWord:g}}function GC(l,n){const a=new _C(l);if(n.row<a.top||n.row>a.bottom||n.col<0||n.col>=l.cols)return null;const s=LC(a,n.row,n.col);return s?UC(a,n,s)??KC(a,n,s)??IC(a,n,s):null}class YC{constructor(){$(this,"insertSeen",new Set)}detect(n,a){const s=GC(n,a);return!s||s.vimInsert===null?s:s.vimInsert?(this.insertSeen.add(s.region),s):this.insertSeen.has(s.region)?null:s}reset(){this.insertSeen.clear()}}class PC{constructor(n){$(this,"tracker",new YC);$(this,"cached");$(this,"lastComplete",null);$(this,"detect",()=>{var n,a;if((a=(n=this.options).isSynchronizing)!=null&&a.call(n))return this.lastComplete;if(this.cached===void 0){const s=this.options.getScreen(),r=this.options.getCursor();this.cached=s&&r?this.tracker.detect(s,r):null,this.lastComplete=this.cached}return this.cached});this.options=n}invalidate(){this.cached=void 0}reset(){this.tracker.reset(),this.cached=void 0,this.lastComplete=null}}const ea=4294967295;var We=(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))(We||{}),Qe=(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))(Qe||{}),st=(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))(st||{}),ji=(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))(ji||{}),ta=(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))(ta||{});function $C(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const yr={fg:0,bg:0,ext:0};function jy(l){return l.bg&268435456&&l.extended?l.extended.ext>>>0:0}function VC(l){return l>>>26&7}function qC(l){return l&67108863}function XC(l,n){const a=l.codePointAt(0)??0;return l.length>0&&String.fromCodePoint(a).length===l.length?{content:a|n<<22,combinedData:""}:{content:2097152|n<<22,combinedData:l}}function vr(l){const n=l;return!n||typeof n.fg!="number"||typeof n.bg!="number"?null:{fg:n.fg>>>0,bg:n.bg>>>0,ext:jy(n)}}const nr=new Map;function Oy(l){let n=nr.get(l);return n===void 0&&(n=`#${(l&Qe.RGB_MASK).toString(16).padStart(6,"0")}`,nr.size>4096&&nr.clear(),nr.set(l,n)),n}function Dy(l,n,a){var s;switch(l&Qe.CM_MASK){case Qe.CM_P16:case Qe.CM_P256:return((s=n.ansi[l&Qe.PCOLOR_MASK])==null?void 0:s.css)??a;case Qe.CM_RGB:return Oy(l&Qe.RGB_MASK);default:return a}}function bs(l,n,a,s){var v;const r=(l&st.INVERSE)!==0,c=r?n:l,f=r?l:n;let m;const p=c&Qe.CM_MASK;if(p===Qe.CM_P16||p===Qe.CM_P256){let w=c&Qe.PCOLOR_MASK;s&&l&st.BOLD&&w<8&&(w+=8),m=((v=a.ansi[w])==null?void 0:v.css)??a.foreground.css}else p===Qe.CM_RGB?m=Oy(c&Qe.RGB_MASK):m=r?a.background.css:a.foreground.css;const g=f&Qe.CM_MASK,y=g===Qe.CM_DEFAULT?r?a.foreground.css:a.background.css:Dy(f,a,a.background.css);return{fg:m,bg:y,bgIsDefault:!r&&g===Qe.CM_DEFAULT}}function sa(l){return(l&st.BOLD)!==0}function ys(l){return(l&ji.ITALIC)!==0}function Ms(l){return(l&ji.DIM)!==0}function ia(l){return(l&st.INVISIBLE)!==0}function zy(l){var a,s,r,c;const n=l._core;return!(n!=null&&n.screenElement)||!n.coreService||!((a=n.optionsService)!=null&&a.rawOptions)||!((s=n._bufferService)!=null&&s.buffer)||!n._charSizeService||!n._coreBrowserService||!((r=n._themeService)!=null&&r.colors)||typeof((c=n._renderService)==null?void 0:c.setRenderer)!="function"?null:n}class ZC{constructor(){$(this,"listeners",new Set);$(this,"event",n=>(this.listeners.add(n),{dispose:()=>this.listeners.delete(n)}))}fire(n){for(const a of[...this.listeners])a(n)}dispose(){this.listeners.clear()}}class WC{constructor(n){$(this,"provider",null);$(this,"core");$(this,"layer");$(this,"subscriptions",[]);var s;this.terminal=n,this.core=zy(n);const a=(s=this.core)==null?void 0:s.screenElement;this.layer=a?a.ownerDocument.createElement("div"):null,a&&this.layer&&(this.layer.setAttribute("aria-hidden","true"),Object.assign(this.layer.style,{position:"absolute",inset:"0",pointerEvents:"none",zIndex:"7",overflow:"hidden"}),a.append(this.layer),this.subscriptions.push(n.onRender(()=>this.invalidateOverlay()),n.onScroll(()=>this.invalidateOverlay())))}setOverlayProvider(n){this.provider=n,this.invalidateOverlay()}invalidateOverlay(){var y,v,w,x;const n=this.core,a=this.layer,s=n==null?void 0:n.screenElement;if(!n||!a||!s)return;a.replaceChildren(),delete s.dataset.predictiveEcho;const r=(y=this.provider)==null?void 0:y.call(this),c=(v=n._renderService.dimensions)==null?void 0:v.css.cell;if(!(r!=null&&r.cells.length)||!(c!=null&&c.width)||!c.height)return;const f=n.optionsService.rawOptions,m=n._themeService.colors,p=this.terminal.buffer.active,g=S=>{const T=S.row-p.viewportY;if(T<0||T>=this.terminal.rows)return null;const A=s.ownerDocument.createElement("span"),k=bs(S.style.fg,S.style.bg,m,f.drawBoldTextInBrightColors);return A.textContent=ia(S.style.fg)?" ":S.chars,Object.assign(A.style,{position:"absolute",left:`${S.col*c.width}px`,top:`${T*c.height}px`,width:`${S.width*c.width}px`,height:`${c.height}px`,lineHeight:`${c.height}px`,whiteSpace:"pre",color:Ms(S.style.bg)?`color-mix(in srgb, ${k.fg} 50%, ${k.bg})`:k.fg,backgroundColor:k.bg,fontFamily:f.fontFamily,fontSize:`${f.fontSize}px`,fontWeight:String(sa(S.style.fg)?f.fontWeightBold:f.fontWeight),fontStyle:ys(S.style.bg)?"italic":"normal",textDecoration:S.style.fg&st.UNDERLINE?"underline":"none"}),a.append(A),A};if(r.cursor){s.dataset.predictiveEcho="true";const S=s.ownerDocument.createElement("style");S.textContent=".xterm-screen[data-predictive-echo] .xterm-cursor { visibility: hidden; }",a.append(S);const T=p.baseY+p.cursorY,A=(w=p.getLine(T))==null?void 0:w.getCell(p.cursorX);g({row:T,col:p.cursorX,chars:(A==null?void 0:A.getChars())||" ",width:(A==null?void 0:A.getWidth())===2?2:1,style:vr(A)??yr})}for(const S of r.cells)g(S);if(r.cursor){const{row:S,col:T}=r.cursor,A=(x=p.getLine(S))==null?void 0:x.getCell(T),k=[...r.cells].reverse().find(N=>N.row===S&&N.col===T),E=g(k??{row:S,col:T,chars:(A==null?void 0:A.getChars())||" ",width:1,style:vr(A)??yr});if(E){const N=f.cursorStyle;if(!n._coreBrowserService.isFocused||N!=="block"){E.style.backgroundColor="transparent",E.textContent="",E.style.boxSizing="border-box";const B=N==="bar"?"borderLeft":N==="underline"?"borderBottom":"border";E.style[B]=`${N==="bar"&&f.cursorWidth||1}px solid ${m.cursor.css}`}else E.style.color=m.cursorAccent.css,E.style.backgroundColor=m.cursor.css}}}dispose(){var n,a;this.provider=null;for(const s of this.subscriptions)s.dispose();(n=this.layer)==null||n.remove(),(a=this.core)!=null&&a.screenElement&&delete this.core.screenElement.dataset.predictiveEcho}}class QC{constructor(n){$(this,"items",[]);$(this,"target",null);$(this,"domTarget",null);$(this,"provider",()=>this.paint());this.options=n}attach(n){var a;if(!n){const s=this.options.getTerminal();s&&(n=this.domTarget??(this.domTarget=new WC(s)))}this.target!==n&&((a=this.target)==null||a.setOverlayProvider(null),this.target=n,n==null||n.setOverlayProvider(this.provider))}sync(n){var a;n.length===0&&this.items.length===0||(this.items=n,(a=this.target)==null||a.invalidateOverlay())}clear(){var n;this.items.length!==0&&(this.items=[],(n=this.target)==null||n.invalidateOverlay())}hasItems(){return this.items.length>0}dispose(){var n,a;(n=this.target)==null||n.setOverlayProvider(null),this.target=null,(a=this.domTarget)==null||a.dispose(),this.domTarget=null,this.items=[]}paint(){var w,x;const n=this.options.getTerminal(),a=n==null?void 0:n.buffer.active;if(!n||!a)return null;const s=this.options.isCursorHidden(),r=a.baseY+a.cursorY,c=a.cursorX,f=_d(n,r,c),m=s&&!!f&&Hy(f);if(this.items.length===0){if(!m)return null;const S=((x=(w=a.getLine(r))==null?void 0:w.getCell(c))==null?void 0:x.getChars())??"";return{cells:[],paintedCaret:$g(r,c,S,f)}}const p=[];let g,y;for(const S of this.items)switch(S.kind){case"char":p.push({row:S.row,col:S.col,chars:S.char,width:S.width,style:S.style??eT(n,S.row,S.col)});break;case"erase":p.push({row:S.row,col:S.col,chars:" ",width:S.width,style:JC(S.style??_d(n,S.row,S.col)??yr)});break;case"mask":m&&S.row===r&&S.col===c&&p.push({row:S.row,col:S.col,chars:S.char,width:1,style:S.style??By(f)});break;case"caret":s?m&&(p.push({row:S.row,col:S.col,chars:S.char,width:1,style:f}),y=$g(S.row,S.col,S.char,f)):g={row:S.row,col:S.col};break}const v={cells:p};return g!==void 0&&(v.cursor=g),y&&(v.paintedCaret=y),v}}function $g(l,n,a,s){return{row:l,col:n,style:s,plain:{row:l,col:n,chars:a||" ",width:1,style:By(s)}}}function _d(l,n,a){var s;return a<0||a>=l.cols?null:vr((s=l.buffer.active.getLine(n))==null?void 0:s.getCell(a))}function Hy(l){return(l.fg&st.INVERSE)!==0||(l.bg&Qe.CM_MASK)!==Qe.CM_DEFAULT}function By(l){return{fg:l.fg&~st.INVERSE,bg:l.bg&~(Qe.CM_MASK|Qe.RGB_MASK),ext:l.ext}}function JC(l){return{fg:l.fg&st.INVERSE?l.fg&(st.INVERSE|Qe.CM_MASK|Qe.RGB_MASK):0,bg:l.bg&(Qe.CM_MASK|Qe.RGB_MASK),ext:0}}function eT(l,n,a){const s=_d(l,n,a-1);return s&&!Hy(s)&&!(s.bg&ji.DIM)?s:yr}const Uy="\x1B",tT=/^\x1b\[[IO]/,Ky=/^\x1b\[<(\d+);\d+;\d+[Mm]/,nT=/^\x1b\[M[\s\S]{3}/,iT=[/^\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\\/],lT=/^\x1b\[1;[2-8]R/;function Vg(l){if(lT.test(l))return 0;const n=tT.exec(l);if(n)return n[0].length;const a=Ky.exec(l);if(a){const s=Number(a[1]);return(s&32)!==0&&(s&3)===3&&(s&64)===0?a[0].length:0}for(const s of iT){const r=s.exec(l);if(r)return r[0].length}return 0}function Iy(l){if(!l.startsWith(Uy))return"keys";if(Ky.test(l)||nT.test(l)){let a=l;for(;a.length>0;){const s=Vg(a);if(s===0)return"pointer";a=a.slice(s)}return"passive"}let n=l;for(;n.length>0;){const a=Vg(n);if(a===0)return"keys";n=n.slice(a)}return"passive"}function aT(l){return l===Uy}function Qn(l){return l===""||l===" "?" ":l}function sT(l,n,a,s=64){var f;const r=l.buffer.active.getLine(n),c=[];for(let m=a-1;m>=0&&c.length<s;m--){const p=r==null?void 0:r.getCell(m);if(!p)break;((f=p.getWidth)==null?void 0:f.call(p))!==0&&c.unshift(Qn(p.getChars()))}return c}function oT(l,n){for(let a=Math.min(l.length,n.length);a>0;a--){let s=!0;for(let r=0;r<a&&s;r++)s=n[n.length-a+r]===Qn(l[r]);if(s)return a}return 0}function rT(l){const n=l.buffer.active;return{key:"legacy",row:n.baseY+n.cursorY,caretCol:n.cursorX,startCol:n.cursorX,endCol:l.cols,empty:!1,agentLike:!1}}function cT(l,{style:n,predictedCursor:a,field:s,runStartedEmpty:r,active:c}){var x,S,T,A,k;const f=l.map(E=>{const N={row:E.row,col:E.col,char:E.cancelled?" ":E.char,width:E.width,kind:E.cancelled?"erase":E.kind};return n&&(N.style=n),N}),m=l[l.length-1],p=a??{row:m.row,col:m.kind==="erase"||m.cancelled?m.col:m.col+m.width},g=(E,N)=>f.some(B=>B.row===E&&B.col<=N&&N<B.col+B.width),y=l.some(E=>E.kind==="char"&&!E.cancelled);if(c&&s&&r&&y&&s.agentLike&&p.row===s.row){const E=c.getLine(p.row);for(let N=p.col;N<s.endCol;N++){if(g(p.row,N)||Qn(((x=E==null?void 0:E.getCell(N))==null?void 0:x.getChars())??"")===" ")continue;const B={row:p.row,col:N,char:" ",width:1,kind:"erase"};n&&(B.style=n),f.push(B)}}if(c){const E={row:c.baseY+c.cursorY,col:c.cursorX};if(!g(E.row,E.col)&&(E.row!==p.row||E.col!==p.col)){const N=((T=(S=c.getLine(E.row))==null?void 0:S.getCell(E.col))==null?void 0:T.getChars())??"",B={row:E.row,col:E.col,char:Qn(N),width:1,kind:"mask"};n&&(B.style=n),f.push(B)}}const v=f.find(E=>E.row===p.row&&E.col===p.col&&E.kind!=="mask"),w=v?v.char:Qn(((k=(A=c==null?void 0:c.getLine(p.row))==null?void 0:A.getCell(p.col))==null?void 0:k.getChars())??"");return f.push({row:p.row,col:p.col,char:w,width:1,kind:"caret"}),f}const uT=[[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 Fy(l){if(l>=32&&l<=126)return 1;if(l<12288)return 0;for(const[n,a]of uT){if(l<n)return 0;if(l<=a)return 2}return 0}const Ld=["ctrl+b"],dT=new Map([["meta","alt"],["bs","backspace"],["minus","-"],["comma",","],["period","."],["slash","/"],["quote","'"],["double_quote",'"'],["double-quote",'"'],["semicolon",";"],["colon",":"],["percent","%"],["ampersand","&"],["backtick","`"]]),Gy=["ctrl","control"],Yy=["alt","option","meta"],fT=[...Gy,...Yy,"shift"];function qg(l){const n=l.split("+"),a=[];try{a.push(...cn(n.map(c=>dT.get(c)??c).join("+")))}catch(c){if(c instanceof pn)return[];throw c}if(a.length!==1)return[];const s=n.find(c=>!fT.includes(c)),r=s==="space"?" ":s;if((r==null?void 0:r.length)===1&&n.some(c=>Gy.includes(c))){const c=Hd(r);c!==r&&a.push(n.some(f=>Yy.includes(f))?`\x1B${c}`:c)}return a}class Xg{constructor(n){$(this,"sequences");const a=new Set(n.flatMap(qg));this.sequences=a.size>0?[...a]:[...new Set(Ld.flatMap(qg))]}startsAt(n,a){return this.sequences.some(s=>n.startsWith(s,a))}}function hT(l){let n,a=new Xg(Ld);return()=>{const s=l==null?void 0:l();return s!==n&&(n=s,a=new Xg(s??Ld)),a}}const Zg=8,mT=1500,pT=4e3,gT=20;class bT{constructor(n){$(this,"getTerminal");$(this,"getFieldOption");$(this,"charWidth");$(this,"herdrPrefix");$(this,"now");$(this,"textDecoder",new TextDecoder("utf-8"));$(this,"confidentKeys",new Set);$(this,"fieldStyles",new Map);$(this,"field",null);$(this,"runStartedEmpty",!1);$(this,"predictions",[]);$(this,"predictedCursor",null);$(this,"srtt",null);$(this,"isSuppressed",!1);$(this,"suppressCursor",null);$(this,"suppressSentAt",0);$(this,"inFlight",[]);$(this,"inFlightUnknown",!1);$(this,"runInFlight",[]);$(this,"probationRun",!1);$(this,"runSent",[]);$(this,"lastSentUndrawn",!1);$(this,"awaitingPrefixCommand",!1);$(this,"mismatches",0);$(this,"trace",[]);this.getTerminal=n.getTerminal,this.getFieldOption=n.getField,this.charWidth=n.charWidth,this.herdrPrefix=hT(n.getHerdrPrefixKeys),this.now=n.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}updateSuppression(n){if(!this.isSuppressed)return;if(this.predictions.some(s=>s.frozenFrom)){this.suppressSentAt=this.now();return}!!n&&!!this.suppressCursor&&(n.row!==this.suppressCursor.row||n.col!==this.suppressCursor.col)?this.liftSuppression():this.stillSuppressed()}reset(n,a){var c;this.predictions=[],this.predictedCursor=null;const s=typeof a=="boolean"?a:(a==null?void 0:a.suppress)??!0,r=typeof a=="object"&&(a==null?void 0:a.demote)===!0;if(this.note(`reset: ${n??"unspecified"}`),r){const f=this.field??((c=this.getFieldOption)==null?void 0:c.call(this))??null;f&&this.confidentKeys.delete(f.key)}if(this.forgetInFlight(),s){this.isSuppressed=!0,this.suppressSentAt=this.now();const f=this.getTerminal();f?this.suppressCursor={row:f.buffer.active.baseY+f.buffer.active.cursorY,col:f.buffer.active.cursorX}:this.suppressCursor=null}else this.isSuppressed=!1,this.suppressCursor=null}forgetConfidence(){this.confidentKeys.clear(),this.fieldStyles.clear(),this.field=null}getState(){return this.field&&this.confidentKeys.has(this.field.key)?"confident":"tentative"}getField(){return this.field}getMismatchCount(){return this.mismatches}getEchoSrttMs(){return this.srtt}getExpiryDelayMs(){if(this.predictions.length===0)return null;const n=Math.min(...this.predictions.map(a=>a.sentAt));return Math.max(1,n+this.predictionTimeout()-this.now()+1)}getTrace(){return this.trace}visiblePredictions(){const n=this.getState()==="confident";return this.predictions.filter(a=>a.frozenFrom?a.shownWhenFrozen:n&&!a.probation)}freeze(n,a={}){var p;const s=this.getTerminal(),r=s?{row:s.buffer.active.baseY+s.buffer.active.cursorY,col:s.buffer.active.cursorX}:null,c=this.getState()==="confident";this.predictions=this.predictions.filter(g=>!g.cancelled);for(const g of this.predictions)g.frozenFrom||(g.frozenFrom=r??{row:g.row,col:g.col},g.shownWhenFrozen=c&&!g.probation);const f=this.predictedCursor?{...this.predictedCursor}:r,m=this.inFlight.length>0||this.inFlightUnknown||this.lastSentUndrawn||this.probationRun&&this.runSent.length===0;if(this.predictedCursor=null,this.note(`freeze: ${n}${a.demote?" (demote)":""}`),a.demote){const g=this.field??((p=this.getFieldOption)==null?void 0:p.call(this))??null;g&&this.confidentKeys.delete(g.key)}this.isSuppressed=!0,this.suppressSentAt=this.now(),this.suppressCursor=f,this.forgetInFlight(),this.inFlightUnknown=m}forgetInFlight(){this.inFlight=[],this.inFlightUnknown=!1,this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.lastSentUndrawn=!1}suppressTimeout(){return Math.max(300,(this.srtt??300)*1.5)}predictionTimeout(){return Math.min(pT,Math.max(mT,(this.srtt??0)*4))}stillSuppressed(){return this.isSuppressed?this.now()-this.suppressSentAt>=this.suppressTimeout()?(this.liftSuppression(),!1):!0:!1}liftSuppression(){this.isSuppressed=!1,this.suppressCursor=null}assumedWidth(n){var s;const a=(s=this.charWidth)==null?void 0:s.call(this,n);return a===0||a===1||a===2?a:1}coveredByPrediction(n,a){return this.predictions.some(s=>(s.echoed||s.cancelled||s.kind==="erase"&&!s.frozenFrom)&&s.row===n&&s.col<=a&&a<s.col+s.width)}ensureField(n){if(this.predictedCursor&&this.field)return this.field;const a=this.getFieldOption?this.getFieldOption():rT(n);if(!a)return null;let s=a.caretCol,r=[],c=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){r=this.inFlight.slice(oT(this.inFlight,sT(n,a.row,s)));for(const f of r){const m=f.codePointAt(0)??0;s+=Fy(m)||this.assumedWidth(m)}c=r.length>0}return this.inFlight=[],this.inFlightUnknown=!1,this.field=a,this.runStartedEmpty=a.empty&&r.length===0,this.predictions=this.predictions.filter(f=>f.frozenFrom),this.predictedCursor={row:a.row,col:s},this.runInFlight=r,this.probationRun=c,this.runSent=[],a}confirm(n,a){if(this.updateSrtt(Math.max(0,this.now()-n.sentAt)),a&&!n.frozenFrom&&this.markConfident(a.key),n.probation&&n.kind==="char"){for(const s of this.predictions)s.probation=void 0;this.probationRun=!1,this.runInFlight=[],this.runSent=[]}}learnStyle(n,a){const s=vr(a);if(s)for(this.fieldStyles.delete(n),this.fieldStyles.set(n,s);this.fieldStyles.size>Zg;){const r=this.fieldStyles.keys().next().value;if(r===void 0)break;this.fieldStyles.delete(r)}}markConfident(n){for(this.confidentKeys.delete(n),this.confidentKeys.add(n);this.confidentKeys.size>Zg;){const a=this.confidentKeys.values().next().value;if(a===void 0)break;this.confidentKeys.delete(a)}}mismatch(n){this.mismatches++,this.note(`mismatch: ${n}`),this.predictions=[],this.predictedCursor=null,this.field&&this.confidentKeys.delete(this.field.key),this.isSuppressed=!1,this.suppressCursor=null}note(n){const a=this.trace[this.trace.length-1];if(a&&a.event===n){a.count++,a.at=this.now();return}this.trace.push({at:this.now(),event:n,count:1}),this.trace.length>gT&&this.trace.shift()}pruneExpired(){if(this.predictions.length===0)return;const n=this.now(),a=this.predictionTimeout(),s=this.predictions.filter(r=>n-r.sentAt<=a);s.length!==this.predictions.length&&(this.note("expired without an echo"),this.predictions=s,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(n){this.srtt===null?this.srtt=n:this.srtt=this.srtt*.8+n*.2}}const yT="?!#";class vT extends bT{handlePrintable(n,a,s){var S;const r=this.ensureField(s);if(!r||!this.predictedCursor)return this.note("refused: caret is not in an input field"),!1;const c=this.predictedCursor,f=this.predictions.every(T=>T.frozenFrom||T.cancelled)&&c.col===r.caretCol;if(r.agentLike&&r.empty&&f&&yT.includes(n))return this.freeze("agent mode switch"),!1;if(r.midWord&&f)return this.freeze("the word above may move down"),!1;if(c.col+a>r.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const m=(S=s.buffer.active.getLine(c.row))==null?void 0:S.getCell(c.col),p=[Qn(m?m.getChars():"")],g=this.predictions.findIndex(T=>T.kind==="erase"&&!T.frozenFrom&&T.row===c.row&&T.col===c.col);let y;g>=0&&([y]=this.predictions.splice(g,1),p.push(...y.before," "));for(const T of this.predictions)T.cancelled&&T.row===c.row&&T.col===c.col&&p.push(T.char);const v=s.buffer.active,w=v.baseY+v.cursorY,x=w>c.row||w===c.row&&v.cursorX>c.col;return this.predictions.push({row:c.row,col:c.col,char:n,width:a,kind:"char",before:p,sentAt:this.now(),replaces:y,probation:this.probationRun||void 0,behindCaret:x||void 0}),this.probationRun&&this.runSent.push(n),this.lastSentUndrawn=!1,c.col+=a,!0}skipUnpredictable(n,a,s){const r=this.ensureField(s),c=this.predictedCursor;if(!r||!c)return this.note("refused: caret is not in an input field"),!1;const f=this.assumedWidth(a);return c.col+f>r.endCol-1?(this.freeze("cursor would reach the edge of the field"),!1):(this.probationRun||(this.probationRun=!0,this.runSent=[]),this.runSent.push(n),this.lastSentUndrawn=!0,c.col+=f,this.note("width unknown: guessing"),!0)}handleBackspace(n){var s,r,c;let a;for(let f=this.predictions.length-1;f>=0&&!a;f--)this.predictions[f].cancelled||(a=this.predictions[f]);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 f=this.ensureField(n),m=this.predictedCursor;if(f&&m){const p=n.buffer.active.getLine(m.row),g=p==null?void 0:p.getCell(m.col-1),y=g&&((s=g.getWidth)==null?void 0:s.call(g))===0?2:1,v=m.col-y;let w=!0;for(let S=m.col;S<f.endCol&&w;S++)w=this.coveredByPrediction(m.row,S)||Qn(((r=p==null?void 0:p.getCell(S))==null?void 0:r.getChars())??"")===" ";const x=Qn(((c=p==null?void 0:p.getCell(v))==null?void 0:c.getChars())??"");if(v>=f.startCol&&w&&x!==" ")return this.predictions=this.predictions.filter(S=>!(S.echoed&&S.row===m.row&&S.col+S.width>v)),this.predictions.push({row:m.row,col:v,char:" ",width:y,kind:"erase",before:[x],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,m.col=v,!0}}return this.freeze("backspace into server content"),!1}}class xT extends vT{handleUserInput(n){var p;if(this.pruneExpired(),n.length===0)return;const a=this.textDecoder.decode(n,{stream:!1});if(!a)return;const s=Iy(a);if(s==="passive")return;if(s==="pointer"){this.freeze("pointer");return}if(this.awaitingPrefixCommand){this.awaitingPrefixCommand=!1,this.freeze("Herdr prefix command",{demote:!0});return}const r=this.herdrPrefix();if(aT(a)&&!r.startsAt(a,0)){const g=this.field??((p=this.getFieldOption)==null?void 0:p.call(this))??null;this.freeze("escape",{demote:(g==null?void 0:g.modal)!==!1});return}const c=this.getTerminal();if(!c){this.reset("terminal unavailable",!0);return}const f=Array.from(a);let m=0;for(let g=0;g<f.length;g++){const y=f[g],v=y.codePointAt(0);if(v===void 0)continue;const w=m;if(m+=y.length,r.startsAt(a,w)){this.awaitingPrefixCommand=!0,this.freeze("Herdr prefix",{demote:!0});return}if(v===27||v===9||v===10||v===13||v<32&&v!==8){this.freeze("control or escape sequence");return}if(v===8||v===127){if(!this.handleBackspace(c)){g<f.length-1&&(this.inFlightUnknown=!0);return}continue}if(this.stillSuppressed()){this.inFlight.push(y),this.note("refused: waiting for the caret to move");continue}const x=Fy(v);if(x===0){if(!this.skipUnpredictable(y,v,c)){g<f.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(y,x,c)){g<f.length-1&&(this.inFlightUnknown=!0);return}}}onServerOutput(){const n=this.getTerminal(),a=n?{row:n.buffer.active.baseY+n.buffer.active.cursorY,col:n.buffer.active.cursorX}:null;this.pruneExpired(),n&&a&&this.predictions.length>0&&this.settle(n,a),this.field&&this.getFieldOption&&!this.getFieldOption()&&(this.reset("left input field",{suppress:!1,demote:!0}),this.field=null),this.updateSuppression(a)}settle(n,a){var f,m;const s=this.field;if(this.getFieldOption){const p=this.getFieldOption();if(!p||p.key!==(s==null?void 0:s.key)){if(this.predictions.every(g=>g.frozenFrom||g.echoed||g.cancelled)){this.predictions=[],this.predictedCursor=null;return}this.mismatch("field changed");return}if(p.layout!==s.layout){this.predictions=[],this.predictedCursor=null,this.field=p,this.note("layout changed");return}}let r=[],c=!1;for(const p of this.predictions){if(p.cancelled){if(!c){const T=a.row>p.row||a.row===p.row&&a.col>=p.col+p.width;if(T||(p.behindCaret=void 0),p.passed&&!T)continue;T&&!p.behindCaret&&(p.passed=!0)}r.push(p),c=!0;continue}const g=(f=n.buffer.active.getLine(p.row))==null?void 0:f.getCell(p.col),y=Qn(g?g.getChars():""),v=p.kind==="char"?y===p.char&&(p.width===1||(((m=g==null?void 0:g.getWidth)==null?void 0:m.call(g))??2)===2):y===" ",w=p.before.includes(y);p.behindCaret&&(a.row<p.row||a.row===p.row&&a.col<=p.col)&&(p.behindCaret=void 0);const x=p.kind==="char"?(a.row>p.row||a.row===p.row&&a.col>=p.col+p.width)&&!(p.behindCaret&&w):a.row<p.row||a.row===p.row&&a.col<=p.col,S=p.kind==="char"&&y===p.char&&!v;if(c&&!p.frozenFrom){if(!v||w){r.push(p);continue}r=r.filter(T=>!T.cancelled),c=!1}if(!(p.echoed&&!v))if(v&&(x||!w)){if(p.echoed||this.confirm(p,s),x){p.kind==="char"&&s&&!p.frozenFrom&&this.learnStyle(s.key,g);continue}p.echoed=!0,r.push(p)}else if(p.frozenFrom){const T=p.frozenFrom,A=p.kind==="erase"||a.col>=T.col;!x&&a.row===T.row&&A?r.push(p):x&&p.probation&&(this.inFlightUnknown=!0)}else if(!x&&!S)r.push(p);else if(p.probation){this.note("probation guess dropped"),this.predictions.some(T=>!T.frozenFrom&&T.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(T=>T.frozenFrom),this.predictedCursor=null;return}else{this.mismatch("echo differs from prediction");return}}this.predictions=r,r.length===0&&(this.predictedCursor=null,this.probationRun&&(this.inFlightUnknown=!0))}getVisiblePredictions(){return this.pruneExpired(),this.visiblePredictions().filter(n=>!n.echoed&&!n.cancelled).map(n=>({row:n.row,col:n.col,char:n.char}))}getOverlayItems(){var a;this.pruneExpired();const n=this.visiblePredictions();return n.length===0?[]:cT(n,{style:this.field?this.fieldStyles.get(this.field.key):void 0,predictedCursor:this.predictedCursor,field:this.field,runStartedEmpty:this.runStartedEmpty,active:(a=this.getTerminal())==null?void 0:a.buffer.active})}}const wT=25,ST=2026,CT=1e3;function TT(l,n=()=>performance.now()){let a=!1,s=null;const r=new Set,c=y=>(r.add(y),{dispose:()=>void r.delete(y)}),f=()=>{a=!1,s=null},m=l.parser;if(!m||typeof m.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:c,reset:f,dispose:()=>{}};const p=y=>v=>{for(const w of v.flat())if(w===wT&&(a=!y),w===ST){const x=!y&&s!==null;if(s=y?n():null,x)for(const S of[...r])S()}return!1},g=[m.registerCsiHandler({prefix:"?",final:"h"},p(!0)),m.registerCsiHandler({prefix:"?",final:"l"},p(!1)),m.registerCsiHandler({intermediates:"!",final:"p"},()=>(f(),!1))];return typeof m.registerEscHandler=="function"&&g.push(m.registerEscHandler({final:"c"},()=>(f(),!1))),{isCursorHidden:()=>a,isSynchronizing:()=>s!==null&&n()-s<CT,onSyncEnd:c,reset:f,dispose:()=>{for(const y of g)y.dispose();r.clear()}}}const MT=40;function AT(l,n){return l==="off"?!1:l==="always"?!0:n!==null&&n>MT}function ET(l,n,a){var p;const s=TT(l),r=new PC({getScreen:()=>{const g=n();if(!g)return null;const y=g.buffer.active;return{cols:g.cols,rows:g.rows,baseY:y.baseY,getLine:v=>y.getLine(v),getNullCell:typeof y.getNullCell=="function"?()=>y.getNullCell():void 0}},getCursor:()=>{var y;const g=(y=n())==null?void 0:y.buffer.active;return g?{row:g.baseY+g.cursorY,col:g.cursorX,hidden:s.isCursorHidden()}:null},isSynchronizing:s.isSynchronizing}),c=(p=l._core)==null?void 0:p.unicodeService,f=new xT({getTerminal:n,getField:r.detect,getHerdrPrefixKeys:a,charWidth:typeof(c==null?void 0:c.wcwidth)=="function"?g=>c.wcwidth(g):void 0}),m=new QC({getTerminal:n,isCursorHidden:()=>s.isCursorHidden()});return{screenState:s,fieldProbe:r,predictor:f,overlay:m}}function kT({termRef:l,rendererRef:n,mode:a,connectionState:s,observeKeyInput:r,herdrPrefixKeys:c}){const f=M.useRef(null),m=M.useRef(null),p=M.useRef(null),g=M.useRef(null),y=En(a),v=En(c),w=M.useCallback(()=>{g.current!==null&&clearTimeout(g.current),g.current=null;const E=f.current,N=m.current;if(!E||!N)return;const B=E.getOverlayItems(),L=E.getExpiryDelayMs();if(L!==null&&(g.current=setTimeout(w,L)),!AT(y.current,E.getEchoSrttMs())){N.clear();return}N.sync(B)},[y]),x=M.useCallback(E=>{var N,B,L,D;(N=f.current)==null||N.reset(E),(B=f.current)==null||B.forgetConfidence(),(L=p.current)==null||L.reset(),(D=m.current)==null||D.clear()},[]),S=M.useCallback(E=>{var N,B;(N=f.current)==null||N.reset(E),(B=m.current)==null||B.clear()},[]),T=M.useCallback(E=>{var N,B,L;(N=f.current)==null||N.handleUserInput(E),w(),(L=(B=n.current)==null?void 0:B.canvas)==null||L.markInput()},[w,n]),A=M.useCallback(E=>{const N=ET(E,()=>l.current,()=>v.current);return p.current=N.fieldProbe,f.current=N.predictor,m.current=N.overlay,N},[l,v]),k=M.useCallback(()=>{var E;g.current!==null&&clearTimeout(g.current),g.current=null,(E=m.current)==null||E.dispose(),m.current=null,f.current=null,p.current=null},[]);return M.useEffect(()=>()=>{g.current!==null&&clearTimeout(g.current)},[]),M.useEffect(()=>r(T),[r,T]),M.useEffect(()=>{w()},[a,w]),M.useEffect(()=>{x("connectionState")},[s,x]),{predictorRef:f,overlayRef:m,fieldProbeRef:p,attach:A,detach:k,sync:w,forget:x,discard:S,onUserInput:T}}const NT=20,_T=6,LT=500,RT=300,fa=13,Py=.602,$y=1.3;function Wn(l,n){return Number.isFinite(l)&&l>0?l:n}function Wg(l,n,a){return Math.min(a,Math.max(n,l))}function Vy(l){const{width:n,height:a,cellWidth:s,cellHeight:r,minCols:c=NT,minRows:f=_T,maxCols:m=LT,maxRows:p=RT}=l,g=Wn(s,fa*Py),y=Wn(r,fa*$y);return{cols:Wg(Math.floor(Wn(n,0)/g),c,m),rows:Wg(Math.floor(Wn(a,0)/y),f,p)}}function rl(l,n=fa){var s,r,c;if(l)try{const f=l._core,m=(c=(r=(s=f==null?void 0:f._renderService)==null?void 0:s.dimensions)==null?void 0:r.css)==null?void 0:c.cell;if(m!=null&&m.width&&m.width>0&&m.height&&m.height>0)return{cellWidth:m.width,cellHeight:m.height,measured:!0}}catch{}const a=Wn(n,fa);return{cellWidth:Math.round(a*Py*100)/100,cellHeight:Math.round(a*$y*100)/100,measured:!1}}function jT(l){var s;const n=(s=l==null?void 0:l.querySelector)==null?void 0:s.call(l,".xterm-viewport");if(!n)return 0;const a=(n.offsetWidth||0)-(n.clientWidth||0);return Number.isFinite(a)&&a>0?a:0}function Rd(l,n,a){if(!l)return{width:n,height:a};let s=0,r=0;if(typeof l.getBoundingClientRect=="function"){const c=l.getBoundingClientRect();s=(c==null?void 0:c.width)||0,r=(c==null?void 0:c.height)||0}return{width:Wn(s,Wn(l.clientWidth,n)),height:Wn(r,Wn(l.clientHeight,a))}}function qy(l,n,a,s){const r=Number.isFinite(s)&&s>.01?s:1;return{clientX:a.left+(l-a.left)/r,clientY:a.top+(n-a.top)/r}}function Qg(l,n){const a=typeof window<"u"?window:void 0,s=a&&typeof a.devicePixelRatio=="number"&&a.devicePixelRatio>0?a.devicePixelRatio:1,r=a!=null&&a.visualViewport&&typeof a.visualViewport.scale=="number"&&a.visualViewport.scale>0?a.visualViewport.scale:1,c=Math.max(0,l.width),f=Math.max(0,l.height),m=Math.round(c*s*100)/100,p=Math.round(f*s*100)/100;return{dpr:s,scale:r,cssWidth:c,cssHeight:f,physicalWidth:m,physicalHeight:p}}function OT(l){const{lastSnapshot:n,currentSnapshot:a,physicalTolerancePx:s=6}=l;if(!n)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const r=Math.abs(a.scale-n.scale)>.01,c=Math.abs(a.scale-1)>.01;if(r||c)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(a.dpr-n.dpr)>.01){const g=Math.abs(a.physicalWidth-n.physicalWidth),y=Math.abs(a.physicalHeight-n.physicalHeight);if(g<=s&&y<=s)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const m=Math.abs(a.cssWidth-n.cssWidth),p=Math.abs(a.cssHeight-n.cssHeight);return m<1&&p<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const DT=250;function zT({termRef:l,containerRef:n,frameRef:a,surfaceRef:s,currentScaleRef:r,rendererRef:c,initialBannerWrittenRef:f,isActiveRef:m,sendResize:p,onResized:g}){const y=En(p),v=En(g),w=M.useRef({cols:0,rows:0}),x=M.useRef(null),S=M.useRef(null),T=M.useRef(null),A=M.useRef(null),k=M.useRef({width:0,height:0}),E=M.useRef(null),N=M.useRef(!1),B=M.useCallback(()=>{const ie=x.current;x.current=null,ie&&(ie.cols===w.current.cols&&ie.rows===w.current.rows||(w.current=ie,y.current(ie.cols,ie.rows),v.current()))},[y,v]),L=M.useCallback((ie,re,ce=!1)=>{if(!(!Number.isFinite(ie)||!Number.isFinite(re)||ie<=0||re<=0)&&!(ie===w.current.cols&&re===w.current.rows)){if(x.current={cols:ie,rows:re},ce){S.current&&clearTimeout(S.current),S.current=null,B();return}S.current||(S.current=setTimeout(()=>{S.current=null,B()},DT))}},[B]),D=M.useCallback((ie=!1,re=!1)=>{var pe;const ce=l.current,O=n.current,J=s.current,I=a.current;if(!ce||!O||!J||!I)return;const le=Rd(O,oa(),pd());if(le.width<=0||le.height<=0)return;I.style.width="100%",I.style.height="100%",J.style.width="100%",J.style.height="100%",J.style.transform="none",J.style.transformOrigin="top left",r.current=1;const P=Qg(le),fe=OT({lastSnapshot:E.current,currentSnapshot:P});if(fe.isVisualZoom&&!ie){E.current=P;try{ce.refresh(0,Math.max(0,ce.rows-1))}catch{}return}if(fe.shouldIgnore&&!ie)return;E.current=P;const ve=rl(ce,fa),X=Vy({width:le.width-jT(J),height:le.height,cellWidth:ve.cellWidth,cellHeight:ve.cellHeight}),ue=Math.abs(le.width-k.current.width)>1||Math.abs(le.height-k.current.height)>1;if(ce.cols!==X.cols||ce.rows!==X.rows)try{ce.resize(X.cols,X.rows)}catch(se){console.debug("Error resizing terminal grid:",se)}f.current&&!N.current&&(ue||ce.cols!==X.cols||ce.rows!==X.rows)&&(N.current=!0,(pe=c.current)==null||pe.verify());const oe=X.cols!==w.current.cols||X.rows!==w.current.rows;m.current&&(ue||ie||oe)&&(k.current={width:le.width,height:le.height},L(X.cols,X.rows,re));try{ce.refresh(0,Math.max(0,ce.rows-1))}catch{}},[l,n,s,a,r,c,f,m,L]),R=M.useRef(D);R.current=D;const z=M.useCallback(()=>{if(T.current===null){if(typeof requestAnimationFrame!="function"){R.current();return}T.current=requestAnimationFrame(()=>{T.current=null,R.current()})}},[]),K=M.useCallback((ie=30)=>{A.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(A.current),A.current=null);let re=0;const ce=()=>{A.current=null,re++;const O=re>=ie;R.current(!0),!O&&re<2&&typeof requestAnimationFrame=="function"&&(A.current=requestAnimationFrame(ce))};typeof requestAnimationFrame=="function"?A.current=requestAnimationFrame(ce):ce()},[]),V=M.useCallback(()=>R.current(!0,!0),[]),te=M.useCallback(ie=>{k.current={width:ie.width,height:ie.height},E.current=Qg(ie)},[]),Z=M.useCallback(()=>{S.current&&(clearTimeout(S.current),S.current=null),T.current!==null&&(cancelAnimationFrame(T.current),T.current=null),A.current!==null&&(cancelAnimationFrame(A.current),A.current=null)},[]);return{requestFit:z,scheduleBoundedFit:K,fitNow:V,seedFit:te,cancelPendingFits:Z}}const HT=" ()[]{}'\"\\`";function BT(l,n,a,s=1){var A,k;if(!((A=n==null?void 0:n.buffer)!=null&&A.active)||n.cols<=0||n.rows<=0)return null;const r=a||((k=n.element)==null?void 0:k.querySelector(".xterm-screen"))||n.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const c=r.getBoundingClientRect(),f=qy(l.clientX,l.clientY,c,s),m=rl(n);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,c.width||n.cols*m.cellWidth),g=Math.max(1,c.height||n.rows*m.cellHeight),y=Math.max(0,Math.min(p-1,f.clientX-c.left)),v=Math.max(0,Math.min(g-1,f.clientY-c.top)),w=Math.max(0,Math.min(n.cols-1,Math.floor(y/m.cellWidth))),x=Math.max(0,Math.min(n.rows-1,Math.floor(v/m.cellHeight))),T=(n.buffer.active.viewportY??0)+x;return{col:w,bufferRow:T}}function UT(l,n){if(!l||l.length===0||l==="\0")return!0;for(const a of l)if(a==="\0"||/\s/.test(a)||n.includes(a))return!0;return!1}function KT(l,n,a){var w,x;if(!((w=l==null?void 0:l.buffer)!=null&&w.active)||n<0||n>=l.cols)return null;const s=l.buffer.active.getLine(a);if(!s)return null;const r=((x=l.options)==null?void 0:x.wordSeparator)??HT,c=new Array(l.cols).fill(null),f=Math.min(l.cols,s.length);let m=0;for(;m<f;){const S=s.getCell(m);if(!S){c[m]={startCol:m,endCol:m+1,isSeparator:!0},m++;continue}const T=S.getWidth();if(T===0){c[m]||(c[m]={startCol:m,endCol:m+1,isSeparator:!0}),m++;continue}const A=S.getChars(),k=UT(A,r),E=Math.min(l.cols,m+T),N={startCol:m,endCol:E,isSeparator:k};for(let B=m;B<E;B++)c[B]=N;m+=Math.max(1,T)}for(let S=f;S<l.cols;S++)c[S]||(c[S]={startCol:S,endCol:S+1,isSeparator:!0});const p=c[n];if(!p||p.isSeparator)return null;let g=p.startCol;for(;g>0;){const S=c[g-1];if(S&&!S.isSeparator)g=S.startCol;else break}let y=p.endCol;for(;y<l.cols;){const S=c[y];if(S&&!S.isSeparator)y=S.endCol;else break}const v=y-g;return v<=0?null:{startCol:g,length:v}}function IT(l){var c;if(!((c=l==null?void 0:l.buffer)!=null&&c.active))return"";const n=l.buffer.active,a=n.viewportY??0,s=l.rows,r=[];for(let f=0;f<s;f++){const m=n.getLine(a+f);r.push(m?m.translateToString(!0):"")}for(;r.length>0&&r[r.length-1]==="";)r.pop();return r.join(`
49
+ `)}const Jg=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),FT=.6,GT=new Set(["─","━","═","┄","┅","┈","┉","-"]),YT=.8;function nd(l,n){if(!l)return!1;let a=0;const s=Math.min(n,l.length);for(let r=0;r<s;r++){const c=l.getCell(r);if(c){const f=c.getChars();f&&GT.has(f)&&a++}}return a>=Math.max(5,Math.min(n*.25,10))}function id(l,n,a){var x;if(!((x=l==null?void 0:l.buffer)!=null&&x.active)||l.cols<=0)return{startCol:0,endCol:0};const s=l.buffer.active,r=l.cols,c=Math.max(0,Math.min(r-1,n)),f=s.viewportY??0,m=l.rows>0?l.rows:1,p=new Int32Array(r);let g=0;for(let S=0;S<m;S++){const T=s.getLine(f+S);if(g++,!T)continue;const A=Math.min(r,T.length);for(let k=0;k<A;k++){const E=T.getCell(k);if(E){const N=E.getChars();N&&Jg.has(N)&&p[k]++}}}if(g===0)return{startCol:0,endCol:r-1};const y=g*FT,v=S=>p[S]>=y;let w=!1;for(let S=0;S<r;S++)if(v(S)){w=!0;break}if(w){if(v(c))return{startCol:c,endCol:c};let S=-1;for(let A=c-1;A>=0;A--)if(v(A)){S=A;break}let T=r;for(let A=c+1;A<r;A++)if(v(A)){T=A;break}return{startCol:S+1,endCol:T-1}}if(a!==void 0){const S=Math.max(f,Math.min(f+m-1,a)),T=s.getLine(S);if(!nd(T,r)){let A=f;for(let N=S-1;N>=f;N--)if(nd(s.getLine(N),r)){A=N+1;break}let k=f+m-1;for(let N=S+1;N<=f+m-1;N++)if(nd(s.getLine(N),r)){k=N-1;break}const E=k-A+1;if(E>=2){const N=new Int32Array(r);for(let R=A;R<=k;R++){const z=s.getLine(R);if(!z)continue;const K=Math.min(r,z.length);for(let V=0;V<K;V++){const te=z.getCell(V);if(te){const Z=te.getChars();Z&&Jg.has(Z)&&N[V]++}}}const B=E*YT,L=R=>N[R]>=B;let D=!1;for(let R=0;R<r;R++)if(L(R)){D=!0;break}if(D){if(L(c))return{startCol:c,endCol:c};let R=-1;for(let K=c-1;K>=0;K--)if(L(K)){R=K;break}let z=r;for(let K=c+1;K<r;K++)if(L(K)){z=K;break}return{startCol:R+1,endCol:z-1}}}}}return{startCol:0,endCol:r-1}}function eb(l,n){const a=Math.min(l.startCol,l.endCol),s=Math.max(l.startCol,l.endCol),r=Math.min(l.startRow,l.endRow),c=Math.max(l.startRow,l.endRow);return{startCol:Math.max(n.startCol,Math.min(n.endCol,a)),endCol:Math.max(n.startCol,Math.min(n.endCol,s)),startRow:r,endRow:c}}function tb(l,n){var g;if(!((g=l==null?void 0:l.buffer)!=null&&g.active)||l.cols<=0)return"";const a=l.buffer.active,s=l.cols,r=Math.min(n.startRow,n.endRow),c=Math.max(n.startRow,n.endRow),f=Math.max(0,Math.min(n.startCol,n.endCol)),m=Math.min(s-1,Math.max(n.startCol,n.endCol));if(f>m||r>c)return"";const p=[];for(let y=r;y<=c;y++){const v=a.getLine(y);if(!v){p.push("");continue}const w=v.translateToString(!0,f,m+1);p.push(w.trimEnd())}return p.join(`
50
+ `)}function PT({termRef:l,surfaceRef:n,mainRef:a,currentScaleRef:s,addToast:r,t:c}){const f=En(r),m=En(c),[p,g]=M.useState(null),y=M.useRef(null);y.current=p;const[v,w]=M.useState(null),x=M.useRef(null);x.current=v;const[S,T]=M.useState(""),A=M.useRef("");A.current=S;const[k,E]=M.useState(!1),N=M.useRef(!1);N.current=k;const B=M.useRef(!1),[L,D]=M.useState(0),R=M.useRef(0),z=M.useRef(null),K=M.useRef(null),V=M.useRef(null),te=M.useRef(null),Z=M.useCallback(se=>{var we;const xe=l.current;if(!xe)return null;const ae=((we=n.current)==null?void 0:we.querySelector(".xterm-screen"))||n.current;return BT(se,xe,ae,s.current)},[l,n,s]),ie=M.useCallback(se=>{const xe=l.current,ae=Z(se);return!xe||!ae?null:uC(xe,ae.col,ae.bufferRow)},[l,Z]),re=M.useCallback((se,xe)=>{w(xe),T(tb(se,xe)),E(!0)},[]),ce=M.useCallback(()=>{w(null),T(""),E(!1),V.current=null,te.current=null},[]),O=M.useCallback(()=>{g(null),y.current=null,w(null),x.current=null,T(""),A.current="",E(!1),z.current=null,K.current=null},[]),J=M.useCallback(se=>{const xe=l.current;if(!xe)return;const ae=Z(se),we=ae?KT(xe,ae.col,ae.bufferRow):null;if(ae&&we){V.current=ae;const ke=id(xe,ae.col,ae.bufferRow);te.current=ke;const Ie={startCol:we.startCol,endCol:we.startCol+we.length-1,startRow:ae.bufferRow,endRow:ae.bufferRow};re(xe,eb(Ie,ke))}else ce();z.current=se,K.current=null},[l,Z,re,ce]),I=M.useCallback(se=>{const xe=l.current,ae=V.current;if(!xe||!ae)return;const we=Z(se);if(!we)return;K.current=se;const ke=te.current??id(xe,ae.col,ae.bufferRow),Ie={startCol:Math.min(ae.col,we.col),endCol:Math.max(ae.col,we.col),startRow:Math.min(ae.bufferRow,we.bufferRow),endRow:Math.max(ae.bufferRow,we.bufferRow)};re(xe,eb(Ie,ke))},[l,Z,re]),le=M.useCallback(()=>{const se=K.current??z.current;if(!se||!a.current)return;const xe=a.current.getBoundingClientRect(),ae=se.clientX-xe.left,we=se.clientY-xe.top,ke=ie(se);g({x:ae,y:we,link:ke}),y.current={x:ae,y:we,link:ke}},[a,ie]),P=M.useCallback(async se=>{await qd(se)==="failed"?f.current("error",m.current("clipboard.copyFailed")):f.current("success",m.current("clipboard.copied"))},[f,m]),fe=M.useCallback(async()=>{const se=A.current;se&&await P(se)},[P]),ve=M.useCallback(async()=>{var ke,Ie,tt,Je;const se=l.current,xe=(ke=se==null?void 0:se.buffer)==null?void 0:ke.active;if(!se||!xe)return;const ae=((Ie=x.current)==null?void 0:Ie.startRow)??((tt=V.current)==null?void 0:tt.bufferRow)??xe.viewportY,we=te.current??id(se,((Je=V.current)==null?void 0:Je.col)??0,ae);await P(tb(se,{startCol:we.startCol,endCol:we.endCol,startRow:ae,endRow:ae}))},[l,P]),X=M.useCallback(async()=>{const se=l.current;se&&await P(IT(se))},[l,P]),ue=M.useCallback((se,xe,ae)=>{const we=se.buffer.active.viewportY??0;we!==R.current&&(R.current=we,D(we));const ke=x.current;if(ke&&N.current){const Ie=ke.startRow-we,tt=ke.endRow-we;B.current&&xe<=tt&&ae>=Ie&&(E(!1),B.current=!1)}else B.current=!1},[]),oe=M.useCallback(se=>{const xe=se.buffer.active.viewportY??0;R.current=xe,D(xe)},[]),pe=M.useCallback(()=>{B.current=!0},[]);return{selectionMenu:p,selectionRect:v,selectionSnapshot:S,isHighlightVisible:k,viewportY:L,hasOpenMenu:()=>y.current!==null,hasSelectionExtension:()=>K.current!==null,clearSelection:O,handleLongPress:J,handleSelectionExtend:I,openMenuAtGesture:le,handleCopySelection:fe,handleCopyLine:ve,handleCopyScreen:X,onTerminalRender:ue,onTerminalScroll:oe,onTerminalContentChanged:pe}}const $T=({term:l,surface:n,main:a,rect:s,viewportY:r})=>{if(!l||!a)return null;const c=rl(l);if(c.cellWidth<=0||c.cellHeight<=0)return null;const f=(n==null?void 0:n.querySelector(".xterm-screen"))||n;if(!f)return null;const m=f.getBoundingClientRect(),p=a.getBoundingClientRect(),g=s.startRow-r;if(s.endRow-r<0||g>=l.rows)return null;const v=m.top-p.top+g*c.cellHeight,w=m.left-p.left+s.startCol*c.cellWidth,x=(s.endCol-s.startCol+1)*c.cellWidth,S=(s.endRow-s.startRow+1)*c.cellHeight;return h.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${v}px`,left:`${w}px`,width:`${x}px`,height:`${S}px`}})},VT=600;var Zn=(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))(Zn||{});function nb(l){switch(l){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function Xy(l,n,a,s,r,c,{css:f,dpr:m,cursorWidth:p}){switch(l.save(),l.fillStyle=f,l.strokeStyle=f,c){case 2:l.fillRect(a,s,Math.max(1,Math.round(p*m)),n.cell.height);break;case 3:l.fillRect(a,s+n.cell.height-Math.max(1,Math.round(m))-1,r,Math.max(1,Math.round(m)));break;case 4:{const g=Math.max(1,Math.round(m));l.lineWidth=g,l.strokeRect(a+g/2,s+g/2,r-g,n.cell.height-g);break}}l.restore()}function qT(l,n,a,s,r){let c,f;if(a&&a.cursor!==void 0){if(a.cursor===null)return null;c=a.cursor.row,f=a.cursor.col}else{if(!l.coreService.isCursorInitialized||l.coreService.isCursorHidden)return null;c=n.ybase+n.y,f=n.x}const m=c-n.ydisp;if(m<0||m>=s.rows)return null;const p=Math.min(Math.max(0,f),s.cols-1),g=l.optionsService.rawOptions;let y;if(l._coreBrowserService.isFocused)r?y=0:y=nb(g.cursorStyle||"block");else{const v=g.cursorInactiveStyle??"outline";y=v==="none"?0:nb(v)}return y===0?null:{x:p,y:m,shape:y}}class XT{constructor(n){$(this,"timer",null);$(this,"visible",!0);this.onToggle=n}get running(){return this.timer!==null}get hidden(){return this.timer!==null&&!this.visible}start(){this.stop(),this.timer=setInterval(()=>{this.visible=!this.visible,this.onToggle()},VT)}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.visible=!0}}const ib=80,ZT=16;class WT{constructor(){$(this,"last",null);$(this,"fromX",0);$(this,"toX",0);$(this,"start",0);$(this,"sliding",!1)}update(n,a,s){const r=this.last;if(this.last=n&&{x:n.x,y:n.y},!n)return this.sliding=!1,null;if(!r||r.x!==n.x||r.y!==n.y){const c=r!==null&&r.y===n.y&&n.y===a&&Math.abs(n.x-r.x)<=ZT;this.fromX=!c||!r?n.x:this.sliding?this.x(s):r.x,this.toX=n.x,this.start=s,this.sliding=c}return this.sliding?s-this.start>=ib?(this.sliding=!1,null):{x:this.x(s),y:n.y,shape:n.shape,css:n.css}:null}x(n){const a=Math.min(1,Math.max(0,(n-this.start)/ib));return this.fromX+(this.toX-this.fromX)*(1-(1-a)**3)}}function QT(l,n,a,s){if(l)return{x:l.x,y:l.y,shape:l.shape,css:s.cursor.css};const r=n==null?void 0:n.paintedCaret;if(!r)return null;const{bg:c}=bs(r.style.fg,r.style.bg,s,!0);return{x:r.col,y:r.row-a,shape:Zn.BLOCK,css:c,plain:r.plain}}const JT=120,eM=16,tM=96,nM=32,iM=64;function hs(l,n){const a=l.content[n];if(!(a>>>We.WIDTH_SHIFT)||ia(l.fg[n]))return!1;if(a&We.IS_COMBINED_MASK)return l.combined[n]!=="";const s=a&We.CODEPOINT_MASK;return s!==0&&s!==32}function lb(l,n){return{content:l.content[n],fg:l.fg[n],bg:l.bg[n],combined:l.combined[n]}}class lM{constructor(){$(this,"fades",new Map)}get size(){return this.fades.size}clear(){this.fades.clear()}rows(n){const a=new Set;for(const s of this.fades.keys())a.add(Math.floor(s/n));return a}begin(n,a,s,r,c,f){const m=n*a,p=Math.max(0,s.start),g=Math.min(a,s.end);let y=0;for(let w=p;w<g;w++){const x=m+w;if(r.content[x]===ea)return;const S=hs(r,x),T=hs(c,w);if(S&&T){if(r.content[x]!==c.content[w]||r.combined[x]!==c.combined[w])return}else(S||T)&&y++}if(y===0||y>nM)return;let v=0;for(let w=p;w<g;w++){const x=m+w,S=hs(r,x),T=hs(c,w);if(T&&!S){const A=Math.min(v++*eM,tM);this.fades.set(x,{...lb(c,w),start:f+A,out:!1})}else S&&!T&&this.fades.set(x,{...lb(r,x),start:f,out:!0})}}at(n,a,s,r){const c=this.fades.get(n);if(!c)return null;const f=c.out?!hs(s,a):s.content[a]===c.content&&s.combined[a]===c.combined,m=(r-c.start)/JT;if(!f||m>=1)return this.fades.delete(n),null;const p=Math.max(0,m);return c.out?{alpha:(1-p)**2,gone:c}:{alpha:1-(1-p)**3}}}function aM(l,n,{gone:a,alpha:s},r,c){if(!a)return;const f=a.content&We.IS_COMBINED_MASK?a.combined:String.fromCodePoint(a.content&We.CODEPOINT_MASK),m=n.get({chars:f,bold:sa(a.fg),italic:ys(a.bg),dim:Ms(a.bg),fg:r.fg,bg:r.bg,cells:c.cells});m&&(l.globalAlpha=s,l.drawImage(m.source,m.x,m.y,m.width,m.height,c.px,c.py,c.width,c.height),l.globalAlpha=1)}/**
51
+ * Box drawing, block element and Powerline glyphs, drawn as shapes rather than
52
+ * taken from the font.
53
+ *
54
+ * Vendored verbatim from @xterm/xterm 5.5.0,
55
+ * src/browser/renderer/shared/CustomGlyphs.ts. The only edits are the one
56
+ * helper it imported, inlined below, and underscores on parameters the strict
57
+ * compiler flags as unused.
58
+ *
59
+ * Copyright (c) 2021 The xterm.js authors. All rights reserved.
60
+ * @license MIT
61
+ */function ab(l){if(!l)throw new Error("value must not be falsy");return l}const sM={"▀":[{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}]},oM={"░":[[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]]},rM={"─":{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,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"║":{1:(l,n)=>`M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╒":{1:(l,n)=>`M.5,1 L.5,${.5-n} L1,${.5-n} M.5,${.5+n} L1,${.5+n}`},"╓":{1:(l,n)=>`M${.5-l},1 L${.5-l},.5 L1,.5 M${.5+l},.5 L${.5+l},1`},"╔":{1:(l,n)=>`M1,${.5-n} L${.5-l},${.5-n} L${.5-l},1 M1,${.5+n} L${.5+l},${.5+n} L${.5+l},1`},"╕":{1:(l,n)=>`M0,${.5-n} L.5,${.5-n} L.5,1 M0,${.5+n} L.5,${.5+n}`},"╖":{1:(l,n)=>`M${.5+l},1 L${.5+l},.5 L0,.5 M${.5-l},.5 L${.5-l},1`},"╗":{1:(l,n)=>`M0,${.5+n} L${.5-l},${.5+n} L${.5-l},1 M0,${.5-n} L${.5+l},${.5-n} L${.5+l},1`},"╘":{1:(l,n)=>`M.5,0 L.5,${.5+n} L1,${.5+n} M.5,${.5-n} L1,${.5-n}`},"╙":{1:(l,n)=>`M1,.5 L${.5-l},.5 L${.5-l},0 M${.5+l},.5 L${.5+l},0`},"╚":{1:(l,n)=>`M1,${.5-n} L${.5+l},${.5-n} L${.5+l},0 M1,${.5+n} L${.5-l},${.5+n} L${.5-l},0`},"╛":{1:(l,n)=>`M0,${.5+n} L.5,${.5+n} L.5,0 M0,${.5-n} L.5,${.5-n}`},"╜":{1:(l,n)=>`M0,.5 L${.5+l},.5 L${.5+l},0 M${.5-l},.5 L${.5-l},0`},"╝":{1:(l,n)=>`M0,${.5-n} L${.5-l},${.5-n} L${.5-l},0 M0,${.5+n} L${.5+l},${.5+n} L${.5+l},0`},"╞":{1:(l,n)=>`M.5,0 L.5,1 M.5,${.5-n} L1,${.5-n} M.5,${.5+n} L1,${.5+n}`},"╟":{1:(l,n)=>`M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1 M${.5+l},.5 L1,.5`},"╠":{1:(l,n)=>`M${.5-l},0 L${.5-l},1 M1,${.5+n} L${.5+l},${.5+n} L${.5+l},1 M1,${.5-n} L${.5+l},${.5-n} L${.5+l},0`},"╡":{1:(l,n)=>`M.5,0 L.5,1 M0,${.5-n} L.5,${.5-n} M0,${.5+n} L.5,${.5+n}`},"╢":{1:(l,n)=>`M0,.5 L${.5-l},.5 M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╣":{1:(l,n)=>`M${.5+l},0 L${.5+l},1 M0,${.5+n} L${.5-l},${.5+n} L${.5-l},1 M0,${.5-n} L${.5-l},${.5-n} L${.5-l},0`},"╤":{1:(l,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n} M.5,${.5+n} L.5,1`},"╥":{1:(l,n)=>`M0,.5 L1,.5 M${.5-l},.5 L${.5-l},1 M${.5+l},.5 L${.5+l},1`},"╦":{1:(l,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L${.5-l},${.5+n} L${.5-l},1 M1,${.5+n} L${.5+l},${.5+n} L${.5+l},1`},"╧":{1:(l,n)=>`M.5,0 L.5,${.5-n} M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"╨":{1:(l,n)=>`M0,.5 L1,.5 M${.5-l},.5 L${.5-l},0 M${.5+l},.5 L${.5+l},0`},"╩":{1:(l,n)=>`M0,${.5+n} L1,${.5+n} M0,${.5-n} L${.5-l},${.5-n} L${.5-l},0 M1,${.5-n} L${.5+l},${.5-n} L${.5+l},0`},"╪":{1:(l,n)=>`M.5,0 L.5,1 M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"╫":{1:(l,n)=>`M0,.5 L1,.5 M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╬":{1:(l,n)=>`M0,${.5+n} L${.5-l},${.5+n} L${.5-l},1 M1,${.5+n} L${.5+l},${.5+n} L${.5+l},1 M0,${.5-n} L${.5-l},${.5-n} L${.5-l},0 M1,${.5-n} L${.5+l},${.5-n} 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,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,1,.5`},"╮":{1:(l,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,0,.5`},"╯":{1:(l,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.15*.5},.5,.5,0,.5`},"╰":{1:(l,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.15*.5},.5,.5,1,.5`}},As={"":{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}};As[""]=As[""];As[""]=As[""];function cM(l,n,a,s,r,c,f,m){const p=sM[n];if(p)return uM(l,p,a,s,r,c),!0;const g=oM[n];if(g)return dM(l,g,a,s,r,c),!0;const y=rM[n];if(y)return fM(l,y,a,s,r,c,m),!0;const v=As[n];return v?(hM(l,v,a,s,r,c,f,m),!0):!1}function uM(l,n,a,s,r,c){for(let f=0;f<n.length;f++){const m=n[f],p=r/8,g=c/8;l.fillRect(a+m.x*p,s+m.y*g,m.w*p,m.h*g)}}const sb=new Map;function dM(l,n,a,s,r,c){let f=sb.get(n);f||(f=new Map,sb.set(n,f));const m=l.fillStyle;if(typeof m!="string")throw new Error(`Unexpected fillStyle type "${m}"`);let p=f.get(m);if(!p){const g=n[0].length,y=n.length,v=l.canvas.ownerDocument.createElement("canvas");v.width=g,v.height=y;const w=ab(v.getContext("2d")),x=new ImageData(g,y);let S,T,A,k;if(m.startsWith("#"))S=parseInt(m.slice(1,3),16),T=parseInt(m.slice(3,5),16),A=parseInt(m.slice(5,7),16),k=m.length>7&&parseInt(m.slice(7,9),16)||1;else if(m.startsWith("rgba"))[S,T,A,k]=m.substring(5,m.length-1).split(",").map(E=>parseFloat(E));else throw new Error(`Unexpected fillStyle color format "${m}" when drawing pattern glyph`);for(let E=0;E<y;E++)for(let N=0;N<g;N++)x.data[(E*g+N)*4]=S,x.data[(E*g+N)*4+1]=T,x.data[(E*g+N)*4+2]=A,x.data[(E*g+N)*4+3]=n[E][N]*(k*255);w.putImageData(x,0,0),p=ab(l.createPattern(v,null)),f.set(m,p)}l.fillStyle=p,l.fillRect(a,s,r,c)}function fM(l,n,a,s,r,c,f){l.strokeStyle=l.fillStyle;for(const[m,p]of Object.entries(n)){l.beginPath(),l.lineWidth=f*Number.parseInt(m,10);let g;if(typeof p=="function"){const v=.15/c*r;g=p(.15,v)}else g=p;for(const y of g.split(" ")){const v=y[0],w=Zy[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}const x=y.substring(1).split(",");!x[0]||!x[1]||w(l,Wy(x,r,c,a,s,!0,f))}l.stroke(),l.closePath()}}function hM(l,n,a,s,r,c,f,m){const p=new Path2D;p.rect(a,s,r,c),l.clip(p),l.beginPath();const g=f/12;l.lineWidth=m*g;for(const y of n.d.split(" ")){const v=y[0],w=Zy[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}const x=y.substring(1).split(",");!x[0]||!x[1]||w(l,Wy(x,r,c,a,s,!1,m,(n.leftPadding??0)*(g/2),(n.rightPadding??0)*(g/2)))}n.type===1?(l.strokeStyle=l.fillStyle,l.stroke()):l.fill(),l.closePath()}function ob(l,n,a=0){return Math.max(Math.min(l,n),a)}const Zy={C:(l,n)=>l.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5]),L:(l,n)=>l.lineTo(n[0],n[1]),M:(l,n)=>l.moveTo(n[0],n[1])};function Wy(l,n,a,s,r,c,f,m=0,p=0){const g=l.map(y=>parseFloat(y)||parseInt(y,10));if(g.length<2)throw new Error("Too few arguments for instruction");for(let y=0;y<g.length;y+=2)g[y]*=n-m*f-p*f,c&&g[y]!==0&&(g[y]=ob(Math.round(g[y]+.5)-.5,n,0)),g[y]+=s+m*f;for(let y=1;y<g.length;y+=2)g[y]*=a,c&&g[y]!==0&&(g[y]=ob(Math.round(g[y]+.5)-.5,a,0)),g[y]+=r;return g}const Xd=.5,mM=1024,pM=6;function gM(l){return/Firefox\//.test(l)||/Edge\/\d/.test(l)?"bottom":"ideographic"}class bM{constructor(n,a=typeof navigator<"u"?navigator.userAgent:""){$(this,"pages",[]);$(this,"slots",new Map);$(this,"inkCache",new Map);$(this,"metrics",null);$(this,"font",null);$(this,"baseline");$(this,"generation",0);$(this,"scratch");this.document=n,this.baseline=gM(a)}configure(n,a){const s=this.metrics&&this.font&&this.metrics.cellWidth===n.cellWidth&&this.metrics.cellHeight===n.cellHeight&&this.metrics.charWidth===n.charWidth&&this.metrics.charHeight===n.charHeight&&this.metrics.charLeft===n.charLeft&&this.metrics.charTop===n.charTop&&this.metrics.dpr===n.dpr&&this.font.fontFamily===a.fontFamily&&this.font.fontSize===a.fontSize&&this.font.fontWeight===a.fontWeight&&this.font.fontWeightBold===a.fontWeightBold&&this.font.customGlyphs===a.customGlyphs;this.metrics={...n},this.font={...a},s||this.clear()}clear(){this.slots.clear(),this.inkCache.clear();for(const n of this.pages)n.shelfX=0,n.shelfY=0;this.generation++}dispose(){this.slots.clear(),this.inkCache.clear();for(const n of this.pages)n.canvas.width=0,n.canvas.height=0;this.pages=[]}get pageCount(){return this.pages.length}fontString(n,a){const s=this.font,r=n?s.fontWeightBold:s.fontWeight;return`${a?"italic ":""}${r} ${s.fontSize*this.metrics.dpr}px ${s.fontFamily}`}overflow(n,a,s){if(!this.metrics||!this.font||n.length===1&&n.charCodeAt(0)<128)return 0;const r=`${a?1:0}${s?1:0}${n}`,c=this.inkCache.get(r);if(c!==void 0)return c;let f=0;const m=this.scratchContext();if(m&&!(this.font.customGlyphs&&Qy(n))){m.font=this.fontString(a,s),m.textBaseline=this.baseline;const p=m.measureText(n),g=typeof p.actualBoundingBoxRight=="number"?p.actualBoundingBoxRight:p.width;f=Math.max(0,Math.ceil(this.metrics.charLeft+g-this.metrics.cellWidth))}return this.inkCache.set(r,f),f}get(n){const a=this.metrics,s=this.font;if(!a||!s||a.cellWidth<=0||a.cellHeight<=0)return null;const r=`${n.cells}${n.bold?1:0}${n.italic?1:0}${n.dim?1:0}${n.fg}\0${n.bg}\0${n.chars}`,c=this.slots.get(r);if(c)return c;const f=a.cellWidth*n.cells,m=a.cellHeight,p=this.allocate(f,m);if(!p)return null;const{page:g,x:y,y:v}=p,w=g.ctx;w.save(),w.beginPath(),w.rect(y,v,f,m),w.clip(),w.globalAlpha=1,w.fillStyle=n.bg,w.fillRect(y,v,f,m),w.fillStyle=n.fg,n.dim&&(w.globalAlpha=Xd);let x=!1;s.customGlyphs&&(x=cM(w,n.chars,y,v,a.cellWidth,a.cellHeight,s.fontSize,a.dpr)),x||(w.font=this.fontString(n.bold,n.italic),w.textBaseline=this.baseline,w.fillText(n.chars,y+a.charLeft,v+a.charTop+a.charHeight)),w.restore();const S={source:g.canvas,x:y,y:v,width:f,height:m};return this.slots.set(r,S),S}allocate(n,a){for(const s of this.pages){const r=this.fit(s,n,a);if(r)return r}if(this.pages.length<pM){const s=this.createPage(Math.max(mM,n,a));return s?(this.pages.push(s),this.fit(s,n,a)):null}return this.clear(),this.pages[0]?this.fit(this.pages[0],n,a):null}fit(n,a,s){if(n.shelfX+a>n.canvas.width&&(n.shelfX=0,n.shelfY+=s),n.shelfY+s>n.canvas.height||a>n.canvas.width)return null;const r={page:n,x:n.shelfX,y:n.shelfY};return n.shelfX+=a,r}createPage(n){const a=this.document.createElement("canvas");a.width=n,a.height=n;const s=a.getContext("2d",{alpha:!1});return s?{canvas:a,ctx:s,shelfX:0,shelfY:0}:null}scratchContext(){if(this.scratch===void 0){const n=this.document.createElement("canvas");n.width=1,n.height=1,this.scratch=n.getContext("2d")}return this.scratch}}function Qy(l){if(l.length!==1)return!1;const n=l.charCodeAt(0);return n>=9472&&n<=9631||n>=57504&&n<=57558}function yM(l,n){return(l&(st.UNDERLINE|st.STRIKETHROUGH))!==0||(n&ji.OVERLINE)!==0}function vM(l,n,{px:a,py:s,cells:r,fgWord:c,bgWord:f,ext:m,fgCss:p},{fontSize:g,dpr:y,colors:v,boldBright:w}){const x=(c&st.UNDERLINE)!==0,S=(c&st.STRIKETHROUGH)!==0,T=(f&ji.OVERLINE)!==0,A=r*n.cell.width;l.save(),l.beginPath(),l.rect(a,s,A,n.cell.height),l.clip(),Ms(f)&&(l.globalAlpha=Xd);const k=Math.max(1,Math.floor(g*y/15)),E=k%2===1?.5:0;if(x){const N=qC(m);let B=p;if(N){let R=N;w&&sa(c)&&(R&50331648)!==50331648&&(R&255)<8&&(R+=8),B=Dy(R,v,p)}l.strokeStyle=B,l.lineWidth=k;const L=s+n.char.top+Math.ceil(n.char.height)-E-k*2,D=m?VC(m):ta.SINGLE;switch(l.beginPath(),D){case ta.DOUBLE:l.moveTo(a,L),l.lineTo(a+A,L),l.moveTo(a,L+k*2),l.lineTo(a+A,L+k*2);break;case ta.CURLY:{const R=L+k,z=Math.max(1,k);for(let K=0;K<r;K++){const V=a+K*n.cell.width,te=V+n.cell.width/2,Z=V+n.cell.width;l.moveTo(V,R),l.bezierCurveTo(V,R-z,te,R-z,te,R),l.bezierCurveTo(te,R+z,Z,R+z,Z,R)}break}case ta.DOTTED:l.setLineDash([k,k]),l.moveTo(a,L),l.lineTo(a+A,L);break;case ta.DASHED:{const R=Math.floor(.6*n.cell.width),z=Math.floor(.3*n.cell.width);l.setLineDash([R,z,n.cell.width-R-z]),l.moveTo(a,L),l.lineTo(a+A,L);break}default:l.moveTo(a,L),l.lineTo(a+A,L)}l.stroke(),l.setLineDash([])}if(T&&(l.strokeStyle=p,l.lineWidth=k,l.beginPath(),l.moveTo(a,s+n.char.top+E),l.lineTo(a+A,s+n.char.top+E),l.stroke()),S){const N=Math.max(1,Math.floor(g*y/10)),B=s+n.char.top+Math.floor(n.char.height/2)-(N%2===1?.5:0);l.strokeStyle=p,l.lineWidth=N,l.beginPath(),l.moveTo(a,B),l.lineTo(a+A,B),l.stroke()}l.restore()}const ld=4,xM=3;class wM{constructor(n,a,s,r){$(this,"atlas");$(this,"fades",new lM);$(this,"cols",0);$(this,"rows",0);$(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});$(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});$(this,"work",$C());this.ctx=n,this.core=s,this.dimensions=r,this.atlas=new bM(a)}resize(n,a){this.cols=n,this.rows=a,this.fades.clear();const s=n*a;this.painted={content:new Uint32Array(s).fill(ea),fg:new Uint32Array(s),bg:new Uint32Array(s),ext:new Uint32Array(s),meta:new Uint32Array(s).fill(ea),combined:new Array(s).fill("")},this.row={content:new Uint32Array(n),fg:new Uint32Array(n),bg:new Uint32Array(n),ext:new Uint32Array(n),combined:new Array(n).fill("")}}invalidate(){this.painted.content.fill(ea),this.painted.meta.fill(ea),this.fades.clear()}hasPaintedInk(n,a){const s=this.dimensions.device;if(!s.cell.width||!s.cell.height)return!1;const r=Math.min(this.cols,Math.floor(n/s.cell.width)),c=Math.min(this.rows,Math.floor(a/s.cell.height)),f=this.painted;for(let m=0;m<c;m++)for(let p=0;p<r;p++){const g=m*this.cols+p,y=f.content[g];if(y===ea||f.meta[g]===ld||ia(f.fg[g]))continue;const v=y&We.CODEPOINT_MASK;if(y&We.IS_COMBINED_MASK?f.combined[g]!=="":v!==0&&v!==32)return!0}return!1}loadRow(n,a){const{content:s,fg:r,bg:c,ext:f,combined:m}=this.row,p=this.work;for(let g=0;g<this.cols;g++)n&&g<n.length?(n.loadCell(g,p),s[g]=p.content,r[g]=p.fg,c[g]=p.bg,f[g]=jy(p),m[g]=p.content&We.IS_COMBINED_MASK?p.combinedData:""):(s[g]=1<<We.WIDTH_SHIFT,r[g]=0,c[g]=0,f[g]=0,m[g]="");if(a)for(const g of a){const y=g.col;if(y<0||y+g.width>this.cols)continue;y>0&&!(s[y]>>>We.WIDTH_SHIFT)&&this.blankAt(y-1);const v=y+g.width;v<this.cols&&!(s[v]>>>We.WIDTH_SHIFT)&&s[v-1]>>>We.WIDTH_SHIFT===2&&this.blankAt(v);const w=XC(g.chars,g.width);s[y]=w.content,m[y]=w.combinedData,r[y]=g.style.fg,c[y]=g.style.bg,f[y]=g.style.ext,g.width===2&&(s[y+1]=0,m[y+1]="",r[y+1]=g.style.fg,c[y+1]=g.style.bg,f[y+1]=g.style.ext)}}blankAt(n){this.row.content[n]=32|1<<We.WIDTH_SHIFT,this.row.combined[n]=""}paintRow(n,a,s=null,r=0){const c=this.cols,{content:f,fg:m,bg:p,ext:g,combined:y}=this.row,v=this.painted,w=n*c;s&&this.fades.begin(n,c,s,v,this.row,r);let x=0,S=-1,T=-1,A="";const k=()=>{S<0||(this.fillCells(S,n,T-S,A),S=-1)};let E=0;for(;E<c;){let B=f[E]>>>We.WIDTH_SHIFT;B===0&&(B=1),E+B>c&&(B=c-E),B===1&&E+1<c&&this.overflowsInto(E)&&(B=2);const L=a&&a.y===n&&a.x>=E&&a.x<E+B?a.shape:Zn.NONE,D=B|L<<xM,R=this.fades.size>0?this.fades.at(w+E,E,this.row,r):null;let z=R!==null||this.differs(w+E,E,D);for(let K=1;K<B;K++)this.differs(w+E+K,E+K,ld)&&(z=!0);if(z){for(let V=0;V<B;V++){const te=w+E+V;v.content[te]=f[E+V],v.fg[te]=m[E+V],v.bg[te]=p[E+V],v.ext[te]=g[E+V],v.meta[te]=V===0?R?D|iM:D:ld,v.combined[te]=y[E+V]}x+=B;const K=R?null:this.plainFill(E,L);K!==null?S>=0&&T===E&&A===K?T=E+B:(k(),S=E,T=E+B,A=K):(k(),this.paintCell(E,n,B,L,R))}E+=B}return k(),x}differs(n,a,s){const r=this.painted,c=this.row;return r.meta[n]!==s||r.content[n]!==c.content[a]||r.fg[n]!==c.fg[a]||r.bg[n]!==c.bg[a]||r.ext[n]!==c.ext[a]||r.combined[n]!==c.combined[a]}overflowsInto(n){const{content:a,fg:s,bg:r,ext:c}=this.row,f=a[n];if((f&We.CODEPOINT_MASK)<128&&!(f&We.IS_COMBINED_MASK)||f>>>We.WIDTH_SHIFT!==1||ia(s[n]))return!1;const p=a[n+1],g=p&We.CODEPOINT_MASK;if(p>>>We.WIDTH_SHIFT!==1||p&We.IS_COMBINED_MASK||g!==0&&g!==32||r[n]!==r[n+1]||c[n+1]!==0||(s[n]&st.INVERSE)!==(s[n+1]&st.INVERSE)||s[n]&st.INVERSE&&s[n]!==s[n+1]||s[n+1]&(st.UNDERLINE|st.STRIKETHROUGH)||r[n+1]&ji.OVERLINE)return!1;const y=this.charsAt(n);return this.core.optionsService.rawOptions.customGlyphs!==!1&&Qy(y)?!1:this.atlas.overflow(y,sa(s[n]),ys(r[n]))>0}charsAt(n){const a=this.row.content[n];if(a&We.IS_COMBINED_MASK)return this.row.combined[n];const s=a&We.CODEPOINT_MASK;return s?String.fromCodePoint(s):""}plainFill(n,a){if(a!==Zn.NONE)return null;const{content:s,fg:r,bg:c}=this.row,f=s[n],m=f&We.CODEPOINT_MASK,p=!(f&We.IS_COMBINED_MASK)&&(m===0||m===32),g=ia(r[n]);return!p&&!g||(r[n]&(st.UNDERLINE|st.STRIKETHROUGH)||c[n]&ji.OVERLINE)&&!g?null:bs(r[n],c[n],this.colors(),this.boldBright()).bg}paintCell(n,a,s,r,c=null){const f=this.ctx,m=this.dimensions.device,p=this.colors(),g=this.row.fg[n],y=this.row.bg[n],v=this.row.ext[n],w=bs(g,y,p,this.boldBright());let x=w.fg,S=w.bg;r===Zn.BLOCK&&(S=p.cursor.css,x=p.cursorAccent.css);const T=ia(g),A=this.charsAt(n),k=n*m.cell.width,E=a*m.cell.height,N=s*m.cell.width,B=m.cell.height,L=T||A===""||A===" ",D=L?null:this.atlas.get({chars:A,bold:sa(g),italic:ys(y),dim:Ms(y),fg:x,bg:S,cells:s}),R=c&&!c.gone?c.alpha:1;if(D&&R===1?f.drawImage(D.source,D.x,D.y,D.width,D.height,k,E,N,B):(f.fillStyle=S,f.fillRect(k,E,N,B),D?(f.globalAlpha=R,f.drawImage(D.source,D.x,D.y,D.width,D.height,k,E,N,B),f.globalAlpha=1):L||(f.save(),f.beginPath(),f.rect(k,E,N,B),f.clip(),f.fillStyle=x,f.globalAlpha=(Ms(y)?Xd:1)*R,f.font=this.atlas.fontString(sa(g),ys(y)),f.fillText(A,k+m.char.left,E+m.char.top+m.char.height),f.restore())),c!=null&&c.gone){const K=r===Zn.BLOCK||(g&st.INVERSE)!==0?x:bs(c.gone.fg,c.gone.bg,p,this.boldBright()).fg;aM(f,this.atlas,c,{fg:K,bg:S},{px:k,py:E,width:N,height:B,cells:s})}!T&&yM(g,y)&&vM(f,m,{px:k,py:E,cells:s,fgWord:g,bgWord:y,ext:v,fgCss:x},{fontSize:this.core.optionsService.rawOptions.fontSize,dpr:this.core._coreBrowserService.dpr,colors:p,boldBright:this.boldBright()}),r!==Zn.NONE&&r!==Zn.BLOCK&&Xy(f,m,k,E,N,r,{css:p.cursor.css,dpr:this.core._coreBrowserService.dpr,cursorWidth:this.core.optionsService.rawOptions.cursorWidth})}fillCells(n,a,s,r){const c=this.dimensions.device;this.ctx.fillStyle=r,this.ctx.fillRect(n*c.cell.width,a*c.cell.height,s*c.cell.width,c.cell.height)}fillBackground(){this.ctx.fillStyle=this.colors().background.css,this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)}configureAtlas(){const n=this.dimensions.device,a=this.core.optionsService.rawOptions;this.atlas.configure({cellWidth:n.cell.width,cellHeight:n.cell.height,charWidth:n.char.width,charHeight:n.char.height,charLeft:n.char.left,charTop:n.char.top,dpr:this.core._coreBrowserService.dpr},{fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,customGlyphs:a.customGlyphs!==!1})}colors(){return this.core._themeService.colors}boldBright(){return this.core.optionsService.rawOptions.drawBoldTextInBrightColors!==!1}}function SM(){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 CM(l,n,a,s){const r=n._charSizeService;if(!r.hasValidSize)return!1;const c=n._coreBrowserService.dpr,f=n.optionsService.rawOptions;return l.device.char.width=Math.floor(r.width*c),l.device.char.height=Math.ceil(r.height*c),l.device.cell.height=Math.floor(l.device.char.height*f.lineHeight),l.device.char.top=f.lineHeight===1?0:Math.round((l.device.cell.height-l.device.char.height)/2),l.device.cell.width=l.device.char.width+Math.round(f.letterSpacing),l.device.char.left=Math.floor(f.letterSpacing/2),l.device.canvas.height=s*l.device.cell.height,l.device.canvas.width=a*l.device.cell.width,l.css.canvas.height=Math.round(l.device.canvas.height/c),l.css.canvas.width=Math.round(l.device.canvas.width/c),l.css.cell.height=l.css.canvas.height/s,l.css.cell.width=l.css.canvas.width/a,!0}function TM(l,n,a){if(!l||typeof l.ResizeObserver!="function")return null;let s=new l.ResizeObserver(r=>{var p;const c=r.find(g=>g.target===n);if(!c)return;if(!("devicePixelContentBoxSize"in c)||!((p=c.devicePixelContentBoxSize)!=null&&p[0])){s==null||s.disconnect(),s=null;return}const f=c.devicePixelContentBoxSize[0].inlineSize,m=c.devicePixelContentBoxSize[0].blockSize;f<=0||m<=0||f===n.width&&m===n.height||a(f,m)});try{s.observe(n,{box:"device-pixel-content-box"})}catch{s.disconnect(),s=null}return{dispose:()=>s==null?void 0:s.disconnect()}}function MM(l){if(!l)return[];const n=l.cells.map(a=>a.row);return l.cursor&&n.push(l.cursor.row),n}function AM(l){const n=new Map;for(const a of(l==null?void 0:l.cells)??[]){const s=n.get(a.row);s?s.push(a):n.set(a.row,[a])}return n}class EM{constructor(n){$(this,"canvas");$(this,"ctx");$(this,"selection",null);$(this,"link",null);this.canvas=n.createElement("canvas"),this.canvas.classList.add("xterm-decor-layer"),this.canvas.style.zIndex="2";const a=this.canvas.getContext("2d");if(!a)throw new Error("2D canvas unavailable");this.ctx=a}setSelection(n,a,s){this.selection=n&&a&&!(n[0]===a[0]&&n[1]===a[1])?{start:[n[0],n[1]],end:[a[0],a[1]],columnSelectMode:s}:null}paint({dims:n,rows:a,cols:s,ydisp:r,colors:c,focused:f,dpr:m,cursorWidth:p,caret:g}){var S;const y=this.ctx;if(y.clearRect(0,0,this.canvas.width,this.canvas.height),!n.cell.width||!a)return;const{selection:v,link:w}=this,x=(T,A,k,E)=>y.fillRect(T*n.cell.width,A*n.cell.height,k*n.cell.width,E*n.cell.height);if(v){const T=v.start[1]-r,A=v.end[1]-r,k=Math.max(T,0),E=Math.min(A,a-1);if(k<a&&E>=0)if(y.fillStyle=(f?c.selectionBackgroundTransparent:c.selectionInactiveBackgroundTransparent).css,v.columnSelectMode)x(v.start[0],k,v.end[0]-v.start[0],E-k+1);else{const N=T===k?v.start[0]:0,B=k===A?v.end[0]:s;x(N,k,B-N,1),x(0,k+1,s,Math.max(E-k-1,0)),k!==E&&x(0,E,A===E?v.end[0]:s,1)}}if(w){y.fillStyle=w.fg===257?c.background.css:w.fg!==void 0&&w.fg<256?((S=c.ansi[w.fg])==null?void 0:S.css)??c.foreground.css:c.foreground.css;const T=(A,k,E)=>y.fillRect(A*n.cell.width,(k+1)*n.cell.height-m-1,E*n.cell.width,m);if(w.y1===w.y2)T(w.x1,w.y1,w.x2-w.x1);else{T(w.x1,w.y1,w.cols-w.x1);for(let A=w.y1+1;A<w.y2;A++)T(0,A,w.cols);T(0,w.y2,w.x2)}}if(g){const T=Math.round(g.x*n.cell.width),A=g.y*n.cell.height;g.shape===Zn.BLOCK?(y.fillStyle=g.css,y.fillRect(T,A,n.cell.width,n.cell.height)):Xy(y,n,T,A,n.cell.width,g.shape,{css:g.css,dpr:m,cursorWidth:p})}}}class kM{constructor(n,a){$(this,"text");$(this,"textContext");$(this,"decor");this.screen=a,this.text=n.createElement("canvas"),this.text.classList.add("xterm-text-layer"),this.text.style.zIndex="0";const s=this.text.getContext("2d",{alpha:!1});if(!s)throw new Error("2D canvas unavailable");this.textContext=s,this.decor=new EM(n),a.appendChild(this.text),a.appendChild(this.decor.canvas)}size(n){for(const a of[this.text,this.decor.canvas])a.width=n.device.canvas.width,a.height=n.device.canvas.height,a.style.width=`${n.css.canvas.width}px`,a.style.height=`${n.css.canvas.height}px`;this.screen.style.width=`${n.css.canvas.width}px`,this.screen.style.height=`${n.css.canvas.height}px`}watchDevicePixels(n,a,s,r){return TM(n,this.text,(c,f)=>{const m=a.css.canvas;if(!(Math.abs(c-m.width*s())>2||Math.abs(f-m.height*s())>2)){a.device.canvas.width=c,a.device.canvas.height=f;for(const p of[this.text,this.decor.canvas])p.width=c,p.height=f;r()}})}remove(){this.text.remove(),this.decor.canvas.remove()}}function NM(l,n){const a=l.fonts;return!a||typeof a.addEventListener!="function"?null:(a.addEventListener("loadingdone",n),{dispose:()=>a.removeEventListener("loadingdone",n)})}class _M{constructor(n,a,s){$(this,"startedAt",null);$(this,"held",null);$(this,"timer",null);this.now=n,this.maxHoldMs=a,this.onExpire=s}get pending(){return this.held}hold(n,a){const s=this.now();return this.startedAt===null&&(this.startedAt=s),s-this.startedAt>=this.maxHoldMs?!1:(this.held=this.held?{start:Math.min(this.held.start,n),end:Math.max(this.held.end,a)}:{start:n,end:a},this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.onExpire()},this.maxHoldMs)),!0)}release(n,a){return this.held&&(n=Math.min(n,this.held.start),a=Math.max(a,this.held.end)),this.held=null,this.startedAt=null,this.timer&&(clearTimeout(this.timer),this.timer=null),{start:n,end:a}}dispose(){this.timer&&clearTimeout(this.timer)}}const LM=150;class Zd{constructor(n,a){$(this,"dimensions",SM());$(this,"redraw",new ZC);$(this,"onRequestRedraw",this.redraw.event);$(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});$(this,"surface");$(this,"cells");$(this,"disposables",[]);$(this,"now");$(this,"syncHold");$(this,"cols",0);$(this,"rows",0);$(this,"overlayProvider",null);$(this,"typingZoneProvider",null);$(this,"reducedMotion");$(this,"paintedOverlayRows",new Set);$(this,"paintedCursorRow",-1);$(this,"lastYdisp",0);$(this,"inputAt",null);$(this,"blink",new XT(()=>this.requestCursorRow()));$(this,"glide",new WT);$(this,"slidingCaret",null);$(this,"disposed",!1);$(this,"isSynchronizing");$(this,"dprUsed",0);var f,m;this.core=n,this.now=a.now??(()=>performance.now()),this.syncHold=new _M(this.now,a.maxSyncHoldMs??LM,()=>this.flushHeld()),this.isSynchronizing=a.isSynchronizing??(()=>!1),this.reducedMotion=(m=(f=n._coreBrowserService.window).matchMedia)==null?void 0:m.call(f,"(prefers-reduced-motion: reduce)");const s=n._coreBrowserService.mainDocument;this.surface=new kM(s,n.screenElement),this.cells=new wM(this.surface.textContext,s,n,this.dimensions),this.disposables.push(n._themeService.onChangeColors(()=>{this.cells.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),n.optionsService.onOptionChange(p=>{(p==="cursorBlink"||p==="cursorStyle")&&this.restartBlink()})),n.linkifier&&this.disposables.push(n.linkifier.onShowLinkUnderline(p=>{this.surface.decor.link=p,this.redrawDecor()}),n.linkifier.onHideLinkUnderline(()=>{this.surface.decor.link=null,this.redrawDecor()}));const r=this.surface.watchDevicePixels(n._coreBrowserService.window,this.dimensions,()=>n._coreBrowserService.dpr,()=>{this.invalidateAll(),this.cells.fillBackground(),this.redrawDecor(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})});r&&this.disposables.push(r);const c=NM(s,()=>this.clearTextureAtlas());c&&this.disposables.push(c),this.restartBlink()}static install(n,a={}){const s=zy(n);if(!s)return null;const r=new Zd(s,a);return s._renderService.setRenderer(r),s._renderService.handleResize(s._bufferService.cols,s._bufferService.rows),r}setOverlayProvider(n){this.overlayProvider=n,this.invalidateOverlay()}setTypingZoneProvider(n){this.typingZoneProvider=n}invalidateOverlay(){var s;const n=((s=this.overlayProvider)==null?void 0:s.call(this))??null,a=new Set(this.paintedOverlayRows);for(const r of MM(n))a.add(r);this.paintedCursorRow>=0&&a.add(this.paintedCursorRow+this.buffer().ydisp),this.requestAbsoluteRows(a)}markInput(){this.inputAt=this.now()}flushHeld(){const n=this.syncHold.pending;n&&this.redraw.fire({start:n.start,end:n.end})}handleDevicePixelRatioChange(){this.dimensions.device.cell.width&&this.dprUsed!==this.core._coreBrowserService.dpr&&this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleResize(n,a){CM(this.dimensions,this.core,n,a)&&(this.dprUsed=this.core._coreBrowserService.dpr),this.surface.size(this.dimensions),this.cols=n,this.rows=a,this.cells.resize(n,a),this.paintedOverlayRows.clear(),this.paintedCursorRow=-1,this.cells.configureAtlas(),this.cells.fillBackground(),this.redrawDecor()}handleCharSizeChanged(){this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleBlur(){this.blink.stop(),this.requestCursorRow(),this.redrawDecor()}handleFocus(){this.restartBlink(),this.requestCursorRow(),this.redrawDecor()}handleSelectionChanged(n,a,s){this.surface.decor.setSelection(n,a,s),this.redrawDecor()}handleCursorMove(){this.blink.running&&this.restartBlink()}clear(){this.invalidateAll(),this.cells.fillBackground()}clearTextureAtlas(){this.cells.atlas.clear(),this.invalidateAll(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}renderRows(n,a){if(this.disposed||!this.cols||!this.rows||!this.dimensions.device.cell.width)return;if(this.isSynchronizing()&&this.syncHold.hold(n,a)){this.stats.heldFrames++;return}const s=this.syncHold.release(n,a);this.paint(Math.max(0,s.start),Math.min(this.rows-1,s.end))}dispose(){if(!this.disposed){this.disposed=!0,this.blink.stop(),this.syncHold.dispose();for(const n of this.disposables)n.dispose();this.disposables.length=0,this.redraw.dispose(),this.cells.atlas.dispose(),this.surface.remove()}}uninstall(){const n=this.core._createRenderer;typeof n=="function"&&(this.core._renderService.setRenderer(n.call(this.core)),this.core._renderService.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)),this.dispose()}get textCanvas(){return this.surface.text}hasPaintedInk(n,a){return this.cells.hasPaintedInk(n,a)}paint(n,a){var k,E,N;const s=this.now(),r=this.buffer(),c=r.ydisp;c!==this.lastYdisp&&(this.lastYdisp=c,this.cells.fades.clear(),this.redrawDecor());const f=(k=this.reducedMotion)!=null&&k.matches?null:((E=this.typingZoneProvider)==null?void 0:E.call(this))??null,m=f?f.row-c:-1,p=((N=this.overlayProvider)==null?void 0:N.call(this))??null,g=AM(p),y=this.cursorState(p),v=QT(y,p,c,this.colors()),w=this.glide.update(v,m,s),x=w?null:y,S=w&&(v==null?void 0:v.plain);S&&g.set(S.row,[...g.get(S.row)??[],S]);const T=new Set;for(let B=n;B<=a;B++)T.add(B);for(const B of this.paintedOverlayRows)ms(T,B-c,this.rows);for(const B of g.keys())ms(T,B-c,this.rows);this.paintedCursorRow>=0&&ms(T,this.paintedCursorRow,this.rows),x&&ms(T,x.y,this.rows);for(const B of this.cells.fades.rows(this.cols))ms(T,B,this.rows);let A=0;for(const B of T){this.cells.loadRow(r.lines.get(c+B),g.get(B+c));const L=B===m?{start:f.startCol,end:f.endCol}:null;A+=this.cells.paintRow(B,x,L,s)}this.cells.fades.size>0&&this.requestAbsoluteRows([...this.cells.fades.rows(this.cols)].map(B=>B+c)),(w||this.slidingCaret)&&(this.slidingCaret=w,this.redrawDecor(),w&&this.requestAbsoluteRows([w.y+c])),this.paintedOverlayRows=new Set(g.keys()),this.paintedCursorRow=x?x.y:-1,this.stats.frames++,this.stats.lastCells=A,this.stats.lastPaintMs=this.now()-s,this.inputAt!==null&&A>0&&(this.stats.lastInputToPaintMs=this.now()-this.inputAt,this.inputAt=null)}cursorState(n){return qT(this.core,this.buffer(),n,{rows:this.rows,cols:this.cols},this.blink.hidden)}restartBlink(){if(this.blink.stop(),this.disposed||!this.core.optionsService.rawOptions.cursorBlink||!this.core._coreBrowserService.isFocused){this.requestCursorRow();return}this.blink.start(),this.requestCursorRow()}requestCursorRow(){if(!this.rows)return;const n=this.buffer(),a=new Set;a.add(n.ybase+n.y),this.paintedCursorRow>=0&&a.add(this.paintedCursorRow+n.ydisp),this.requestAbsoluteRows(a)}redrawDecor(){this.surface.decor.paint({dims:this.dimensions.device,rows:this.rows,cols:this.cols,ydisp:this.buffer().ydisp,colors:this.colors(),focused:this.core._coreBrowserService.isFocused,dpr:this.core._coreBrowserService.dpr,cursorWidth:this.core.optionsService.rawOptions.cursorWidth,caret:this.slidingCaret})}invalidateAll(){this.cells.invalidate(),this.paintedCursorRow=-1}buffer(){return this.core._bufferService.buffer}colors(){return this.core._themeService.colors}requestAbsoluteRows(n){if(!this.rows)return;const a=this.buffer().ydisp;let s=1/0,r=-1/0;for(const c of n){const f=c-a;f<0||f>=this.rows||(s=Math.min(s,f),r=Math.max(r,f))}s<=r&&this.redraw.fire({start:s,end:r})}}function ms(l,n,a){n>=0&&n<a&&l.add(n)}const RM=30,Jy=640,e0=240,ir=1,jM=720*60*60*1e3;function t0(){const l=ws("local",At.rendererProbe);if(!l)return{v:ir,ua:{}};try{const n=JSON.parse(l);return typeof n=="object"&&n!==null&&n.v===ir&&typeof n.ua=="object"&&n.ua!==null?n:{v:ir,ua:{}}}catch{return{v:ir,ua:{}}}}function OM(l,n=Date.now()){const a=t0();a.ua[l]={failedAt:n},Li("local",At.rendererProbe,JSON.stringify(a))}function DM(l,n=Date.now()){const a=typeof navigator<"u"?navigator.userAgent:"";if(!a)return!1;const r=t0().ua[a];return!(!r||typeof r.failedAt!="number"||n-r.failedAt>jM)}function rb(l,n=Date.now()){const a=typeof navigator<"u"?navigator.userAgent:"";a&&OM(a,n)}function zM(l){if(l.length<4)return!0;const n=l[0],a=l[1],s=l[2],r=l[3];for(let c=4;c<l.length;c+=4)if(l[c]!==n||l[c+1]!==a||l[c+2]!==s||l[c+3]!==r)return!1;return!0}function HM(l){if(!l||l.width<=0||l.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let n=null;try{n=l.getContext("2d",{willReadFrequently:!0})||l.getContext("2d")}catch(r){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",r),"inconclusive"}if(!n)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const a=Math.min(l.width,Jy),s=Math.min(l.height,e0);if(a<=0||s<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const r=n.getImageData(0,0,a,s);return zM(r.data)?"blank":"healthy"}catch(r){return console.debug("Canvas probe inconclusive: getImageData threw exception:",r),"inconclusive"}}function cb(l=2){return new Promise(n=>{if(typeof requestAnimationFrame!="function"){setTimeout(n,32);return}let a=l;const s=()=>{a--,a<=0?n():requestAnimationFrame(s)};requestAnimationFrame(s)})}const ad={kind:"dom",canvas:null,dispose:()=>{},verify:async()=>{}};function BM(l,n={}){if(DM())return ad;let a;try{a=Zd.install(l,{isSynchronizing:n.isSynchronizing})}catch(m){return console.debug("Canvas renderer unavailable, using the DOM renderer:",m),rb(),ad}if(!a)return ad;let s=a,r=null;const c=()=>{var p;if(!s)return;rb();const m=s;s=null;try{m.uninstall()}catch{}(p=n.onRendererSwapped)==null||p.call(n,"dom")};return{get kind(){return s?"canvas":"dom"},get canvas(){return s},dispose:()=>{const m=s;s=null;try{m==null||m.dispose()}catch{}},verify:async()=>{if(s)return r||(r=(async()=>{try{const m=s.stats.frames;await cb(2);for(let g=0;g<RM&&s&&s.stats.frames===m;g++)await cb(1);if(!s)return;const p=HM(s.textCanvas);p==="blank"&&s.hasPaintedInk(Jy,e0)?c():p==="blank"?console.debug("Canvas probe inconclusive: uniform, but no character was painted there"):p==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(m){console.debug("Canvas probe inconclusive: unexpected error during verify():",m)}finally{r=null}})(),r)}}}function UM(l,n,a){l.writeln(" ___ ___ .___ "),l.writeln(` / | \\ ____ _______| _/______ \x1B[1m${n}\x1B[0m`),l.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${a}\x1B[0m`),l.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),l.writeln(" \\___|_ / \\___ >|__| /___/____ >"),l.writeln(" \\/ \\/ \\/ "),l.writeln("")}var KM=jx(),sd={exports:{}},ub;function IM(){return ub||(ub=1,(function(l,n){(function(a,s){l.exports=s()})(self,(()=>(()=>{var a={6:(f,m)=>{function p(y){try{const v=new URL(y),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 y.toLocaleLowerCase().startsWith(w.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(m,"__esModule",{value:!0}),m.LinkComputer=m.WebLinkProvider=void 0,m.WebLinkProvider=class{constructor(y,v,w,x={}){this._terminal=y,this._regex=v,this._handler=w,this._options=x}provideLinks(y,v){const w=g.computeLink(y,this._regex,this._terminal,this._handler);v(this._addCallbacks(w))}_addCallbacks(y){return y.map((v=>(v.leave=this._options.leave,v.hover=(w,x)=>{if(this._options.hover){const{range:S}=v;this._options.hover(w,x,S)}},v)))}};class g{static computeLink(v,w,x,S){const T=new RegExp(w.source,(w.flags||"")+"g"),[A,k]=g._getWindowedLineStrings(v-1,x),E=A.join("");let N;const B=[];for(;N=T.exec(E);){const L=N[0];if(!p(L))continue;const[D,R]=g._mapStrIdx(x,k,0,N.index),[z,K]=g._mapStrIdx(x,D,R,L.length);if(D===-1||R===-1||z===-1||K===-1)continue;const V={start:{x:R+1,y:D+1},end:{x:K,y:z+1}};B.push({range:V,text:L,activate:S})}return B}static _getWindowedLineStrings(v,w){let x,S=v,T=v,A=0,k="";const E=[];if(x=w.buffer.active.getLine(v)){const N=x.translateToString(!0);if(x.isWrapped&&N[0]!==" "){for(A=0;(x=w.buffer.active.getLine(--S))&&A<2048&&(k=x.translateToString(!0),A+=k.length,E.push(k),x.isWrapped&&k.indexOf(" ")===-1););E.reverse()}for(E.push(N),A=0;(x=w.buffer.active.getLine(++T))&&x.isWrapped&&A<2048&&(k=x.translateToString(!0),A+=k.length,E.push(k),k.indexOf(" ")===-1););}return[E,S]}static _mapStrIdx(v,w,x,S){const T=v.buffer.active,A=T.getNullCell();let k=x;for(;S;){const E=T.getLine(w);if(!E)return[-1,-1];for(let N=k;N<E.length;++N){E.getCell(N,A);const B=A.getChars();if(A.getWidth()&&(S-=B.length||1,N===E.length-1&&B==="")){const L=T.getLine(w+1);L&&L.isWrapped&&(L.getCell(0,A),A.getWidth()===2&&(S+=1))}if(S<0)return[w,N]}w++,k=0}return[w,k]}}m.LinkComputer=g}},s={};function r(f){var m=s[f];if(m!==void 0)return m.exports;var p=s[f]={exports:{}};return a[f](p,p.exports,r),p.exports}var c={};return(()=>{var f=c;Object.defineProperty(f,"__esModule",{value:!0}),f.WebLinksAddon=void 0;const m=r(6),p=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(y,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")}f.WebLinksAddon=class{constructor(y=g,v={}){this._handler=y,this._options=v}activate(y){this._terminal=y;const v=this._options,w=v.urlRegex||p;this._linkProvider=this._terminal.registerLinkProvider(new m.WebLinkProvider(this._terminal,w,this._handler,v))}dispose(){var y;(y=this._linkProvider)==null||y.dispose()}}})(),c})()))})(sd)),sd.exports}var FM=IM(),GM=Ox();function YM({fontSize:l,fontFamily:n,theme:a,cols:s,rows:r}){const c=new GM.Terminal({fontSize:l,fontFamily:n,lineHeight:1.15,...a?{theme:{...a}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:s,rows:r,screenReaderMode:!1,linkHandler:{activate:(f,m)=>{Ed(m)}}});try{const f=new KM.Unicode11Addon;c.loadAddon(f),c.unicode.activeVersion="11"}catch(f){console.debug("Unicode11 addon unavailable, using default width table:",f)}try{c.loadAddon(new FM.WebLinksAddon((f,m)=>{Ed(m)}))}catch(f){console.debug("WebLinks addon unavailable, URLs stay plain text:",f)}return c}function ps(l){var n,a;if(!l)return!1;try{const s=l.modes;if(s&&typeof s.mouseTrackingMode=="string"&&s.mouseTrackingMode!=="none")return!0;const r=l._core;if((n=r==null?void 0:r._coreMouseService)!=null&&n.areMouseEventsActive||(a=r==null?void 0:r.coreMouseService)!=null&&a.areMouseEventsActive||r!=null&&r.mouseMode&&r.mouseMode!=="none")return!0}catch{}return!1}function PM(l,n){const a=n.button??0,s=n.buttons??(l==="mouseup"?0:1);return new MouseEvent(l,{bubbles:!0,cancelable:!0,clientX:n.clientX,clientY:n.clientY,screenX:n.clientX,screenY:n.clientY,button:a,buttons:s})}function n0(l,n,a){const s=PM(n,a);return l.dispatchEvent(s)}function i0(l){var n;try{return((n=l.buffer)==null?void 0:n.active)||null}catch{return null}}function od(l){var a;const n=(a=i0(l))==null?void 0:a.viewportY;return typeof n=="number"&&Number.isFinite(n)?n:null}function $M(l){var n;try{(n=l.blur)==null||n.call(l)}catch{}}function db(l){var a,s;const n=l;return n.coreMouseService||((a=n._core)==null?void 0:a.coreMouseService)||((s=n._core)==null?void 0:s._coreMouseService)||null}function VM(l){var a;const n=l;return n.coreService||((a=n._core)==null?void 0:a.coreService)||null}class qM{constructor(n){this.options=n}getLogicalCoordinates(n,a){const s=this.options.getScale?this.options.getScale():1,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(s!==1&&r&&typeof r.getBoundingClientRect=="function"){const c=r.getBoundingClientRect();return qy(n,a,c,s)}return{clientX:n,clientY:a}}getViewportElement(n){var r;const a=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(a==null?void 0:a.querySelector(".xterm-viewport"))||((r=n.element)==null?void 0:r.querySelector(".xterm-viewport"))||null}isInputLineHit(n,a){var E;const s=(E=a.buffer)==null?void 0:E.active,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,c=(r==null?void 0:r.querySelector(".xterm-screen"))||a.element||r,f=rl(a);if(!c||typeof c.getBoundingClientRect!="function"||f.cellHeight<=0)return!1;const m=c.getBoundingClientRect(),p=this.getLogicalCoordinates(n.clientX,n.clientY),g=m.width>0&&m.height>0;if(![s==null?void 0:s.cursorY,s==null?void 0:s.viewportY,s==null?void 0:s.baseY].every(N=>typeof N=="number"&&Number.isFinite(N)))return!1;const v=s==null?void 0:s.cursorY,w=s==null?void 0:s.viewportY,S=(s==null?void 0:s.baseY)+v-w,T=m.top+S*f.cellHeight,A=T+f.cellHeight,k=Number(a.rows);return S>=0&&(!Number.isFinite(k)||S<k)&&p.clientY>=T-2&&p.clientY<=A+2&&(!g||p.clientX>=m.left&&p.clientX<=m.right)}resolveDispatchTarget(n,a){var m;const s=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(s==null?void 0:s.querySelector(".xterm-screen"))||a.querySelector(".xterm-screen")||null,c=((m=r==null?void 0:r.closest)==null?void 0:m.call(r,".xterm"))||null;let f=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(f=document.elementFromPoint(n.clientX,n.clientY)),f&&c&&(f===c||c.contains(f))?f:r||s||a}getMouseReport(n,a){const s=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(s==null?void 0:s.querySelector(".xterm-screen"))||a.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const c=r.getBoundingClientRect(),f=this.getLogicalCoordinates(n.clientX,n.clientY),m=rl(a);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,c.width||a.cols*m.cellWidth),g=Math.max(1,c.height||a.rows*m.cellHeight),y=Math.max(0,Math.min(p-1,f.clientX-c.left)),v=Math.max(0,Math.min(g-1,f.clientY-c.top)),w=Math.max(0,Math.min(a.cols-1,Math.floor(y/m.cellWidth))),x=Math.max(0,Math.min(a.rows-1,Math.floor(v/m.cellHeight)));return{col:w,row:x,x:Math.floor(y),y:Math.floor(v),button:0,action:0}}getWheelDispatchTarget(n){const a=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(a==null?void 0:a.querySelector(".xterm"))||n.element||null}dispatchWheel(n,a,s,r){const c=this.getWheelDispatchTarget(s);if(!c||typeof WheelEvent>"u"||a===0)return!1;const f=this.getLogicalCoordinates(n.clientX,n.clientY),m=a<0?-1:1;let p=0;for(let g=0;g<Math.abs(a);g+=1)try{const y=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:f.clientX,clientY:f.clientY,deltaX:0,deltaY:m,deltaMode:1,ctrlKey:!!(r!=null&&r.ctrlKey),altKey:!!(r!=null&&r.altKey),shiftKey:!!(r!=null&&r.shiftKey)});c.dispatchEvent(y),p+=1}catch{return p>0}return p>0}emitWheel(n,a,s,r){if(a===0)return!1;if(this.dispatchWheel(n,a,s,r))return!0;const c=db(s);if(!(c!=null&&c.triggerMouseEvent))return!1;let f=0;for(let m=0;m<Math.abs(a);m+=1){const p=this.getMouseReport(n,s);p&&(p.button=4,p.action=a<0?0:1,p.ctrl=!!(r!=null&&r.ctrlKey),p.alt=!!(r!=null&&r.altKey),p.shift=!!(r!=null&&r.shiftKey),c.triggerMouseEvent(p)&&(f+=1))}return f>0}scrollAlternateBuffer(n,a,s,r){var f;if(a===0)return"none";const c=ps(s);if(!c&&!this.options.getIsController())return"none";if(this.emitWheel(n,a,s,r))return c?"application-mouse":"application-keys";if(!c){const m=VM(s);if(!(m!=null&&m.triggerDataEvent))return"none";const g=`\x1B${!!((f=m.decPrivateModes)!=null&&f.applicationCursorKeys)?"O":"["}${a<0?"A":"B"}`;return m.triggerDataEvent(g.repeat(Math.abs(a)),!0),"application-keys"}return"none"}emitMouse(n,a,s,r){const c=this.options.getTerminal();if(!c)return;const f=db(c);if(f!=null&&f.triggerMouseEvent){const p=this.getMouseReport(a,c);p&&(p.action=n==="mousedown"?1:n==="mouseup"?0:32,p.ctrl=!!(s!=null&&s.ctrlKey),p.alt=!!(s!=null&&s.altKey),p.shift=!!(s!=null&&s.shiftKey),f.triggerMouseEvent(p));return}if(this.options.allowSyntheticMouseFallback===!1||!r)return;const m=this.getLogicalCoordinates(a.clientX,a.clientY);n0(r,n,{clientX:m.clientX,clientY:m.clientY,button:0,buttons:n==="mouseup"?0:1})}}class XM{constructor(n){$(this,"options");$(this,"state","idle");$(this,"startX",0);$(this,"startY",0);$(this,"lastX",0);$(this,"lastY",0);$(this,"activeTarget",null);$(this,"longPressTimer",null);$(this,"longPressMenuTimer",null);$(this,"capturedPointerId",null);$(this,"captureElement",null);$(this,"scrollRemainderY",0);$(this,"delivery");this.options={longPressDelayMs:500,longPressMenuDelayMs:2500,dragThresholdPx:8,scrollLineHeightPx:18,...n},this.delivery=new qM(this.options)}getState(){return this.state}setGestureState(n){var a,s;this.state!==n&&(this.state=n,(s=(a=this.options).onGestureStateChange)==null||s.call(a,n))}beginGesture(n,a){this.startX=n.clientX,this.startY=n.clientY,this.lastX=n.clientX,this.lastY=n.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.delivery.resolveDispatchTarget(n,a),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var s,r;this.state==="pending"&&(this.setGestureState("longpress"),(r=(s=this.options).onLongPress)==null||r.call(s,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs),this.longPressMenuTimer=setTimeout(()=>{var s,r;this.longPressMenuTimer=null,this.state==="longpress"&&((r=(s=this.options).onLongPressMenu)==null||r.call(s,{clientX:this.startX,clientY:this.startY}))},this.options.longPressMenuDelayMs)}moveGesture(n,a){var g,y,v,w;if(this.state==="idle")return;const s=n.clientX-this.startX,r=n.clientY-this.startY,c=Math.hypot(s,r);if(this.state==="longpress"){c>(this.options.dragThresholdPx||8)&&this.clearLongPressMenuTimer(),(y=(g=this.options).onSelectionExtend)==null||y.call(g,{clientX:n.clientX,clientY:n.clientY}),a!=null&&a.cancelable&&((v=a.preventDefault)==null||v.call(a));return}if(this.state==="scrolling"){this.scrollGesture(n,a);return}const f=this.options.getTerminal(),m=this.options.getIsController(),p=ps(f);if(!(c<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(r)>=Math.abs(s)||!p||!m){this.setGestureState("scrolling"),f&&$M(f),this.lastX=n.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(n,a);return}if(p&&m){this.state==="pending"&&(this.setGestureState("dragging"),this.delivery.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},a,this.activeTarget)),this.state==="dragging"&&(this.lastX=n.clientX,this.lastY=n.clientY,this.delivery.emitMouse("mousemove",n,a,this.activeTarget),a!=null&&a.cancelable&&((w=a.preventDefault)==null||w.call(a)));return}this.lastX=n.clientX,this.lastY=n.clientY}}scrollGesture(n,a){var S,T,A;const s=this.options.getTerminal();if(!s)return;const r=n.clientY-this.lastY;this.lastX=n.clientX,this.lastY=n.clientY;const c=rl(s),f=c.measured?c.cellHeight:this.options.scrollLineHeightPx||c.cellHeight||18;this.scrollRemainderY+=r;const m=Math.trunc(this.scrollRemainderY/f),p=-m;let g=!1,y="none";const v=i0(s),w=ps(s);if(p!==0){if((v==null?void 0:v.type)==="alternate")y=this.delivery.scrollAlternateBuffer(n,p,s,a),g=y!=="none";else{const k=od(s);s.scrollLines(p);const E=od(s);y="buffer",g=k===null||E===null||k!==E}this.scrollRemainderY-=m*f}const x=this.delivery.getViewportElement(s);(T=(S=this.options).onGestureScroll)==null||T.call(S,{deltaY:r,lines:p,viewportY:od(s),scrollTop:(x==null?void 0:x.scrollTop)??null,scrollHeight:(x==null?void 0:x.scrollHeight)??null,clientHeight:(x==null?void 0:x.clientHeight)??null,moved:g,bufferType:(v==null?void 0:v.type)||null,baseY:typeof(v==null?void 0:v.baseY)=="number"?v.baseY:null,cursorY:typeof(v==null?void 0:v.cursorY)=="number"?v.cursorY:null,hasScrollback:typeof(v==null?void 0:v.hasScrollback)=="boolean"?v.hasScrollback:null,mouseTracking:w,scrollMode:y}),a!=null&&a.cancelable&&((A=a.preventDefault)==null||A.call(a))}endGesture(n,a){var f,m,p;this.clearLongPressTimer();const s=this.options.getTerminal(),r=this.options.getIsController(),c=ps(s);if(this.state==="pending"){if(c&&r){const y={clientX:this.startX,clientY:this.startY};this.delivery.emitMouse("mousedown",y,a,this.activeTarget),this.delivery.emitMouse("mouseup",y,a,this.activeTarget)}const g={clientX:this.startX,clientY:this.startY};r&&s&&this.delivery.isInputLineHit(g,s)&&((m=(f=this.options).onFocus)==null||m.call(f))}else if(this.state==="dragging"&&c&&r){const g=n??{clientX:this.lastX,clientY:this.lastY};this.delivery.emitMouse("mouseup",g,a,this.activeTarget),a!=null&&a.cancelable&&((p=a.preventDefault)==null||p.call(a))}this.reset()}handlePointerDown(n,a){if(n.pointerType==="mouse")return!1;if(!n.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(n.cancelable&&n.preventDefault(),this.beginGesture(n,a),n.pointerType!=="touch")try{typeof a.setPointerCapture=="function"&&(a.setPointerCapture(n.pointerId),this.capturedPointerId=n.pointerId,this.captureElement=a)}catch{}return!0}handlePointerMove(n){n.pointerType==="mouse"||this.state==="idle"||this.moveGesture(n,n)}handlePointerUp(n){n.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(n,n))}handlePointerCancel(n){n&&n.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(n,a){if(n.touches.length!==1){this.reset();return}n.cancelable&&n.preventDefault(),this.beginGesture(n.touches[0],a)}handleTouchMove(n){n.touches.length===1&&this.moveGesture(n.touches[0],n)}handleTouchEnd(n){n.cancelable&&n.preventDefault(),this.endGesture(null,n)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const n=this.options.getTerminal(),a=this.options.getIsController(),s=ps(n);if(this.state==="dragging"&&s&&a&&this.activeTarget){const r=this.delivery.getLogicalCoordinates(this.lastX,this.lastY);n0(this.activeTarget,"mouseup",{clientX:r.clientX,clientY:r.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const n=this.captureElement,a=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!n||a===null))try{typeof n.releasePointerCapture=="function"&&(typeof n.hasPointerCapture!="function"||n.hasPointerCapture(a))&&n.releasePointerCapture(a)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null),this.clearLongPressMenuTimer()}clearLongPressMenuTimer(){this.longPressMenuTimer&&(clearTimeout(this.longPressMenuTimer),this.longPressMenuTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}function ZM({container:l,term:n,isTouchDevice:a,debug:s,getTerminal:r,getIsController:c,getScale:f,getSurfaceElement:m,getSelection:p,onFocus:g}){const y=new XM({getTerminal:r,getIsController:c,getScale:f,getSurfaceElement:m,allowSyntheticMouseFallback:!1,onFocus:()=>{try{n.focus()}catch{}s==null||s(L=>({...L,focused:document.activeElement===n.textarea})),g()},onGestureStateChange:L=>{s==null||s(D=>({...D,state:L}))},onGestureScroll:({deltaY:L,lines:D,viewportY:R,scrollTop:z,scrollHeight:K,clientHeight:V,moved:te,bufferType:Z,baseY:ie,cursorY:re,hasScrollback:ce,mouseTracking:O,scrollMode:J})=>{s==null||s(I=>({...I,deltaY:L,lines:D,viewportY:R,scrollTop:z,scrollHeight:K,clientHeight:V,moved:te,focused:document.activeElement===n.textarea,bufferType:Z,baseY:ie,cursorY:re,hasScrollback:ce,mouseTracking:O,scrollMode:J,scrollCalls:I.scrollCalls+(D!==0?1:0),lastScrollLines:D}))},longPressDelayMs:500,longPressMenuDelayMs:2500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:a?L=>p().handleLongPress(L):void 0,onLongPressMenu:a?()=>p().openMenuAtGesture():void 0,onSelectionExtend:a?L=>p().handleSelectionExtend(L):void 0}),v=typeof window<"u"&&"PointerEvent"in window,w=typeof TouchEvent<"u",x=[],S={passive:!1,capture:!0},T=(L,D)=>{document.addEventListener(L,D,S),x.push(()=>document.removeEventListener(L,D,S))},A=(L,D=!1)=>{const R=L.target;return R instanceof Node&&l.contains(R)||D&&y.getState()!=="idle"},k=(L,D)=>{s==null||s(R=>({...R,[L]:R[L]+1,lastInputEvent:D}))},E=L=>{const D=p();return D.hasOpenMenu()?(D.clearSelection(),L.cancelable&&L.preventDefault(),L.stopPropagation(),!0):!1},N=()=>{const L=p();y.getState()==="longpress"&&L.hasSelectionExtension()&&!L.hasOpenMenu()&&L.openMenuAtGesture()};if(v){if(T("pointerdown",L=>{if(!A(L)||(k("pointerEvents","pointerdown"),E(L)))return;y.handlePointerDown(L,l)&&L.stopPropagation()}),T("pointermove",L=>{A(L,!0)&&(k("pointerEvents","pointermove"),y.handlePointerMove(L),L.pointerType!=="mouse"&&L.stopPropagation())}),T("pointerup",L=>{A(L,!0)&&(k("pointerEvents","pointerup"),N(),y.handlePointerUp(L),L.pointerType!=="mouse"&&L.stopPropagation())}),T("pointercancel",L=>{A(L,!0)&&(k("pointerEvents","pointercancel"),p().clearSelection(),y.handlePointerCancel(L),L.pointerType!=="mouse"&&L.stopPropagation())}),w){const L=D=>{A(D,!0)&&(s==null||s(R=>({...R,touchEvents:R.touchEvents+1})),D.cancelable&&D.preventDefault(),D.stopPropagation())};for(const D of["touchstart","touchmove","touchend","touchcancel"])T(D,L)}}else T("touchstart",L=>{A(L)&&(k("touchEvents","touchstart"),!E(L)&&(L.touches.length===1&&L.stopPropagation(),y.handleTouchStart(L,l)))}),T("touchmove",L=>{A(L,!0)&&(k("touchEvents","touchmove"),L.touches.length===1&&L.stopPropagation(),y.handleTouchMove(L))}),T("touchend",L=>{A(L,!0)&&(k("touchEvents","touchend"),N(),L.stopPropagation(),y.handleTouchEnd(L))}),T("touchcancel",L=>{A(L,!0)&&(k("touchEvents","touchcancel"),p().clearSelection(),L.stopPropagation(),y.handleTouchCancel())});const B=L=>{L.preventDefault()};return l.addEventListener("contextmenu",B),x.push(()=>l.removeEventListener("contextmenu",B)),()=>{y.handlePointerCancel();for(const L of x)L()}}function WM(l,{requestFit:n,onPageVisible:a}){const s=new ResizeObserver(()=>{n()});s.observe(l);const r=()=>{n()},c=()=>{document.visibilityState==="visible"&&a()};window.addEventListener("resize",r),window.addEventListener("orientationchange",r),document.addEventListener("visibilitychange",c),window.addEventListener("pageshow",c);const f=()=>{n()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",f),window.visualViewport.addEventListener("scroll",f)),()=>{s.disconnect(),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),document.removeEventListener("visibilitychange",c),window.removeEventListener("pageshow",c),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",f),window.visualViewport.removeEventListener("scroll",f))}}function tl(l){if(l)try{l.refresh(0,Math.max(0,l.rows-1))}catch{}}function QM({containerRef:l,surfaceRef:n,termRef:a,rendererRef:s,currentScaleRef:r,initialBannerWrittenRef:c,live:f,selection:m,prediction:p,fit:g,isTouchDevice:y,debug:v,terminalFontSize:w,terminalFontFamily:x,hostTheme:S,glyphRevision:T,terminalResetVersion:A,isActive:k,subscribeToOutput:E,onOutput:N,onTitle:B,onRendererKind:L}){const{requestFit:D,scheduleBoundedFit:R,fitNow:z,seedFit:K,cancelPendingFits:V}=g;M.useEffect(()=>{var tt,Je;if(!l.current||!n.current)return;const Z=l.current,ie=Rd(Z,oa(),pd()),re=rl(null,fa),ce=Vy({width:ie.width,height:ie.height,cellWidth:re.cellWidth,cellHeight:re.cellHeight});f.current.sendResize(ce.cols,ce.rows),K(ie);const O=YM({fontSize:dg(w,ie.width),fontFamily:x,theme:f.current.hostTheme,cols:ce.cols,rows:ce.rows});O.open(n.current),a.current=O;const J=O.onTitleChange(Se=>{B(Ad(Se)||null)}),{screenState:I,fieldProbe:le,overlay:P}=p.attach(O);y&&O.textarea&&(O.textarea.readOnly=!1,O.textarea.tabIndex=0,O.textarea.inputMode="text");let fe=()=>{};if(v&&O.textarea){const Se=()=>{v(Me=>({...Me,focused:document.activeElement===O.textarea}))};O.textarea.addEventListener("focus",Se),O.textarea.addEventListener("blur",Se),fe=()=>{var Me,ot;(Me=O.textarea)==null||Me.removeEventListener("focus",Se),(ot=O.textarea)==null||ot.removeEventListener("blur",Se)},Se()}const ve=async Se=>{p.discard("paste");const Me=_y(Se);if(Me){if(Se.preventDefault(),Se.stopPropagation(),!f.current.isController){f.current.warnViewerMode();return}await f.current.uploadImage(Me)}};(tt=O.textarea)==null||tt.addEventListener("paste",ve),Z.addEventListener("paste",ve);const X=BM(O,{isSynchronizing:I.isSynchronizing,onRendererSwapped:Se=>{var Me;Z.dataset.renderer=Se,L(Se),(Me=p.overlayRef.current)==null||Me.attach(null),tl(O)}});P.attach(X.canvas),(Je=X.canvas)==null||Je.setTypingZoneProvider(()=>{const Se=le.detect();return Se&&{row:Se.row,startCol:Se.startCol,endCol:Se.endCol}});const ue=I.onSyncEnd(()=>{var Se,Me;return(Me=(Se=s.current)==null?void 0:Se.canvas)==null?void 0:Me.flushHeld()});if(s.current=X,Z.dataset.renderer=X.kind,L(X.kind),UM(O,f.current.t("terminal.bannerTitle"),f.current.t("terminal.bannerSubtitle")),c.current=!0,O.write("",()=>void X.verify()),!y)try{O.focus()}catch{}const oe=typeof document<"u"?document.fonts:void 0;typeof(oe==null?void 0:oe.load)=="function"&&oe.load('13px "Symbols Nerd Font Mono"').then(()=>{a.current&&(tl(a.current),R(5))}).catch(()=>{});const pe=O.onData(Se=>{const{isController:Me}=f.current;let ot=Se;if(Me&&Iy(Se)==="keys"&&$x(Se)){const bt=f.current.consumeModifierLatch();bt&&(ot=sr(Se,bt))}const nt=zd(ot);if(!Me&&!cr(nt)){f.current.warnViewerMode();return}p.onUserInput(nt),f.current.sendBinary(nt)}),se=O.onBinary(Se=>{const Me=new Uint8Array(Se.length);for(let ot=0;ot<Se.length;ot++)Me[ot]=Se.charCodeAt(ot)&255;!f.current.isController&&!cr(Me)||f.current.sendBinary(Me)}),xe=typeof O.onWriteParsed=="function"?O.onWriteParsed(()=>{var bt;if(m.current.onTerminalContentChanged(),le.invalidate(),I.isSynchronizing())return;const Se=O.buffer.active,Me=Se.baseY+Se.cursorY,ot=Array.from({length:8},(yn,vn)=>{var Nn;return((Nn=Se.getLine(Me-7+vn))==null?void 0:Nn.translateToString(!0))??""}),nt=Yw(ot,f.current.platform);nt&&f.current.reportShellProfile(nt),(bt=p.predictorRef.current)==null||bt.onServerOutput(),p.sync()}):{dispose:()=>{}},ae=typeof O.onRender=="function"?O.onRender(Se=>{var Me;if(f.current.glyphScan){const ot=O.buffer.active.viewportY??0;let nt="";for(let bt=Se.start;bt<=Se.end;bt+=1)nt+=((Me=O.buffer.active.getLine(ot+bt))==null?void 0:Me.translateToString(!0))??"";/[^\x00-\x7f]/.test(nt)&&f.current.ensureHostGlyphs(nt)}m.current.onTerminalRender(O,Se.start,Se.end)}):{dispose:()=>{}},we=typeof O.onScroll=="function"?O.onScroll(()=>{m.current.onTerminalScroll(O),p.discard("scroll")}):{dispose:()=>{}},ke=ZM({container:Z,term:O,isTouchDevice:y,debug:v,getTerminal:()=>a.current,getIsController:()=>f.current.isController,getScale:()=>r.current,getSurfaceElement:()=>n.current,getSelection:()=>m.current,onFocus:()=>{var Se,Me;return(Me=(Se=f.current).onTerminalFocus)==null?void 0:Me.call(Se)}}),Ie=WM(Z,{requestFit:D,onPageVisible:()=>{R(10),tl(a.current)}});return()=>{var Se;pe.dispose(),se.dispose(),ae.dispose(),we.dispose(),xe.dispose(),J.dispose(),ue.dispose(),p.detach(),I.dispose(),ke(),Ie(),V(),fe(),(Se=O.textarea)==null||Se.removeEventListener("paste",ve),Z.removeEventListener("paste",ve),X.dispose(),s.current=null,O.dispose(),a.current=null}},[]),M.useEffect(()=>{const Z=a.current;if(!Z)return;const ie=Rd(l.current,oa(),pd()),re=dg(w,ie.width),ce=Z.options.fontSize!==re||Z.options.fontFamily!==x;Z.options.fontSize=re,Z.options.fontFamily=x,tl(Z),ce&&z(),R(10)},[w,x]),M.useEffect(()=>{var ie,re;const Z=a.current;!Z||!T||((re=(ie=s.current)==null?void 0:ie.canvas)==null||re.clearTextureAtlas(),tl(Z))},[T]);const te=M.useRef(A);M.useEffect(()=>{var ie;if(te.current===A)return;te.current=A,p.forget("resetVersion");const Z=a.current;if(Z)try{(ie=Z.reset)==null||ie.call(Z),Z.clear(),Z.refresh(0,Math.max(0,Z.rows-1))}catch{}},[A]),M.useEffect(()=>{const Z=a.current;!Z||!S||(Z.options.theme={...S},tl(Z))},[S]),M.useEffect(()=>E(ie=>{const re=a.current;if(!re)throw new Error("terminal not ready");re.write(ie),N==null||N(ie.byteLength)}),[E,a,N]),M.useEffect(()=>{if(!k)return;R(10);const Z=a.current;if(Z&&(tl(Z),!y))try{Z.focus()}catch{}},[k,y,R,a])}const JM=({onTerminalFocus:l,isActive:n=!0})=>{var Nn;const a=M.useRef(null),s=M.useRef(null),r=M.useRef(null),c=M.useRef(null),f=M.useRef(null),m=M.useRef(1),p=M.useRef(null),g=M.useRef(!1),y=fw(),v=y||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,w=yC(),[x,S]=M.useState(bC),{metrics:T,record:A}=vC(w),[k,E]=M.useState(null),{settings:N,terminalFontFamily:B,terminalFontSize:L,hostFont:D,ensureHostGlyphs:R,profiles:z,activeProfileId:K,t:V}=Ee(),{isController:te,connectionState:Z,hostPalette:ie,herdrPrefixKeys:re,terminalResetVersion:ce,agentStatus:O,platform:J,reportShellProfile:I,connect:le,rttMs:P}=it(),{addToast:fe}=dn(),{sendResize:ve,sendBinary:X,observeKeyInput:ue,consumeModifierLatch:oe,warnViewerMode:pe,subscribeToOutput:se,subscribeToPasteFileReady:xe}=Sr(),{uploadImage:ae}=Cr(),we=Jn.useMemo(()=>Sw(ie),[ie]),ke=En({isController:te,sendBinary:X,sendResize:ve,warnViewerMode:pe,uploadImage:ae,t:V,consumeModifierLatch:oe,hostTheme:we,onTerminalFocus:l,ensureHostGlyphs:R,glyphScan:D.glyphs.status==="ready",platform:J,reportShellProfile:I}),Ie=En(n),tt=kT({termRef:f,rendererRef:p,mode:N.predictiveEcho,connectionState:Z,observeKeyInput:ue,herdrPrefixKeys:re}),[Je,Se]=M.useState(null),Me=PT({termRef:f,surfaceRef:r,mainRef:c,currentScaleRef:m,addToast:fe,t:V}),ot=En(Me),nt=TC({termRef:f,isController:te,warnViewerMode:pe,uploadImage:ae,addToast:fe,t:V,onPaste:()=>tt.discard("paste"),subscribeToPasteFileReady:xe}),bt=zT({termRef:f,containerRef:a,frameRef:s,surfaceRef:r,currentScaleRef:m,rendererRef:p,initialBannerWrittenRef:g,isActiveRef:Ie,sendResize:ve,onResized:()=>tt.forget("resize")});QM({containerRef:a,surfaceRef:r,termRef:f,rendererRef:p,currentScaleRef:m,initialBannerWrittenRef:g,live:ke,selection:ot,prediction:tt,fit:bt,isTouchDevice:y,debug:w?S:null,terminalFontSize:L,terminalFontFamily:B,hostTheme:we,glyphRevision:D.glyphRevision,terminalResetVersion:ce,isActive:n,subscribeToOutput:se,onOutput:w?A:null,onTitle:Se,onRendererKind:E});const yn=Jn.useMemo(()=>{var qt;return((qt=z.find(ut=>ut.id===K))==null?void 0:qt.displayName)??null},[z,K]);M.useEffect(()=>{Z!=="connected"&&Se(null)},[Z]),M.useEffect(()=>{const qt=n&&Z==="connected",ut=N.agentAlertBadge?Ts(O):null;lC(qt?Je:null,yn,ut)},[n,Z,Je,yn,O,N.agentAlertBadge]),M.useEffect(()=>{Z==="disconnected"&&le()},[]);const vn=qt=>{qt.preventDefault()};return h.jsxs("main",{ref:c,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:vn,"aria-label":V("terminal.windowAriaLabel"),children:[h.jsx("div",{id:"terminal-container",ref:a,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:v?"none":"auto"},tabIndex:0,onContextMenu:vn,"aria-label":V("terminal.bufferAriaLabel"),role:"region",children:h.jsx("div",{id:"terminal-frame",ref:s,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:h.jsx("div",{id:"terminal-surface",ref:r,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),w&&h.jsx(CC,{debug:x,rttMs:P,metrics:T,rendererKind:k,predictiveEcho:N.predictiveEcho,predictor:tt.predictorRef.current,field:((Nn=tt.fieldProbeRef.current)==null?void 0:Nn.detect())??null,renderer:p.current}),y&&Me.selectionRect&&Me.isHighlightVisible&&h.jsx($T,{term:f.current,surface:r.current,main:c.current,rect:Me.selectionRect,viewportY:Me.viewportY}),y&&Me.selectionMenu&&h.jsx(gC,{anchorPoint:Me.selectionMenu,hasSelection:!!Me.selectionSnapshot,isController:te,vibrateOnKeyPress:N.vibrateOnKeyPress,linkUrl:Me.selectionMenu.link??null,onOpenLink:qt=>{Ed(qt)||fe("warning",V("clipboard.openLinkFailed"))},onCopySelection:Me.handleCopySelection,onCopyLine:Me.handleCopyLine,onCopyScreen:Me.handleCopyScreen,onPaste:nt.handlePaste,onClose:Me.clearSelection}),y&&nt.isPasteFallbackOpen&&h.jsx(pC,{isOpen:nt.isPasteFallbackOpen,onClose:nt.closePasteFallback,onSend:nt.handleFallbackPasteSend,onSendImage:nt.handleFallbackImageSend})]})},e5=2e3;function Wd(){const{t:l}=Ee(),{addToast:n}=dn(),[a,s]=M.useState(null),r=M.useRef(null);M.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]);const c=M.useCallback((f,m,p="success")=>{qd(f).then(g=>{if(g==="failed"){n("error",l("clipboard.copyFailed"));return}s(f),n(p,m),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>s(null),e5)})},[n,l]);return{copied:a,copy:c}}const il="herdr-remote pair",fb="herdr-remote",t5=({onPairedSuccess:l})=>{const{settings:n,updateSettings:a,t:s}=Ee(),{connect:r,connectionState:c,stateDetail:f}=it(),{addToast:m}=dn(),[p,g]=M.useState(""),{copied:y,copy:v}=Wd(),[w,x]=M.useState(!1),[S,T]=M.useState(n.wsUrl||Ut),[A,k]=M.useState(n.token||""),[E,N]=M.useState(n.clientId||""),B=z=>v(z,s("toasts.commandCopied")),L=z=>{z.preventDefault();const K=p.trim().toUpperCase();if(!K&&!A.trim()){m("warning",s("toasts.connectionError"));return}const V={pairCode:K,wsUrl:S.trim()||Ut,clientId:E.trim()||n.clientId};A.trim()&&(V.token=A.trim()),a(V),r({pairCode:K||void 0,token:A.trim()||void 0,wsUrl:S.trim()||Ut,clientId:E.trim()||n.clientId}),l&&l()},D=c==="connecting"||c==="reconnecting",R=({n:z})=>h.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",z,"]"]});return h.jsx("div",{className:"flex h-full w-full flex-1 justify-center overflow-y-auto bg-tui-crust p-2 sm:p-4",children:h.jsxs("div",{className:"my-auto w-full max-w-3xl space-y-3",children:[h.jsxs("div",{className:"border border-tui-border bg-tui-base px-3 py-2",children:[h.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[h.jsx("span",{"aria-hidden":"true",className:"font-bold text-tui-accent",children:"herdr-remote"}),h.jsx("h1",{className:"text-tui font-bold text-tui-text",children:s("onboarding.title")}),h.jsx("span",{className:"text-tui uppercase text-tui-warn",children:s("onboarding.firstTimeSetup")})]}),h.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:s("onboarding.description")})]}),c==="error"&&h.jsxs(Ri,{tone:"warn",action:h.jsx(Ae,{variant:"warn",onClick:()=>r(),children:s("common.retry")}),children:[h.jsx("span",{className:"block font-bold",children:s("onboarding.authRequired")}),h.jsx("span",{className:"block text-tui-muted",children:f||s("onboarding.authRequiredDesc")})]}),h.jsxs("form",{onSubmit:L,className:"grid gap-3",children:[h.jsx(Et,{title:s("onboarding.step1Title"),className:"min-w-0",children:h.jsxs("div",{className:"space-y-2",children:[h.jsxs("p",{className:"flex items-start gap-2 text-tui text-tui-muted",children:[h.jsx(R,{n:1}),h.jsx("span",{className:"leading-snug",children:s("onboarding.step1Desc")})]}),h.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),h.jsx("code",{className:"min-w-0 flex-1 truncate text-tui text-tui-text",children:il}),h.jsx(Ae,{onClick:()=>B(il),glyph:y===il?_e.check:"⧉",className:ne("shrink-0",y===il&&"border-tui-ok text-tui-ok"),children:s(y===il?"common.copied":"common.copy")})]}),h.jsx("div",{className:"space-y-0.5 text-tui-sm",children:h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("span",{className:"truncate text-tui-faint",children:s("onboarding.step1TuiNote")}),h.jsx("button",{type:"button",onClick:()=>B(fb),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:s("common.clickToCopy"),children:h.jsx("code",{children:fb})})]})})]})}),h.jsx(Et,{title:s("onboarding.step2Title"),className:"min-w-0",children:h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(R,{n:2}),h.jsx(un,{type:"text",value:p,onChange:z=>g(z.target.value.toUpperCase()),placeholder:s("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":s("onboarding.step2Title"),className:"font-bold uppercase"})]}),h.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:s("onboarding.step2Note")})]})}),h.jsx(Ae,{variant:"primary",type:"submit",block:!0,disabled:D,className:"py-1.5",children:D?h.jsx(ol,{label:s("onboarding.connectingAndPairing")}):s("onboarding.connectAndPair")}),h.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[h.jsxs("button",{type:"button",onClick:()=>x(!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:[h.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:w?_e.chevronDown:_e.chevronRight}),h.jsx("span",{className:"uppercase",children:s("onboarding.advancedTitle")})]}),w&&h.jsxs("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx(sl,{htmlFor:"onboarding-token",children:s("onboarding.manualTokenLabel")}),h.jsx(un,{id:"onboarding-token",type:"password",value:A,onChange:z=>k(z.target.value),placeholder:s("onboarding.manualTokenPlaceholder")})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx(sl,{htmlFor:"onboarding-ws",children:s("onboarding.wsEndpointLabel")}),h.jsx(un,{id:"onboarding-ws",type:"text",value:S,onChange:z=>T(z.target.value),placeholder:s("onboarding.wsEndpointPlaceholder")})]}),h.jsx($S,{}),h.jsxs("div",{className:"space-y-1",children:[h.jsx(sl,{htmlFor:"onboarding-client-id",children:s("onboarding.clientIdLabel")}),h.jsx(un,{id:"onboarding-client-id",type:"text",value:E,onChange:z=>N(z.target.value)})]})]})]})]})]})})},ei="tui-focusable inline-flex shrink-0 select-none items-center justify-center gap-1 whitespace-nowrap border text-tui font-medium transition-colors",Ns="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",n5="border-tui-accent bg-tui-accent text-tui-crust font-bold",i5="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",l0={default:Ns,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 l5(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"}}const a5={left:{glyph:"󰜱",box:[0,660,34,686]},up:{glyph:"󰜷",box:[0,652,30,690]},down:{glyph:"󰜮",box:[0,652,30,690]},right:{glyph:"󰜴",box:[0,660,34,686]},enter:{glyph:"󱞦",box:[0,709,-36,756]},backspace:{glyph:"󰁮",box:[0,1e3,-15,735]},shift:{glyph:"󰘶",box:[0,832,26,694]},open:{glyph:"󰍠",box:[91,509,256,464]},close:{glyph:"󰍝",box:[91,509,256,464]},image:{glyph:"󰋩",box:[0,750,-15,735]},customize:{glyph:"󰙪",box:[0,750,-15,735]},admin:{glyph:"󰢏",box:[0,750,-99,819]}},s5={"←":"left","↑":"up","↓":"down","→":"right","⏎":"enter","⌫":"backspace","⇧":"shift"},o5=.9,r5=.86,rd=1e3;function c5([l,n,a,s]){const r=o5*rd/Math.max(n-l,s-a),c=(l+n)/2/rd,f=r5-(a+s)/2/rd;return{fontSize:`${r}em`,left:`${(.5-r*c)*100}%`,top:`${(.5-r*f)*100}%`}}function sn({name:l}){const n=a5[l];return h.jsx("span",{"aria-hidden":"true","data-key-icon":l,className:"relative inline-block size-[1em] shrink-0 overflow-visible",children:h.jsx("span",{className:"absolute leading-none",style:c5(n.box),children:n.glyph})})}function a0({text:l}){return h.jsx("span",{className:"inline-flex items-center",children:[...l].map((n,a)=>{const s=s5[n];return s?h.jsx(sn,{name:s},a):n})})}function u5({keyClass:l,squareKeyClass:n,onCustomize:a,sendCombo:s}){const{settings:r,t:c}=Ee(),{agentProfile:f,shellProfile:m}=it(),p=rw(f,r.agentKeymaps[f],m),g=v=>{let w="";try{w=na(v.combo)}catch{}const x=v.custom?v.customLabel||"":c(`agentActions.${v.labelKey}`),S=v.labelKey==="interrupt"&&v.combo.trim().toLowerCase()==="ctrl+c"?"bad":v.combo.trim().toLowerCase()==="ctrl+z"?"warn":"default";return h.jsx("button",{type:"button","data-testid":`agent-key-${v.id}`,onClick:()=>s(v.combo),className:ne(ei,l,"font-bold",l0[S]),title:`${w} ${x}`.trim(),"aria-label":`${w} ${x}`.trim(),children:h.jsx(a0,{text:w||x})},v.id)},y=[...p.agentActions,...p.genericActions];return y.length===0&&!a?null:h.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${nl[f].name} ${c("agentKeymaps.agentGroup")}`,className:"flex shrink-0 items-center gap-1",children:[h.jsx("span",{"aria-hidden":"true",className:"mx-1 h-5 w-px shrink-0 bg-tui-border-dim"}),y.map(g),a&&h.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:a,className:ne(ei,n,"border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:c("agentKeymaps.customizeBar"),"aria-label":c("agentKeymaps.customizeBar"),children:h.jsx(sn,{name:"customize"})})]})}const s0="scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5";function d5({capHeight:l,onKey:n}){return h.jsx("div",{className:"grid grid-cols-6 gap-1 border-b border-tui-border-dim bg-tui-crust p-1.5 sm:grid-cols-12",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(a=>{const s=`F${a}`;return h.jsxs("button",{type:"button",onClick:()=>n(de[s]),className:ne(ei,Ns,l),children:["F",a]},s)})})}const f5=[{code:de.CTRL_C,caption:"^C",title:"virtualKeyboard.ctrlCTitle",badge:"virtualKeyboard.badgeSigint",tone:"bad"},{code:de.CTRL_D,caption:"^D",title:"virtualKeyboard.ctrlDTitle",badge:"virtualKeyboard.badgeEof"},{code:de.CTRL_Z,caption:"^Z",title:"virtualKeyboard.ctrlZTitle",badge:"virtualKeyboard.badgeTstp",tone:"warn"},{code:de.CTRL_L,caption:"^L",title:"virtualKeyboard.ctrlLTitle",badge:"virtualKeyboard.badgeClear"},{code:de.CTRL_R,caption:"^R",title:"virtualKeyboard.ctrlRTitle",badge:"virtualKeyboard.badgeSearch"},{code:de.CTRL_A,caption:"^A",title:"virtualKeyboard.ctrlATitle",badge:"virtualKeyboard.badgeStart"},{code:de.CTRL_E,caption:"^E",title:"virtualKeyboard.ctrlETitle",badge:"virtualKeyboard.badgeEnd"},{code:de.CTRL_K,caption:"^K",title:"virtualKeyboard.ctrlKTitle",badge:"virtualKeyboard.badgeKill"}];function h5({capHeight:l,onKey:n}){const{t:a}=Ee();return h.jsx("div",{className:s0,children:f5.map(s=>h.jsxs("button",{type:"button",onClick:()=>n(s.code,!1),className:ne(ei,l,"gap-1.5 px-2",l0[s.tone??"default"]),title:a(s.title),children:[h.jsx("span",{className:"font-bold",children:s.caption}),h.jsx("span",{className:"text-tui-sm opacity-70",children:a(s.badge)})]},s.caption))})}const m5=["|","~","/","\\","-","_","$","&",";",":","`",'"',"'",">","<","=","#","@","{","}","[","]"];function p5({squareKeyClass:l,onKey:n}){return h.jsx("div",{className:s0,children:m5.map(a=>h.jsx("button",{type:"button",onClick:()=>n(a,!0),className:ne(ei,Ns,l,"font-bold"),children:a},a))})}const hb="image/png,image/jpeg,image/webp,image/gif,image/*";function mb({fileInputRef:l}){const{uploadImage:n}=Cr(),a=s=>{var c;const r=(c=s.target.files)==null?void 0:c[0];s.target.value="",r&&n(r)};return h.jsxs(h.Fragment,{children:[h.jsx("input",{ref:l,type:"file",accept:hb,className:"hidden","data-testid":"key-toolbar-file-input",onChange:a}),h.jsx("input",{type:"file",accept:hb,capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:a})]})}function pb({collapsed:l}){const{uploadProgress:n}=Cr();return n.active?h.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:h.jsx(XS,{ratio:n.ratio,label:n.statusText,tone:n.phase==="completed"?"ok":n.phase==="error"?"bad":"accent","aria-label":n.statusText})}):null}function g5({fileInputRef:l,keyClass:n,squareKeyClass:a,vibrate:s}){const{t:r}=Ee(),{isController:c}=it(),{warnViewerMode:f}=Sr(),{uploadProgress:m}=Cr(),p=m.active,g=()=>{var y;if(s(),!c){f();return}p||(y=l.current)==null||y.click()};return h.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:g,disabled:p,className:ne(ei,p?n:a,p?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":Ns),title:p?m.statusText:r("virtualKeyboard.uploadImageTitle"),"aria-label":r("virtualKeyboard.uploadImage"),children:p?h.jsx("span",{children:`${m.percent}%`}):h.jsx(sn,{name:"image"})})}function b5(){const{settings:l}=Ee(),{isController:n}=it(),{sendKey:a,warnViewerMode:s,consumeModifierLatch:r}=Sr(),c=M.useRef([]);M.useEffect(()=>()=>{for(const g of c.current)clearTimeout(g);c.current=[]},[]);const f=M.useCallback(()=>{if(l.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[l.vibrateOnKeyPress]),m=M.useCallback((g,y=!0)=>{if(f(),!n){s();return}const v=r();a(y&&v?sr(g,v):g)},[n,a,s,f,r]),p=M.useCallback(g=>{if(f(),!n){s();return}let y;try{y=cn(g)}catch{return}if(r(),y.length===1){a(y[0]);return}y.forEach((v,w)=>{const x=setTimeout(()=>{c.current=c.current.filter(S=>S!==x),a(v)},w*120);c.current.push(x)})},[r,n,a,f,s]);return{vibrate:f,pressKey:m,sendCombo:p}}function y5({squareKeyClass:l}){const{platform:n,adminTerminalSupported:a,adapter:s}=it(),{t:r}=Ee();if(n!=="win32")return null;const c=a!==!1;return h.jsx("button",{type:"button","data-testid":"new-admin-terminal",onClick:()=>s==null?void 0:s.sendAdminTabOpen(),disabled:!c,className:ne(ei,l,"border-amber-500/50 bg-amber-500/10 text-amber-200 hover:border-amber-400 hover:bg-amber-500/20 disabled:cursor-not-allowed disabled:opacity-50"),title:r(c?"terminal.adminTerminalSetup":"terminal.adminTerminalUpdate"),"aria-label":r("terminal.newAdminTerminal"),children:h.jsx(sn,{name:"admin"})})}const v5=new Set(["left","up","down","right","enter"]),x5=500,w5=8,S5=({compact:l=!1,onCustomize:n})=>{const{settings:a,updateSettings:s,t:r}=Ee(),{modifierLatch:c,toggleModifierLatch:f}=Sr(),{vibrate:m,pressKey:p,sendCombo:g}=b5(),{capHeight:y,keyClass:v,squareKeyClass:w,drawerToggleClass:x}=l5(l),S=M.useRef(null),T=M.useRef(null),A=M.useRef(null),k=M.useRef(!1);M.useEffect(()=>()=>{T.current&&clearTimeout(T.current)},[]);const[E,N]=M.useState(!1),[B,L]=M.useState(!1),[D,R]=M.useState(!1),z=M.useRef(null),[K,V]=M.useState(!1),te=M.useCallback(()=>{const X=z.current;V(!!X&&X.scrollLeft+X.clientWidth<X.scrollWidth-1)},[]);M.useEffect(te),M.useEffect(()=>{const X=z.current;if(!X||typeof ResizeObserver!="function")return;const ue=new ResizeObserver(te);return ue.observe(X),()=>ue.disconnect()},[te,a.toolbarVisible]);const Z=()=>{T.current&&clearTimeout(T.current),T.current=null},ie=(X,ue)=>{const oe=X.modifierType;X.type!=="modifier"||ue.button!==0||oe!=="ctrl"&&oe!=="alt"&&oe!=="shift"||(Z(),k.current=!1,A.current={pointerId:ue.pointerId,clientX:ue.clientX,clientY:ue.clientY,triggered:!1},T.current=setTimeout(()=>{const pe=A.current;!pe||pe.pointerId!==ue.pointerId||(pe.triggered=!0,k.current=!0,c[oe]||f(oe),m())},x5))},re=X=>{const ue=A.current;!ue||ue.pointerId!==X.pointerId||Math.hypot(X.clientX-ue.clientX,X.clientY-ue.clientY)<=w5||(Z(),ue.triggered||(A.current=null))},ce=X=>{const ue=A.current;!ue||ue.pointerId!==X.pointerId||(Z(),A.current=null,ue.triggered&&setTimeout(()=>{k.current=!1},0))},O=X=>{const ue=A.current;!ue||ue.pointerId!==X.pointerId||(Z(),A.current=null,k.current=!1)};if(!a.toolbarVisible)return h.jsxs("div",{"data-testid":"key-toolbar-collapsed",className:"z-20 flex shrink-0 flex-col border-t border-tui-border bg-tui-mantle pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]",children:[h.jsx(mb,{fileInputRef:S}),h.jsx(pb,{collapsed:!0}),h.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:h.jsxs("button",{type:"button",onClick:()=>s({toolbarVisible:!0}),className:"tui-focusable flex h-6 w-28 items-center justify-center gap-1 text-tui uppercase text-tui-faint transition-colors hover:text-tui-accent",title:r("virtualKeyboard.expandToolbar"),"aria-label":r("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[h.jsx(sn,{name:"open"}),h.jsx("span",{"aria-hidden":"true",children:r("common.keyBar")})]})})]});const J=a.virtualKeys&&a.virtualKeys.length>0?a.virtualKeys.filter(X=>X.enabled):Wb,I=X=>X.id==="left"?h.jsx(sn,{name:"left"}):X.id==="up"?h.jsx(sn,{name:"up"}):X.id==="down"?h.jsx(sn,{name:"down"}):X.id==="right"?h.jsx(sn,{name:"right"}):X.id==="enter"?h.jsx(sn,{name:"enter"}):X.id==="drawer_chords"?h.jsx("span",{children:"^C"}):X.id==="drawer_fn"?h.jsxs(h.Fragment,{children:[h.jsx("span",{children:"Fn"}),h.jsx(sn,{name:E?"close":"open"})]}):h.jsx(a0,{text:X.label}),le=X=>{if(m(),X.type==="modifier"){X.modifierType==="ctrl"||X.modifierType==="alt"||X.modifierType==="shift"?f(X.modifierType):X.modifierType==="meta"&&p(de.ESC);return}if(X.type==="drawer"){X.drawerType==="fn"?(N(!E),L(!1),R(!1)):X.drawerType==="chords"?(R(!D),N(!1),L(!1)):X.drawerType==="symbols"&&(L(!B),N(!1),R(!1));return}p(X.code,X.type!=="chord")},P=X=>{if(X.type==="modifier"){if(X.modifierType==="ctrl")return c.ctrl;if(X.modifierType==="alt")return c.alt;if(X.modifierType==="shift")return c.shift}if(X.type==="drawer"){if(X.drawerType==="fn")return E;if(X.drawerType==="chords")return D;if(X.drawerType==="symbols")return B}return!1},fe=X=>{const ue=P(X),oe=xd(X,r);return h.jsx("button",{type:"button",onPointerDown:pe=>ie(X,pe),onPointerMove:re,onPointerUp:ce,onPointerCancel:O,onClick:()=>{if(k.current){k.current=!1;return}le(X)},className:ne(ei,v5.has(X.id)?w:X.type==="drawer"?x:v,X.id==="enter"?i5:ue?n5:Ns),title:oe,"aria-label":oe,"aria-pressed":ue,children:I(X)},X.id)},ve=J.find(X=>X.id==="enter");return h.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:[h.jsx(mb,{fileInputRef:S}),h.jsx(pb,{collapsed:!1}),E&&h.jsx(d5,{capHeight:y,onKey:p}),D&&h.jsx(h5,{capHeight:y,onKey:p}),B&&h.jsx(p5,{squareKeyClass:w,onKey:p}),h.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:[h.jsxs("div",{className:"relative min-w-0",children:[h.jsxs("div",{ref:z,"data-testid":"key-toolbar-scroll",onScroll:te,className:"scrollbar-none flex flex-nowrap touch-pan-x items-center gap-1 overflow-x-auto overscroll-x-contain",children:[h.jsx("button",{type:"button",onClick:()=>s({toolbarVisible:!1}),className: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:h.jsx(sn,{name:"close"})}),J.filter(X=>X.id!=="enter").map(fe),h.jsx(y5,{squareKeyClass:w}),h.jsx(u5,{keyClass:v,squareKeyClass:w,onCustomize:n,sendCombo:g}),h.jsx(g5,{fileInputRef:S,keyClass:v,squareKeyClass:w,vibrate:m})]}),K&&h.jsx("span",{"aria-hidden":"true","data-testid":"key-toolbar-more",className:"pointer-events-none absolute inset-y-0 right-0 w-4 bg-gradient-to-l from-tui-mantle"})]}),ve&&fe(ve)]})]})},C5=({hint:l,children:n})=>{const{t:a}=Ee(),[s,r]=M.useState(!1);return h.jsxs("div",{className:"border border-tui-border-dim",children:[h.jsxs("button",{type:"button",onClick:()=>r(!s),"aria-expanded":s,className:"tui-focusable flex w-full items-center gap-2 px-2 py-1 text-left text-tui text-tui-muted transition-colors hover:text-tui-accent",children:[h.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:s?_e.chevronDown:_e.chevronRight}),h.jsx("span",{children:a("pairing.advancedTitle")}),h.jsx("span",{className:"min-w-0 truncate text-tui-sm text-tui-faint",children:l})]}),s&&h.jsx("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:n})]})},T5=({isOpen:l,onClose:n})=>{const{t:a,addProfileAndConnect:s}=Ee(),{addToast:r}=dn(),[c,f]=M.useState(""),[m,p]=M.useState(Ut),[g,y]=M.useState("");M.useEffect(()=>{l&&(f(""),p(Ut),y(""))},[l]);const v=w=>{w.preventDefault();const x=c.trim().toUpperCase();if(!x&&!g.trim()){r("warning",a("pairing.credentialsRequired"));return}s({wsUrl:m.trim()||Ut,pairCode:x,token:g.trim()}),n()};return h.jsx(ma,{isOpen:l,onClose:n,title:a("pairing.addTitle"),subtitle:a("pairing.addSubtitle"),closeLabel:a("common.closeDialog"),size:"sm",hints:[{keys:"esc",action:a("common.close")},{keys:"⏎",action:a("pairing.pairAndConnect")}],footer:h.jsx(Ae,{variant:"primary",type:"submit",form:"add-host-form",children:a("pairing.pairAndConnect")}),children:h.jsxs("form",{id:"add-host-form",onSubmit:v,className:"space-y-3",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx(sl,{htmlFor:"add-host-code",hint:a("pairing.pairCodeNote"),children:a("pairing.pairCodeLabel")}),h.jsx(un,{id:"add-host-code",type:"text",value:c,onChange:w=>f(w.target.value.toUpperCase()),placeholder:a("pairing.pairCodePlaceholder"),maxLength:12,autoComplete:"off",autoFocus:!0,className:"font-bold uppercase"}),h.jsx("p",{className:"text-tui-sm text-tui-faint",children:a("pairing.pairCodeHelp")})]}),h.jsxs(C5,{hint:a("pairing.advancedHint"),children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx(sl,{htmlFor:"add-host-ws",children:a("pairing.wsUrlLabel")}),h.jsx(un,{id:"add-host-ws",type:"text",value:m,onChange:w=>p(w.target.value),placeholder:a("onboarding.wsEndpointPlaceholder")})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx(sl,{htmlFor:"add-host-token",hint:a("pairing.tokenNote"),children:a("pairing.tokenLabel")}),h.jsx(un,{id:"add-host-token",type:"password",value:g,onChange:w=>y(w.target.value),placeholder:a("onboarding.manualTokenPlaceholder")})]})]})]})})},_i=ne(Mr,"py-0"),M5="h-7 py-0",jd="h-7 py-0 px-1.5",xr="text-tui-bad hover:border-tui-bad hover:text-tui-bad",A5=["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 o0(l){return{offLabel:l("settings.toggleOff"),onLabel:l("settings.toggleOn")}}const E5=["ctrl","alt","shift"],k5=[[..."1234567890"].map(l=>({token:l,label:l})),[..."qwertyuiop"].map(l=>({token:l,label:l.toUpperCase()})),[..."asdfghjkl"].map(l=>({token:l,label:l.toUpperCase()})),[..."zxcvbnm"].map(l=>({token:l,label:l.toUpperCase()})),["-","=","[","]","backslash",";","'",",",".","/","plus"].map(l=>({token:l,label:l==="backslash"?"\\":l==="plus"?"+":l}))],N5=[{token:"esc",label:"ESC"},{token:"tab",label:"TAB"},{token:"space",label:"SPACE"},{token:"enter",label:"ENTER"},{token:"backspace",label:"⌫"},{token:"delete",label:"DEL"},{token:"insert",label:"INS"},{token:"home",label:"HOME"},{token:"end",label:"END"},{token:"pageup",label:"PGUP"},{token:"pagedown",label:"PGDN"},{token:"left",label:"←"},{token:"up",label:"↑"},{token:"down",label:"↓"},{token:"right",label:"→"},...Array.from({length:12},(l,n)=>({token:`f${n+1}`,label:`F${n+1}`}))],cd="tui-focusable min-w-0 border border-tui-border bg-tui-mantle px-1.5 py-1 text-tui-sm font-bold text-tui-text transition-colors hover:border-tui-accent hover:text-tui-accent";function _5(l){const n=l.trim();if(!n)return[];try{return cn(n),n.split(/\s+/)}catch{return[]}}function L5({isOpen:l,value:n,onClose:a,onApply:s}){const{t:r}=Ee(),[c,f]=M.useState([]),m=M.useRef(0),[p,g]=M.useState([]);M.useEffect(()=>{l&&(m.current=0,f(_5(n).map(S=>({id:m.current++,combo:S}))),g([]))},[l,n]);const y=S=>{g(T=>T.includes(S)?T.filter(A=>A!==S):[...T,S])},v=S=>{if(c.length>=8)return;const T=[...p,S].join("+");f(A=>[...A,{id:m.current++,combo:T}]),g([])},w=c.map(S=>S.combo).join(" "),x=c.length>0&&p.length===0;return h.jsx(ma,{isOpen:l,onClose:a,title:r("agentKeymaps.comboPickerTitle"),closeLabel:r("common.closeDialog"),size:"lg",footer:h.jsxs(h.Fragment,{children:[h.jsx(Ae,{variant:"ghost",onClick:a,children:r("common.cancel")}),h.jsx(Ae,{variant:"primary",disabled:!x,onClick:()=>s(w),"data-testid":"combo-picker-apply",children:r("agentKeymaps.comboPickerApply")})]}),children:h.jsxs("div",{className:"space-y-3",children:[h.jsx("p",{className:"text-tui-sm text-tui-faint",children:r("agentKeymaps.comboPickerHint")}),h.jsxs("div",{className:"space-y-1",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("span",{className:"text-tui-sm text-tui-muted",children:r("agentKeymaps.comboPickerSelection")}),h.jsx(Ae,{variant:"ghost",disabled:c.length===0&&p.length===0,onClick:()=>{f([]),g([])},children:r("agentKeymaps.comboPickerClear")})]}),h.jsxs("div",{"data-testid":"combo-picker-selection",className:"flex min-h-9 flex-wrap items-center gap-1 border border-tui-border-dim bg-tui-crust p-1",children:[c.map((S,T)=>{let A=S.combo;try{A=na(S.combo)}catch{}return h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx(pr,{children:A}),h.jsx("button",{type:"button","aria-label":r("agentKeymaps.comboPickerRemoveStep",{step:T+1}),className:"tui-focusable text-tui-faint hover:text-tui-bad",onClick:()=>f(k=>k.filter(E=>E.id!==S.id)),children:"×"})]},S.id)}),p.map(S=>h.jsx(pr,{active:!0,children:S.toUpperCase()},S)),c.length===0&&p.length===0&&h.jsx("span",{className:"px-1 text-tui-sm text-tui-faint",children:r("agentKeymaps.comboPickerEmpty")})]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"mb-1 text-tui-sm text-tui-muted",children:r("agentKeymaps.comboPickerModifiers")}),h.jsx("div",{className:"flex gap-1",children:E5.map(S=>h.jsx("button",{type:"button","aria-pressed":p.includes(S),onClick:()=>y(S),className:`${cd} ${p.includes(S)?"border-tui-accent bg-tui-accent text-tui-crust":""}`,children:S.toUpperCase()},S))})]}),h.jsxs("fieldset",{className:"space-y-1.5",children:[h.jsx("legend",{className:"sr-only",children:r("agentKeymaps.comboPickerKeyboard")}),k5.map(S=>h.jsx("div",{className:"grid grid-cols-10 gap-1",children:S.map(({token:T,label:A})=>h.jsx("button",{type:"button","aria-label":A,className:cd,disabled:c.length>=8,onClick:()=>v(T),children:A},T))},S.map(({token:T})=>T).join("-"))),h.jsx("div",{className:"flex flex-wrap gap-1",children:N5.map(({token:S,label:T})=>h.jsx("button",{type:"button","aria-label":T,className:cd,disabled:c.length>=8,onClick:()=>v(S),children:T},S))})]})]})})}const R5=({profile:l,onProfileChange:n})=>{const{settings:a,updateSettings:s,t:r}=Ee(),{agentProfile:c}=it(),[f,m]=M.useState({}),p=M.useRef({}),[g,y]=M.useState(""),[v,w]=M.useState(""),[x,S]=M.useState(null),T=l||c,A=a.agentKeymaps[T]||{},k=Rb(T,A),E=jb(T,A),N=E.filter(I=>!I.hidden).length,B=I=>I.custom?I.customLabel||"":r(`agentActions.${I.labelKey}`),L=I=>{try{return na(I.combo)}catch{return I.combo}},D=I=>{s({agentKeymaps:{...a.agentKeymaps,[T]:I}})},R=(I,le)=>{var P;D({...A,actions:{...A.actions,[I]:{...(P=A.actions)==null?void 0:P[I],...le}}})},z=I=>{R(I.id,{keys:I.defaultCombo})},K=(I,le)=>{const P=I+(le==="up"?-1:1);if(P<0||P>=k.length)return;const fe=k.map(ve=>ve.id);[fe[I],fe[P]]=[fe[P],fe[I]],D({...A,order:fe})},V=I=>{var le;D({...A,custom:(A.custom||[]).filter(P=>P.id!==I),order:(le=A.order)==null?void 0:le.filter(P=>P!==I)})},te=()=>D(cw(A)),Z=()=>{const I={...a.agentKeymaps};delete I[T],s({agentKeymaps:I})},ie=()=>{const I=g.trim();if(!I)return;try{cn(v)}catch{return}const le=`custom-${Date.now().toString(36)}`;D({...A,custom:[...A.custom||[],{id:le,label:I,keys:v.trim()}],order:[...k.map(P=>P.id),le]}),y(""),w("")},re=I=>I instanceof pn?r(`agentKeymaps.errors.${I.code}`,I.params):String(I),ce=(I,le)=>`${I}:${le}`,O=(I,le)=>{const P=ce(T,I);p.current={...p.current,[P]:le},m(p.current);try{cn(le),R(I,{keys:le})}catch{}},J=I=>{const le=ce(T,I),P=p.current[le];if(P!==void 0){delete p.current[le],m({...p.current});try{cn(P),R(I,{keys:P})}catch{}}};return h.jsxs("div",{className:"space-y-4",children:[h.jsx(gn,{title:r("agentKeymaps.settingsProfileLabel"),aside:h.jsx(Ae,{variant:"ghost",onClick:Z,className:ne(xr,jd),children:r("agentKeymaps.restoreProfile")}),children:h.jsx(Bt,{label:r("agentKeymaps.profileRowLabel"),htmlFor:"agent-keymap-profile",hint:nl[T].configHint?r("agentKeymaps.configHint",{path:nl[T].configHint}):void 0,control:h.jsx(Tr,{id:"agent-keymap-profile","aria-label":r("agentKeymaps.settingsProfileLabel"),value:T,onChange:I=>n(I.target.value),className:_i,children:Qx.map(I=>h.jsx("option",{value:I,children:nl[I].name},I))})})}),h.jsx(gn,{title:r("agentKeymaps.barGroup"),aside:h.jsx(Ae,{variant:"ghost",onClick:te,className:ne(xr,jd),children:r("agentKeymaps.restoreBar")}),children:h.jsxs("div",{className:"space-y-2 py-1.5",children:[h.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r("agentKeymaps.barHint",{profile:nl[T].name,count:N})}),h.jsx("div",{role:"group","aria-label":r("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:E.map(I=>{const le=B(I),P=L(I),fe=!I.hidden;return h.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${I.id}`,"aria-pressed":fe,onClick:()=>R(I.id,{hidden:fe}),title:`${P} ${le}`.trim(),className:ne("tui-focusable inline-flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",fe?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent"),children:[h.jsx("span",{"aria-hidden":"true",className:"font-bold",children:fe?_e.check:"+"}),h.jsx("span",{className:"font-bold",children:P}),h.jsx("span",{className:fe?void 0:"opacity-80",children:le})]},I.id)})})]})}),h.jsx(gn,{title:r("agentKeymaps.listGroup",{profile:nl[T].name}),children:k.map((I,le)=>{var se,xe;const P=B(I),fe=r("agentKeymaps.defaultCombo",{combo:na(I.defaultCombo)}),ve=((xe=(se=A.actions)==null?void 0:se[I.id])==null?void 0:xe.keys)??I.combo,X=ce(T,I.id),ue=f[X]??ve;let oe="",pe=null;try{cn(ue),oe=na(ue)}catch(ae){pe=re(ae)}return h.jsxs("div",{"data-testid":`agent-setting-row-${I.id}`,className:A5,children:[h.jsx(pr,{className:"w-full overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:oe||"—"}),h.jsxs("span",{className:"min-w-0 break-words text-tui text-tui-text [grid-area:label]",title:P,children:[P,!I.verified&&h.jsx("span",{className:"ml-1 text-tui-sm text-tui-faint",children:r("agentKeymaps.unverified")})]}),h.jsxs("label",{className:"sr-only",htmlFor:`agent-combo-${I.id}`,children:[r("agentKeymaps.shortcutLabel")," ",P]}),h.jsx(un,{id:`agent-combo-${I.id}`,"aria-label":`${r("agentKeymaps.shortcutLabel")} ${P}`,value:ue,onChange:ae=>O(I.id,ae.target.value),onClick:()=>S({kind:"action",actionId:I.id,value:ue}),inputMode:"none",onBlur:()=>J(I.id),onKeyDown:ae=>{ae.key==="Enter"&&ae.currentTarget.blur()},placeholder:r("agentKeymaps.comboPlaceholder"),"aria-invalid":!!pe,className:ne("w-full min-w-0 [grid-area:combo]",M5)}),h.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint [grid-area:default]",title:fe,children:fe}),h.jsxs("div",{className:"flex items-center justify-end [grid-area:actions]",children:[h.jsx(ll,{onClick:()=>z(I),title:r("agentKeymaps.resetAction"),"aria-label":`${r("agentKeymaps.resetAction")} ${P}`,children:"↺"}),h.jsx(ll,{disabled:le===0,onClick:()=>K(le,"up"),title:r("agentKeymaps.moveUp"),"aria-label":`${r("agentKeymaps.moveUp")} ${P}`,children:"↑"}),h.jsx(ll,{disabled:le===k.length-1,onClick:()=>K(le,"down"),title:r("agentKeymaps.moveDown"),"aria-label":`${r("agentKeymaps.moveDown")} ${P}`,children:"↓"}),I.custom?h.jsx(ll,{variant:"danger",onClick:()=>V(I.id),title:r("agentKeymaps.removeCustom"),"aria-label":`${r("agentKeymaps.removeCustom")} ${P}`,children:_e.cross}):h.jsx("span",{"aria-hidden":"true",className:"h-7 w-7 shrink-0"})]}),pe&&h.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:r("agentKeymaps.invalidCombo",{error:pe})})]},I.id)})}),h.jsx(gn,{title:r("agentKeymaps.addCustom"),children:h.jsxs("div",{className:"space-y-1 py-1.5",children:[h.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[h.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[h.jsx("span",{children:r("agentKeymaps.customLabel")}),h.jsx(un,{value:g,onChange:I=>y(I.target.value),className:_i})]}),h.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[h.jsx("span",{children:r("agentKeymaps.customCombo")}),h.jsx(un,{value:v,onChange:I=>w(I.target.value),onClick:()=>S({kind:"custom",value:v}),inputMode:"none",placeholder:r("agentKeymaps.comboPlaceholder"),className:_i})]}),h.jsx(Ae,{variant:"primary",glyph:"+",onClick:ie,disabled:!g.trim()||!v.trim(),className:_i,children:r("agentKeymaps.addAction")})]}),v.trim()&&(()=>{try{return cn(v),h.jsx("p",{className:"text-tui-sm text-tui-info",children:na(v)})}catch(I){const le=re(I);return h.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:le})}})()]})}),x&&h.jsx(L5,{isOpen:!0,value:x.value,onClose:()=>S(null),onApply:I=>{x.kind==="custom"?w(I):(O(x.actionId,I),J(x.actionId)),S(null)}})]})},r0={"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:n,declineHostFont:a,settings:s,activeProfile:r,t:c}=Ee(),{herdrLaunch:f,hostname:m}=it(),{addToast:p}=dn(),{font:g,status:y,glyphs:v}=l,w=y==="loading"||v.status==="loading",x=y==="failed"||v.status==="failed",S=M.useRef(!1);M.useEffect(()=>{S.current&&!w&&!x&&l.interactive&&p("success",c("hostFont.loaded")),S.current=w&&l.interactive},[w,x,l.interactive,p,c]);const T=y==="available"||v.status==="available",A=l.interactive&&(w||x);if(!(g&&s.fontFamily==="host"&&!f&&(T||A)))return null;const E=y==="available"||l.interactive&&(y==="loading"||y==="failed"),N=v.source&&(v.status==="available"||l.interactive&&(v.status==="loading"||v.status==="failed")),B=m||(r==null?void 0:r.displayName)||c("herdrLaunch.thisHost"),L=[g.sizePx?`${Math.round(g.sizePx)}px`:null,g.source?r0[g.source]||g.source:null].filter(Boolean).join(c("hostFont.detailSeparator")),D=l.error&&j5.includes(l.error)?l.error:"other",R=l.totalBytes?l.receivedBytes/l.totalBytes:0;return h.jsx("div",{"data-testid":"host-font-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:h.jsxs(Et,{title:c("hostFont.title"),tone:y==="failed"?"bad":"accent",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":c("hostFont.title"),children:[h.jsx("p",{className:"leading-snug text-tui-text",children:E||!v.source?c("hostFont.body",{host:B,family:g.family,detail:L?c("hostFont.detail",{detail:L}):""}):c("hostFont.bodyGlyphsOnly",{host:B,family:v.source.family})}),w?h.jsxs("div",{className:"space-y-1",role:"status",children:[h.jsx(qS,{value:R,width:32,className:"max-w-full overflow-hidden"}),h.jsx("p",{className:"text-tui-sm text-tui-muted",children:c("hostFont.loading",{received:Vu(l.receivedBytes),total:Vu(l.totalBytes)})})]}):h.jsxs(h.Fragment,{children:[x?h.jsx(Ri,{tone:"bad",children:c("hostFont.failed",{reason:c(`hostFont.reasons.${D}`)})}):h.jsxs("div",{className:"space-y-1 text-tui-sm leading-snug text-tui-faint",children:[E&&g.faces.length?h.jsx("p",{children:c("hostFont.download",{count:g.faces.length,size:Vu(l.totalBytes)})}):null,N&&v.source?h.jsx("p",{children:c(v.source.scope==="all"?"hostFont.glyphsAll":"hostFont.glyphs",{family:v.source.family})}):null]}),h.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[h.jsx(Ae,{onClick:a,children:c("hostFont.decline")}),h.jsx(Ae,{variant:"primary",onClick:n,autoFocus:!0,children:c(x?"common.retry":"hostFont.load")})]})]})]})})},D5=({onOpenAdmin:l})=>{var L;const{settings:n,updateSettings:a,language:s,setLanguage:r,t:c,hostFont:f,syncHostFont:m,terminalFontFamily:p,terminalFontSize:g}=Ee(),{connectionState:y}=it(),v=gd.find(D=>D.id===n.fontFamily),w=(D,R)=>D==="host"||D==="system"?c(`fontPresets.${D}`):R,x=(()=>{const{font:D,status:R}=f,z=f.totalBytes?Math.round(f.receivedBytes/f.totalBytes*100):0,K=c(`settings.hostFontStatus.${R}`,{percent:z});return D?[D.family,D.sizePx?`${Math.round(D.sizePx)}px`:null,D.source?r0[D.source]||D.source:null,K].filter(Boolean).join(" · "):K})(),S=(L=f.font)!=null&&L.sizePx?ra(f.font.sizePx):null,T=f.glyphs.source&&f.glyphs.status!=="none"?c("settings.hostGlyphLine",{family:f.glyphs.source.family,status:c(`settings.hostGlyphStatus.${f.glyphs.status}`,{count:f.glyphs.covered.toLocaleString()})}):null,A=typeof window<"u"&&window.isSecureContext&&"Notification"in window,k=10,E=24,N=o0(c),B=S?c("settings.fontSizeFollowHost",{size:S}):c("settings.fontSizeFollowHostUnknown");return h.jsxs("div",{className:"space-y-4",children:[h.jsx(gn,{title:c("settings.sectionInterface"),children:h.jsx(Bt,{label:c("settings.languageLabel"),hint:c("settings.languageHint"),control:h.jsx(gr,{name:"ui-language","aria-label":c("settings.languageLabel"),value:s,onChange:r,options:[{value:"zh",label:"简体中文"},{value:"en",label:"English"}]})})}),h.jsxs(gn,{title:c("settings.sectionFont"),children:[h.jsx(Bt,{label:c("settings.fontFamilyLabel"),htmlFor:"terminal-font-select",control:h.jsxs(Tr,{id:"terminal-font-select",value:n.fontFamily,onChange:D=>a({fontFamily:D.target.value}),"aria-label":c("settings.fontFamilyLabel"),className:_i,children:[!v&&h.jsx("option",{value:n.fontFamily,children:n.fontFamily}),gd.map(D=>h.jsx("option",{value:D.id,children:w(D.id,D.name)},D.id))]})}),n.fontFamily==="host"&&h.jsx(Bt,{label:c("settings.hostFontLabel"),hint:h.jsxs(h.Fragment,{children:[h.jsx("span",{"data-testid":"host-font-status",className:"block break-words text-tui-info",children:x}),T?h.jsx("span",{"data-testid":"host-glyph-status",className:"block break-words",children:T}):null]}),control:h.jsx(Ae,{block:!0,onClick:m,disabled:y!=="connected"||f.status==="loading"||f.glyphs.status==="loading",className:_i,children:c("settings.hostFontSync")})}),h.jsx(Bt,{label:c("settings.fontSizeLabel",{size:g}),hint:c("settings.fontSizeHint"),htmlFor:"terminal-font-size",control:h.jsx("div",{className:ne("flex items-center",Mr),children:h.jsx("input",{id:"terminal-font-size",type:"range",min:k,max:E,step:1,value:g,onChange:D=>a({fontSize:Number(D.target.value),fontSizeFollowsHost:!1}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})})}),h.jsx(Bt,{label:B,control:h.jsx(Ni,{label:B,...N,checked:n.fontSizeFollowsHost,onChange:D=>a(D?{fontSizeFollowsHost:!0}:{fontSizeFollowsHost:!1,fontSize:g})})}),h.jsx("div",{className:"py-1.5",children:h.jsxs("div",{className:"overflow-x-auto whitespace-nowrap border border-tui-border bg-tui-mantle px-2 py-1.5 leading-snug text-tui-text",style:{fontFamily:p,fontSize:`${g}px`},children:[h.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})})]}),h.jsxs(gn,{title:c("settings.sectionInput"),children:[h.jsx(Bt,{label:c("settings.predictiveEchoLabel"),hint:c("settings.predictiveEchoDesc"),control:h.jsx(gr,{name:"predictive-echo","aria-label":c("settings.predictiveEchoLabel"),value:n.predictiveEcho,onChange:D=>a({predictiveEcho:D}),options:[{value:"auto",label:c("settings.predictiveEchoAuto")},{value:"always",label:c("settings.predictiveEchoAlways")},{value:"off",label:c("settings.predictiveEchoOff")}]})}),h.jsx(Bt,{label:c("settings.touchKeyToolbar"),hint:c("settings.touchKeyToolbarDesc"),control:h.jsx(Ni,{label:c("settings.touchKeyToolbar"),...N,checked:n.toolbarVisible,onChange:D=>a({toolbarVisible:D})})}),h.jsx(Bt,{label:c("settings.touchHaptics"),hint:c("settings.touchHapticsDesc"),control:h.jsx(Ni,{label:c("settings.touchHaptics"),...N,checked:n.vibrateOnKeyPress,onChange:D=>a({vibrateOnKeyPress:D})})})]}),h.jsxs(gn,{title:c("settings.agentAlertsLabel"),children:[h.jsx(Bt,{label:c("settings.agentAlertBadge"),hint:c("settings.agentAlertBadgeDesc"),control:h.jsx(Ni,{label:c("settings.agentAlertBadge"),...N,checked:n.agentAlertBadge,onChange:D=>a({agentAlertBadge:D})})}),h.jsx(Bt,{label:c("settings.agentAlertVibrate"),hint:c("settings.agentAlertVibrateDesc"),control:h.jsx(Ni,{label:c("settings.agentAlertVibrate"),...N,checked:n.agentAlertVibrate,onChange:D=>a({agentAlertVibrate:D})})}),h.jsx(Bt,{label:c("settings.agentAlertSound"),hint:c("settings.agentAlertSoundDesc"),control:h.jsx(Ni,{label:c("settings.agentAlertSound"),...N,checked:n.agentAlertSound,onChange:D=>{a({agentAlertSound:D}),D&&(ry(),cy("done"))}})}),A&&h.jsx(Bt,{label:c("settings.agentAlertNotify"),hint:c("settings.agentAlertNotifyDesc"),control:h.jsx(Ni,{label:c("settings.agentAlertNotify"),...N,checked:n.agentAlertNotify,onChange:D=>{if(D&&Notification.permission!=="granted"){Notification.requestPermission().then(R=>a({agentAlertNotify:R==="granted"}));return}a({agentAlertNotify:D})}})})]}),l&&h.jsx(gn,{title:c("settings.sectionAdmin"),children:h.jsx(Bt,{label:c("settings.adminEntry"),hint:c("settings.adminEntryHint"),control:h.jsx(Ae,{block:!0,variant:"primary",glyph:_e.arrowRight,onClick:l,className:_i,children:c("settings.adminEntryOpen")})})})]})},z5=()=>{const{settings:l,updateSettings:n,t:a}=Ee(),{addToast:s}=dn(),[r,c]=M.useState(!1),f=o0(a),m=l.virtualKeys&&l.virtualKeys.length>0?l.virtualKeys:Cs(),p=x=>{const S=m.map(T=>T.id===x?{...T,enabled:!T.enabled}:T);n({virtualKeys:S})},g=(x,S)=>{const T=S==="up"?x-1:x+1;if(T<0||T>=m.length)return;const A=[...m],k=A[x];A[x]=A[T],A[T]=k,n({virtualKeys:A})},y=x=>{if(m.some(T=>T.id===x.id)){const T=m.map(A=>A.id===x.id?{...A,enabled:!0}:A);n({virtualKeys:T})}else{const T=[...m,{...x,enabled:!0}];n({virtualKeys:T})}c(!1)},v=x=>{const S=m.filter(T=>T.id!==x);n({virtualKeys:S})},w=()=>{n({virtualKeys:Cs()}),s("info",a("toasts.keyLayoutReset"))};return h.jsxs("div",{className:"space-y-3",children:[h.jsx(gn,{title:a("virtualKeyboard.customizeTitle"),aside:h.jsx(Ae,{variant:"ghost",onClick:w,className:ne(xr,jd),children:a("virtualKeyboard.resetLayout")}),children:m.map((x,S)=>{const T=xd(x,a);return h.jsxs("div",{className:"flex items-center gap-2 py-1",children:[h.jsx(pr,{className:ne("w-16 shrink-0 truncate",!x.enabled&&"opacity-50"),children:x.label}),h.jsx("span",{className:ne("min-w-0 flex-1 break-words text-tui",x.enabled?"text-tui-text":"text-tui-faint"),children:T}),h.jsx(Ni,{label:`${a("virtualKeyboard.enableKey")} ${x.label}`,...f,checked:x.enabled,onChange:()=>p(x.id),className:"h-7 w-24 shrink-0"}),h.jsx(ll,{disabled:S===0,onClick:()=>g(S,"up"),title:a("virtualKeyboard.moveUp"),"aria-label":a("virtualKeyboard.moveUp"),children:"↑"}),h.jsx(ll,{disabled:S===m.length-1,onClick:()=>g(S,"down"),title:a("virtualKeyboard.moveDown"),"aria-label":a("virtualKeyboard.moveDown"),children:"↓"}),h.jsx(ll,{variant:"danger",onClick:()=>v(x.id),title:a("virtualKeyboard.deleteKeyTitle"),"aria-label":a("virtualKeyboard.deleteKeyTitle"),children:_e.cross})]},x.id)})}),h.jsx(Ae,{block:!0,glyph:"+",onClick:()=>c(!r),className:ne("border-dashed",_i),children:a("virtualKeyboard.addKey")}),r&&h.jsx(gn,{title:a("virtualKeyboard.availableKeys"),children:h.jsx("div",{className:"flex flex-wrap gap-1 py-1.5",children:E1.map(x=>{const S=m.some(T=>T.id===x.id);return h.jsxs("button",{type:"button",onClick:()=>y(x),title:xd(x,a),className:ne("tui-focusable flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",S?"border-tui-border-dim text-tui-faint":"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent"),children:[h.jsx("span",{children:x.label}),h.jsx("span",{"aria-hidden":"true",className:S?"text-tui-ok":"text-tui-accent",children:S?_e.check:"+"})]},x.id)})})})]})},H5=({isOpen:l,onClose:n,initialTab:a,onOpenAdmin:s})=>{const{updateSettings:r,t:c,activeProfile:f}=Ee(),{addToast:m}=dn(),[p,g]=M.useState("general"),[y,v]=M.useState(null);if(M.useEffect(()=>{!l||!a||(g(a),v(null))},[l,a]),!l)return null;const w=()=>{const x=ey();r({fontSize:x.fontSize,fontSizeFollowsHost:x.fontSizeFollowsHost,fontFamily:x.fontFamily,toolbarVisible:x.toolbarVisible,vibrateOnKeyPress:x.vibrateOnKeyPress,predictiveEcho:x.predictiveEcho,agentAlertBadge:x.agentAlertBadge,agentAlertSound:x.agentAlertSound,agentAlertVibrate:x.agentAlertVibrate,agentAlertNotify:x.agentAlertNotify,virtualKeys:x.virtualKeys}),m("info",c("settings.resetDefaultsToast"))};return h.jsxs(ma,{isOpen:l,onClose:n,title:c("settings.title"),subtitle:f?c("settings.subtitleInstance",{name:f.displayName}):c("settings.subtitle"),closeLabel:c("common.closeDialog"),size:"lg",fixedHeight:!0,hints:[{keys:"esc",action:c("common.close")}],footer:h.jsxs(h.Fragment,{children:[h.jsx(Ae,{variant:"ghost",onClick:w,className:xr,children:c("settings.resetDefaults")}),h.jsx(Ae,{variant:"primary",onClick:n,children:c("common.done")})]}),children:[h.jsx(Pd,{tabs:[{id:"general",label:c("settings.tabGeneral"),index:1},{id:"virtualKeys",label:c("settings.tabVirtualKeys"),index:2},{id:"agentKeymaps",label:c("settings.tabAgentKeymaps"),index:3}],activeId:p,onSelect:x=>g(x),className:"mb-3 border-b border-tui-border-dim pb-1"}),p==="general"&&h.jsx(D5,{onOpenAdmin:s}),p==="virtualKeys"&&h.jsx(z5,{}),p==="agentKeymaps"&&h.jsx(R5,{profile:y,onProfileChange:v})]})},B5={success:"ok",warning:"warn",error:"bad",info:"accent"},U5={success:_e.check,warning:_e.warn,error:_e.cross,info:"›"},K5=()=>{const{t:l}=Ee(),{toasts:n,removeToast:a}=dn();return n.length===0?null:h.jsx("div",{className:"pointer-events-none fixed right-2 top-12 z-50 flex w-[calc(100vw-16px)] max-w-sm flex-col gap-1","aria-live":"polite","aria-atomic":"true",children:n.map(s=>{const r=B5[s.type];return h.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",rn[r].edgeL),role:"alert",children:[h.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",rn[r].text),children:U5[s.type]}),h.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:s.message}),s.count>1&&h.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted",children:["×",s.count]}),h.jsx("button",{type:"button",onClick:()=>a(s.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":l("common.dismissNotification"),children:h.jsx("span",{"aria-hidden":"true",children:_e.cross})})]},s.id)})})};function Qd(l,n){const a=(s,r)=>n?n(s):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 c0=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}];function I5(l){return l?l.total>0||c0.some(({status:n})=>{var a;return(((a=l.counts)==null?void 0:a[n])??0)>0}):!1}const u0=({className:l,compact:n=!1})=>{const{t:a}=Ee(),{agentStatus:s}=it();if(!s)return null;const r=c0.map(({status:f,level:m})=>{var p;return{status:f,level:m,count:((p=s.counts)==null?void 0:p[f])??0}}).filter(f=>f.count>0),c=n?r.slice(0,1):r;return c.length===0?s.total===0?null:h.jsxs("span",{"data-testid":"agent-status-chip",className:ne("flex shrink-0 items-center gap-1 px-1 text-tui-muted",l),title:a("agents.title"),children:[h.jsx(bn,{level:"idle"}),h.jsx("span",{className:"text-tui-faint",children:a("agents.allIdle")})]}):h.jsx("span",{"data-testid":"agent-status-chip",className:ne("flex shrink-0 items-center gap-2 px-1",l),title:a("agents.title"),children:c.map(({status:f,level:m,count:p})=>h.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[h.jsx(bn,{level:m}),h.jsx("span",{className:"text-tui-text",children:p}),h.jsx("span",{className:"text-tui-faint",children:a(`agents.${f}`)})]},f))})},Jd=({onAddProfile:l,mobile:n=!1,statusBar:a=!1})=>{const{profiles:s,activeProfileId:r,activeProfile:c,switchProfile:f,renameProfile:m,removeProfile:p,t:g}=Ee(),{connectionState:y}=it(),[v,w]=M.useState(!1),[x,S]=M.useState(null),[T,A]=M.useState(""),k=M.useRef(null);M.useEffect(()=>{if(!v)return;const R=z=>{k.current&&!k.current.contains(z.target)&&w(!1)};return document.addEventListener("pointerdown",R),()=>document.removeEventListener("pointerdown",R)},[v]);const E=(R,z)=>{S(R),A(z)},N=R=>{const z=T.trim();z&&m(R,z),S(null)},B=R=>{typeof window<"u"&&!window.confirm(g("profiles.removeConfirm"))||(p(R),S(null))},L=(c==null?void 0:c.displayName)||g("profiles.addHost"),D=y==="connected"?"ok":y==="connecting"||y==="reconnecting"?"warn":y==="error"?"bad":"idle";return h.jsxs("div",{ref:k,className:ne("relative min-w-0",n&&"w-full",a&&"flex-1",!n&&!a&&"h-full",!n&&!a&&"shrink-0"),children:[h.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":v,"aria-label":g("profiles.switcherLabel"),onClick:()=>w(R=>!R),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":n?"min-h-11 w-full px-2":"h-full max-w-[18rem] px-1"),children:[h.jsx(bn,{level:D}),h.jsx("span",{className:ne("min-w-0 truncate text-tui-text",a&&"flex-1"),children:L}),h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:v?_e.chevronDown:_e.chevronRight})]}),v&&h.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)]":n?"inset-x-0 bottom-auto top-full mt-1 mb-0 w-full":"w-80 max-w-[calc(100vw-1rem)]"),children:[h.jsx("div",{className:"border-b border-tui-border-dim px-2 py-1 text-tui-sm uppercase text-tui-faint",children:g("profiles.title")}),s.length===0?h.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:g("profiles.empty")}):s.map(R=>{const z=R.id===r,K=R.id===x;return h.jsxs("div",{role:"none",className:"border-b border-tui-border-dim last:border-b-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsxs("button",{type:"button",role:"menuitem","aria-current":z?"true":void 0,onClick:()=>{f(R.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",z?"text-tui-accent":"text-tui-text"),children:[h.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:z?_e.cursor:""}),h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block truncate font-bold",children:R.displayName}),h.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:R.hostname||R.hostId,children:R.hostname||R.hostId||R.wsUrl})]}),z&&h.jsx("span",{className:"shrink-0 text-tui-sm text-tui-ok",children:g("profiles.current")})]}),h.jsx("button",{type:"button",role:"menuitem","aria-label":g("profiles.rename"),title:g("profiles.rename"),onClick:()=>E(R.id,R.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:_e.ellipsis})]}),K&&h.jsxs("div",{className:"grid grid-cols-2 gap-1 px-2 pb-2",children:[h.jsx("input",{autoFocus:!0,value:T,maxLength:64,onChange:V=>A(V.target.value),onKeyDown:V=>{V.key==="Enter"&&N(R.id),V.key==="Escape"&&S(null)},"aria-label":g("profiles.rename"),className:"tui-input col-span-2 h-11 min-w-0 px-2 py-1 text-tui"}),h.jsx(Ae,{onClick:()=>N(R.id),variant:"primary",className:"h-11 w-full min-w-0 whitespace-nowrap",children:g("common.save")}),h.jsx(Ae,{onClick:()=>B(R.id),variant:"danger",className:"h-11 w-full min-w-0 whitespace-nowrap",children:g("profiles.remove")})]})]},R.id)}),h.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:[h.jsx("span",{"aria-hidden":"true",children:"+"}),h.jsx("span",{children:g("profiles.addHost")})]})]})]})},d0=({compact:l=!1,className:n})=>{const{settings:a,updateSettings:s,t:r}=Ee(),{connectionState:c,sharedWindowCount:f,assignedClientId:m}=it(),p=a.observerMode,g=h.jsx(gr,{name:"control-mode","aria-label":r("role.modeLabel"),value:p?"observe":"control",onChange:y=>s({observerMode:y==="observe"}),tone:p?"warn":"ok",size:l?"sm":"md",options:[{value:"control",label:r("role.sharedControl")},{value:"observe",label:r("common.viewer")}],className:n});return l?g:h.jsxs("div",{className:"flex w-full flex-col gap-1",children:[g,h.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r(p?"role.observerHint":"role.controlHint")}),c==="connected"&&f>1?h.jsx("p",{className:"text-tui-sm text-tui-muted",children:r("role.sharedWindows",{count:f})}):null,m?h.jsx(An,{label:r("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:h.jsx("span",{className:"truncate text-tui-muted",children:m})}):null]})},F5="dibin666/herdr-remote",f0=`https://github.com/${F5}/releases`,G5=`${f0}/latest/download/herdr-remote.tgz`;function Y5(l){return`${f0}/download/herdr-remote-v${l}/herdr-remote-${l}.tgz`}function h0(){const{updateStatus:l,ignoredUpdate:n,hostVersion:a}=it();return a===null||!!(l!=null&&l.updateAvailable)&&n!==(l==null?void 0:l.latest)}const P5="Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like '*node_modules\\herdr-remote*' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }",m0=({compact:l=!1,className:n})=>{const{t:a}=Ee(),{updateStatus:s}=it(),r=h0(),[c,f]=M.useState(!1);if(!r)return null;const m=s!=null&&s.updateAvailable?s:null,p=m?m.restartPending?a("update.chipRestart",{version:m.latest}):l?a("update.chipCompact",{version:m.latest}):a("update.chip",{version:m.latest}):a("update.chipOutdated");return h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button","data-testid":"update-chip",onClick:()=>f(!0),title:a("update.title"),className:ne("tui-focusable shrink-0 whitespace-nowrap px-1 text-tui-warn hover:underline",n),children:p}),h.jsx($5,{isOpen:c,onClose:()=>f(!1)})]})},al=({command:l})=>{const{t:n}=Ee(),{addToast:a}=dn();return h.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),h.jsx("code",{className:"min-w-0 flex-1 break-all text-tui-text",children:l}),h.jsx(Ae,{glyph:"⧉",className:"shrink-0",onClick:()=>{qd(l).then(s=>{a(s==="failed"?"error":"success",n(s==="failed"?"clipboard.copyFailed":"toasts.commandCopied"))})},children:n("common.copy")})]})},$5=({isOpen:l,onClose:n})=>{const{t:a}=Ee(),{updateStatus:s,ignoreUpdate:r,hostname:c,hostId:f,platform:m}=it();if(!(s!=null&&s.updateAvailable))return h.jsx(V5,{isOpen:l,onClose:n,host:c||f,win:m==="win32"});const{current:p,installed:g,latest:y,restartPending:v,updateCommand:w}=s;return h.jsx(ma,{isOpen:l,onClose:n,title:a("update.title"),closeLabel:a("common.closeDialog"),size:"md",footer:h.jsxs(h.Fragment,{children:[h.jsx(Ae,{variant:"ghost",onClick:()=>{r(y),n()},children:a("update.ignore")}),h.jsx(Ae,{variant:"primary",onClick:n,children:a("common.done")})]}),children:h.jsxs("div",{className:"space-y-3","data-testid":"update-modal",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsx(An,{label:a("common.host"),labelWidth:10,children:c||f||"—"}),h.jsx(An,{label:a("update.running"),labelWidth:10,children:p}),g!==p?h.jsx(An,{label:a("update.installed"),labelWidth:10,children:g}):null,h.jsx(An,{label:a("update.latest"),labelWidth:10,children:h.jsx("span",{className:"text-tui-ok",children:y})})]}),v?h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"leading-snug text-tui-text",children:a("update.restartPending",{version:g})}),h.jsx(al,{command:"herdr-remote restart"})]}):h.jsxs(h.Fragment,{children:[h.jsxs("p",{className:"leading-snug text-tui-text",children:[h.jsx("span",{"aria-hidden":"true",className:"mr-1 text-tui-accent",children:_e.arrowRight}),a("update.stepTui")]}),h.jsx("p",{className:"leading-snug text-tui-muted",children:a("update.stepCli")}),w?h.jsx(al,{command:"herdr-remote update"}):h.jsxs(h.Fragment,{children:[h.jsx(al,{command:`npm install -g ${Y5(y)}`}),h.jsx(al,{command:"herdr-remote restart"})]}),h.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:a("update.restartNote")})]})]})})},V5=({isOpen:l,onClose:n,host:a,win:s})=>{const{t:r}=Ee();return h.jsx(ma,{isOpen:l,onClose:n,title:r("update.title"),closeLabel:r("common.closeDialog"),size:"md",footer:h.jsx(Ae,{variant:"primary",onClick:n,children:r("common.done")}),children:h.jsxs("div",{className:"space-y-3","data-testid":"update-modal",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsx(An,{label:r("common.host"),labelWidth:10,children:a||"—"}),h.jsx(An,{label:r("update.running"),labelWidth:10,children:h.jsx("span",{className:"text-tui-warn",children:r("update.outdatedVersion")})})]}),h.jsx("p",{className:"leading-snug text-tui-text",children:r("update.outdated")}),s?h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"leading-snug text-tui-muted",children:r("update.windowsStop")}),h.jsx(al,{command:P5})]}):null,h.jsx(al,{command:`npm install -g ${G5}`}),h.jsx(al,{command:"herdr-remote restart"}),h.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r("update.restartNote")})]})})},ud="shrink-0 whitespace-nowrap",gb="min-w-0 truncate whitespace-nowrap",q5=({onAddProfile:l=()=>{}})=>{const{settings:n,t:a}=Ee(),{connectionState:s,hostId:r,assignedClientId:c,sharedWindowCount:f,rttMs:m,agentStatus:p}=it(),g=Qd(s,a),y=s==="connected",v=h0();return h.jsx(ky,{left:h.jsxs(h.Fragment,{children:[h.jsx(Jd,{onAddProfile:l}),h.jsx(Md,{"data-testid":"status-line-segments",items:[h.jsxs("span",{className:ne(ud,"flex items-center gap-1"),children:[h.jsx(bn,{level:g.level}),h.jsx("span",{className:"text-tui-text",children:g.label})]},"status"),y?h.jsx(d0,{compact:!0,className:ne(ud,"h-full w-auto")},"role"):null,y&&f>1?h.jsx("span",{className:ne(ud,"text-tui-muted"),children:a("role.sharedWindows",{count:f})},"windows"):null,r?h.jsxs("span",{className:gb,children:[h.jsxs("span",{className:"text-tui-faint",children:[a("common.host"),":"]})," ",h.jsx("span",{className:"text-tui-text",children:r})]},"host"):null,h.jsxs("span",{className:gb,children:[h.jsx("span",{className:"text-tui-faint",children:a("header.clientIdLabel")})," ",h.jsx("span",{className:"text-tui-text",children:c||n.clientId})]},"client")]})]}),right:h.jsx(Md,{items:[v?h.jsx(m0,{},"update"):null,y&&I5(p)?h.jsx(u0,{},"agents"):null,m!==null?h.jsxs("span",{className:"text-tui-muted",children:[a("header.latencyTitle"),": ",h.jsxs("span",{className:"text-tui-text",children:[m,"ms"]})]},"rtt"):null,h.jsx("span",{className:"hidden text-tui-faint sm:inline",children:a("header.tagline")},"mode")]})})},X5=({wsUrl:l,adminUrl:n,onOpenRemoteAdmin:a,onSignIn:s})=>{const{t:r}=Ee();return h.jsxs(Et,{title:r("admin.remoteRelayTitle"),bodyClassName:"space-y-2",children:[h.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:r("admin.remoteRelayNotice")}),h.jsxs("div",{className:"space-y-0.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[h.jsx(An,{label:r("admin.remoteRelayEndpoint"),labelWidth:18,children:h.jsx("code",{className:"break-all text-tui-accent",children:l})}),h.jsx(An,{label:r("admin.remoteRelayAdminUrl"),labelWidth:18,children:h.jsx("code",{className:"break-all text-tui-ok",children:n})})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx(Ae,{variant:"primary",onClick:a,glyph:_e.arrowRight,children:r("admin.openRemoteAdminBtn")}),h.jsx(Ae,{onClick:s,children:r("admin.relayAdminLoginBtn")})]})]})},Z5=({adminConfigured:l,isAuthError:n,tokenInput:a,onTokenInput:s,onSubmit:r,isSameOriginRelay:c,onBackToTerminal:f,showBack:m,onCancel:p})=>{const{t:g}=Ee();return h.jsxs(Et,{title:g("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[l===!1?h.jsx(Ri,{tone:"warn",children:g("admin.relayAdminNotConfigured")}):n?h.jsx(Ri,{tone:"bad",children:g("admin.relayAdminAuthError")}):h.jsx(Ri,{tone:"accent",children:g("admin.relayAdminPrompt")}),h.jsxs("form",{onSubmit:r,className:"space-y-2",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx(sl,{htmlFor:"relay-admin-token",children:g("admin.relayAdminTokenLabel")}),h.jsx(un,{id:"relay-admin-token",type:"password",autoComplete:"current-password",value:a,onChange:y=>s(y.target.value),placeholder:g("admin.relayAdminTokenPlaceholder")})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Ae,{variant:"primary",type:"submit",disabled:!a.trim(),children:g("admin.relayAdminLoginBtn")}),c?f&&!m?h.jsx(Ae,{variant:"ghost",onClick:f,children:g("admin.returnToTerminal")}):null:h.jsx(Ae,{variant:"ghost",onClick:p,children:g("common.cancel")})]})]})]})},W5=({onOpenPairing:l,onRetry:n})=>{const{t:a}=Ee(),{copied:s,copy:r}=Wd(),c=s!==null,f=()=>r(il,a("toasts.commandCopied"));return h.jsxs(Et,{title:a("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[h.jsx(Ri,{tone:"bad",children:a("admin.unauthorizedDesc")}),h.jsxs("div",{className:"space-y-1.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[h.jsx("span",{className:"block text-tui-sm uppercase text-tui-muted",children:a("admin.pairingStepsTitle")}),h.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-crust px-2 py-1",children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),h.jsx("code",{className:"min-w-0 flex-1 truncate text-tui-text",children:il}),h.jsx(Ae,{onClick:f,glyph:c?_e.check:"⧉",className:ne("shrink-0",c&&"border-tui-ok text-tui-ok"),children:a(c?"admin.copiedJson":"common.copy")})]}),h.jsx("p",{className:"text-tui-sm text-tui-faint",children:a("admin.pairingStepsHelp")})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[l&&h.jsx(Ae,{variant:"primary",onClick:l,children:a("admin.enterPairCodeBtn")}),h.jsx(Ae,{onClick:n,children:a("admin.retryFetchBtn")})]})]})},Q5=[[/\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"]],J5=[[/\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 bb(l,n){for(const[a,s]of l)if(a.test(n))return s;return null}function ef(l){const n=typeof l=="string"?l.trim():"";if(!n)return{label:"",raw:""};const a=bb(Q5,n),s=bb(J5,n);return a&&s?{label:`${a} · ${s}`,raw:n}:a?{label:a,raw:n}:s?{label:s,raw:n}:{label:n.length>32?`${n.slice(0,32)}…`:n,raw:n}}function la(l){if(!l||l<=0)return"0 B";const n=1024,a=["B","KB","MB","GB","TB"],s=Math.min(a.length-1,Math.floor(Math.log(l)/Math.log(n)));return`${(l/n**s).toFixed(1)} ${a[s]}`}function yb(l,n,a=!1){const s=Math.max(0,Math.floor(l)),r=Math.floor(s/86400),c=Math.floor(s%86400/3600),f=Math.floor(s%3600/60),m=s%60,p=(y,v)=>`${y}${n(`admin.unit${v}`)}`,g=r>0?[p(r,"Day"),p(c,"Hour"),p(f,"Minute")]:c>0?[p(c,"Hour"),p(f,"Minute"),p(m,"Second")]:[p(f,"Minute"),p(m,"Second")];return(a?g.slice(0,2):g).join(" ")}function tf(l,n,a=Date.now()){if(!l)return"—";const s=new Date(l).getTime();if(Number.isNaN(s))return"—";const r=Math.max(0,Math.floor((a-s)/1e3));return r<60?n("admin.relJustNow"):r<3600?n("admin.relMinutes",{count:Math.floor(r/60)}):r<86400?n("admin.relHours",{count:Math.floor(r/3600)}):n("admin.relDays",{count:Math.floor(r/86400)})}function nf(l){if(!l)return"";const n=new Date(l);return Number.isNaN(n.getTime())?"":n.toLocaleString()}function p0(l=[]){const n=new Map;for(const a of l)a.deviceId&&n.set(a.deviceId,(n.get(a.deviceId)||0)+1);return n}const eA=({clients:l})=>{const{t:n}=Ee(),a=l.some(r=>r.hostId),s=[{key:"id",header:n("admin.colClientId"),render:r=>h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(bn,{level:"ok"}),h.jsx("span",{className:"font-bold text-tui-text",children:r.id})]})},...a?[{key:"host",header:n("admin.colHost"),render:r=>h.jsx("span",{className:"text-tui-text",children:r.hostId||"—"})}]:[],{key:"role",header:n("admin.colRole"),width:10,render:r=>{const c=r.role==="controller";return h.jsx(Ay,{tone:c?"ok":"warn",className:"text-tui-sm",children:n(c?"common.controller":"common.viewer")})}},{key:"device",header:n("admin.colDevice"),render:r=>{const c=ef(r.userAgent);return h.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[h.jsx("span",{className:c.label?"text-tui-text":"text-tui-faint",title:c.raw,children:c.label||n("admin.unknownDevice")}),r.deviceId?h.jsx("code",{className:"text-tui-sm text-tui-faint",children:r.deviceId}):null]})}},{key:"ip",header:n("admin.colIp"),render:r=>h.jsx("span",{className:"text-tui-muted",children:r.ip||"127.0.0.1"})},{key:"connectedAt",header:n("admin.colConnectedAt"),render:r=>h.jsx("span",{className:"whitespace-nowrap text-tui-muted",title:nf(r.connectedAt),children:r.connectedAt?tf(r.connectedAt,n):n("admin.startedRecently")})},{key:"traffic",header:n("admin.colTraffic"),align:"right",render:r=>h.jsxs("span",{className:"whitespace-nowrap",children:[h.jsxs("span",{className:"text-tui-accent",children:["↓",la(r.bytesReceived||0)]}),h.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),h.jsxs("span",{className:"text-tui-ok",children:["↑",la(r.bytesSent||0)]})]})}];return h.jsx(Et,{title:n("admin.connectedClientsTitle",{count:l.length}),bodyClassName:"-mx-1",children:h.jsx($d,{columns:s,items:l,rowKey:r=>r.id,empty:n("admin.noClients")})})},tA=({devices:l,clients:n,onRevoke:a})=>{const{t:s}=Ee(),[r,c]=M.useState(null),[f,m]=M.useState(null),p=p0(n),g=[...l].sort((w,x)=>{const S=+!!p.get(x.deviceId)-+!!p.get(w.deviceId);return S||(Date.parse(x.lastSeenAt)||0)-(Date.parse(w.lastSeenAt)||0)}),y=async w=>{if(r!==w){c(w);return}m(w);try{await a(w)}finally{m(null),c(null)}},v=[{key:"status",header:s("admin.colStatus"),width:12,render:w=>{const x=p.get(w.deviceId)||0;return h.jsxs("span",{className:ne("flex items-center gap-1.5 whitespace-nowrap",x?"text-tui-ok":"text-tui-faint"),children:[h.jsx(bn,{level:x?"ok":"idle"}),s(x?"admin.hostStatusOnline":"admin.hostStatusOffline")]})}},{key:"device",header:s("admin.colDevice"),render:w=>{const x=ef(w.userAgent);return h.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[h.jsx("span",{className:"text-tui-text",title:x.raw,children:x.label||s("admin.unknownDevice")}),h.jsx("code",{className:"text-tui-sm text-tui-faint",children:w.deviceId})]})}},{key:"host",header:s("admin.colHost"),render:w=>h.jsx("span",{className:"text-tui-text",children:w.hostId||"—"})},{key:"ip",header:s("admin.colIp"),render:w=>h.jsx("span",{className:"text-tui-muted",children:w.lastIp||"—"})},{key:"lastSeen",header:s("admin.colLastSeen"),render:w=>{const x=p.get(w.deviceId)||0;return h.jsx("span",{className:ne("whitespace-nowrap",x?"text-tui-ok":"text-tui-muted"),title:nf(w.lastSeenAt),children:x?s("admin.deviceWindows",{count:x}):tf(w.lastSeenAt,s)})}},{key:"actions",header:s("admin.colActions"),align:"right",render:w=>{const x=r===w.deviceId,S=f===w.deviceId;return h.jsx(Ae,{variant:"danger",disabled:S,onClick:()=>void y(w.deviceId),onBlur:()=>c(T=>T===w.deviceId?null:T),"aria-label":s("admin.revokeDevice"),className:ne("h-6 py-0 text-tui-sm",x&&"bg-tui-bad text-tui-crust"),children:S?h.jsx(ol,{}):s(x?"admin.revokeConfirm":"admin.revokeDevice")})}}];return h.jsx(Et,{title:s("admin.pairedDevicesTitle",{count:l.length}),bodyClassName:"-mx-1",children:h.jsx($d,{columns:v,items:g,rowKey:w=>w.deviceId,empty:s("admin.noDevices")})})},vb={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function nA(l=[],n=[]){const a=new Map;for(const c of n){if(!(c!=null&&c.hostId))continue;const f=a.get(c.hostId);f?f.push(c):a.set(c.hostId,[c])}const s=l.map(c=>{const f=a.get(c.id)||[];return{id:c.id,hostname:c.hostname||c.id,status:c.status||"online",connectedDeviceCount:c.connectedDeviceCount??0,pairedDeviceCount:c.pairedDeviceCount??f.length,activePtyCount:c.activePtyCount??0,version:c.version,latestVersion:c.latestVersion,devices:f,fromRosterOnly:!1}}),r=new Set(s.map(c=>c.id));for(const[c,f]of a)r.has(c)||s.push({id:c,hostname:c,status:"offline",connectedDeviceCount:0,pairedDeviceCount:f.length,activePtyCount:0,devices:f,fromRosterOnly:!0});return s.sort((c,f)=>c.fromRosterOnly!==f.fromRosterOnly?c.fromRosterOnly?1:-1:c.hostname.localeCompare(f.hostname))}const iA=({hosts:l,devices:n,clients:a})=>{const{t:s}=Ee(),r=nA(l,n),c=p0(a),f={online:s("admin.hostStatusOnline"),busy:s("admin.hostStatusBusy"),reconnecting:s("admin.hostStatusReconnecting"),offline:s("admin.hostStatusOffline")};return h.jsx(Et,{title:s("admin.hostsTitle",{count:r.length}),bodyClassName:"space-y-2",children:r.length===0?h.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:s("admin.noHosts")}):r.map(m=>h.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border-dim px-2 py-1",children:[h.jsxs("span",{className:"flex min-w-0 flex-auto items-center gap-1.5 text-tui",children:[h.jsx(bn,{level:vb[m.status]}),h.jsx("span",{className:"truncate font-bold text-tui-text",children:m.hostname}),m.hostname!==m.id?h.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:m.id}):null,h.jsx(Ay,{tone:vb[m.status],className:"ml-1 text-tui-sm",children:f[m.status]})]}),h.jsx(Md,{className:"shrink-0 text-tui-sm",items:[h.jsx("span",{className:m.connectedDeviceCount?"text-tui-ok":"text-tui-faint",children:s("admin.hostConnectedDevices",{count:m.connectedDeviceCount})},"connected"),h.jsx("span",{className:"text-tui-muted",children:s("admin.hostPairedDevices",{count:m.pairedDeviceCount})},"paired"),m.version===void 0?null:h.jsx("span",{className:m.version&&!m.latestVersion?"text-tui-muted":"text-tui-warn",children:m.version?m.latestVersion?s("admin.hostVersionBehind",{version:m.version,latest:m.latestVersion}):s("admin.hostVersion",{version:m.version}):s("admin.hostVersionUnknown")},"version"),m.fromRosterOnly?null:h.jsx("span",{className:m.activePtyCount?"text-tui-info":"text-tui-faint",children:s("admin.hostPtys",{count:m.activePtyCount})},"ptys")]})]}),m.devices.length>0?h.jsx("ul",{className:"divide-y divide-tui-border-dim",children:m.devices.map(p=>{const g=ef(p.userAgent),y=c.get(p.deviceId)||0;return h.jsxs("li",{className:"grid grid-cols-[1ch_minmax(0,1fr)_auto] items-baseline gap-x-2 px-2 py-0.5 text-tui sm:grid-cols-[1ch_minmax(0,18ch)_minmax(0,1fr)_16ch_16ch]",children:[h.jsx(bn,{level:y?"ok":"idle"}),h.jsx("span",{className:"truncate text-tui-text",title:g.raw,children:g.label||s("admin.unknownDevice")}),h.jsx("code",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:p.deviceId}),h.jsx("span",{className:"hidden truncate text-tui-sm text-tui-muted sm:block",children:p.lastIp||"—"}),h.jsx("span",{className:ne("whitespace-nowrap text-right text-tui-sm",y?"text-tui-ok":"text-tui-faint"),title:nf(p.lastSeenAt),children:y?s("admin.deviceWindows",{count:y}):tf(p.lastSeenAt,s)})]},p.deviceId)})}):h.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:m.pairedDeviceCount>0?s("admin.hostRosterOperatorOnly"):s("admin.noDevices")})]},m.id))})},lA=({data:l})=>{var r,c,f,m,p,g,y,v,w,x;const{t:n}=Ee(),a=l.activeUserCount??((r=l.clients)==null?void 0:r.length)??0,s=new Set((l.devices||[]).map(S=>S.hostId).filter(S=>S&&!(l.hosts||[]).some(T=>T.id===S))).size;return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 xl:grid-cols-6",children:[h.jsx(Zl,{label:n("admin.connectedHosts"),value:((c=l.hosts)==null?void 0:c.length)||0,sub:s?n("admin.hostsOfflineSub",{count:s}):void 0,tone:(f=l.hosts)!=null&&f.length?"ok":"idle"}),h.jsx(Zl,{label:n("admin.activeUsers"),value:a,sub:n("admin.acrossWindows",{count:((m=l.clients)==null?void 0:m.length)||0}),tone:a?"accent":"idle"}),h.jsx(Zl,{label:n("admin.activePtys"),value:((p=l.ptys)==null?void 0:p.length)||0,sub:n("admin.terminalShells"),tone:(g=l.ptys)!=null&&g.length?"info":"idle"}),h.jsx(Zl,{label:n("admin.statInbound"),value:n("admin.perSecond",{value:la(((y=l.throughput)==null?void 0:y.bytesInPerSec)||0)}),sub:n("admin.statTotal",{value:la(((v=l.throughput)==null?void 0:v.bytesIn)||0)}),tone:"accent"}),h.jsx(Zl,{label:n("admin.statOutbound"),value:n("admin.perSecond",{value:la(((w=l.throughput)==null?void 0:w.bytesOutPerSec)||0)}),sub:n("admin.statTotal",{value:la(((x=l.throughput)==null?void 0:x.bytesOut)||0)}),tone:"ok"}),h.jsx(Zl,{label:n("admin.uptime"),value:yb(l.uptimeSeconds||0,n,!0),title:yb(l.uptimeSeconds||0,n),sub:l.startTime?n("admin.startedAt",{time:new Date(l.startTime).toLocaleTimeString()}):n("admin.startedRecently")})]}),h.jsx(iA,{hosts:l.hosts||[],devices:l.devices,clients:l.clients||[]})]})},aA=({ptys:l})=>{const{t:n}=Ee(),a=l.some(r=>r.hostId),s=[{key:"id",header:n("admin.colPtyId"),render:r=>h.jsx("span",{className:"font-bold text-tui-accent",children:r.id})},...a?[{key:"host",header:n("admin.colHost"),render:r=>h.jsx("span",{className:"text-tui-text",children:r.hostId})}]:[],{key:"pid",header:n("admin.colPid"),width:9,render:r=>h.jsx("span",{className:"text-tui-muted",children:r.pid})},{key:"command",header:n("admin.colCommand"),render:r=>h.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:r.command})},{key:"grid",header:n("admin.colGrid"),width:11,render:r=>h.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[r.cols,h.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),r.rows]})},{key:"cwd",header:n("admin.colCwd"),className:"max-w-xs truncate",render:r=>h.jsx("span",{className:"text-tui-muted",children:r.cwd||"~"})},{key:"viewers",header:n("admin.colViewers"),align:"right",width:9,render:r=>h.jsx("span",{className:"font-bold text-tui-ok",children:r.activeClients})}];return h.jsx(Et,{title:n("admin.activePtysTitle",{count:l.length}),bodyClassName:"-mx-1",children:h.jsx($d,{columns:s,items:l,rowKey:r=>r.id,empty:n("admin.noPtys")})})};function Od(l){if(typeof window>"u"||!l||l.startsWith("/"))return"";try{const n=new URL(l.replace(/^ws/,"http")),a=n.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return n.origin===window.location.origin&&!a?"":`${n.origin}${a}`}catch{return""}}function Es(l,n){const a=Od(l);return a?`${a}${n.startsWith("/")?n:`/${n}`}`:n}async function sA(l){try{const a=await fetch(Es(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 xb(l,n){const a=await fetch(l,{headers:{Accept:"application/json",...n}});if(a.status===401||a.status===403)return{kind:"denied",status:a.status};if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);return{kind:"ok",data:await a.json()}}async function oA(l,n,a){return(await fetch(Es(l,`/api/admin/devices/${encodeURIComponent(a)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":n}})).ok}function rA(l,n,a){return l!=null&&l.adminPath?l.publicUrl?`${l.publicUrl.replace(/\/$/,"")}${l.adminPath}`:Es(a,l.adminPath):n!=null&&n.remoteAdminUrl?n.remoteAdminUrl:a?Es(a,"/admin"):"/admin"}function cA({wsUrl:l,deviceToken:n,adminToken:a,relayOrigin:s,refreshInterval:r,t:c}){const[f,m]=M.useState(null),[p,g]=M.useState(null),[y,v]=M.useState(!1),[w,x]=M.useState(!0),[S,T]=M.useState(null),[A,k]=M.useState(!1),[E,N]=M.useState(null);M.useEffect(()=>{m(null),g(null),v(!1)},[s]),M.useEffect(()=>{let K=!0;return x(!0),sA(l).then(V=>{K&&(g(V),v(!0))}),()=>{K=!1}},[l,s]);const B=(p==null?void 0:p.relayMode)==="remote",L=M.useCallback((K,V)=>{if(K.kind==="denied"){k(!0),T(V),m(null);return}m(K.data),T(null),k(!1),N(new Date)},[]),D=M.useCallback((K,V)=>{k(!1),T(K instanceof Error?K.message:V),m(null)},[]),R=M.useCallback(async()=>{if(y){if(B){if(!a){m(null),x(!1),T(null),k(!1);return}try{x(!0);const K=await xb(Es(l,(p==null?void 0:p.adminStatusPath)||"/api/admin/status"),{"X-Relay-Admin-Token":a});L(K,c("admin.relayAdminAuthError"))}catch(K){console.warn("GET /api/admin/status request failed:",K),D(K,"Failed to fetch remote admin status")}finally{x(!1)}return}try{x(!0);const K=await xb("/api/status",n?{Authorization:`Bearer ${n}`}:{});L(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),D(K,"Failed to fetch status")}finally{x(!1)}}},[y,B,a,p,n,l,s,c]),z=M.useCallback(async K=>{try{if(!await oA(l,a,K)){T(c("admin.revokeFailed"));return}await R()}catch{T(c("admin.revokeFailed"))}},[a,R,l,c]);return M.useEffect(()=>{if(!y)return;R();let K=null;const V=()=>{r>0&&!K&&(K=setInterval(()=>{document.visibilityState==="visible"&&R()},r))},te=()=>{K&&(clearInterval(K),K=null)},Z=()=>{document.visibilityState==="visible"?(R(),V()):te()};return V(),document.addEventListener("visibilitychange",Z),()=>{te(),document.removeEventListener("visibilitychange",Z)}},[y,R,r]),{data:f,relayInfo:p,infoLoaded:y,isRemoteRelay:B,loading:w,error:S,isAuthError:A,lastUpdated:E,fetchStatus:R,revokeDevice:z}}const dd="h-7 py-0",uA=({onBackToTerminal:l,onOpenPairing:n,showBack:a=!1})=>{var ve,X,ue;const{settings:s,updateSettings:r,t:c}=Ee(),f=Od(s.wsUrl)||(typeof window<"u"?window.location.origin:"local"),m=((ve=s.adminTokens)==null?void 0:ve[f])||(f===(typeof window<"u"?window.location.origin:"local")?s.adminToken:"")||"",[p,g]=M.useState(3e3),[y,v]=M.useState("overview"),[w,x]=M.useState(m),[S,T]=M.useState(m),[A,k]=M.useState(!!m),E=!Od(s.wsUrl);M.useEffect(()=>{x(m),T(m),k(!!m)},[f]);const{data:N,relayInfo:B,infoLoaded:L,isRemoteRelay:D,loading:R,error:z,isAuthError:K,lastUpdated:V,fetchStatus:te,revokeDevice:Z}=cA({wsUrl:s.wsUrl,deviceToken:s.token,adminToken:S,relayOrigin:f,refreshInterval:p,t:c}),ie=oe=>{oe.preventDefault();const pe=w.trim();r({adminToken:pe,adminTokens:{...s.adminTokens||{},[f]:pe}}),T(pe),k(!!pe)},re=rA(B,N,s.wsUrl),ce=N?[{id:"overview",label:c("admin.tabOverview"),index:1},{id:"clients",label:c("admin.tabClients",{count:((X=N.clients)==null?void 0:X.length)||0}),index:2},{id:"ptys",label:c("admin.tabPtys",{count:((ue=N.ptys)==null?void 0:ue.length)||0}),index:3},...N.devices?[{id:"devices",label:c("admin.tabDevices",{count:N.devices.length}),index:4}]:[]]:[],O=ce.map(oe=>oe.id).join("|");M.useEffect(()=>{const oe=O?O.split("|"):[],pe=se=>{if(se.ctrlKey||se.altKey||se.metaKey)return;const xe=se.target;if(xe instanceof HTMLInputElement||xe instanceof HTMLTextAreaElement||xe instanceof HTMLSelectElement||xe!=null&&xe.isContentEditable||document.querySelector('[role="dialog"]'))return;if(se.key==="Escape"&&l){se.preventDefault(),l();return}if(se.key.toLowerCase()==="r"){se.preventDefault(),te();return}const ae=Number.parseInt(se.key,10)-1;Number.isInteger(ae)&&ae>=0&&ae<oe.length&&(se.preventDefault(),v(oe[ae]))};return window.addEventListener("keydown",pe),()=>window.removeEventListener("keydown",pe)},[te,l,O]);const J=(B==null?void 0:B.version)||(N==null?void 0:N.version)||"0.1.0",I=a&&l?h.jsx(Ae,{variant:"ghost",onClick:l,title:c("admin.returnToTerminal"),"aria-label":c("admin.returnToTerminal"),glyph:_e.arrowLeft,brackets:!1,className:dd,children:h.jsx("span",{className:"sr-only",children:c("admin.returnToTerminal")})}):null,le=h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"hidden items-center gap-1.5 whitespace-nowrap text-tui-sm sm:flex",children:[h.jsxs("span",{className:"text-tui-faint",children:["v",J]}),h.jsx(Yd,{}),h.jsx("span",{className:D?"text-tui-alt":"text-tui-ok",children:c(D?"admin.modeRemote":"admin.localWorkstationBadge")})]}),N?h.jsxs(h.Fragment,{children:[h.jsxs("label",{className:"hidden items-center gap-1.5 text-tui-sm text-tui-muted md:flex",children:[h.jsx("span",{children:c("admin.autoRefresh")}),h.jsxs(Tr,{value:p,onChange:oe=>g(Number(oe.target.value)),"aria-label":c("admin.autoRefresh"),className:ne("w-auto",dd),children:[h.jsx("option",{value:0,children:c("admin.paused")}),h.jsx("option",{value:1e3,children:"1s"}),h.jsx("option",{value:3e3,children:"3s"}),h.jsx("option",{value:5e3,children:"5s"}),h.jsx("option",{value:1e4,children:"10s"})]})]}),h.jsx(Ae,{variant:"primary",onClick:te,disabled:R,title:c("admin.refreshNow"),className:dd,children:R?h.jsx(ol,{}):c("admin.refreshNow")})]}):null]}),P=L&&D&&!A&&!E,fe=L&&D&&(A||E)&&!N;return h.jsxs(WS,{tabs:ce,activeTabId:y,onSelectTab:oe=>v(oe),tabsAriaLabel:c("header.mainNavigationAria"),toolbarStart:I,toolbarAside:le,hints:[...N?[{keys:"1–4",action:c("admin.hintTabs")},{keys:"r",action:c("admin.hintRefresh")}]:[],...l?[{keys:"esc",action:c("admin.hintBack")}]:[]],footerAside:V?h.jsx("span",{className:"text-tui-faint",children:c("admin.updatedAt",{time:V.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!L&&h.jsx("div",{className:"flex items-center justify-center gap-2 border border-tui-border bg-tui-base px-3 py-8 text-tui text-tui-muted",children:h.jsx(ol,{label:c("admin.loadingStatus")})}),P&&h.jsx(X5,{wsUrl:s.wsUrl,adminUrl:re,onOpenRemoteAdmin:()=>window.open(re,"_blank","noopener,noreferrer"),onSignIn:()=>k(!0)}),fe&&h.jsx(Z5,{adminConfigured:B==null?void 0:B.adminConfigured,isAuthError:K,tokenInput:w,onTokenInput:x,onSubmit:ie,isSameOriginRelay:E,onBackToTerminal:l,showBack:a,onCancel:()=>k(!1)}),L&&!D&&K&&h.jsx(W5,{onOpenPairing:n,onRetry:te}),L&&z&&!K&&h.jsx(Ri,{tone:"warn",action:h.jsx(Ae,{variant:"warn",onClick:te,children:c("common.retry")}),children:c("admin.errorConnecting",{error:z})}),N&&h.jsxs(h.Fragment,{children:[y==="overview"&&h.jsx(lA,{data:N}),y==="clients"&&h.jsx(eA,{clients:N.clients||[]}),y==="ptys"&&h.jsx(aA,{ptys:N.ptys||[]}),y==="devices"&&h.jsx(tA,{devices:N.devices||[],clients:N.clients||[],onRevoke:Z})]})]})},fd="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",hd="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",dA="border-tui-accent bg-tui-selection text-tui-accent",md=({active:l=!1})=>h.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",l?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:_e.cursor}),fA=({onClose:l,onOpenSettings:n,onAddProfile:a=()=>{}})=>{const{settings:s,updateSettings:r,language:c,setLanguage:f,t:m}=Ee(),{connectionState:p,stateDetail:g,rttMs:y,hostId:v,connect:w}=it(),{addToast:x}=dn(),{copied:S,copy:T}=Wd(),A=S!==null,k=Qd(p,m),E=L=>()=>{var R;const D=document.activeElement;(R=D==null?void 0:D.blur)==null||R.call(D),L()},N=()=>T(s.clientId,m("toasts.clientIdCopied",{id:s.clientId}),"info"),B=()=>{const L=c==="zh"?"en":"zh";f(L),x("info",Dd(L,"toasts.switchedLanguage",{lang:L==="zh"?"简体中文":"English"}))};return h.jsxs("div",{className:"flex flex-col gap-3 px-3 pb-2 pt-2",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border pb-1.5",children:[h.jsx("h2",{className:"text-tui font-bold uppercase text-tui-accent",children:m("mobile.sessionControls")}),h.jsx(Ae,{variant:"ghost",onClick:l,"aria-label":m("mobile.closeSessionControls"),children:"esc"})]}),h.jsx(Et,{title:m("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:h.jsx(Jd,{mobile:!0,onAddProfile:a})}),h.jsxs(Et,{title:m("common.status"),tone:k.level==="ok"?"ok":k.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[h.jsx(bn,{level:k.level}),h.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:k.label}),p==="connected"&&y!==null&&h.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[y,"ms"]})]}),k.actionLabel&&h.jsx(Ae,{variant:"primary",onClick:()=>w(),className:"shrink-0",children:k.actionLabel})]}),k.needsAttention&&g&&h.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:g}),v&&h.jsx(An,{label:m("common.host"),labelWidth:9,children:v}),h.jsxs("button",{type:"button",onClick:N,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:m("header.copyClientIdTitle"),children:[h.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:m("header.clientIdLabel")}),h.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:s.clientId}),h.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",A?"text-tui-ok":"text-tui-faint"),children:A?_e.check:"⧉"})]})]}),h.jsx(Et,{title:m("mobile.inputControl"),tone:"accent","aria-label":m("mobile.terminalControlAria"),children:h.jsx(d0,{className:"h-11"})}),h.jsxs(Et,{title:m("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[h.jsxs("button",{type:"button",onClick:B,className:ne(fd,hd),"aria-label":m("header.languageToggleTitle"),children:[h.jsx(md,{}),h.jsx("span",{className:"truncate",children:c==="zh"?"English":"中文"})]}),h.jsxs("button",{type:"button",onClick:E(n),className:ne(fd,hd),"aria-label":m("mobile.settingsAria"),children:[h.jsx(md,{}),h.jsx("span",{className:"truncate",children:m("common.settings")})]}),h.jsxs("button",{type:"button",onClick:()=>r({toolbarVisible:!s.toolbarVisible}),className:ne(fd,s.toolbarVisible?dA:hd),"aria-label":m("mobile.keybarAria"),"aria-pressed":s.toolbarVisible,children:[h.jsx(md,{active:s.toolbarVisible}),h.jsx("span",{className:"truncate",children:m("common.keyBar")}),h.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:s.toolbarVisible?"[x]":"[ ]"})]})]})]})},hA=({onAddProfile:l})=>{const{t:n}=Ee(),{rttMs:a}=it();return h.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":n("mobile.statusBarAria"),className:"absolute inset-x-0 bottom-0 z-40 flex h-11 shrink-0 items-center gap-2 border-t border-tui-border bg-tui-mantle px-1 text-tui-sm",children:[h.jsx(Jd,{statusBar:!0,onAddProfile:l}),h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),h.jsx(u0,{compact:!0}),h.jsx(m0,{compact:!0}),h.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:n("header.latencyTitle"),children:[h.jsx("span",{className:"text-tui-faint",children:"RTT"}),h.jsx("span",{className:ne(a===null?"text-tui-faint":"text-tui-text"),children:a===null?"—":`${a}ms`})]})]})},mA=({onOpenSettings:l,onAddProfile:n=()=>{}})=>{const{t:a}=Ee(),{connectionState:s,isController:r}=it(),[c,f]=M.useState(!1),m=M.useRef(null),p=M.useCallback(()=>f(!1),[]);M.useEffect(()=>{if(!c)return;const y=v=>{if(!(v.ctrlKey||v.altKey||v.metaKey)&&v.key==="Escape"){const w=v.target;w&&typeof w.closest=="function"&&!!w.closest("#terminal-container")||(v.stopPropagation(),v.preventDefault(),p())}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[c,p]),M.useEffect(()=>{var y;c&&((y=m.current)==null||y.focus({preventScroll:!0}))},[c]);const g=Qd(s,a);return h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":a("mobile.sessionControls"),className:"pointer-events-none absolute inset-x-0 top-0 z-40 flex h-12 items-center justify-between gap-2 border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-sm text-tui-muted",children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:"herdr"}),h.jsx(Yd,{className:"shrink-0"}),h.jsx(bn,{level:g.level}),h.jsx("span",{className:"truncate uppercase",children:g.label})]}),h.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>f(!0),"aria-label":a("mobile.sessionControls"),"aria-expanded":c,"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",g.needsAttention?"border-tui-warn text-tui-warn":r?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!r&&!g.needsAttention&&h.jsx("span",{className:"max-w-[8rem] truncate",children:a("common.viewer")}),h.jsx("span",{"aria-hidden":"true",className:"text-tui",children:_e.chevronDown}),h.jsx("span",{"aria-hidden":"true",children:a("mobile.menu")})]})]}),c&&h.jsxs(h.Fragment,{children:[h.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:p,"aria-hidden":"true"}),h.jsx("div",{ref:m,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":a("mobile.sessionControls"),tabIndex:-1,className:"herdr-sheet absolute inset-x-0 bottom-0 z-50 max-h-[85%] overflow-y-auto border-t border-tui-border bg-tui-base pb-3 focus:outline-none",children:h.jsx(fA,{onClose:p,onOpenSettings:()=>{p(),l()},onAddProfile:()=>{p(),n()}})})]}),h.jsx(hA,{onAddProfile:n})]})},pA=()=>{const{activeProfile:l,t:n}=Ee(),{herdrLaunch:a,startHerdr:s,hostname:r}=it();if(!a)return null;const c=r||(l==null?void 0:l.displayName)||n("herdrLaunch.thisHost"),f=a.phase==="failed";return h.jsx("div",{"data-testid":"herdr-start-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:h.jsx(Et,{title:n(f?"herdrLaunch.failedTitle":"herdrLaunch.title"),tone:f?"bad":"warn",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":n("herdrLaunch.title"),children:a.phase==="starting"?h.jsxs("p",{className:"flex items-center gap-2 text-tui-text",role:"status",children:[h.jsx(ol,{}),h.jsx("span",{children:n("herdrLaunch.starting",{host:c})})]}):h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"leading-snug text-tui-text",children:n("herdrLaunch.body",{host:c})}),f&&a.message?h.jsx(Ri,{tone:"bad",children:h.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap break-words font-mono text-tui-sm",children:a.message})}):null,h.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:n("herdrLaunch.scope")}),h.jsx("div",{className:"flex justify-end",children:h.jsx(Ae,{variant:"primary",onClick:s,autoFocus:!0,children:n(f?"common.retry":"herdrLaunch.start")})})]})})})},g0="--app-height",b0="--keyboard-inset",gA=80;function bA(){if(typeof window>"u")return{height:768,keyboardInset:0};const l=window.innerHeight||768,n=window.visualViewport;if(n&&typeof n.height=="number"&&n.height>0){const a=l-n.height-(n.offsetTop||0),s=a>=gA?Math.round(a):0;return{height:Math.round(n.height),keyboardInset:s}}return{height:l,keyboardInset:0}}function wb(l,n=bA()){return l.style.setProperty(g0,`${n.height}px`),l.style.setProperty(b0,`${n.keyboardInset}px`),n}function yA(l=typeof document<"u"?document.documentElement:null){if(!l||typeof window>"u")return()=>{};let n=null;const a=()=>{n=null,wb(l)},s=()=>{if(n===null){if(typeof requestAnimationFrame!="function"){a();return}n=requestAnimationFrame(a)}};wb(l);const r=window.visualViewport;return r==null||r.addEventListener("resize",s),r==null||r.addEventListener("scroll",s),window.addEventListener("resize",s),window.addEventListener("orientationchange",s),()=>{n!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(n),n=null),r==null||r.removeEventListener("resize",s),r==null||r.removeEventListener("scroll",s),window.removeEventListener("resize",s),window.removeEventListener("orientationchange",s),l.style.removeProperty(g0),l.style.removeProperty(b0)}}const vA=900;function Sb(){if(typeof window>"u")return!1;const l=oa();return l<Bd?!0:l<=vA}function xA(){const[l,n]=M.useState(Sb);return M.useEffect(()=>{var r,c;const a=()=>{const f=Sb();n(m=>m===f?m:f)};a();let s=null;try{s=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{s=null}return(r=s==null?void 0:s.addEventListener)==null||r.call(s,"change",a),window.addEventListener("resize",a),window.addEventListener("orientationchange",a),(c=window.visualViewport)==null||c.addEventListener("resize",a),()=>{var f,m;(f=s==null?void 0:s.removeEventListener)==null||f.call(s,"change",a),window.removeEventListener("resize",a),window.removeEventListener("orientationchange",a),(m=window.visualViewport)==null||m.removeEventListener("resize",a)}},[]),l}function wA(l){const n=l.target;if(!n)return!1;if(n.id==="terminal-container"||n.id==="terminal-frame"||n.id==="terminal-surface"||n.classList.contains("xterm-helper-textarea")||n.classList.contains("xterm")||n.closest("#terminal-container")||n.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const a=document.activeElement;if(a.id==="terminal-container"||a.classList.contains("xterm-helper-textarea")||a.closest("#terminal-container")||a.closest(".xterm"))return!0}return!1}function SA(l,n={}){if(typeof window>"u")return()=>{};const a=s=>{var r;s.ctrlKey||s.altKey||s.metaKey||s.key==="Escape"&&(n.isModalOpen||n.isSheetOpen)&&(wA(s)||(s.preventDefault(),s.stopPropagation(),(r=l.onCloseModals)==null||r.call(l)))};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}}function CA(){const[l,n]=M.useState("terminal"),[a,s]=M.useState(!1),[r,c]=M.useState(!1),[f,m]=M.useState(void 0),p=V=>{m(V),c(!0)},{updateSettings:g,addProfileAndConnect:y,settings:v}=Ee(),{connectionState:w,stateDetail:x,stateCode:S,lastPairedAt:T}=it();J1();const A=xA();M.useEffect(()=>yA(),[]),M.useEffect(()=>{zb()},[]),M.useEffect(()=>{const V=a||r;if(V)return SA({onCloseModals:()=>{s(!1),c(!1)}},{isModalOpen:V})},[a,r]),M.useEffect(()=>{var te;const V=()=>{const Z=window.location.pathname,ie=window.location.hash;n(Z==="/admin"||ie==="#admin"?"admin":"terminal")};V(),window.addEventListener("popstate",V),window.addEventListener("hashchange",V);try{const Z=new URL(window.location.href),ie=(te=Z.searchParams.get("pairCode"))==null?void 0:te.toUpperCase();ie&&hr().token?y({wsUrl:Ut,pairCode:ie}):ie&&g({pairCode:ie});let re=!1;if(Z.searchParams.has("token")&&(Z.searchParams.delete("token"),re=!0),Z.searchParams.has("pairCode")&&(Z.searchParams.delete("pairCode"),re=!0),re){const ce=Z.searchParams.toString(),O=Z.pathname+(ce?`?${ce}`:"")+Z.hash;window.history.replaceState({},"",O)}}catch(Z){console.warn("Failed to parse URL query params:",Z)}return()=>{window.removeEventListener("popstate",V),window.removeEventListener("hashchange",V)}},[g,y]);const k=()=>s(!0),E=V=>{n(V),V==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},N=!v.token&&!v.pairCode&&w!=="connected",B=w==="error"&&(["auth_required","unauthorized","device_revoked"].includes(S||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(x||"")),L=N||B,[D,R]=M.useState(!L);M.useEffect(()=>{L||R(!0)},[L]),M.useEffect(()=>{T&&(s(!1),R(!0),n("terminal"))},[T]);const z=l==="terminal"&&!L,K=V=>({visibility:V?"visible":"hidden",opacity:V?1:0,pointerEvents:V?"auto":"none",zIndex:V?1:0});return h.jsxs("div",{"data-testid":"app-shell",style:A?{paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"env(safe-area-inset-left, 0px)",paddingRight:"env(safe-area-inset-right, 0px)"}:void 0,className:"flex h-full w-full select-none flex-col overflow-hidden bg-tui-crust font-mono text-tui text-tui-text",onContextMenu:V=>{V.preventDefault(),V.stopPropagation()},children:[!A&&h.jsx(eC,{currentView:l,onNavigate:E,onOpenSettings:()=>p()}),!A&&!L&&h.jsx(tC,{}),h.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[D&&h.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${A?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:K(z),"aria-hidden":!z,children:[h.jsx(JM,{isActive:z}),h.jsx(S5,{compact:A,onCustomize:()=>p("agentKeymaps")}),h.jsx(pA,{}),h.jsx(O5,{})]}),l==="terminal"&&L&&h.jsx("div",{"data-testid":"onboarding-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-10",children:h.jsx(t5,{onPairedSuccess:()=>{}})}),l==="admin"&&h.jsx("div",{"data-testid":"admin-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-20",children:h.jsx(uA,{onBackToTerminal:()=>E("terminal"),onOpenPairing:k,showBack:A})}),A&&z&&h.jsx(mA,{onOpenSettings:()=>p(),onAddProfile:k})]}),!A&&l!=="admin"&&h.jsx(q5,{onAddProfile:k}),h.jsx(T5,{isOpen:a,onClose:()=>s(!1)}),h.jsx(H5,{isOpen:r,initialTab:f,onClose:()=>c(!1),onOpenAdmin:()=>{c(!1),E("admin")}}),h.jsx(K5,{})]})}function TA(){return h.jsx(I1,{children:h.jsx(CA,{})})}const y0=document.getElementById("root");if(!y0)throw new Error("Root element not found");Fx.createRoot(y0).render(h.jsx(Jn.StrictMode,{children:h.jsx(TA,{})}));