@rynx-ai/server 0.1.0 → 0.1.9
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.
- package/dist/browser-surface-control-queue.d.ts +42 -0
- package/dist/browser-surface-control-queue.js +187 -0
- package/dist/browser-surface-ws.d.ts +14 -0
- package/dist/browser-surface-ws.js +355 -0
- package/dist/control-api.d.ts +59 -4
- package/dist/control-api.js +2213 -132
- package/dist/control-web/assets/highlighted-body-OFNGDK62-e-w61YLy.js +1 -0
- package/dist/control-web/assets/index-BQ7XVBKO.css +32 -0
- package/dist/control-web/assets/index-ClpzuBJx.js +606 -0
- package/dist/control-web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/control-web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/control-web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/control-web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/control-web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/control-web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/control-web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/control-web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/control-web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/control-web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/control-web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/control-web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/control-web/assets/mermaid-GHXKKRXX-DZn7Hbr2.js +131 -0
- package/dist/control-web/assets/rynx-wordmark-LL1QRYHD.png +0 -0
- package/dist/control-web/favicon.png +0 -0
- package/dist/control-web/favicon.svg +38 -0
- package/dist/control-web/index.html +16 -0
- package/dist/control-web-dist.d.ts +1 -1
- package/dist/control-web-dist.js +19 -14
- package/dist/desktop-browser-host.d.ts +153 -0
- package/dist/desktop-browser-host.js +936 -0
- package/dist/direct-runtime-browser-surface-server.d.ts +74 -0
- package/dist/direct-runtime-browser-surface-server.js +821 -0
- package/dist/direct-runtime-server.d.ts +137 -0
- package/dist/direct-runtime-server.js +1931 -0
- package/dist/emulator-surface-ws.d.ts +6 -0
- package/dist/emulator-surface-ws.js +197 -0
- package/dist/machine-session-service.d.ts +182 -0
- package/dist/machine-session-service.js +559 -0
- package/dist/provider-cli-host.d.ts +10 -0
- package/dist/provider-cli-host.js +1 -0
- package/dist/remote-runtime-dispatcher.d.ts +94 -0
- package/dist/remote-runtime-dispatcher.js +380 -0
- package/dist/remote-runtime-session-projection.d.ts +19 -0
- package/dist/remote-runtime-session-projection.js +556 -0
- package/dist/remote-runtime.d.ts +22 -0
- package/dist/remote-runtime.js +32 -0
- package/dist/runtime-web-auth.d.ts +21 -0
- package/dist/runtime-web-auth.js +92 -0
- package/dist/server.d.ts +292 -10
- package/dist/server.js +314 -98
- package/dist/session-browser-service.d.ts +218 -0
- package/dist/session-browser-service.js +686 -0
- package/dist/session-browser-surface-coordinator.d.ts +23 -0
- package/dist/session-browser-surface-coordinator.js +563 -0
- package/dist/session-emulator-service.d.ts +167 -0
- package/dist/session-emulator-service.js +464 -0
- package/dist/session-runtime-index.d.ts +17 -0
- package/dist/session-runtime-index.js +86 -0
- package/dist/session-terminal-host.d.ts +46 -0
- package/dist/session-terminal-host.js +252 -0
- package/dist/terminal-ws.d.ts +9 -20
- package/dist/terminal-ws.js +420 -97
- package/package.json +9 -7
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
var CD=Object.defineProperty;var ED=(e,t,r)=>t in e?CD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ir=(e,t,r)=>ED(e,typeof t!="symbol"?t+"":t,r);function RD(e,t){for(var r=0;r<t.length;r++){const i=t[r];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(i,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();function H0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mg={exports:{}},Hc={};/**
|
|
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 nS;function kD(){if(nS)return Hc;nS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(i,s,o){var c=null;if(o!==void 0&&(c=""+o),s.key!==void 0&&(c=""+s.key),"key"in s){o={};for(var d in s)d!=="key"&&(o[d]=s[d])}else o=s;return s=o.ref,{$$typeof:e,type:i,key:c,ref:s!==void 0?s:null,props:o}}return Hc.Fragment=t,Hc.jsx=r,Hc.jsxs=r,Hc}var sS;function ND(){return sS||(sS=1,Mg.exports=kD()),Mg.exports}var u=ND(),Tg={exports:{}},He={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.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 aS;function AD(){if(aS)return He;aS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),b=Symbol.iterator;function x($){return $===null||typeof $!="object"?null:($=b&&$[b]||$["@@iterator"],typeof $=="function"?$:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,E={};function C($,X,V){this.props=$,this.context=X,this.refs=E,this.updater=V||w}C.prototype.isReactComponent={},C.prototype.setState=function($,X){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,X,"setState")},C.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function A(){}A.prototype=C.prototype;function N($,X,V){this.props=$,this.context=X,this.refs=E,this.updater=V||w}var k=N.prototype=new A;k.constructor=N,S(k,C.prototype),k.isPureReactComponent=!0;var O=Array.isArray;function z(){}var H={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function G($,X,V){var J=V.ref;return{$$typeof:e,type:$,key:X,ref:J!==void 0?J:null,props:V}}function Y($,X){return G($.type,X,$.props)}function W($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function L($){var X={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(V){return X[V]})}var T=/\/+/g;function j($,X){return typeof $=="object"&&$!==null&&$.key!=null?L(""+$.key):X.toString(36)}function U($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(z,z):($.status="pending",$.then(function(X){$.status==="pending"&&($.status="fulfilled",$.value=X)},function(X){$.status==="pending"&&($.status="rejected",$.reason=X)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function M($,X,V,J,le){var ae=typeof $;(ae==="undefined"||ae==="boolean")&&($=null);var ee=!1;if($===null)ee=!0;else switch(ae){case"bigint":case"string":case"number":ee=!0;break;case"object":switch($.$$typeof){case e:case t:ee=!0;break;case g:return ee=$._init,M(ee($._payload),X,V,J,le)}}if(ee)return le=le($),ee=J===""?"."+j($,0):J,O(le)?(V="",ee!=null&&(V=ee.replace(T,"$&/")+"/"),M(le,X,V,"",function(Se){return Se})):le!=null&&(W(le)&&(le=Y(le,V+(le.key==null||$&&$.key===le.key?"":(""+le.key).replace(T,"$&/")+"/")+ee)),X.push(le)),1;ee=0;var se=J===""?".":J+":";if(O($))for(var ce=0;ce<$.length;ce++)J=$[ce],ae=se+j(J,ce),ee+=M(J,X,V,ae,le);else if(ce=x($),typeof ce=="function")for($=ce.call($),ce=0;!(J=$.next()).done;)J=J.value,ae=se+j(J,ce++),ee+=M(J,X,V,ae,le);else if(ae==="object"){if(typeof $.then=="function")return M(U($),X,V,J,le);throw X=String($),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ee}function P($,X,V){if($==null)return $;var J=[],le=0;return M($,J,"","",function(ae){return X.call(V,ae,le++)}),J}function I($){if($._status===-1){var X=$._result;X=X(),X.then(function(V){($._status===0||$._status===-1)&&($._status=1,$._result=V)},function(V){($._status===0||$._status===-1)&&($._status=2,$._result=V)}),$._status===-1&&($._status=0,$._result=X)}if($._status===1)return $._result.default;throw $._result}var F=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}console.error($)},q={map:P,forEach:function($,X,V){P($,function(){X.apply(this,arguments)},V)},count:function($){var X=0;return P($,function(){X++}),X},toArray:function($){return P($,function(X){return X})||[]},only:function($){if(!W($))throw Error("React.Children.only expected to receive a single React element child.");return $}};return He.Activity=p,He.Children=q,He.Component=C,He.Fragment=r,He.Profiler=s,He.PureComponent=N,He.StrictMode=i,He.Suspense=m,He.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,He.__COMPILER_RUNTIME={__proto__:null,c:function($){return H.H.useMemoCache($)}},He.cache=function($){return function(){return $.apply(null,arguments)}},He.cacheSignal=function(){return null},He.cloneElement=function($,X,V){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var J=S({},$.props),le=$.key;if(X!=null)for(ae in X.key!==void 0&&(le=""+X.key),X)!D.call(X,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&X.ref===void 0||(J[ae]=X[ae]);var ae=arguments.length-2;if(ae===1)J.children=V;else if(1<ae){for(var ee=Array(ae),se=0;se<ae;se++)ee[se]=arguments[se+2];J.children=ee}return G($.type,le,J)},He.createContext=function($){return $={$$typeof:c,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null},$.Provider=$,$.Consumer={$$typeof:o,_context:$},$},He.createElement=function($,X,V){var J,le={},ae=null;if(X!=null)for(J in X.key!==void 0&&(ae=""+X.key),X)D.call(X,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(le[J]=X[J]);var ee=arguments.length-2;if(ee===1)le.children=V;else if(1<ee){for(var se=Array(ee),ce=0;ce<ee;ce++)se[ce]=arguments[ce+2];le.children=se}if($&&$.defaultProps)for(J in ee=$.defaultProps,ee)le[J]===void 0&&(le[J]=ee[J]);return G($,ae,le)},He.createRef=function(){return{current:null}},He.forwardRef=function($){return{$$typeof:d,render:$}},He.isValidElement=W,He.lazy=function($){return{$$typeof:g,_payload:{_status:-1,_result:$},_init:I}},He.memo=function($,X){return{$$typeof:f,type:$,compare:X===void 0?null:X}},He.startTransition=function($){var X=H.T,V={};H.T=V;try{var J=$(),le=H.S;le!==null&&le(V,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(z,F)}catch(ae){F(ae)}finally{X!==null&&V.types!==null&&(X.types=V.types),H.T=X}},He.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},He.use=function($){return H.H.use($)},He.useActionState=function($,X,V){return H.H.useActionState($,X,V)},He.useCallback=function($,X){return H.H.useCallback($,X)},He.useContext=function($){return H.H.useContext($)},He.useDebugValue=function(){},He.useDeferredValue=function($,X){return H.H.useDeferredValue($,X)},He.useEffect=function($,X){return H.H.useEffect($,X)},He.useEffectEvent=function($){return H.H.useEffectEvent($)},He.useId=function(){return H.H.useId()},He.useImperativeHandle=function($,X,V){return H.H.useImperativeHandle($,X,V)},He.useInsertionEffect=function($,X){return H.H.useInsertionEffect($,X)},He.useLayoutEffect=function($,X){return H.H.useLayoutEffect($,X)},He.useMemo=function($,X){return H.H.useMemo($,X)},He.useOptimistic=function($,X){return H.H.useOptimistic($,X)},He.useReducer=function($,X,V){return H.H.useReducer($,X,V)},He.useRef=function($){return H.H.useRef($)},He.useState=function($){return H.H.useState($)},He.useSyncExternalStore=function($,X,V){return H.H.useSyncExternalStore($,X,V)},He.useTransition=function(){return H.H.useTransition()},He.version="19.2.7",He}var oS;function F0(){return oS||(oS=1,Tg.exports=AD()),Tg.exports}var _=F0();const ye=H0(_),kf=RD({__proto__:null,default:ye},[_]);var Dg={exports:{}},Fc={},Lg={exports:{}},jg={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.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 lS;function MD(){return lS||(lS=1,(function(e){function t(M,P){var I=M.length;M.push(P);e:for(;0<I;){var F=I-1>>>1,q=M[F];if(0<s(q,P))M[F]=P,M[I]=q,I=F;else break e}}function r(M){return M.length===0?null:M[0]}function i(M){if(M.length===0)return null;var P=M[0],I=M.pop();if(I!==P){M[0]=I;e:for(var F=0,q=M.length,$=q>>>1;F<$;){var X=2*(F+1)-1,V=M[X],J=X+1,le=M[J];if(0>s(V,I))J<q&&0>s(le,V)?(M[F]=le,M[J]=I,F=J):(M[F]=V,M[X]=I,F=X);else if(J<q&&0>s(le,I))M[F]=le,M[J]=I,F=J;else break e}}return P}function s(M,P){var I=M.sortIndex-P.sortIndex;return I!==0?I:M.id-P.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var m=[],f=[],g=1,p=null,b=3,x=!1,w=!1,S=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function k(M){for(var P=r(f);P!==null;){if(P.callback===null)i(f);else if(P.startTime<=M)i(f),P.sortIndex=P.expirationTime,t(m,P);else break;P=r(f)}}function O(M){if(S=!1,k(M),!w)if(r(m)!==null)w=!0,z||(z=!0,L());else{var P=r(f);P!==null&&U(O,P.startTime-M)}}var z=!1,H=-1,D=5,G=-1;function Y(){return E?!0:!(e.unstable_now()-G<D)}function W(){if(E=!1,z){var M=e.unstable_now();G=M;var P=!0;try{e:{w=!1,S&&(S=!1,A(H),H=-1),x=!0;var I=b;try{t:{for(k(M),p=r(m);p!==null&&!(p.expirationTime>M&&Y());){var F=p.callback;if(typeof F=="function"){p.callback=null,b=p.priorityLevel;var q=F(p.expirationTime<=M);if(M=e.unstable_now(),typeof q=="function"){p.callback=q,k(M),P=!0;break t}p===r(m)&&i(m),k(M)}else i(m);p=r(m)}if(p!==null)P=!0;else{var $=r(f);$!==null&&U(O,$.startTime-M),P=!1}}break e}finally{p=null,b=I,x=!1}P=void 0}}finally{P?L():z=!1}}}var L;if(typeof N=="function")L=function(){N(W)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,j=T.port2;T.port1.onmessage=W,L=function(){j.postMessage(null)}}else L=function(){C(W,0)};function U(M,P){H=C(function(){M(e.unstable_now())},P)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(M){switch(b){case 1:case 2:case 3:var P=3;break;default:P=b}var I=b;b=P;try{return M()}finally{b=I}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(M,P){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var I=b;b=M;try{return P()}finally{b=I}},e.unstable_scheduleCallback=function(M,P,I){var F=e.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?F+I:F):I=F,M){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=I+q,M={id:g++,callback:P,priorityLevel:M,startTime:I,expirationTime:q,sortIndex:-1},I>F?(M.sortIndex=I,t(f,M),r(m)===null&&M===r(f)&&(S?(A(H),H=-1):S=!0,U(O,I-F))):(M.sortIndex=q,t(m,M),w||x||(w=!0,z||(z=!0,L()))),M},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(M){var P=b;return function(){var I=b;b=P;try{return M.apply(this,arguments)}finally{b=I}}}})(jg)),jg}var cS;function TD(){return cS||(cS=1,Lg.exports=MD()),Lg.exports}var Bg={exports:{}},$r={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var uS;function DD(){if(uS)return $r;uS=1;var e=F0();function t(m){var f="https://react.dev/errors/"+m;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)f+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+m+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal");function o(m,f,g){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:m,containerInfo:f,implementation:g}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(m,f){if(m==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return $r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,$r.createPortal=function(m,f){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return o(m,f,null,g)},$r.flushSync=function(m){var f=c.T,g=i.p;try{if(c.T=null,i.p=2,m)return m()}finally{c.T=f,i.p=g,i.d.f()}},$r.preconnect=function(m,f){typeof m=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,i.d.C(m,f))},$r.prefetchDNS=function(m){typeof m=="string"&&i.d.D(m)},$r.preinit=function(m,f){if(typeof m=="string"&&f&&typeof f.as=="string"){var g=f.as,p=d(g,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,x=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;g==="style"?i.d.S(m,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:p,integrity:b,fetchPriority:x}):g==="script"&&i.d.X(m,{crossOrigin:p,integrity:b,fetchPriority:x,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},$r.preinitModule=function(m,f){if(typeof m=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var g=d(f.as,f.crossOrigin);i.d.M(m,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&i.d.M(m)},$r.preload=function(m,f){if(typeof m=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var g=f.as,p=d(g,f.crossOrigin);i.d.L(m,g,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},$r.preloadModule=function(m,f){if(typeof m=="string")if(f){var g=d(f.as,f.crossOrigin);i.d.m(m,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else i.d.m(m)},$r.requestFormReset=function(m){i.d.r(m)},$r.unstable_batchedUpdates=function(m,f){return m(f)},$r.useFormState=function(m,f,g){return c.H.useFormState(m,f,g)},$r.useFormStatus=function(){return c.H.useHostTransitionStatus()},$r.version="19.2.7",$r}var dS;function oE(){if(dS)return Bg.exports;dS=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Bg.exports=DD(),Bg.exports}/**
|
|
34
|
+
* @license React
|
|
35
|
+
* react-dom-client.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var hS;function LD(){if(hS)return Fc;hS=1;var e=TD(),t=F0(),r=oE();function i(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)a+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function o(n){var a=n,l=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(l=a.return),n=a.return;while(n)}return a.tag===3?l:null}function c(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function d(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function m(n){if(o(n)!==n)throw Error(i(188))}function f(n){var a=n.alternate;if(!a){if(a=o(n),a===null)throw Error(i(188));return a!==n?null:n}for(var l=n,h=a;;){var v=l.return;if(v===null)break;var y=v.alternate;if(y===null){if(h=v.return,h!==null){l=h;continue}break}if(v.child===y.child){for(y=v.child;y;){if(y===l)return m(v),n;if(y===h)return m(v),a;y=y.sibling}throw Error(i(188))}if(l.return!==h.return)l=v,h=y;else{for(var R=!1,B=v.child;B;){if(B===l){R=!0,l=v,h=y;break}if(B===h){R=!0,h=v,l=y;break}B=B.sibling}if(!R){for(B=y.child;B;){if(B===l){R=!0,l=y,h=v;break}if(B===h){R=!0,h=y,l=v;break}B=B.sibling}if(!R)throw Error(i(189))}}if(l.alternate!==h)throw Error(i(190))}if(l.tag!==3)throw Error(i(188));return l.stateNode.current===l?n:a}function g(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=g(n),a!==null)return a;n=n.sibling}return null}var p=Object.assign,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),N=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function L(n){return n===null||typeof n!="object"?null:(n=W&&n[W]||n["@@iterator"],typeof n=="function"?n:null)}var T=Symbol.for("react.client.reference");function j(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===T?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case S:return"Fragment";case C:return"Profiler";case E:return"StrictMode";case O:return"Suspense";case z:return"SuspenseList";case G:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case w:return"Portal";case N:return n.displayName||"Context";case A:return(n._context.displayName||"Context")+".Consumer";case k:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case H:return a=n.displayName||null,a!==null?a:j(n.type)||"Memo";case D:a=n._payload,n=n._init;try{return j(n(a))}catch{}}return null}var U=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},F=[],q=-1;function $(n){return{current:n}}function X(n){0>q||(n.current=F[q],F[q]=null,q--)}function V(n,a){q++,F[q]=n.current,n.current=a}var J=$(null),le=$(null),ae=$(null),ee=$(null);function se(n,a){switch(V(ae,a),V(le,n),V(J,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?kw(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=kw(a),n=Nw(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}X(J),V(J,n)}function ce(){X(J),X(le),X(ae)}function Se(n){n.memoizedState!==null&&V(ee,n);var a=J.current,l=Nw(a,n.type);a!==l&&(V(le,n),V(J,l))}function Re(n){le.current===n&&(X(J),X(le)),ee.current===n&&(X(ee),zc._currentValue=I)}var Ne,Q;function re(n){if(Ne===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);Ne=a&&a[1]||"",Q=-1<l.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Ne+n+Q}var be=!1;function pe(n,a){if(!n||be)return"";be=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(ue){var oe=ue}Reflect.construct(n,[],fe)}else{try{fe.call()}catch(ue){oe=ue}n.call(fe.prototype)}}else{try{throw Error()}catch(ue){oe=ue}(fe=n())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(ue){if(ue&&oe&&typeof ue.stack=="string")return[ue.stack,oe.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=h.DetermineComponentFrameRoot(),R=y[0],B=y[1];if(R&&B){var K=R.split(`
|
|
44
|
+
`),ne=B.split(`
|
|
45
|
+
`);for(v=h=0;h<K.length&&!K[h].includes("DetermineComponentFrameRoot");)h++;for(;v<ne.length&&!ne[v].includes("DetermineComponentFrameRoot");)v++;if(h===K.length||v===ne.length)for(h=K.length-1,v=ne.length-1;1<=h&&0<=v&&K[h]!==ne[v];)v--;for(;1<=h&&0<=v;h--,v--)if(K[h]!==ne[v]){if(h!==1||v!==1)do if(h--,v--,0>v||K[h]!==ne[v]){var de=`
|
|
46
|
+
`+K[h].replace(" at new "," at ");return n.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",n.displayName)),de}while(1<=h&&0<=v);break}}}finally{be=!1,Error.prepareStackTrace=l}return(l=n?n.displayName||n.name:"")?re(l):""}function Ee(n,a){switch(n.tag){case 26:case 27:case 5:return re(n.type);case 16:return re("Lazy");case 13:return n.child!==a&&a!==null?re("Suspense Fallback"):re("Suspense");case 19:return re("SuspenseList");case 0:case 15:return pe(n.type,!1);case 11:return pe(n.type.render,!1);case 1:return pe(n.type,!0);case 31:return re("Activity");default:return""}}function Ie(n){try{var a="",l=null;do a+=Ee(n,l),l=n,n=n.return;while(n);return a}catch(h){return`
|
|
47
|
+
Error generating stack: `+h.message+`
|
|
48
|
+
`+h.stack}}var Te=Object.prototype.hasOwnProperty,Ye=e.unstable_scheduleCallback,ft=e.unstable_cancelCallback,Ge=e.unstable_shouldYield,zt=e.unstable_requestPaint,dt=e.unstable_now,Vt=e.unstable_getCurrentPriorityLevel,Wr=e.unstable_ImmediatePriority,_n=e.unstable_UserBlockingPriority,Gt=e.unstable_NormalPriority,Jt=e.unstable_LowPriority,Jr=e.unstable_IdlePriority,Xi=e.log,Ri=e.unstable_setDisableYieldValue,yn=null,gr=null;function Qr(n){if(typeof Xi=="function"&&Ri(n),gr&&typeof gr.setStrictMode=="function")try{gr.setStrictMode(yn,n)}catch{}}var or=Math.clz32?Math.clz32:ve,Mo=Math.log,Ds=Math.LN2;function ve(n){return n>>>=0,n===0?32:31-(Mo(n)/Ds|0)|0}var Le=256,Je=262144,wt=4194304;function gt(n){var a=n&42;if(a!==0)return a;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Pe(n,a,l){var h=n.pendingLanes;if(h===0)return 0;var v=0,y=n.suspendedLanes,R=n.pingedLanes;n=n.warmLanes;var B=h&134217727;return B!==0?(h=B&~y,h!==0?v=gt(h):(R&=B,R!==0?v=gt(R):l||(l=B&~n,l!==0&&(v=gt(l))))):(B=h&~y,B!==0?v=gt(B):R!==0?v=gt(R):l||(l=h&~n,l!==0&&(v=gt(l)))),v===0?0:a!==0&&a!==v&&(a&y)===0&&(y=v&-v,l=a&-a,y>=l||y===32&&(l&4194048)!==0)?a:v}function ct(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function Ct(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 zr(){var n=wt;return wt<<=1,(wt&62914560)===0&&(wt=4194304),n}function Ls(n){for(var a=[],l=0;31>l;l++)a.push(n);return a}function Lt(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function ei(n,a,l,h,v,y){var R=n.pendingLanes;n.pendingLanes=l,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=l,n.entangledLanes&=l,n.errorRecoveryDisabledLanes&=l,n.shellSuspendCounter=0;var B=n.entanglements,K=n.expirationTimes,ne=n.hiddenUpdates;for(l=R&~l;0<l;){var de=31-or(l),fe=1<<de;B[de]=0,K[de]=-1;var oe=ne[de];if(oe!==null)for(ne[de]=null,de=0;de<oe.length;de++){var ue=oe[de];ue!==null&&(ue.lane&=-536870913)}l&=~fe}h!==0&&Da(n,h,0),y!==0&&v===0&&n.tag!==0&&(n.suspendedLanes|=y&~(R&~a))}function Da(n,a,l){n.pendingLanes|=a,n.suspendedLanes&=~a;var h=31-or(a);n.entangledLanes|=a,n.entanglements[h]=n.entanglements[h]|1073741824|l&261930}function ti(n,a){var l=n.entangledLanes|=a;for(n=n.entanglements;l;){var h=31-or(l),v=1<<h;v&a|n[h]&a&&(n[h]|=a),l&=~v}}function ri(n,a){var l=a&-a;return l=(l&42)!==0?1:To(l),(l&(n.suspendedLanes|a))!==0?0:l}function To(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Zi(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function bm(){var n=P.p;return n!==0?n:(n=window.event,n===void 0?32:Zw(n.type))}function fb(n,a){var l=P.p;try{return P.p=n,a()}finally{P.p=l}}var js=Math.random().toString(36).slice(2),Nr="__reactFiber$"+js,ii="__reactProps$"+js,Do="__reactContainer$"+js,xm="__reactEvents$"+js,fT="__reactListeners$"+js,mT="__reactHandles$"+js,mb="__reactResources$"+js,Ql="__reactMarker$"+js;function wm(n){delete n[Nr],delete n[ii],delete n[xm],delete n[fT],delete n[mT]}function Lo(n){var a=n[Nr];if(a)return a;for(var l=n.parentNode;l;){if(a=l[Do]||l[Nr]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(n=Bw(n);n!==null;){if(l=n[Nr])return l;n=Bw(n)}return a}n=l,l=n.parentNode}return null}function jo(n){if(n=n[Nr]||n[Do]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function ec(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(i(33))}function Bo(n){var a=n[mb];return a||(a=n[mb]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function vr(n){n[Ql]=!0}var pb=new Set,gb={};function La(n,a){Oo(n,a),Oo(n+"Capture",a)}function Oo(n,a){for(gb[n]=a,n=0;n<a.length;n++)pb.add(a[n])}var pT=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]*$"),vb={},_b={};function gT(n){return Te.call(_b,n)?!0:Te.call(vb,n)?!1:pT.test(n)?_b[n]=!0:(vb[n]=!0,!1)}function td(n,a,l){if(gT(a))if(l===null)n.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+l)}}function rd(n,a,l){if(l===null)n.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+l)}}function qn(n,a,l,h){if(h===null)n.removeAttribute(l);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(l);return}n.setAttributeNS(a,l,""+h)}}function ki(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function yb(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function vT(n,a,l){var h=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var v=h.get,y=h.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return v.call(this)},set:function(R){l=""+R,y.call(this,R)}}),Object.defineProperty(n,a,{enumerable:h.enumerable}),{getValue:function(){return l},setValue:function(R){l=""+R},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function Sm(n){if(!n._valueTracker){var a=yb(n)?"checked":"value";n._valueTracker=vT(n,a,""+n[a])}}function bb(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var l=a.getValue(),h="";return n&&(h=yb(n)?n.checked?"true":"false":n.value),n=h,n!==l?(a.setValue(n),!0):!1}function id(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var _T=/[\n"\\]/g;function Ni(n){return n.replace(_T,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Cm(n,a,l,h,v,y,R,B){n.name="",R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?n.type=R:n.removeAttribute("type"),a!=null?R==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+ki(a)):n.value!==""+ki(a)&&(n.value=""+ki(a)):R!=="submit"&&R!=="reset"||n.removeAttribute("value"),a!=null?Em(n,R,ki(a)):l!=null?Em(n,R,ki(l)):h!=null&&n.removeAttribute("value"),v==null&&y!=null&&(n.defaultChecked=!!y),v!=null&&(n.checked=v&&typeof v!="function"&&typeof v!="symbol"),B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?n.name=""+ki(B):n.removeAttribute("name")}function xb(n,a,l,h,v,y,R,B){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(n.type=y),a!=null||l!=null){if(!(y!=="submit"&&y!=="reset"||a!=null)){Sm(n);return}l=l!=null?""+ki(l):"",a=a!=null?""+ki(a):l,B||a===n.value||(n.value=a),n.defaultValue=a}h=h??v,h=typeof h!="function"&&typeof h!="symbol"&&!!h,n.checked=B?n.checked:!!h,n.defaultChecked=!!h,R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(n.name=R),Sm(n)}function Em(n,a,l){a==="number"&&id(n.ownerDocument)===n||n.defaultValue===""+l||(n.defaultValue=""+l)}function Po(n,a,l,h){if(n=n.options,a){a={};for(var v=0;v<l.length;v++)a["$"+l[v]]=!0;for(l=0;l<n.length;l++)v=a.hasOwnProperty("$"+n[l].value),n[l].selected!==v&&(n[l].selected=v),v&&h&&(n[l].defaultSelected=!0)}else{for(l=""+ki(l),a=null,v=0;v<n.length;v++){if(n[v].value===l){n[v].selected=!0,h&&(n[v].defaultSelected=!0);return}a!==null||n[v].disabled||(a=n[v])}a!==null&&(a.selected=!0)}}function wb(n,a,l){if(a!=null&&(a=""+ki(a),a!==n.value&&(n.value=a),l==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=l!=null?""+ki(l):""}function Sb(n,a,l,h){if(a==null){if(h!=null){if(l!=null)throw Error(i(92));if(U(h)){if(1<h.length)throw Error(i(93));h=h[0]}l=h}l==null&&(l=""),a=l}l=ki(a),n.defaultValue=l,h=n.textContent,h===l&&h!==""&&h!==null&&(n.value=h),Sm(n)}function zo(n,a){if(a){var l=n.firstChild;if(l&&l===n.lastChild&&l.nodeType===3){l.nodeValue=a;return}}n.textContent=a}var yT=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 Cb(n,a,l){var h=a.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?h?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":h?n.setProperty(a,l):typeof l!="number"||l===0||yT.has(a)?a==="float"?n.cssFloat=l:n[a]=(""+l).trim():n[a]=l+"px"}function Eb(n,a,l){if(a!=null&&typeof a!="object")throw Error(i(62));if(n=n.style,l!=null){for(var h in l)!l.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?n.setProperty(h,""):h==="float"?n.cssFloat="":n[h]="");for(var v in a)h=a[v],a.hasOwnProperty(v)&&l[v]!==h&&Cb(n,v,h)}else for(var y in a)a.hasOwnProperty(y)&&Cb(n,y,a[y])}function Rm(n){if(n.indexOf("-")===-1)return!1;switch(n){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 bT=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"]]),xT=/^[\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 nd(n){return xT.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Vn(){}var km=null;function Nm(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Io=null,$o=null;function Rb(n){var a=jo(n);if(a&&(n=a.stateNode)){var l=n[ii]||null;e:switch(n=a.stateNode,a.type){case"input":if(Cm(n,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),a=l.name,l.type==="radio"&&a!=null){for(l=n;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Ni(""+a)+'"][type="radio"]'),a=0;a<l.length;a++){var h=l[a];if(h!==n&&h.form===n.form){var v=h[ii]||null;if(!v)throw Error(i(90));Cm(h,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(a=0;a<l.length;a++)h=l[a],h.form===n.form&&bb(h)}break e;case"textarea":wb(n,l.value,l.defaultValue);break e;case"select":a=l.value,a!=null&&Po(n,!!l.multiple,a,!1)}}}var Am=!1;function kb(n,a,l){if(Am)return n(a,l);Am=!0;try{var h=n(a);return h}finally{if(Am=!1,(Io!==null||$o!==null)&&(qd(),Io&&(a=Io,n=$o,$o=Io=null,Rb(a),n)))for(a=0;a<n.length;a++)Rb(n[a])}}function tc(n,a){var l=n.stateNode;if(l===null)return null;var h=l[ii]||null;if(h===null)return null;l=h[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(n=n.type,h=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!h;break e;default:n=!1}if(n)return null;if(l&&typeof l!="function")throw Error(i(231,a,typeof l));return l}var Gn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mm=!1;if(Gn)try{var rc={};Object.defineProperty(rc,"passive",{get:function(){Mm=!0}}),window.addEventListener("test",rc,rc),window.removeEventListener("test",rc,rc)}catch{Mm=!1}var Bs=null,Tm=null,sd=null;function Nb(){if(sd)return sd;var n,a=Tm,l=a.length,h,v="value"in Bs?Bs.value:Bs.textContent,y=v.length;for(n=0;n<l&&a[n]===v[n];n++);var R=l-n;for(h=1;h<=R&&a[l-h]===v[y-h];h++);return sd=v.slice(n,1<h?1-h:void 0)}function ad(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function od(){return!0}function Ab(){return!1}function ni(n){function a(l,h,v,y,R){this._reactName=l,this._targetInst=v,this.type=h,this.nativeEvent=y,this.target=R,this.currentTarget=null;for(var B in n)n.hasOwnProperty(B)&&(l=n[B],this[B]=l?l(y):y[B]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?od:Ab,this.isPropagationStopped=Ab,this}return p(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=od)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=od)},persist:function(){},isPersistent:od}),a}var ja={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ld=ni(ja),ic=p({},ja,{view:0,detail:0}),wT=ni(ic),Dm,Lm,nc,cd=p({},ic,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bm,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==nc&&(nc&&n.type==="mousemove"?(Dm=n.screenX-nc.screenX,Lm=n.screenY-nc.screenY):Lm=Dm=0,nc=n),Dm)},movementY:function(n){return"movementY"in n?n.movementY:Lm}}),Mb=ni(cd),ST=p({},cd,{dataTransfer:0}),CT=ni(ST),ET=p({},ic,{relatedTarget:0}),jm=ni(ET),RT=p({},ja,{animationName:0,elapsedTime:0,pseudoElement:0}),kT=ni(RT),NT=p({},ja,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),AT=ni(NT),MT=p({},ja,{data:0}),Tb=ni(MT),TT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},DT={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"},LT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jT(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=LT[n])?!!a[n]:!1}function Bm(){return jT}var BT=p({},ic,{key:function(n){if(n.key){var a=TT[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=ad(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?DT[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bm,charCode:function(n){return n.type==="keypress"?ad(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?ad(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),OT=ni(BT),PT=p({},cd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Db=ni(PT),zT=p({},ic,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bm}),IT=ni(zT),$T=p({},ja,{propertyName:0,elapsedTime:0,pseudoElement:0}),UT=ni($T),HT=p({},cd,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),FT=ni(HT),WT=p({},ja,{newState:0,oldState:0}),qT=ni(WT),VT=[9,13,27,32],Om=Gn&&"CompositionEvent"in window,sc=null;Gn&&"documentMode"in document&&(sc=document.documentMode);var GT=Gn&&"TextEvent"in window&&!sc,Lb=Gn&&(!Om||sc&&8<sc&&11>=sc),jb=" ",Bb=!1;function Ob(n,a){switch(n){case"keyup":return VT.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pb(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Uo=!1;function YT(n,a){switch(n){case"compositionend":return Pb(a);case"keypress":return a.which!==32?null:(Bb=!0,jb);case"textInput":return n=a.data,n===jb&&Bb?null:n;default:return null}}function KT(n,a){if(Uo)return n==="compositionend"||!Om&&Ob(n,a)?(n=Nb(),sd=Tm=Bs=null,Uo=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Lb&&a.locale!=="ko"?null:a.data;default:return null}}var XT={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 zb(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!XT[n.type]:a==="textarea"}function Ib(n,a,l,h){Io?$o?$o.push(h):$o=[h]:Io=h,a=Jd(a,"onChange"),0<a.length&&(l=new ld("onChange","change",null,l,h),n.push({event:l,listeners:a}))}var ac=null,oc=null;function ZT(n){xw(n,0)}function ud(n){var a=ec(n);if(bb(a))return n}function $b(n,a){if(n==="change")return a}var Ub=!1;if(Gn){var Pm;if(Gn){var zm="oninput"in document;if(!zm){var Hb=document.createElement("div");Hb.setAttribute("oninput","return;"),zm=typeof Hb.oninput=="function"}Pm=zm}else Pm=!1;Ub=Pm&&(!document.documentMode||9<document.documentMode)}function Fb(){ac&&(ac.detachEvent("onpropertychange",Wb),oc=ac=null)}function Wb(n){if(n.propertyName==="value"&&ud(oc)){var a=[];Ib(a,oc,n,Nm(n)),kb(ZT,a)}}function JT(n,a,l){n==="focusin"?(Fb(),ac=a,oc=l,ac.attachEvent("onpropertychange",Wb)):n==="focusout"&&Fb()}function QT(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ud(oc)}function e3(n,a){if(n==="click")return ud(a)}function t3(n,a){if(n==="input"||n==="change")return ud(a)}function r3(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var fi=typeof Object.is=="function"?Object.is:r3;function lc(n,a){if(fi(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var l=Object.keys(n),h=Object.keys(a);if(l.length!==h.length)return!1;for(h=0;h<l.length;h++){var v=l[h];if(!Te.call(a,v)||!fi(n[v],a[v]))return!1}return!0}function qb(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Vb(n,a){var l=qb(n);n=0;for(var h;l;){if(l.nodeType===3){if(h=n+l.textContent.length,n<=a&&h>=a)return{node:l,offset:a-n};n=h}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=qb(l)}}function Gb(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Gb(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function Yb(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=id(n.document);a instanceof n.HTMLIFrameElement;){try{var l=typeof a.contentWindow.location.href=="string"}catch{l=!1}if(l)n=a.contentWindow;else break;a=id(n.document)}return a}function Im(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var i3=Gn&&"documentMode"in document&&11>=document.documentMode,Ho=null,$m=null,cc=null,Um=!1;function Kb(n,a,l){var h=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Um||Ho==null||Ho!==id(h)||(h=Ho,"selectionStart"in h&&Im(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),cc&&lc(cc,h)||(cc=h,h=Jd($m,"onSelect"),0<h.length&&(a=new ld("onSelect","select",null,a,l),n.push({event:a,listeners:h}),a.target=Ho)))}function Ba(n,a){var l={};return l[n.toLowerCase()]=a.toLowerCase(),l["Webkit"+n]="webkit"+a,l["Moz"+n]="moz"+a,l}var Fo={animationend:Ba("Animation","AnimationEnd"),animationiteration:Ba("Animation","AnimationIteration"),animationstart:Ba("Animation","AnimationStart"),transitionrun:Ba("Transition","TransitionRun"),transitionstart:Ba("Transition","TransitionStart"),transitioncancel:Ba("Transition","TransitionCancel"),transitionend:Ba("Transition","TransitionEnd")},Hm={},Xb={};Gn&&(Xb=document.createElement("div").style,"AnimationEvent"in window||(delete Fo.animationend.animation,delete Fo.animationiteration.animation,delete Fo.animationstart.animation),"TransitionEvent"in window||delete Fo.transitionend.transition);function Oa(n){if(Hm[n])return Hm[n];if(!Fo[n])return n;var a=Fo[n],l;for(l in a)if(a.hasOwnProperty(l)&&l in Xb)return Hm[n]=a[l];return n}var Zb=Oa("animationend"),Jb=Oa("animationiteration"),Qb=Oa("animationstart"),n3=Oa("transitionrun"),s3=Oa("transitionstart"),a3=Oa("transitioncancel"),ex=Oa("transitionend"),tx=new Map,Fm="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(" ");Fm.push("scrollEnd");function Ji(n,a){tx.set(n,a),La(a,[n])}var dd=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Ai=[],Wo=0,Wm=0;function hd(){for(var n=Wo,a=Wm=Wo=0;a<n;){var l=Ai[a];Ai[a++]=null;var h=Ai[a];Ai[a++]=null;var v=Ai[a];Ai[a++]=null;var y=Ai[a];if(Ai[a++]=null,h!==null&&v!==null){var R=h.pending;R===null?v.next=v:(v.next=R.next,R.next=v),h.pending=v}y!==0&&rx(l,v,y)}}function fd(n,a,l,h){Ai[Wo++]=n,Ai[Wo++]=a,Ai[Wo++]=l,Ai[Wo++]=h,Wm|=h,n.lanes|=h,n=n.alternate,n!==null&&(n.lanes|=h)}function qm(n,a,l,h){return fd(n,a,l,h),md(n)}function Pa(n,a){return fd(n,null,null,a),md(n)}function rx(n,a,l){n.lanes|=l;var h=n.alternate;h!==null&&(h.lanes|=l);for(var v=!1,y=n.return;y!==null;)y.childLanes|=l,h=y.alternate,h!==null&&(h.childLanes|=l),y.tag===22&&(n=y.stateNode,n===null||n._visibility&1||(v=!0)),n=y,y=y.return;return n.tag===3?(y=n.stateNode,v&&a!==null&&(v=31-or(l),n=y.hiddenUpdates,h=n[v],h===null?n[v]=[a]:h.push(a),a.lane=l|536870912),y):null}function md(n){if(50<Tc)throw Tc=0,eg=null,Error(i(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var qo={};function o3(n,a,l,h){this.tag=n,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mi(n,a,l,h){return new o3(n,a,l,h)}function Vm(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Yn(n,a){var l=n.alternate;return l===null?(l=mi(n.tag,a,n.key,n.mode),l.elementType=n.elementType,l.type=n.type,l.stateNode=n.stateNode,l.alternate=n,n.alternate=l):(l.pendingProps=a,l.type=n.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=n.flags&65011712,l.childLanes=n.childLanes,l.lanes=n.lanes,l.child=n.child,l.memoizedProps=n.memoizedProps,l.memoizedState=n.memoizedState,l.updateQueue=n.updateQueue,a=n.dependencies,l.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},l.sibling=n.sibling,l.index=n.index,l.ref=n.ref,l.refCleanup=n.refCleanup,l}function ix(n,a){n.flags&=65011714;var l=n.alternate;return l===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=l.childLanes,n.lanes=l.lanes,n.child=l.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=l.memoizedProps,n.memoizedState=l.memoizedState,n.updateQueue=l.updateQueue,n.type=l.type,a=l.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function pd(n,a,l,h,v,y){var R=0;if(h=n,typeof n=="function")Vm(n)&&(R=1);else if(typeof n=="string")R=hD(n,l,J.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case G:return n=mi(31,l,a,v),n.elementType=G,n.lanes=y,n;case S:return za(l.children,v,y,a);case E:R=8,v|=24;break;case C:return n=mi(12,l,a,v|2),n.elementType=C,n.lanes=y,n;case O:return n=mi(13,l,a,v),n.elementType=O,n.lanes=y,n;case z:return n=mi(19,l,a,v),n.elementType=z,n.lanes=y,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case N:R=10;break e;case A:R=9;break e;case k:R=11;break e;case H:R=14;break e;case D:R=16,h=null;break e}R=29,l=Error(i(130,n===null?"null":typeof n,"")),h=null}return a=mi(R,l,a,v),a.elementType=n,a.type=h,a.lanes=y,a}function za(n,a,l,h){return n=mi(7,n,h,a),n.lanes=l,n}function Gm(n,a,l){return n=mi(6,n,null,a),n.lanes=l,n}function nx(n){var a=mi(18,null,null,0);return a.stateNode=n,a}function Ym(n,a,l){return a=mi(4,n.children!==null?n.children:[],n.key,a),a.lanes=l,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var sx=new WeakMap;function Mi(n,a){if(typeof n=="object"&&n!==null){var l=sx.get(n);return l!==void 0?l:(a={value:n,source:a,stack:Ie(a)},sx.set(n,a),a)}return{value:n,source:a,stack:Ie(a)}}var Vo=[],Go=0,gd=null,uc=0,Ti=[],Di=0,Os=null,bn=1,xn="";function Kn(n,a){Vo[Go++]=uc,Vo[Go++]=gd,gd=n,uc=a}function ax(n,a,l){Ti[Di++]=bn,Ti[Di++]=xn,Ti[Di++]=Os,Os=n;var h=bn;n=xn;var v=32-or(h)-1;h&=~(1<<v),l+=1;var y=32-or(a)+v;if(30<y){var R=v-v%5;y=(h&(1<<R)-1).toString(32),h>>=R,v-=R,bn=1<<32-or(a)+v|l<<v|h,xn=y+n}else bn=1<<y|l<<v|h,xn=n}function Km(n){n.return!==null&&(Kn(n,1),ax(n,1,0))}function Xm(n){for(;n===gd;)gd=Vo[--Go],Vo[Go]=null,uc=Vo[--Go],Vo[Go]=null;for(;n===Os;)Os=Ti[--Di],Ti[Di]=null,xn=Ti[--Di],Ti[Di]=null,bn=Ti[--Di],Ti[Di]=null}function ox(n,a){Ti[Di++]=bn,Ti[Di++]=xn,Ti[Di++]=Os,bn=a.id,xn=a.overflow,Os=n}var Ar=null,Rt=null,st=!1,Ps=null,Li=!1,Zm=Error(i(519));function zs(n){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw dc(Mi(a,n)),Zm}function lx(n){var a=n.stateNode,l=n.type,h=n.memoizedProps;switch(a[Nr]=n,a[ii]=h,l){case"dialog":tt("cancel",a),tt("close",a);break;case"iframe":case"object":case"embed":tt("load",a);break;case"video":case"audio":for(l=0;l<Lc.length;l++)tt(Lc[l],a);break;case"source":tt("error",a);break;case"img":case"image":case"link":tt("error",a),tt("load",a);break;case"details":tt("toggle",a);break;case"input":tt("invalid",a),xb(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":tt("invalid",a);break;case"textarea":tt("invalid",a),Sb(a,h.value,h.defaultValue,h.children)}l=h.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||a.textContent===""+l||h.suppressHydrationWarning===!0||Ew(a.textContent,l)?(h.popover!=null&&(tt("beforetoggle",a),tt("toggle",a)),h.onScroll!=null&&tt("scroll",a),h.onScrollEnd!=null&&tt("scrollend",a),h.onClick!=null&&(a.onclick=Vn),a=!0):a=!1,a||zs(n,!0)}function cx(n){for(Ar=n.return;Ar;)switch(Ar.tag){case 5:case 31:case 13:Li=!1;return;case 27:case 3:Li=!0;return;default:Ar=Ar.return}}function Yo(n){if(n!==Ar)return!1;if(!st)return cx(n),st=!0,!1;var a=n.tag,l;if((l=a!==3&&a!==27)&&((l=a===5)&&(l=n.type,l=!(l!=="form"&&l!=="button")||pg(n.type,n.memoizedProps)),l=!l),l&&Rt&&zs(n),cx(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));Rt=jw(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));Rt=jw(n)}else a===27?(a=Rt,Js(n.type)?(n=bg,bg=null,Rt=n):Rt=a):Rt=Ar?Bi(n.stateNode.nextSibling):null;return!0}function Ia(){Rt=Ar=null,st=!1}function Jm(){var n=Ps;return n!==null&&(li===null?li=n:li.push.apply(li,n),Ps=null),n}function dc(n){Ps===null?Ps=[n]:Ps.push(n)}var Qm=$(null),$a=null,Xn=null;function Is(n,a,l){V(Qm,a._currentValue),a._currentValue=l}function Zn(n){n._currentValue=Qm.current,X(Qm)}function ep(n,a,l){for(;n!==null;){var h=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),n===l)break;n=n.return}}function tp(n,a,l,h){var v=n.child;for(v!==null&&(v.return=n);v!==null;){var y=v.dependencies;if(y!==null){var R=v.child;y=y.firstContext;e:for(;y!==null;){var B=y;y=v;for(var K=0;K<a.length;K++)if(B.context===a[K]){y.lanes|=l,B=y.alternate,B!==null&&(B.lanes|=l),ep(y.return,l,n),h||(R=null);break e}y=B.next}}else if(v.tag===18){if(R=v.return,R===null)throw Error(i(341));R.lanes|=l,y=R.alternate,y!==null&&(y.lanes|=l),ep(R,l,n),R=null}else R=v.child;if(R!==null)R.return=v;else for(R=v;R!==null;){if(R===n){R=null;break}if(v=R.sibling,v!==null){v.return=R.return,R=v;break}R=R.return}v=R}}function Ko(n,a,l,h){n=null;for(var v=a,y=!1;v!==null;){if(!y){if((v.flags&524288)!==0)y=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var R=v.alternate;if(R===null)throw Error(i(387));if(R=R.memoizedProps,R!==null){var B=v.type;fi(v.pendingProps.value,R.value)||(n!==null?n.push(B):n=[B])}}else if(v===ee.current){if(R=v.alternate,R===null)throw Error(i(387));R.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(n!==null?n.push(zc):n=[zc])}v=v.return}n!==null&&tp(a,n,l,h),a.flags|=262144}function vd(n){for(n=n.firstContext;n!==null;){if(!fi(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Ua(n){$a=n,Xn=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Mr(n){return ux($a,n)}function _d(n,a){return $a===null&&Ua(n),ux(n,a)}function ux(n,a){var l=a._currentValue;if(a={context:a,memoizedValue:l,next:null},Xn===null){if(n===null)throw Error(i(308));Xn=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else Xn=Xn.next=a;return l}var l3=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(l,h){n.push(h)}};this.abort=function(){a.aborted=!0,n.forEach(function(l){return l()})}},c3=e.unstable_scheduleCallback,u3=e.unstable_NormalPriority,Qt={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function rp(){return{controller:new l3,data:new Map,refCount:0}}function hc(n){n.refCount--,n.refCount===0&&c3(u3,function(){n.controller.abort()})}var fc=null,ip=0,Xo=0,Zo=null;function d3(n,a){if(fc===null){var l=fc=[];ip=0,Xo=ag(),Zo={status:"pending",value:void 0,then:function(h){l.push(h)}}}return ip++,a.then(dx,dx),a}function dx(){if(--ip===0&&fc!==null){Zo!==null&&(Zo.status="fulfilled");var n=fc;fc=null,Xo=0,Zo=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function h3(n,a){var l=[],h={status:"pending",value:null,reason:null,then:function(v){l.push(v)}};return n.then(function(){h.status="fulfilled",h.value=a;for(var v=0;v<l.length;v++)(0,l[v])(a)},function(v){for(h.status="rejected",h.reason=v,v=0;v<l.length;v++)(0,l[v])(void 0)}),h}var hx=M.S;M.S=function(n,a){K1=dt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&d3(n,a),hx!==null&&hx(n,a)};var Ha=$(null);function np(){var n=Ha.current;return n!==null?n:St.pooledCache}function yd(n,a){a===null?V(Ha,Ha.current):V(Ha,a.pool)}function fx(){var n=np();return n===null?null:{parent:Qt._currentValue,pool:n}}var Jo=Error(i(460)),sp=Error(i(474)),bd=Error(i(542)),xd={then:function(){}};function mx(n){return n=n.status,n==="fulfilled"||n==="rejected"}function px(n,a,l){switch(l=n[l],l===void 0?n.push(a):l!==a&&(a.then(Vn,Vn),a=l),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,vx(n),n;default:if(typeof a.status=="string")a.then(Vn,Vn);else{if(n=St,n!==null&&100<n.shellSuspendCounter)throw Error(i(482));n=a,n.status="pending",n.then(function(h){if(a.status==="pending"){var v=a;v.status="fulfilled",v.value=h}},function(h){if(a.status==="pending"){var v=a;v.status="rejected",v.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,vx(n),n}throw Wa=a,Jo}}function Fa(n){try{var a=n._init;return a(n._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Wa=l,Jo):l}}var Wa=null;function gx(){if(Wa===null)throw Error(i(459));var n=Wa;return Wa=null,n}function vx(n){if(n===Jo||n===bd)throw Error(i(483))}var Qo=null,mc=0;function wd(n){var a=mc;return mc+=1,Qo===null&&(Qo=[]),px(Qo,n,a)}function pc(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function Sd(n,a){throw a.$$typeof===b?Error(i(525)):(n=Object.prototype.toString.call(a),Error(i(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function _x(n){function a(te,Z){if(n){var ie=te.deletions;ie===null?(te.deletions=[Z],te.flags|=16):ie.push(Z)}}function l(te,Z){if(!n)return null;for(;Z!==null;)a(te,Z),Z=Z.sibling;return null}function h(te){for(var Z=new Map;te!==null;)te.key!==null?Z.set(te.key,te):Z.set(te.index,te),te=te.sibling;return Z}function v(te,Z){return te=Yn(te,Z),te.index=0,te.sibling=null,te}function y(te,Z,ie){return te.index=ie,n?(ie=te.alternate,ie!==null?(ie=ie.index,ie<Z?(te.flags|=67108866,Z):ie):(te.flags|=67108866,Z)):(te.flags|=1048576,Z)}function R(te){return n&&te.alternate===null&&(te.flags|=67108866),te}function B(te,Z,ie,he){return Z===null||Z.tag!==6?(Z=Gm(ie,te.mode,he),Z.return=te,Z):(Z=v(Z,ie),Z.return=te,Z)}function K(te,Z,ie,he){var Oe=ie.type;return Oe===S?de(te,Z,ie.props.children,he,ie.key):Z!==null&&(Z.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===D&&Fa(Oe)===Z.type)?(Z=v(Z,ie.props),pc(Z,ie),Z.return=te,Z):(Z=pd(ie.type,ie.key,ie.props,null,te.mode,he),pc(Z,ie),Z.return=te,Z)}function ne(te,Z,ie,he){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==ie.containerInfo||Z.stateNode.implementation!==ie.implementation?(Z=Ym(ie,te.mode,he),Z.return=te,Z):(Z=v(Z,ie.children||[]),Z.return=te,Z)}function de(te,Z,ie,he,Oe){return Z===null||Z.tag!==7?(Z=za(ie,te.mode,he,Oe),Z.return=te,Z):(Z=v(Z,ie),Z.return=te,Z)}function fe(te,Z,ie){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Z=Gm(""+Z,te.mode,ie),Z.return=te,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case x:return ie=pd(Z.type,Z.key,Z.props,null,te.mode,ie),pc(ie,Z),ie.return=te,ie;case w:return Z=Ym(Z,te.mode,ie),Z.return=te,Z;case D:return Z=Fa(Z),fe(te,Z,ie)}if(U(Z)||L(Z))return Z=za(Z,te.mode,ie,null),Z.return=te,Z;if(typeof Z.then=="function")return fe(te,wd(Z),ie);if(Z.$$typeof===N)return fe(te,_d(te,Z),ie);Sd(te,Z)}return null}function oe(te,Z,ie,he){var Oe=Z!==null?Z.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return Oe!==null?null:B(te,Z,""+ie,he);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case x:return ie.key===Oe?K(te,Z,ie,he):null;case w:return ie.key===Oe?ne(te,Z,ie,he):null;case D:return ie=Fa(ie),oe(te,Z,ie,he)}if(U(ie)||L(ie))return Oe!==null?null:de(te,Z,ie,he,null);if(typeof ie.then=="function")return oe(te,Z,wd(ie),he);if(ie.$$typeof===N)return oe(te,Z,_d(te,ie),he);Sd(te,ie)}return null}function ue(te,Z,ie,he,Oe){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return te=te.get(ie)||null,B(Z,te,""+he,Oe);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case x:return te=te.get(he.key===null?ie:he.key)||null,K(Z,te,he,Oe);case w:return te=te.get(he.key===null?ie:he.key)||null,ne(Z,te,he,Oe);case D:return he=Fa(he),ue(te,Z,ie,he,Oe)}if(U(he)||L(he))return te=te.get(ie)||null,de(Z,te,he,Oe,null);if(typeof he.then=="function")return ue(te,Z,ie,wd(he),Oe);if(he.$$typeof===N)return ue(te,Z,ie,_d(Z,he),Oe);Sd(Z,he)}return null}function De(te,Z,ie,he){for(var Oe=null,ot=null,je=Z,Ve=Z=0,nt=null;je!==null&&Ve<ie.length;Ve++){je.index>Ve?(nt=je,je=null):nt=je.sibling;var lt=oe(te,je,ie[Ve],he);if(lt===null){je===null&&(je=nt);break}n&&je&<.alternate===null&&a(te,je),Z=y(lt,Z,Ve),ot===null?Oe=lt:ot.sibling=lt,ot=lt,je=nt}if(Ve===ie.length)return l(te,je),st&&Kn(te,Ve),Oe;if(je===null){for(;Ve<ie.length;Ve++)je=fe(te,ie[Ve],he),je!==null&&(Z=y(je,Z,Ve),ot===null?Oe=je:ot.sibling=je,ot=je);return st&&Kn(te,Ve),Oe}for(je=h(je);Ve<ie.length;Ve++)nt=ue(je,te,Ve,ie[Ve],he),nt!==null&&(n&&nt.alternate!==null&&je.delete(nt.key===null?Ve:nt.key),Z=y(nt,Z,Ve),ot===null?Oe=nt:ot.sibling=nt,ot=nt);return n&&je.forEach(function(ia){return a(te,ia)}),st&&Kn(te,Ve),Oe}function ze(te,Z,ie,he){if(ie==null)throw Error(i(151));for(var Oe=null,ot=null,je=Z,Ve=Z=0,nt=null,lt=ie.next();je!==null&&!lt.done;Ve++,lt=ie.next()){je.index>Ve?(nt=je,je=null):nt=je.sibling;var ia=oe(te,je,lt.value,he);if(ia===null){je===null&&(je=nt);break}n&&je&&ia.alternate===null&&a(te,je),Z=y(ia,Z,Ve),ot===null?Oe=ia:ot.sibling=ia,ot=ia,je=nt}if(lt.done)return l(te,je),st&&Kn(te,Ve),Oe;if(je===null){for(;!lt.done;Ve++,lt=ie.next())lt=fe(te,lt.value,he),lt!==null&&(Z=y(lt,Z,Ve),ot===null?Oe=lt:ot.sibling=lt,ot=lt);return st&&Kn(te,Ve),Oe}for(je=h(je);!lt.done;Ve++,lt=ie.next())lt=ue(je,te,Ve,lt.value,he),lt!==null&&(n&<.alternate!==null&&je.delete(lt.key===null?Ve:lt.key),Z=y(lt,Z,Ve),ot===null?Oe=lt:ot.sibling=lt,ot=lt);return n&&je.forEach(function(SD){return a(te,SD)}),st&&Kn(te,Ve),Oe}function yt(te,Z,ie,he){if(typeof ie=="object"&&ie!==null&&ie.type===S&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case x:e:{for(var Oe=ie.key;Z!==null;){if(Z.key===Oe){if(Oe=ie.type,Oe===S){if(Z.tag===7){l(te,Z.sibling),he=v(Z,ie.props.children),he.return=te,te=he;break e}}else if(Z.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===D&&Fa(Oe)===Z.type){l(te,Z.sibling),he=v(Z,ie.props),pc(he,ie),he.return=te,te=he;break e}l(te,Z);break}else a(te,Z);Z=Z.sibling}ie.type===S?(he=za(ie.props.children,te.mode,he,ie.key),he.return=te,te=he):(he=pd(ie.type,ie.key,ie.props,null,te.mode,he),pc(he,ie),he.return=te,te=he)}return R(te);case w:e:{for(Oe=ie.key;Z!==null;){if(Z.key===Oe)if(Z.tag===4&&Z.stateNode.containerInfo===ie.containerInfo&&Z.stateNode.implementation===ie.implementation){l(te,Z.sibling),he=v(Z,ie.children||[]),he.return=te,te=he;break e}else{l(te,Z);break}else a(te,Z);Z=Z.sibling}he=Ym(ie,te.mode,he),he.return=te,te=he}return R(te);case D:return ie=Fa(ie),yt(te,Z,ie,he)}if(U(ie))return De(te,Z,ie,he);if(L(ie)){if(Oe=L(ie),typeof Oe!="function")throw Error(i(150));return ie=Oe.call(ie),ze(te,Z,ie,he)}if(typeof ie.then=="function")return yt(te,Z,wd(ie),he);if(ie.$$typeof===N)return yt(te,Z,_d(te,ie),he);Sd(te,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Z!==null&&Z.tag===6?(l(te,Z.sibling),he=v(Z,ie),he.return=te,te=he):(l(te,Z),he=Gm(ie,te.mode,he),he.return=te,te=he),R(te)):l(te,Z)}return function(te,Z,ie,he){try{mc=0;var Oe=yt(te,Z,ie,he);return Qo=null,Oe}catch(je){if(je===Jo||je===bd)throw je;var ot=mi(29,je,null,te.mode);return ot.lanes=he,ot.return=te,ot}finally{}}}var qa=_x(!0),yx=_x(!1),$s=!1;function ap(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function op(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Us(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Hs(n,a,l){var h=n.updateQueue;if(h===null)return null;if(h=h.shared,(ut&2)!==0){var v=h.pending;return v===null?a.next=a:(a.next=v.next,v.next=a),h.pending=a,a=md(n),rx(n,null,l),a}return fd(n,h,a,l),md(n)}function gc(n,a,l){if(a=a.updateQueue,a!==null&&(a=a.shared,(l&4194048)!==0)){var h=a.lanes;h&=n.pendingLanes,l|=h,a.lanes=l,ti(n,l)}}function lp(n,a){var l=n.updateQueue,h=n.alternate;if(h!==null&&(h=h.updateQueue,l===h)){var v=null,y=null;if(l=l.firstBaseUpdate,l!==null){do{var R={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};y===null?v=y=R:y=y.next=R,l=l.next}while(l!==null);y===null?v=y=a:y=y.next=a}else v=y=a;l={baseState:h.baseState,firstBaseUpdate:v,lastBaseUpdate:y,shared:h.shared,callbacks:h.callbacks},n.updateQueue=l;return}n=l.lastBaseUpdate,n===null?l.firstBaseUpdate=a:n.next=a,l.lastBaseUpdate=a}var cp=!1;function vc(){if(cp){var n=Zo;if(n!==null)throw n}}function _c(n,a,l,h){cp=!1;var v=n.updateQueue;$s=!1;var y=v.firstBaseUpdate,R=v.lastBaseUpdate,B=v.shared.pending;if(B!==null){v.shared.pending=null;var K=B,ne=K.next;K.next=null,R===null?y=ne:R.next=ne,R=K;var de=n.alternate;de!==null&&(de=de.updateQueue,B=de.lastBaseUpdate,B!==R&&(B===null?de.firstBaseUpdate=ne:B.next=ne,de.lastBaseUpdate=K))}if(y!==null){var fe=v.baseState;R=0,de=ne=K=null,B=y;do{var oe=B.lane&-536870913,ue=oe!==B.lane;if(ue?(it&oe)===oe:(h&oe)===oe){oe!==0&&oe===Xo&&(cp=!0),de!==null&&(de=de.next={lane:0,tag:B.tag,payload:B.payload,callback:null,next:null});e:{var De=n,ze=B;oe=a;var yt=l;switch(ze.tag){case 1:if(De=ze.payload,typeof De=="function"){fe=De.call(yt,fe,oe);break e}fe=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=ze.payload,oe=typeof De=="function"?De.call(yt,fe,oe):De,oe==null)break e;fe=p({},fe,oe);break e;case 2:$s=!0}}oe=B.callback,oe!==null&&(n.flags|=64,ue&&(n.flags|=8192),ue=v.callbacks,ue===null?v.callbacks=[oe]:ue.push(oe))}else ue={lane:oe,tag:B.tag,payload:B.payload,callback:B.callback,next:null},de===null?(ne=de=ue,K=fe):de=de.next=ue,R|=oe;if(B=B.next,B===null){if(B=v.shared.pending,B===null)break;ue=B,B=ue.next,ue.next=null,v.lastBaseUpdate=ue,v.shared.pending=null}}while(!0);de===null&&(K=fe),v.baseState=K,v.firstBaseUpdate=ne,v.lastBaseUpdate=de,y===null&&(v.shared.lanes=0),Gs|=R,n.lanes=R,n.memoizedState=fe}}function bx(n,a){if(typeof n!="function")throw Error(i(191,n));n.call(a)}function xx(n,a){var l=n.callbacks;if(l!==null)for(n.callbacks=null,n=0;n<l.length;n++)bx(l[n],a)}var el=$(null),Cd=$(0);function wx(n,a){n=as,V(Cd,n),V(el,a),as=n|a.baseLanes}function up(){V(Cd,as),V(el,el.current)}function dp(){as=Cd.current,X(el),X(Cd)}var pi=$(null),ji=null;function Fs(n){var a=n.alternate;V(Yt,Yt.current&1),V(pi,n),ji===null&&(a===null||el.current!==null||a.memoizedState!==null)&&(ji=n)}function hp(n){V(Yt,Yt.current),V(pi,n),ji===null&&(ji=n)}function Sx(n){n.tag===22?(V(Yt,Yt.current),V(pi,n),ji===null&&(ji=n)):Ws()}function Ws(){V(Yt,Yt.current),V(pi,pi.current)}function gi(n){X(pi),ji===n&&(ji=null),X(Yt)}var Yt=$(0);function Ed(n){for(var a=n;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||_g(l)||yg(l)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Jn=0,We=null,vt=null,er=null,Rd=!1,tl=!1,Va=!1,kd=0,yc=0,rl=null,f3=0;function It(){throw Error(i(321))}function fp(n,a){if(a===null)return!1;for(var l=0;l<a.length&&l<n.length;l++)if(!fi(n[l],a[l]))return!1;return!0}function mp(n,a,l,h,v,y){return Jn=y,We=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,M.H=n===null||n.memoizedState===null?a1:Ap,Va=!1,y=l(h,v),Va=!1,tl&&(y=Ex(a,l,h,v)),Cx(n),y}function Cx(n){M.H=wc;var a=vt!==null&&vt.next!==null;if(Jn=0,er=vt=We=null,Rd=!1,yc=0,rl=null,a)throw Error(i(300));n===null||tr||(n=n.dependencies,n!==null&&vd(n)&&(tr=!0))}function Ex(n,a,l,h){We=n;var v=0;do{if(tl&&(rl=null),yc=0,tl=!1,25<=v)throw Error(i(301));if(v+=1,er=vt=null,n.updateQueue!=null){var y=n.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}M.H=o1,y=a(l,h)}while(tl);return y}function m3(){var n=M.H,a=n.useState()[0];return a=typeof a.then=="function"?bc(a):a,n=n.useState()[0],(vt!==null?vt.memoizedState:null)!==n&&(We.flags|=1024),a}function pp(){var n=kd!==0;return kd=0,n}function gp(n,a,l){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~l}function vp(n){if(Rd){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}Rd=!1}Jn=0,er=vt=We=null,tl=!1,yc=kd=0,rl=null}function qr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return er===null?We.memoizedState=er=n:er=er.next=n,er}function Kt(){if(vt===null){var n=We.alternate;n=n!==null?n.memoizedState:null}else n=vt.next;var a=er===null?We.memoizedState:er.next;if(a!==null)er=a,vt=n;else{if(n===null)throw We.alternate===null?Error(i(467)):Error(i(310));vt=n,n={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},er===null?We.memoizedState=er=n:er=er.next=n}return er}function Nd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function bc(n){var a=yc;return yc+=1,rl===null&&(rl=[]),n=px(rl,n,a),a=We,(er===null?a.memoizedState:er.next)===null&&(a=a.alternate,M.H=a===null||a.memoizedState===null?a1:Ap),n}function Ad(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return bc(n);if(n.$$typeof===N)return Mr(n)}throw Error(i(438,String(n)))}function _p(n){var a=null,l=We.updateQueue;if(l!==null&&(a=l.memoCache),a==null){var h=We.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(v){return v.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),l===null&&(l=Nd(),We.updateQueue=l),l.memoCache=a,l=a.data[a.index],l===void 0)for(l=a.data[a.index]=Array(n),h=0;h<n;h++)l[h]=Y;return a.index++,l}function Qn(n,a){return typeof a=="function"?a(n):a}function Md(n){var a=Kt();return yp(a,vt,n)}function yp(n,a,l){var h=n.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=l;var v=n.baseQueue,y=h.pending;if(y!==null){if(v!==null){var R=v.next;v.next=y.next,y.next=R}a.baseQueue=v=y,h.pending=null}if(y=n.baseState,v===null)n.memoizedState=y;else{a=v.next;var B=R=null,K=null,ne=a,de=!1;do{var fe=ne.lane&-536870913;if(fe!==ne.lane?(it&fe)===fe:(Jn&fe)===fe){var oe=ne.revertLane;if(oe===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),fe===Xo&&(de=!0);else if((Jn&oe)===oe){ne=ne.next,oe===Xo&&(de=!0);continue}else fe={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},K===null?(B=K=fe,R=y):K=K.next=fe,We.lanes|=oe,Gs|=oe;fe=ne.action,Va&&l(y,fe),y=ne.hasEagerState?ne.eagerState:l(y,fe)}else oe={lane:fe,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},K===null?(B=K=oe,R=y):K=K.next=oe,We.lanes|=fe,Gs|=fe;ne=ne.next}while(ne!==null&&ne!==a);if(K===null?R=y:K.next=B,!fi(y,n.memoizedState)&&(tr=!0,de&&(l=Zo,l!==null)))throw l;n.memoizedState=y,n.baseState=R,n.baseQueue=K,h.lastRenderedState=y}return v===null&&(h.lanes=0),[n.memoizedState,h.dispatch]}function bp(n){var a=Kt(),l=a.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=n;var h=l.dispatch,v=l.pending,y=a.memoizedState;if(v!==null){l.pending=null;var R=v=v.next;do y=n(y,R.action),R=R.next;while(R!==v);fi(y,a.memoizedState)||(tr=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),l.lastRenderedState=y}return[y,h]}function Rx(n,a,l){var h=We,v=Kt(),y=st;if(y){if(l===void 0)throw Error(i(407));l=l()}else l=a();var R=!fi((vt||v).memoizedState,l);if(R&&(v.memoizedState=l,tr=!0),v=v.queue,Sp(Ax.bind(null,h,v,n),[n]),v.getSnapshot!==a||R||er!==null&&er.memoizedState.tag&1){if(h.flags|=2048,il(9,{destroy:void 0},Nx.bind(null,h,v,l,a),null),St===null)throw Error(i(349));y||(Jn&127)!==0||kx(h,a,l)}return l}function kx(n,a,l){n.flags|=16384,n={getSnapshot:a,value:l},a=We.updateQueue,a===null?(a=Nd(),We.updateQueue=a,a.stores=[n]):(l=a.stores,l===null?a.stores=[n]:l.push(n))}function Nx(n,a,l,h){a.value=l,a.getSnapshot=h,Mx(a)&&Tx(n)}function Ax(n,a,l){return l(function(){Mx(a)&&Tx(n)})}function Mx(n){var a=n.getSnapshot;n=n.value;try{var l=a();return!fi(n,l)}catch{return!0}}function Tx(n){var a=Pa(n,2);a!==null&&ci(a,n,2)}function xp(n){var a=qr();if(typeof n=="function"){var l=n;if(n=l(),Va){Qr(!0);try{l()}finally{Qr(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qn,lastRenderedState:n},a}function Dx(n,a,l,h){return n.baseState=l,yp(n,vt,typeof h=="function"?h:Qn)}function p3(n,a,l,h,v){if(Ld(n))throw Error(i(485));if(n=a.action,n!==null){var y={payload:v,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(R){y.listeners.push(R)}};M.T!==null?l(!0):y.isTransition=!1,h(y),l=a.pending,l===null?(y.next=a.pending=y,Lx(a,y)):(y.next=l.next,a.pending=l.next=y)}}function Lx(n,a){var l=a.action,h=a.payload,v=n.state;if(a.isTransition){var y=M.T,R={};M.T=R;try{var B=l(v,h),K=M.S;K!==null&&K(R,B),jx(n,a,B)}catch(ne){wp(n,a,ne)}finally{y!==null&&R.types!==null&&(y.types=R.types),M.T=y}}else try{y=l(v,h),jx(n,a,y)}catch(ne){wp(n,a,ne)}}function jx(n,a,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(h){Bx(n,a,h)},function(h){return wp(n,a,h)}):Bx(n,a,l)}function Bx(n,a,l){a.status="fulfilled",a.value=l,Ox(a),n.state=l,a=n.pending,a!==null&&(l=a.next,l===a?n.pending=null:(l=l.next,a.next=l,Lx(n,l)))}function wp(n,a,l){var h=n.pending;if(n.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=l,Ox(a),a=a.next;while(a!==h)}n.action=null}function Ox(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function Px(n,a){return a}function zx(n,a){if(st){var l=St.formState;if(l!==null){e:{var h=We;if(st){if(Rt){t:{for(var v=Rt,y=Li;v.nodeType!==8;){if(!y){v=null;break t}if(v=Bi(v.nextSibling),v===null){v=null;break t}}y=v.data,v=y==="F!"||y==="F"?v:null}if(v){Rt=Bi(v.nextSibling),h=v.data==="F!";break e}}zs(h)}h=!1}h&&(a=l[0])}}return l=qr(),l.memoizedState=l.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Px,lastRenderedState:a},l.queue=h,l=i1.bind(null,We,h),h.dispatch=l,h=xp(!1),y=Np.bind(null,We,!1,h.queue),h=qr(),v={state:a,dispatch:null,action:n,pending:null},h.queue=v,l=p3.bind(null,We,v,y,l),v.dispatch=l,h.memoizedState=n,[a,l,!1]}function Ix(n){var a=Kt();return $x(a,vt,n)}function $x(n,a,l){if(a=yp(n,a,Px)[0],n=Md(Qn)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=bc(a)}catch(R){throw R===Jo?bd:R}else h=a;a=Kt();var v=a.queue,y=v.dispatch;return l!==a.memoizedState&&(We.flags|=2048,il(9,{destroy:void 0},g3.bind(null,v,l),null)),[h,y,n]}function g3(n,a){n.action=a}function Ux(n){var a=Kt(),l=vt;if(l!==null)return $x(a,l,n);Kt(),a=a.memoizedState,l=Kt();var h=l.queue.dispatch;return l.memoizedState=n,[a,h,!1]}function il(n,a,l,h){return n={tag:n,create:l,deps:h,inst:a,next:null},a=We.updateQueue,a===null&&(a=Nd(),We.updateQueue=a),l=a.lastEffect,l===null?a.lastEffect=n.next=n:(h=l.next,l.next=n,n.next=h,a.lastEffect=n),n}function Hx(){return Kt().memoizedState}function Td(n,a,l,h){var v=qr();We.flags|=n,v.memoizedState=il(1|a,{destroy:void 0},l,h===void 0?null:h)}function Dd(n,a,l,h){var v=Kt();h=h===void 0?null:h;var y=v.memoizedState.inst;vt!==null&&h!==null&&fp(h,vt.memoizedState.deps)?v.memoizedState=il(a,y,l,h):(We.flags|=n,v.memoizedState=il(1|a,y,l,h))}function Fx(n,a){Td(8390656,8,n,a)}function Sp(n,a){Dd(2048,8,n,a)}function v3(n){We.flags|=4;var a=We.updateQueue;if(a===null)a=Nd(),We.updateQueue=a,a.events=[n];else{var l=a.events;l===null?a.events=[n]:l.push(n)}}function Wx(n){var a=Kt().memoizedState;return v3({ref:a,nextImpl:n}),function(){if((ut&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function qx(n,a){return Dd(4,2,n,a)}function Vx(n,a){return Dd(4,4,n,a)}function Gx(n,a){if(typeof a=="function"){n=n();var l=a(n);return function(){typeof l=="function"?l():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function Yx(n,a,l){l=l!=null?l.concat([n]):null,Dd(4,4,Gx.bind(null,a,n),l)}function Cp(){}function Kx(n,a){var l=Kt();a=a===void 0?null:a;var h=l.memoizedState;return a!==null&&fp(a,h[1])?h[0]:(l.memoizedState=[n,a],n)}function Xx(n,a){var l=Kt();a=a===void 0?null:a;var h=l.memoizedState;if(a!==null&&fp(a,h[1]))return h[0];if(h=n(),Va){Qr(!0);try{n()}finally{Qr(!1)}}return l.memoizedState=[h,a],h}function Ep(n,a,l){return l===void 0||(Jn&1073741824)!==0&&(it&261930)===0?n.memoizedState=a:(n.memoizedState=l,n=Z1(),We.lanes|=n,Gs|=n,l)}function Zx(n,a,l,h){return fi(l,a)?l:el.current!==null?(n=Ep(n,l,h),fi(n,a)||(tr=!0),n):(Jn&42)===0||(Jn&1073741824)!==0&&(it&261930)===0?(tr=!0,n.memoizedState=l):(n=Z1(),We.lanes|=n,Gs|=n,a)}function Jx(n,a,l,h,v){var y=P.p;P.p=y!==0&&8>y?y:8;var R=M.T,B={};M.T=B,Np(n,!1,a,l);try{var K=v(),ne=M.S;if(ne!==null&&ne(B,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var de=h3(K,h);xc(n,a,de,yi(n))}else xc(n,a,h,yi(n))}catch(fe){xc(n,a,{then:function(){},status:"rejected",reason:fe},yi())}finally{P.p=y,R!==null&&B.types!==null&&(R.types=B.types),M.T=R}}function _3(){}function Rp(n,a,l,h){if(n.tag!==5)throw Error(i(476));var v=Qx(n).queue;Jx(n,v,a,I,l===null?_3:function(){return e1(n),l(h)})}function Qx(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qn,lastRenderedState:I},next:null};var l={};return a.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qn,lastRenderedState:l},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function e1(n){var a=Qx(n);a.next===null&&(a=n.alternate.memoizedState),xc(n,a.next.queue,{},yi())}function kp(){return Mr(zc)}function t1(){return Kt().memoizedState}function r1(){return Kt().memoizedState}function y3(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var l=yi();n=Us(l);var h=Hs(a,n,l);h!==null&&(ci(h,a,l),gc(h,a,l)),a={cache:rp()},n.payload=a;return}a=a.return}}function b3(n,a,l){var h=yi();l={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ld(n)?n1(a,l):(l=qm(n,a,l,h),l!==null&&(ci(l,n,h),s1(l,a,h)))}function i1(n,a,l){var h=yi();xc(n,a,l,h)}function xc(n,a,l,h){var v={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Ld(n))n1(a,v);else{var y=n.alternate;if(n.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var R=a.lastRenderedState,B=y(R,l);if(v.hasEagerState=!0,v.eagerState=B,fi(B,R))return fd(n,a,v,0),St===null&&hd(),!1}catch{}finally{}if(l=qm(n,a,v,h),l!==null)return ci(l,n,h),s1(l,a,h),!0}return!1}function Np(n,a,l,h){if(h={lane:2,revertLane:ag(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Ld(n)){if(a)throw Error(i(479))}else a=qm(n,l,h,2),a!==null&&ci(a,n,2)}function Ld(n){var a=n.alternate;return n===We||a!==null&&a===We}function n1(n,a){tl=Rd=!0;var l=n.pending;l===null?a.next=a:(a.next=l.next,l.next=a),n.pending=a}function s1(n,a,l){if((l&4194048)!==0){var h=a.lanes;h&=n.pendingLanes,l|=h,a.lanes=l,ti(n,l)}}var wc={readContext:Mr,use:Ad,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useLayoutEffect:It,useInsertionEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useSyncExternalStore:It,useId:It,useHostTransitionStatus:It,useFormState:It,useActionState:It,useOptimistic:It,useMemoCache:It,useCacheRefresh:It};wc.useEffectEvent=It;var a1={readContext:Mr,use:Ad,useCallback:function(n,a){return qr().memoizedState=[n,a===void 0?null:a],n},useContext:Mr,useEffect:Fx,useImperativeHandle:function(n,a,l){l=l!=null?l.concat([n]):null,Td(4194308,4,Gx.bind(null,a,n),l)},useLayoutEffect:function(n,a){return Td(4194308,4,n,a)},useInsertionEffect:function(n,a){Td(4,2,n,a)},useMemo:function(n,a){var l=qr();a=a===void 0?null:a;var h=n();if(Va){Qr(!0);try{n()}finally{Qr(!1)}}return l.memoizedState=[h,a],h},useReducer:function(n,a,l){var h=qr();if(l!==void 0){var v=l(a);if(Va){Qr(!0);try{l(a)}finally{Qr(!1)}}}else v=a;return h.memoizedState=h.baseState=v,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:v},h.queue=n,n=n.dispatch=b3.bind(null,We,n),[h.memoizedState,n]},useRef:function(n){var a=qr();return n={current:n},a.memoizedState=n},useState:function(n){n=xp(n);var a=n.queue,l=i1.bind(null,We,a);return a.dispatch=l,[n.memoizedState,l]},useDebugValue:Cp,useDeferredValue:function(n,a){var l=qr();return Ep(l,n,a)},useTransition:function(){var n=xp(!1);return n=Jx.bind(null,We,n.queue,!0,!1),qr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,l){var h=We,v=qr();if(st){if(l===void 0)throw Error(i(407));l=l()}else{if(l=a(),St===null)throw Error(i(349));(it&127)!==0||kx(h,a,l)}v.memoizedState=l;var y={value:l,getSnapshot:a};return v.queue=y,Fx(Ax.bind(null,h,y,n),[n]),h.flags|=2048,il(9,{destroy:void 0},Nx.bind(null,h,y,l,a),null),l},useId:function(){var n=qr(),a=St.identifierPrefix;if(st){var l=xn,h=bn;l=(h&~(1<<32-or(h)-1)).toString(32)+l,a="_"+a+"R_"+l,l=kd++,0<l&&(a+="H"+l.toString(32)),a+="_"}else l=f3++,a="_"+a+"r_"+l.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:kp,useFormState:zx,useActionState:zx,useOptimistic:function(n){var a=qr();a.memoizedState=a.baseState=n;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=l,a=Np.bind(null,We,!0,l),l.dispatch=a,[n,a]},useMemoCache:_p,useCacheRefresh:function(){return qr().memoizedState=y3.bind(null,We)},useEffectEvent:function(n){var a=qr(),l={impl:n};return a.memoizedState=l,function(){if((ut&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},Ap={readContext:Mr,use:Ad,useCallback:Kx,useContext:Mr,useEffect:Sp,useImperativeHandle:Yx,useInsertionEffect:qx,useLayoutEffect:Vx,useMemo:Xx,useReducer:Md,useRef:Hx,useState:function(){return Md(Qn)},useDebugValue:Cp,useDeferredValue:function(n,a){var l=Kt();return Zx(l,vt.memoizedState,n,a)},useTransition:function(){var n=Md(Qn)[0],a=Kt().memoizedState;return[typeof n=="boolean"?n:bc(n),a]},useSyncExternalStore:Rx,useId:t1,useHostTransitionStatus:kp,useFormState:Ix,useActionState:Ix,useOptimistic:function(n,a){var l=Kt();return Dx(l,vt,n,a)},useMemoCache:_p,useCacheRefresh:r1};Ap.useEffectEvent=Wx;var o1={readContext:Mr,use:Ad,useCallback:Kx,useContext:Mr,useEffect:Sp,useImperativeHandle:Yx,useInsertionEffect:qx,useLayoutEffect:Vx,useMemo:Xx,useReducer:bp,useRef:Hx,useState:function(){return bp(Qn)},useDebugValue:Cp,useDeferredValue:function(n,a){var l=Kt();return vt===null?Ep(l,n,a):Zx(l,vt.memoizedState,n,a)},useTransition:function(){var n=bp(Qn)[0],a=Kt().memoizedState;return[typeof n=="boolean"?n:bc(n),a]},useSyncExternalStore:Rx,useId:t1,useHostTransitionStatus:kp,useFormState:Ux,useActionState:Ux,useOptimistic:function(n,a){var l=Kt();return vt!==null?Dx(l,vt,n,a):(l.baseState=n,[n,l.queue.dispatch])},useMemoCache:_p,useCacheRefresh:r1};o1.useEffectEvent=Wx;function Mp(n,a,l,h){a=n.memoizedState,l=l(h,a),l=l==null?a:p({},a,l),n.memoizedState=l,n.lanes===0&&(n.updateQueue.baseState=l)}var Tp={enqueueSetState:function(n,a,l){n=n._reactInternals;var h=yi(),v=Us(h);v.payload=a,l!=null&&(v.callback=l),a=Hs(n,v,h),a!==null&&(ci(a,n,h),gc(a,n,h))},enqueueReplaceState:function(n,a,l){n=n._reactInternals;var h=yi(),v=Us(h);v.tag=1,v.payload=a,l!=null&&(v.callback=l),a=Hs(n,v,h),a!==null&&(ci(a,n,h),gc(a,n,h))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var l=yi(),h=Us(l);h.tag=2,a!=null&&(h.callback=a),a=Hs(n,h,l),a!==null&&(ci(a,n,l),gc(a,n,l))}};function l1(n,a,l,h,v,y,R){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(h,y,R):a.prototype&&a.prototype.isPureReactComponent?!lc(l,h)||!lc(v,y):!0}function c1(n,a,l,h){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(l,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(l,h),a.state!==n&&Tp.enqueueReplaceState(a,a.state,null)}function Ga(n,a){var l=a;if("ref"in a){l={};for(var h in a)h!=="ref"&&(l[h]=a[h])}if(n=n.defaultProps){l===a&&(l=p({},l));for(var v in n)l[v]===void 0&&(l[v]=n[v])}return l}function u1(n){dd(n)}function d1(n){console.error(n)}function h1(n){dd(n)}function jd(n,a){try{var l=n.onUncaughtError;l(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function f1(n,a,l){try{var h=n.onCaughtError;h(l.value,{componentStack:l.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function Dp(n,a,l){return l=Us(l),l.tag=3,l.payload={element:null},l.callback=function(){jd(n,a)},l}function m1(n){return n=Us(n),n.tag=3,n}function p1(n,a,l,h){var v=l.type.getDerivedStateFromError;if(typeof v=="function"){var y=h.value;n.payload=function(){return v(y)},n.callback=function(){f1(a,l,h)}}var R=l.stateNode;R!==null&&typeof R.componentDidCatch=="function"&&(n.callback=function(){f1(a,l,h),typeof v!="function"&&(Ys===null?Ys=new Set([this]):Ys.add(this));var B=h.stack;this.componentDidCatch(h.value,{componentStack:B!==null?B:""})})}function x3(n,a,l,h,v){if(l.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=l.alternate,a!==null&&Ko(a,l,v,!0),l=pi.current,l!==null){switch(l.tag){case 31:case 13:return ji===null?Vd():l.alternate===null&&$t===0&&($t=3),l.flags&=-257,l.flags|=65536,l.lanes=v,h===xd?l.flags|=16384:(a=l.updateQueue,a===null?l.updateQueue=new Set([h]):a.add(h),ig(n,h,v)),!1;case 22:return l.flags|=65536,h===xd?l.flags|=16384:(a=l.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([h])},l.updateQueue=a):(l=a.retryQueue,l===null?a.retryQueue=new Set([h]):l.add(h)),ig(n,h,v)),!1}throw Error(i(435,l.tag))}return ig(n,h,v),Vd(),!1}if(st)return a=pi.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=v,h!==Zm&&(n=Error(i(422),{cause:h}),dc(Mi(n,l)))):(h!==Zm&&(a=Error(i(423),{cause:h}),dc(Mi(a,l))),n=n.current.alternate,n.flags|=65536,v&=-v,n.lanes|=v,h=Mi(h,l),v=Dp(n.stateNode,h,v),lp(n,v),$t!==4&&($t=2)),!1;var y=Error(i(520),{cause:h});if(y=Mi(y,l),Mc===null?Mc=[y]:Mc.push(y),$t!==4&&($t=2),a===null)return!0;h=Mi(h,l),l=a;do{switch(l.tag){case 3:return l.flags|=65536,n=v&-v,l.lanes|=n,n=Dp(l.stateNode,h,n),lp(l,n),!1;case 1:if(a=l.type,y=l.stateNode,(l.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Ys===null||!Ys.has(y))))return l.flags|=65536,v&=-v,l.lanes|=v,v=m1(v),p1(v,n,l,h),lp(l,v),!1}l=l.return}while(l!==null);return!1}var Lp=Error(i(461)),tr=!1;function Tr(n,a,l,h){a.child=n===null?yx(a,null,l,h):qa(a,n.child,l,h)}function g1(n,a,l,h,v){l=l.render;var y=a.ref;if("ref"in h){var R={};for(var B in h)B!=="ref"&&(R[B]=h[B])}else R=h;return Ua(a),h=mp(n,a,l,R,y,v),B=pp(),n!==null&&!tr?(gp(n,a,v),es(n,a,v)):(st&&B&&Km(a),a.flags|=1,Tr(n,a,h,v),a.child)}function v1(n,a,l,h,v){if(n===null){var y=l.type;return typeof y=="function"&&!Vm(y)&&y.defaultProps===void 0&&l.compare===null?(a.tag=15,a.type=y,_1(n,a,y,h,v)):(n=pd(l.type,null,h,a,a.mode,v),n.ref=a.ref,n.return=a,a.child=n)}if(y=n.child,!Up(n,v)){var R=y.memoizedProps;if(l=l.compare,l=l!==null?l:lc,l(R,h)&&n.ref===a.ref)return es(n,a,v)}return a.flags|=1,n=Yn(y,h),n.ref=a.ref,n.return=a,a.child=n}function _1(n,a,l,h,v){if(n!==null){var y=n.memoizedProps;if(lc(y,h)&&n.ref===a.ref)if(tr=!1,a.pendingProps=h=y,Up(n,v))(n.flags&131072)!==0&&(tr=!0);else return a.lanes=n.lanes,es(n,a,v)}return jp(n,a,l,h,v)}function y1(n,a,l,h){var v=h.children,y=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((a.flags&128)!==0){if(y=y!==null?y.baseLanes|l:l,n!==null){for(h=a.child=n.child,v=0;h!==null;)v=v|h.lanes|h.childLanes,h=h.sibling;h=v&~y}else h=0,a.child=null;return b1(n,a,y,l,h)}if((l&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&yd(a,y!==null?y.cachePool:null),y!==null?wx(a,y):up(),Sx(a);else return h=a.lanes=536870912,b1(n,a,y!==null?y.baseLanes|l:l,l,h)}else y!==null?(yd(a,y.cachePool),wx(a,y),Ws(),a.memoizedState=null):(n!==null&&yd(a,null),up(),Ws());return Tr(n,a,v,l),a.child}function Sc(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function b1(n,a,l,h,v){var y=np();return y=y===null?null:{parent:Qt._currentValue,pool:y},a.memoizedState={baseLanes:l,cachePool:y},n!==null&&yd(a,null),up(),Sx(a),n!==null&&Ko(n,a,h,!0),a.childLanes=v,null}function Bd(n,a){return a=Pd({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function x1(n,a,l){return qa(a,n.child,null,l),n=Bd(a,a.pendingProps),n.flags|=2,gi(a),a.memoizedState=null,n}function w3(n,a,l){var h=a.pendingProps,v=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(st){if(h.mode==="hidden")return n=Bd(a,h),a.lanes=536870912,Sc(null,n);if(hp(a),(n=Rt)?(n=Lw(n,Li),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Os!==null?{id:bn,overflow:xn}:null,retryLane:536870912,hydrationErrors:null},l=nx(n),l.return=a,a.child=l,Ar=a,Rt=null)):n=null,n===null)throw zs(a);return a.lanes=536870912,null}return Bd(a,h)}var y=n.memoizedState;if(y!==null){var R=y.dehydrated;if(hp(a),v)if(a.flags&256)a.flags&=-257,a=x1(n,a,l);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(i(558));else if(tr||Ko(n,a,l,!1),v=(l&n.childLanes)!==0,tr||v){if(h=St,h!==null&&(R=ri(h,l),R!==0&&R!==y.retryLane))throw y.retryLane=R,Pa(n,R),ci(h,n,R),Lp;Vd(),a=x1(n,a,l)}else n=y.treeContext,Rt=Bi(R.nextSibling),Ar=a,st=!0,Ps=null,Li=!1,n!==null&&ox(a,n),a=Bd(a,h),a.flags|=4096;return a}return n=Yn(n.child,{mode:h.mode,children:h.children}),n.ref=a.ref,a.child=n,n.return=a,n}function Od(n,a){var l=a.ref;if(l===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(i(284));(n===null||n.ref!==l)&&(a.flags|=4194816)}}function jp(n,a,l,h,v){return Ua(a),l=mp(n,a,l,h,void 0,v),h=pp(),n!==null&&!tr?(gp(n,a,v),es(n,a,v)):(st&&h&&Km(a),a.flags|=1,Tr(n,a,l,v),a.child)}function w1(n,a,l,h,v,y){return Ua(a),a.updateQueue=null,l=Ex(a,h,l,v),Cx(n),h=pp(),n!==null&&!tr?(gp(n,a,y),es(n,a,y)):(st&&h&&Km(a),a.flags|=1,Tr(n,a,l,y),a.child)}function S1(n,a,l,h,v){if(Ua(a),a.stateNode===null){var y=qo,R=l.contextType;typeof R=="object"&&R!==null&&(y=Mr(R)),y=new l(h,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Tp,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=h,y.state=a.memoizedState,y.refs={},ap(a),R=l.contextType,y.context=typeof R=="object"&&R!==null?Mr(R):qo,y.state=a.memoizedState,R=l.getDerivedStateFromProps,typeof R=="function"&&(Mp(a,l,R,h),y.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(R=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),R!==y.state&&Tp.enqueueReplaceState(y,y.state,null),_c(a,h,y,v),vc(),y.state=a.memoizedState),typeof y.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(n===null){y=a.stateNode;var B=a.memoizedProps,K=Ga(l,B);y.props=K;var ne=y.context,de=l.contextType;R=qo,typeof de=="object"&&de!==null&&(R=Mr(de));var fe=l.getDerivedStateFromProps;de=typeof fe=="function"||typeof y.getSnapshotBeforeUpdate=="function",B=a.pendingProps!==B,de||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(B||ne!==R)&&c1(a,y,h,R),$s=!1;var oe=a.memoizedState;y.state=oe,_c(a,h,y,v),vc(),ne=a.memoizedState,B||oe!==ne||$s?(typeof fe=="function"&&(Mp(a,l,fe,h),ne=a.memoizedState),(K=$s||l1(a,l,K,h,oe,ne,R))?(de||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(a.flags|=4194308)):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=ne),y.props=h,y.state=ne,y.context=R,h=K):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{y=a.stateNode,op(n,a),R=a.memoizedProps,de=Ga(l,R),y.props=de,fe=a.pendingProps,oe=y.context,ne=l.contextType,K=qo,typeof ne=="object"&&ne!==null&&(K=Mr(ne)),B=l.getDerivedStateFromProps,(ne=typeof B=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(R!==fe||oe!==K)&&c1(a,y,h,K),$s=!1,oe=a.memoizedState,y.state=oe,_c(a,h,y,v),vc();var ue=a.memoizedState;R!==fe||oe!==ue||$s||n!==null&&n.dependencies!==null&&vd(n.dependencies)?(typeof B=="function"&&(Mp(a,l,B,h),ue=a.memoizedState),(de=$s||l1(a,l,de,h,oe,ue,K)||n!==null&&n.dependencies!==null&&vd(n.dependencies))?(ne||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(h,ue,K),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(h,ue,K)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||R===n.memoizedProps&&oe===n.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||R===n.memoizedProps&&oe===n.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=ue),y.props=h,y.state=ue,y.context=K,h=de):(typeof y.componentDidUpdate!="function"||R===n.memoizedProps&&oe===n.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||R===n.memoizedProps&&oe===n.memoizedState||(a.flags|=1024),h=!1)}return y=h,Od(n,a),h=(a.flags&128)!==0,y||h?(y=a.stateNode,l=h&&typeof l.getDerivedStateFromError!="function"?null:y.render(),a.flags|=1,n!==null&&h?(a.child=qa(a,n.child,null,v),a.child=qa(a,null,l,v)):Tr(n,a,l,v),a.memoizedState=y.state,n=a.child):n=es(n,a,v),n}function C1(n,a,l,h){return Ia(),a.flags|=256,Tr(n,a,l,h),a.child}var Bp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Op(n){return{baseLanes:n,cachePool:fx()}}function Pp(n,a,l){return n=n!==null?n.childLanes&~l:0,a&&(n|=_i),n}function E1(n,a,l){var h=a.pendingProps,v=!1,y=(a.flags&128)!==0,R;if((R=y)||(R=n!==null&&n.memoizedState===null?!1:(Yt.current&2)!==0),R&&(v=!0,a.flags&=-129),R=(a.flags&32)!==0,a.flags&=-33,n===null){if(st){if(v?Fs(a):Ws(),(n=Rt)?(n=Lw(n,Li),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Os!==null?{id:bn,overflow:xn}:null,retryLane:536870912,hydrationErrors:null},l=nx(n),l.return=a,a.child=l,Ar=a,Rt=null)):n=null,n===null)throw zs(a);return yg(n)?a.lanes=32:a.lanes=536870912,null}var B=h.children;return h=h.fallback,v?(Ws(),v=a.mode,B=Pd({mode:"hidden",children:B},v),h=za(h,v,l,null),B.return=a,h.return=a,B.sibling=h,a.child=B,h=a.child,h.memoizedState=Op(l),h.childLanes=Pp(n,R,l),a.memoizedState=Bp,Sc(null,h)):(Fs(a),zp(a,B))}var K=n.memoizedState;if(K!==null&&(B=K.dehydrated,B!==null)){if(y)a.flags&256?(Fs(a),a.flags&=-257,a=Ip(n,a,l)):a.memoizedState!==null?(Ws(),a.child=n.child,a.flags|=128,a=null):(Ws(),B=h.fallback,v=a.mode,h=Pd({mode:"visible",children:h.children},v),B=za(B,v,l,null),B.flags|=2,h.return=a,B.return=a,h.sibling=B,a.child=h,qa(a,n.child,null,l),h=a.child,h.memoizedState=Op(l),h.childLanes=Pp(n,R,l),a.memoizedState=Bp,a=Sc(null,h));else if(Fs(a),yg(B)){if(R=B.nextSibling&&B.nextSibling.dataset,R)var ne=R.dgst;R=ne,h=Error(i(419)),h.stack="",h.digest=R,dc({value:h,source:null,stack:null}),a=Ip(n,a,l)}else if(tr||Ko(n,a,l,!1),R=(l&n.childLanes)!==0,tr||R){if(R=St,R!==null&&(h=ri(R,l),h!==0&&h!==K.retryLane))throw K.retryLane=h,Pa(n,h),ci(R,n,h),Lp;_g(B)||Vd(),a=Ip(n,a,l)}else _g(B)?(a.flags|=192,a.child=n.child,a=null):(n=K.treeContext,Rt=Bi(B.nextSibling),Ar=a,st=!0,Ps=null,Li=!1,n!==null&&ox(a,n),a=zp(a,h.children),a.flags|=4096);return a}return v?(Ws(),B=h.fallback,v=a.mode,K=n.child,ne=K.sibling,h=Yn(K,{mode:"hidden",children:h.children}),h.subtreeFlags=K.subtreeFlags&65011712,ne!==null?B=Yn(ne,B):(B=za(B,v,l,null),B.flags|=2),B.return=a,h.return=a,h.sibling=B,a.child=h,Sc(null,h),h=a.child,B=n.child.memoizedState,B===null?B=Op(l):(v=B.cachePool,v!==null?(K=Qt._currentValue,v=v.parent!==K?{parent:K,pool:K}:v):v=fx(),B={baseLanes:B.baseLanes|l,cachePool:v}),h.memoizedState=B,h.childLanes=Pp(n,R,l),a.memoizedState=Bp,Sc(n.child,h)):(Fs(a),l=n.child,n=l.sibling,l=Yn(l,{mode:"visible",children:h.children}),l.return=a,l.sibling=null,n!==null&&(R=a.deletions,R===null?(a.deletions=[n],a.flags|=16):R.push(n)),a.child=l,a.memoizedState=null,l)}function zp(n,a){return a=Pd({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function Pd(n,a){return n=mi(22,n,null,a),n.lanes=0,n}function Ip(n,a,l){return qa(a,n.child,null,l),n=zp(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function R1(n,a,l){n.lanes|=a;var h=n.alternate;h!==null&&(h.lanes|=a),ep(n.return,a,l)}function $p(n,a,l,h,v,y){var R=n.memoizedState;R===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:l,tailMode:v,treeForkCount:y}:(R.isBackwards=a,R.rendering=null,R.renderingStartTime=0,R.last=h,R.tail=l,R.tailMode=v,R.treeForkCount=y)}function k1(n,a,l){var h=a.pendingProps,v=h.revealOrder,y=h.tail;h=h.children;var R=Yt.current,B=(R&2)!==0;if(B?(R=R&1|2,a.flags|=128):R&=1,V(Yt,R),Tr(n,a,h,l),h=st?uc:0,!B&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&R1(n,l,a);else if(n.tag===19)R1(n,l,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(v){case"forwards":for(l=a.child,v=null;l!==null;)n=l.alternate,n!==null&&Ed(n)===null&&(v=l),l=l.sibling;l=v,l===null?(v=a.child,a.child=null):(v=l.sibling,l.sibling=null),$p(a,!1,v,l,y,h);break;case"backwards":case"unstable_legacy-backwards":for(l=null,v=a.child,a.child=null;v!==null;){if(n=v.alternate,n!==null&&Ed(n)===null){a.child=v;break}n=v.sibling,v.sibling=l,l=v,v=n}$p(a,!0,l,null,y,h);break;case"together":$p(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function es(n,a,l){if(n!==null&&(a.dependencies=n.dependencies),Gs|=a.lanes,(l&a.childLanes)===0)if(n!==null){if(Ko(n,a,l,!1),(l&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(i(153));if(a.child!==null){for(n=a.child,l=Yn(n,n.pendingProps),a.child=l,l.return=a;n.sibling!==null;)n=n.sibling,l=l.sibling=Yn(n,n.pendingProps),l.return=a;l.sibling=null}return a.child}function Up(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&vd(n)))}function S3(n,a,l){switch(a.tag){case 3:se(a,a.stateNode.containerInfo),Is(a,Qt,n.memoizedState.cache),Ia();break;case 27:case 5:Se(a);break;case 4:se(a,a.stateNode.containerInfo);break;case 10:Is(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,hp(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(Fs(a),a.flags|=128,null):(l&a.child.childLanes)!==0?E1(n,a,l):(Fs(a),n=es(n,a,l),n!==null?n.sibling:null);Fs(a);break;case 19:var v=(n.flags&128)!==0;if(h=(l&a.childLanes)!==0,h||(Ko(n,a,l,!1),h=(l&a.childLanes)!==0),v){if(h)return k1(n,a,l);a.flags|=128}if(v=a.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),V(Yt,Yt.current),h)break;return null;case 22:return a.lanes=0,y1(n,a,l,a.pendingProps);case 24:Is(a,Qt,n.memoizedState.cache)}return es(n,a,l)}function N1(n,a,l){if(n!==null)if(n.memoizedProps!==a.pendingProps)tr=!0;else{if(!Up(n,l)&&(a.flags&128)===0)return tr=!1,S3(n,a,l);tr=(n.flags&131072)!==0}else tr=!1,st&&(a.flags&1048576)!==0&&ax(a,uc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(n=Fa(a.elementType),a.type=n,typeof n=="function")Vm(n)?(h=Ga(n,h),a.tag=1,a=S1(null,a,n,h,l)):(a.tag=0,a=jp(null,a,n,h,l));else{if(n!=null){var v=n.$$typeof;if(v===k){a.tag=11,a=g1(null,a,n,h,l);break e}else if(v===H){a.tag=14,a=v1(null,a,n,h,l);break e}}throw a=j(n)||n,Error(i(306,a,""))}}return a;case 0:return jp(n,a,a.type,a.pendingProps,l);case 1:return h=a.type,v=Ga(h,a.pendingProps),S1(n,a,h,v,l);case 3:e:{if(se(a,a.stateNode.containerInfo),n===null)throw Error(i(387));h=a.pendingProps;var y=a.memoizedState;v=y.element,op(n,a),_c(a,h,null,l);var R=a.memoizedState;if(h=R.cache,Is(a,Qt,h),h!==y.cache&&tp(a,[Qt],l,!0),vc(),h=R.element,y.isDehydrated)if(y={element:h,isDehydrated:!1,cache:R.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=C1(n,a,h,l);break e}else if(h!==v){v=Mi(Error(i(424)),a),dc(v),a=C1(n,a,h,l);break e}else{switch(n=a.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(Rt=Bi(n.firstChild),Ar=a,st=!0,Ps=null,Li=!0,l=yx(a,null,h,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Ia(),h===v){a=es(n,a,l);break e}Tr(n,a,h,l)}a=a.child}return a;case 26:return Od(n,a),n===null?(l=Iw(a.type,null,a.pendingProps,null))?a.memoizedState=l:st||(l=a.type,n=a.pendingProps,h=Qd(ae.current).createElement(l),h[Nr]=a,h[ii]=n,Dr(h,l,n),vr(h),a.stateNode=h):a.memoizedState=Iw(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return Se(a),n===null&&st&&(h=a.stateNode=Ow(a.type,a.pendingProps,ae.current),Ar=a,Li=!0,v=Rt,Js(a.type)?(bg=v,Rt=Bi(h.firstChild)):Rt=v),Tr(n,a,a.pendingProps.children,l),Od(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&st&&((v=h=Rt)&&(h=Q3(h,a.type,a.pendingProps,Li),h!==null?(a.stateNode=h,Ar=a,Rt=Bi(h.firstChild),Li=!1,v=!0):v=!1),v||zs(a)),Se(a),v=a.type,y=a.pendingProps,R=n!==null?n.memoizedProps:null,h=y.children,pg(v,y)?h=null:R!==null&&pg(v,R)&&(a.flags|=32),a.memoizedState!==null&&(v=mp(n,a,m3,null,null,l),zc._currentValue=v),Od(n,a),Tr(n,a,h,l),a.child;case 6:return n===null&&st&&((n=l=Rt)&&(l=eD(l,a.pendingProps,Li),l!==null?(a.stateNode=l,Ar=a,Rt=null,n=!0):n=!1),n||zs(a)),null;case 13:return E1(n,a,l);case 4:return se(a,a.stateNode.containerInfo),h=a.pendingProps,n===null?a.child=qa(a,null,h,l):Tr(n,a,h,l),a.child;case 11:return g1(n,a,a.type,a.pendingProps,l);case 7:return Tr(n,a,a.pendingProps,l),a.child;case 8:return Tr(n,a,a.pendingProps.children,l),a.child;case 12:return Tr(n,a,a.pendingProps.children,l),a.child;case 10:return h=a.pendingProps,Is(a,a.type,h.value),Tr(n,a,h.children,l),a.child;case 9:return v=a.type._context,h=a.pendingProps.children,Ua(a),v=Mr(v),h=h(v),a.flags|=1,Tr(n,a,h,l),a.child;case 14:return v1(n,a,a.type,a.pendingProps,l);case 15:return _1(n,a,a.type,a.pendingProps,l);case 19:return k1(n,a,l);case 31:return w3(n,a,l);case 22:return y1(n,a,l,a.pendingProps);case 24:return Ua(a),h=Mr(Qt),n===null?(v=np(),v===null&&(v=St,y=rp(),v.pooledCache=y,y.refCount++,y!==null&&(v.pooledCacheLanes|=l),v=y),a.memoizedState={parent:h,cache:v},ap(a),Is(a,Qt,v)):((n.lanes&l)!==0&&(op(n,a),_c(a,null,null,l),vc()),v=n.memoizedState,y=a.memoizedState,v.parent!==h?(v={parent:h,cache:h},a.memoizedState=v,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=v),Is(a,Qt,h)):(h=y.cache,Is(a,Qt,h),h!==v.cache&&tp(a,[Qt],l,!0))),Tr(n,a,a.pendingProps.children,l),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function ts(n){n.flags|=4}function Hp(n,a,l,h,v){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(v&335544128)===v)if(n.stateNode.complete)n.flags|=8192;else if(tw())n.flags|=8192;else throw Wa=xd,sp}else n.flags&=-16777217}function A1(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Ww(a))if(tw())n.flags|=8192;else throw Wa=xd,sp}function zd(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?zr():536870912,n.lanes|=a,ol|=a)}function Cc(n,a){if(!st)switch(n.tailMode){case"hidden":a=n.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?n.tail=null:l.sibling=null;break;case"collapsed":l=n.tail;for(var h=null;l!==null;)l.alternate!==null&&(h=l),l=l.sibling;h===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:h.sibling=null}}function kt(n){var a=n.alternate!==null&&n.alternate.child===n.child,l=0,h=0;if(a)for(var v=n.child;v!==null;)l|=v.lanes|v.childLanes,h|=v.subtreeFlags&65011712,h|=v.flags&65011712,v.return=n,v=v.sibling;else for(v=n.child;v!==null;)l|=v.lanes|v.childLanes,h|=v.subtreeFlags,h|=v.flags,v.return=n,v=v.sibling;return n.subtreeFlags|=h,n.childLanes=l,a}function C3(n,a,l){var h=a.pendingProps;switch(Xm(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kt(a),null;case 1:return kt(a),null;case 3:return l=a.stateNode,h=null,n!==null&&(h=n.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),Zn(Qt),ce(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(n===null||n.child===null)&&(Yo(a)?ts(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Jm())),kt(a),null;case 26:var v=a.type,y=a.memoizedState;return n===null?(ts(a),y!==null?(kt(a),A1(a,y)):(kt(a),Hp(a,v,null,h,l))):y?y!==n.memoizedState?(ts(a),kt(a),A1(a,y)):(kt(a),a.flags&=-16777217):(n=n.memoizedProps,n!==h&&ts(a),kt(a),Hp(a,v,n,h,l)),null;case 27:if(Re(a),l=ae.current,v=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==h&&ts(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return kt(a),null}n=J.current,Yo(a)?lx(a):(n=Ow(v,h,l),a.stateNode=n,ts(a))}return kt(a),null;case 5:if(Re(a),v=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==h&&ts(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return kt(a),null}if(y=J.current,Yo(a))lx(a);else{var R=Qd(ae.current);switch(y){case 1:y=R.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:y=R.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":y=R.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":y=R.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":y=R.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof h.is=="string"?R.createElement("select",{is:h.is}):R.createElement("select"),h.multiple?y.multiple=!0:h.size&&(y.size=h.size);break;default:y=typeof h.is=="string"?R.createElement(v,{is:h.is}):R.createElement(v)}}y[Nr]=a,y[ii]=h;e:for(R=a.child;R!==null;){if(R.tag===5||R.tag===6)y.appendChild(R.stateNode);else if(R.tag!==4&&R.tag!==27&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===a)break e;for(;R.sibling===null;){if(R.return===null||R.return===a)break e;R=R.return}R.sibling.return=R.return,R=R.sibling}a.stateNode=y;e:switch(Dr(y,v,h),v){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&ts(a)}}return kt(a),Hp(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,l),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==h&&ts(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(i(166));if(n=ae.current,Yo(a)){if(n=a.stateNode,l=a.memoizedProps,h=null,v=Ar,v!==null)switch(v.tag){case 27:case 5:h=v.memoizedProps}n[Nr]=a,n=!!(n.nodeValue===l||h!==null&&h.suppressHydrationWarning===!0||Ew(n.nodeValue,l)),n||zs(a,!0)}else n=Qd(n).createTextNode(h),n[Nr]=a,a.stateNode=n}return kt(a),null;case 31:if(l=a.memoizedState,n===null||n.memoizedState!==null){if(h=Yo(a),l!==null){if(n===null){if(!h)throw Error(i(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(557));n[Nr]=a}else Ia(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;kt(a),n=!1}else l=Jm(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=l),n=!0;if(!n)return a.flags&256?(gi(a),a):(gi(a),null);if((a.flags&128)!==0)throw Error(i(558))}return kt(a),null;case 13:if(h=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(v=Yo(a),h!==null&&h.dehydrated!==null){if(n===null){if(!v)throw Error(i(318));if(v=a.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(i(317));v[Nr]=a}else Ia(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;kt(a),v=!1}else v=Jm(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=v),v=!0;if(!v)return a.flags&256?(gi(a),a):(gi(a),null)}return gi(a),(a.flags&128)!==0?(a.lanes=l,a):(l=h!==null,n=n!==null&&n.memoizedState!==null,l&&(h=a.child,v=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(v=h.alternate.memoizedState.cachePool.pool),y=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(y=h.memoizedState.cachePool.pool),y!==v&&(h.flags|=2048)),l!==n&&l&&(a.child.flags|=8192),zd(a,a.updateQueue),kt(a),null);case 4:return ce(),n===null&&ug(a.stateNode.containerInfo),kt(a),null;case 10:return Zn(a.type),kt(a),null;case 19:if(X(Yt),h=a.memoizedState,h===null)return kt(a),null;if(v=(a.flags&128)!==0,y=h.rendering,y===null)if(v)Cc(h,!1);else{if($t!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(y=Ed(n),y!==null){for(a.flags|=128,Cc(h,!1),n=y.updateQueue,a.updateQueue=n,zd(a,n),a.subtreeFlags=0,n=l,l=a.child;l!==null;)ix(l,n),l=l.sibling;return V(Yt,Yt.current&1|2),st&&Kn(a,h.treeForkCount),a.child}n=n.sibling}h.tail!==null&&dt()>Fd&&(a.flags|=128,v=!0,Cc(h,!1),a.lanes=4194304)}else{if(!v)if(n=Ed(y),n!==null){if(a.flags|=128,v=!0,n=n.updateQueue,a.updateQueue=n,zd(a,n),Cc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!y.alternate&&!st)return kt(a),null}else 2*dt()-h.renderingStartTime>Fd&&l!==536870912&&(a.flags|=128,v=!0,Cc(h,!1),a.lanes=4194304);h.isBackwards?(y.sibling=a.child,a.child=y):(n=h.last,n!==null?n.sibling=y:a.child=y,h.last=y)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=dt(),n.sibling=null,l=Yt.current,V(Yt,v?l&1|2:l&1),st&&Kn(a,h.treeForkCount),n):(kt(a),null);case 22:case 23:return gi(a),dp(),h=a.memoizedState!==null,n!==null?n.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(l&536870912)!==0&&(a.flags&128)===0&&(kt(a),a.subtreeFlags&6&&(a.flags|=8192)):kt(a),l=a.updateQueue,l!==null&&zd(a,l.retryQueue),l=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==l&&(a.flags|=2048),n!==null&&X(Ha),null;case 24:return l=null,n!==null&&(l=n.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),Zn(Qt),kt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function E3(n,a){switch(Xm(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Zn(Qt),ce(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return Re(a),null;case 31:if(a.memoizedState!==null){if(gi(a),a.alternate===null)throw Error(i(340));Ia()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(gi(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(i(340));Ia()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return X(Yt),null;case 4:return ce(),null;case 10:return Zn(a.type),null;case 22:case 23:return gi(a),dp(),n!==null&&X(Ha),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Zn(Qt),null;case 25:return null;default:return null}}function M1(n,a){switch(Xm(a),a.tag){case 3:Zn(Qt),ce();break;case 26:case 27:case 5:Re(a);break;case 4:ce();break;case 31:a.memoizedState!==null&&gi(a);break;case 13:gi(a);break;case 19:X(Yt);break;case 10:Zn(a.type);break;case 22:case 23:gi(a),dp(),n!==null&&X(Ha);break;case 24:Zn(Qt)}}function Ec(n,a){try{var l=a.updateQueue,h=l!==null?l.lastEffect:null;if(h!==null){var v=h.next;l=v;do{if((l.tag&n)===n){h=void 0;var y=l.create,R=l.inst;h=y(),R.destroy=h}l=l.next}while(l!==v)}}catch(B){pt(a,a.return,B)}}function qs(n,a,l){try{var h=a.updateQueue,v=h!==null?h.lastEffect:null;if(v!==null){var y=v.next;h=y;do{if((h.tag&n)===n){var R=h.inst,B=R.destroy;if(B!==void 0){R.destroy=void 0,v=a;var K=l,ne=B;try{ne()}catch(de){pt(v,K,de)}}}h=h.next}while(h!==y)}}catch(de){pt(a,a.return,de)}}function T1(n){var a=n.updateQueue;if(a!==null){var l=n.stateNode;try{xx(a,l)}catch(h){pt(n,n.return,h)}}}function D1(n,a,l){l.props=Ga(n.type,n.memoizedProps),l.state=n.memoizedState;try{l.componentWillUnmount()}catch(h){pt(n,a,h)}}function Rc(n,a){try{var l=n.ref;if(l!==null){switch(n.tag){case 26:case 27:case 5:var h=n.stateNode;break;case 30:h=n.stateNode;break;default:h=n.stateNode}typeof l=="function"?n.refCleanup=l(h):l.current=h}}catch(v){pt(n,a,v)}}function wn(n,a){var l=n.ref,h=n.refCleanup;if(l!==null)if(typeof h=="function")try{h()}catch(v){pt(n,a,v)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(v){pt(n,a,v)}else l.current=null}function L1(n){var a=n.type,l=n.memoizedProps,h=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":l.autoFocus&&h.focus();break e;case"img":l.src?h.src=l.src:l.srcSet&&(h.srcset=l.srcSet)}}catch(v){pt(n,n.return,v)}}function Fp(n,a,l){try{var h=n.stateNode;G3(h,n.type,l,a),h[ii]=a}catch(v){pt(n,n.return,v)}}function j1(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Js(n.type)||n.tag===4}function Wp(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||j1(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Js(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function qp(n,a,l){var h=n.tag;if(h===5||h===6)n=n.stateNode,a?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(n,a):(a=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,a.appendChild(n),l=l._reactRootContainer,l!=null||a.onclick!==null||(a.onclick=Vn));else if(h!==4&&(h===27&&Js(n.type)&&(l=n.stateNode,a=null),n=n.child,n!==null))for(qp(n,a,l),n=n.sibling;n!==null;)qp(n,a,l),n=n.sibling}function Id(n,a,l){var h=n.tag;if(h===5||h===6)n=n.stateNode,a?l.insertBefore(n,a):l.appendChild(n);else if(h!==4&&(h===27&&Js(n.type)&&(l=n.stateNode),n=n.child,n!==null))for(Id(n,a,l),n=n.sibling;n!==null;)Id(n,a,l),n=n.sibling}function B1(n){var a=n.stateNode,l=n.memoizedProps;try{for(var h=n.type,v=a.attributes;v.length;)a.removeAttributeNode(v[0]);Dr(a,h,l),a[Nr]=n,a[ii]=l}catch(y){pt(n,n.return,y)}}var rs=!1,rr=!1,Vp=!1,O1=typeof WeakSet=="function"?WeakSet:Set,_r=null;function R3(n,a){if(n=n.containerInfo,fg=ah,n=Yb(n),Im(n)){if("selectionStart"in n)var l={start:n.selectionStart,end:n.selectionEnd};else e:{l=(l=n.ownerDocument)&&l.defaultView||window;var h=l.getSelection&&l.getSelection();if(h&&h.rangeCount!==0){l=h.anchorNode;var v=h.anchorOffset,y=h.focusNode;h=h.focusOffset;try{l.nodeType,y.nodeType}catch{l=null;break e}var R=0,B=-1,K=-1,ne=0,de=0,fe=n,oe=null;t:for(;;){for(var ue;fe!==l||v!==0&&fe.nodeType!==3||(B=R+v),fe!==y||h!==0&&fe.nodeType!==3||(K=R+h),fe.nodeType===3&&(R+=fe.nodeValue.length),(ue=fe.firstChild)!==null;)oe=fe,fe=ue;for(;;){if(fe===n)break t;if(oe===l&&++ne===v&&(B=R),oe===y&&++de===h&&(K=R),(ue=fe.nextSibling)!==null)break;fe=oe,oe=fe.parentNode}fe=ue}l=B===-1||K===-1?null:{start:B,end:K}}else l=null}l=l||{start:0,end:0}}else l=null;for(mg={focusedElem:n,selectionRange:l},ah=!1,_r=a;_r!==null;)if(a=_r,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,_r=n;else for(;_r!==null;){switch(a=_r,y=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(l=0;l<n.length;l++)v=n[l],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&y!==null){n=void 0,l=a,v=y.memoizedProps,y=y.memoizedState,h=l.stateNode;try{var De=Ga(l.type,v);n=h.getSnapshotBeforeUpdate(De,y),h.__reactInternalSnapshotBeforeUpdate=n}catch(ze){pt(l,l.return,ze)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,l=n.nodeType,l===9)vg(n);else if(l===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":vg(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(i(163))}if(n=a.sibling,n!==null){n.return=a.return,_r=n;break}_r=a.return}}function P1(n,a,l){var h=l.flags;switch(l.tag){case 0:case 11:case 15:ns(n,l),h&4&&Ec(5,l);break;case 1:if(ns(n,l),h&4)if(n=l.stateNode,a===null)try{n.componentDidMount()}catch(R){pt(l,l.return,R)}else{var v=Ga(l.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(v,a,n.__reactInternalSnapshotBeforeUpdate)}catch(R){pt(l,l.return,R)}}h&64&&T1(l),h&512&&Rc(l,l.return);break;case 3:if(ns(n,l),h&64&&(n=l.updateQueue,n!==null)){if(a=null,l.child!==null)switch(l.child.tag){case 27:case 5:a=l.child.stateNode;break;case 1:a=l.child.stateNode}try{xx(n,a)}catch(R){pt(l,l.return,R)}}break;case 27:a===null&&h&4&&B1(l);case 26:case 5:ns(n,l),a===null&&h&4&&L1(l),h&512&&Rc(l,l.return);break;case 12:ns(n,l);break;case 31:ns(n,l),h&4&&$1(n,l);break;case 13:ns(n,l),h&4&&U1(n,l),h&64&&(n=l.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(l=B3.bind(null,l),tD(n,l))));break;case 22:if(h=l.memoizedState!==null||rs,!h){a=a!==null&&a.memoizedState!==null||rr,v=rs;var y=rr;rs=h,(rr=a)&&!y?ss(n,l,(l.subtreeFlags&8772)!==0):ns(n,l),rs=v,rr=y}break;case 30:break;default:ns(n,l)}}function z1(n){var a=n.alternate;a!==null&&(n.alternate=null,z1(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&wm(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Tt=null,si=!1;function is(n,a,l){for(l=l.child;l!==null;)I1(n,a,l),l=l.sibling}function I1(n,a,l){if(gr&&typeof gr.onCommitFiberUnmount=="function")try{gr.onCommitFiberUnmount(yn,l)}catch{}switch(l.tag){case 26:rr||wn(l,a),is(n,a,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:rr||wn(l,a);var h=Tt,v=si;Js(l.type)&&(Tt=l.stateNode,si=!1),is(n,a,l),Bc(l.stateNode),Tt=h,si=v;break;case 5:rr||wn(l,a);case 6:if(h=Tt,v=si,Tt=null,is(n,a,l),Tt=h,si=v,Tt!==null)if(si)try{(Tt.nodeType===9?Tt.body:Tt.nodeName==="HTML"?Tt.ownerDocument.body:Tt).removeChild(l.stateNode)}catch(y){pt(l,a,y)}else try{Tt.removeChild(l.stateNode)}catch(y){pt(l,a,y)}break;case 18:Tt!==null&&(si?(n=Tt,Tw(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,l.stateNode),pl(n)):Tw(Tt,l.stateNode));break;case 4:h=Tt,v=si,Tt=l.stateNode.containerInfo,si=!0,is(n,a,l),Tt=h,si=v;break;case 0:case 11:case 14:case 15:qs(2,l,a),rr||qs(4,l,a),is(n,a,l);break;case 1:rr||(wn(l,a),h=l.stateNode,typeof h.componentWillUnmount=="function"&&D1(l,a,h)),is(n,a,l);break;case 21:is(n,a,l);break;case 22:rr=(h=rr)||l.memoizedState!==null,is(n,a,l),rr=h;break;default:is(n,a,l)}}function $1(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{pl(n)}catch(l){pt(a,a.return,l)}}}function U1(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{pl(n)}catch(l){pt(a,a.return,l)}}function k3(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new O1),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new O1),a;default:throw Error(i(435,n.tag))}}function $d(n,a){var l=k3(n);a.forEach(function(h){if(!l.has(h)){l.add(h);var v=O3.bind(null,n,h);h.then(v,v)}})}function ai(n,a){var l=a.deletions;if(l!==null)for(var h=0;h<l.length;h++){var v=l[h],y=n,R=a,B=R;e:for(;B!==null;){switch(B.tag){case 27:if(Js(B.type)){Tt=B.stateNode,si=!1;break e}break;case 5:Tt=B.stateNode,si=!1;break e;case 3:case 4:Tt=B.stateNode.containerInfo,si=!0;break e}B=B.return}if(Tt===null)throw Error(i(160));I1(y,R,v),Tt=null,si=!1,y=v.alternate,y!==null&&(y.return=null),v.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)H1(a,n),a=a.sibling}var Qi=null;function H1(n,a){var l=n.alternate,h=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ai(a,n),oi(n),h&4&&(qs(3,n,n.return),Ec(3,n),qs(5,n,n.return));break;case 1:ai(a,n),oi(n),h&512&&(rr||l===null||wn(l,l.return)),h&64&&rs&&(n=n.updateQueue,n!==null&&(h=n.callbacks,h!==null&&(l=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=l===null?h:l.concat(h))));break;case 26:var v=Qi;if(ai(a,n),oi(n),h&512&&(rr||l===null||wn(l,l.return)),h&4){var y=l!==null?l.memoizedState:null;if(h=n.memoizedState,l===null)if(h===null)if(n.stateNode===null){e:{h=n.type,l=n.memoizedProps,v=v.ownerDocument||v;t:switch(h){case"title":y=v.getElementsByTagName("title")[0],(!y||y[Ql]||y[Nr]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=v.createElement(h),v.head.insertBefore(y,v.querySelector("head > title"))),Dr(y,h,l),y[Nr]=n,vr(y),h=y;break e;case"link":var R=Hw("link","href",v).get(h+(l.href||""));if(R){for(var B=0;B<R.length;B++)if(y=R[B],y.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&y.getAttribute("rel")===(l.rel==null?null:l.rel)&&y.getAttribute("title")===(l.title==null?null:l.title)&&y.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){R.splice(B,1);break t}}y=v.createElement(h),Dr(y,h,l),v.head.appendChild(y);break;case"meta":if(R=Hw("meta","content",v).get(h+(l.content||""))){for(B=0;B<R.length;B++)if(y=R[B],y.getAttribute("content")===(l.content==null?null:""+l.content)&&y.getAttribute("name")===(l.name==null?null:l.name)&&y.getAttribute("property")===(l.property==null?null:l.property)&&y.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&y.getAttribute("charset")===(l.charSet==null?null:l.charSet)){R.splice(B,1);break t}}y=v.createElement(h),Dr(y,h,l),v.head.appendChild(y);break;default:throw Error(i(468,h))}y[Nr]=n,vr(y),h=y}n.stateNode=h}else Fw(v,n.type,n.stateNode);else n.stateNode=Uw(v,h,n.memoizedProps);else y!==h?(y===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):y.count--,h===null?Fw(v,n.type,n.stateNode):Uw(v,h,n.memoizedProps)):h===null&&n.stateNode!==null&&Fp(n,n.memoizedProps,l.memoizedProps)}break;case 27:ai(a,n),oi(n),h&512&&(rr||l===null||wn(l,l.return)),l!==null&&h&4&&Fp(n,n.memoizedProps,l.memoizedProps);break;case 5:if(ai(a,n),oi(n),h&512&&(rr||l===null||wn(l,l.return)),n.flags&32){v=n.stateNode;try{zo(v,"")}catch(De){pt(n,n.return,De)}}h&4&&n.stateNode!=null&&(v=n.memoizedProps,Fp(n,v,l!==null?l.memoizedProps:v)),h&1024&&(Vp=!0);break;case 6:if(ai(a,n),oi(n),h&4){if(n.stateNode===null)throw Error(i(162));h=n.memoizedProps,l=n.stateNode;try{l.nodeValue=h}catch(De){pt(n,n.return,De)}}break;case 3:if(rh=null,v=Qi,Qi=eh(a.containerInfo),ai(a,n),Qi=v,oi(n),h&4&&l!==null&&l.memoizedState.isDehydrated)try{pl(a.containerInfo)}catch(De){pt(n,n.return,De)}Vp&&(Vp=!1,F1(n));break;case 4:h=Qi,Qi=eh(n.stateNode.containerInfo),ai(a,n),oi(n),Qi=h;break;case 12:ai(a,n),oi(n);break;case 31:ai(a,n),oi(n),h&4&&(h=n.updateQueue,h!==null&&(n.updateQueue=null,$d(n,h)));break;case 13:ai(a,n),oi(n),n.child.flags&8192&&n.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Hd=dt()),h&4&&(h=n.updateQueue,h!==null&&(n.updateQueue=null,$d(n,h)));break;case 22:v=n.memoizedState!==null;var K=l!==null&&l.memoizedState!==null,ne=rs,de=rr;if(rs=ne||v,rr=de||K,ai(a,n),rr=de,rs=ne,oi(n),h&8192)e:for(a=n.stateNode,a._visibility=v?a._visibility&-2:a._visibility|1,v&&(l===null||K||rs||rr||Ya(n)),l=null,a=n;;){if(a.tag===5||a.tag===26){if(l===null){K=l=a;try{if(y=K.stateNode,v)R=y.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none";else{B=K.stateNode;var fe=K.memoizedProps.style,oe=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;B.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(De){pt(K,K.return,De)}}}else if(a.tag===6){if(l===null){K=a;try{K.stateNode.nodeValue=v?"":K.memoizedProps}catch(De){pt(K,K.return,De)}}}else if(a.tag===18){if(l===null){K=a;try{var ue=K.stateNode;v?Dw(ue,!0):Dw(K.stateNode,!1)}catch(De){pt(K,K.return,De)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;l===a&&(l=null),a=a.return}l===a&&(l=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=n.updateQueue,h!==null&&(l=h.retryQueue,l!==null&&(h.retryQueue=null,$d(n,l))));break;case 19:ai(a,n),oi(n),h&4&&(h=n.updateQueue,h!==null&&(n.updateQueue=null,$d(n,h)));break;case 30:break;case 21:break;default:ai(a,n),oi(n)}}function oi(n){var a=n.flags;if(a&2){try{for(var l,h=n.return;h!==null;){if(j1(h)){l=h;break}h=h.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var v=l.stateNode,y=Wp(n);Id(n,y,v);break;case 5:var R=l.stateNode;l.flags&32&&(zo(R,""),l.flags&=-33);var B=Wp(n);Id(n,B,R);break;case 3:case 4:var K=l.stateNode.containerInfo,ne=Wp(n);qp(n,ne,K);break;default:throw Error(i(161))}}catch(de){pt(n,n.return,de)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function F1(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;F1(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function ns(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)P1(n,a.alternate,a),a=a.sibling}function Ya(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:qs(4,a,a.return),Ya(a);break;case 1:wn(a,a.return);var l=a.stateNode;typeof l.componentWillUnmount=="function"&&D1(a,a.return,l),Ya(a);break;case 27:Bc(a.stateNode);case 26:case 5:wn(a,a.return),Ya(a);break;case 22:a.memoizedState===null&&Ya(a);break;case 30:Ya(a);break;default:Ya(a)}n=n.sibling}}function ss(n,a,l){for(l=l&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,v=n,y=a,R=y.flags;switch(y.tag){case 0:case 11:case 15:ss(v,y,l),Ec(4,y);break;case 1:if(ss(v,y,l),h=y,v=h.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(ne){pt(h,h.return,ne)}if(h=y,v=h.updateQueue,v!==null){var B=h.stateNode;try{var K=v.shared.hiddenCallbacks;if(K!==null)for(v.shared.hiddenCallbacks=null,v=0;v<K.length;v++)bx(K[v],B)}catch(ne){pt(h,h.return,ne)}}l&&R&64&&T1(y),Rc(y,y.return);break;case 27:B1(y);case 26:case 5:ss(v,y,l),l&&h===null&&R&4&&L1(y),Rc(y,y.return);break;case 12:ss(v,y,l);break;case 31:ss(v,y,l),l&&R&4&&$1(v,y);break;case 13:ss(v,y,l),l&&R&4&&U1(v,y);break;case 22:y.memoizedState===null&&ss(v,y,l),Rc(y,y.return);break;case 30:break;default:ss(v,y,l)}a=a.sibling}}function Gp(n,a){var l=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==l&&(n!=null&&n.refCount++,l!=null&&hc(l))}function Yp(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&hc(n))}function en(n,a,l,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)W1(n,a,l,h),a=a.sibling}function W1(n,a,l,h){var v=a.flags;switch(a.tag){case 0:case 11:case 15:en(n,a,l,h),v&2048&&Ec(9,a);break;case 1:en(n,a,l,h);break;case 3:en(n,a,l,h),v&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&hc(n)));break;case 12:if(v&2048){en(n,a,l,h),n=a.stateNode;try{var y=a.memoizedProps,R=y.id,B=y.onPostCommit;typeof B=="function"&&B(R,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(K){pt(a,a.return,K)}}else en(n,a,l,h);break;case 31:en(n,a,l,h);break;case 13:en(n,a,l,h);break;case 23:break;case 22:y=a.stateNode,R=a.alternate,a.memoizedState!==null?y._visibility&2?en(n,a,l,h):kc(n,a):y._visibility&2?en(n,a,l,h):(y._visibility|=2,nl(n,a,l,h,(a.subtreeFlags&10256)!==0||!1)),v&2048&&Gp(R,a);break;case 24:en(n,a,l,h),v&2048&&Yp(a.alternate,a);break;default:en(n,a,l,h)}}function nl(n,a,l,h,v){for(v=v&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=n,R=a,B=l,K=h,ne=R.flags;switch(R.tag){case 0:case 11:case 15:nl(y,R,B,K,v),Ec(8,R);break;case 23:break;case 22:var de=R.stateNode;R.memoizedState!==null?de._visibility&2?nl(y,R,B,K,v):kc(y,R):(de._visibility|=2,nl(y,R,B,K,v)),v&&ne&2048&&Gp(R.alternate,R);break;case 24:nl(y,R,B,K,v),v&&ne&2048&&Yp(R.alternate,R);break;default:nl(y,R,B,K,v)}a=a.sibling}}function kc(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var l=n,h=a,v=h.flags;switch(h.tag){case 22:kc(l,h),v&2048&&Gp(h.alternate,h);break;case 24:kc(l,h),v&2048&&Yp(h.alternate,h);break;default:kc(l,h)}a=a.sibling}}var Nc=8192;function sl(n,a,l){if(n.subtreeFlags&Nc)for(n=n.child;n!==null;)q1(n,a,l),n=n.sibling}function q1(n,a,l){switch(n.tag){case 26:sl(n,a,l),n.flags&Nc&&n.memoizedState!==null&&fD(l,Qi,n.memoizedState,n.memoizedProps);break;case 5:sl(n,a,l);break;case 3:case 4:var h=Qi;Qi=eh(n.stateNode.containerInfo),sl(n,a,l),Qi=h;break;case 22:n.memoizedState===null&&(h=n.alternate,h!==null&&h.memoizedState!==null?(h=Nc,Nc=16777216,sl(n,a,l),Nc=h):sl(n,a,l));break;default:sl(n,a,l)}}function V1(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function Ac(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var h=a[l];_r=h,Y1(h,n)}V1(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)G1(n),n=n.sibling}function G1(n){switch(n.tag){case 0:case 11:case 15:Ac(n),n.flags&2048&&qs(9,n,n.return);break;case 3:Ac(n);break;case 12:Ac(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,Ud(n)):Ac(n);break;default:Ac(n)}}function Ud(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var h=a[l];_r=h,Y1(h,n)}V1(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:qs(8,a,a.return),Ud(a);break;case 22:l=a.stateNode,l._visibility&2&&(l._visibility&=-3,Ud(a));break;default:Ud(a)}n=n.sibling}}function Y1(n,a){for(;_r!==null;){var l=_r;switch(l.tag){case 0:case 11:case 15:qs(8,l,a);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var h=l.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:hc(l.memoizedState.cache)}if(h=l.child,h!==null)h.return=l,_r=h;else e:for(l=n;_r!==null;){h=_r;var v=h.sibling,y=h.return;if(z1(h),h===l){_r=null;break e}if(v!==null){v.return=y,_r=v;break e}_r=y}}}var N3={getCacheForType:function(n){var a=Mr(Qt),l=a.data.get(n);return l===void 0&&(l=n(),a.data.set(n,l)),l},cacheSignal:function(){return Mr(Qt).controller.signal}},A3=typeof WeakMap=="function"?WeakMap:Map,ut=0,St=null,et=null,it=0,mt=0,vi=null,Vs=!1,al=!1,Kp=!1,as=0,$t=0,Gs=0,Ka=0,Xp=0,_i=0,ol=0,Mc=null,li=null,Zp=!1,Hd=0,K1=0,Fd=1/0,Wd=null,Ys=null,lr=0,Ks=null,ll=null,os=0,Jp=0,Qp=null,X1=null,Tc=0,eg=null;function yi(){return(ut&2)!==0&&it!==0?it&-it:M.T!==null?ag():bm()}function Z1(){if(_i===0)if((it&536870912)===0||st){var n=Je;Je<<=1,(Je&3932160)===0&&(Je=262144),_i=n}else _i=536870912;return n=pi.current,n!==null&&(n.flags|=32),_i}function ci(n,a,l){(n===St&&(mt===2||mt===9)||n.cancelPendingCommit!==null)&&(cl(n,0),Xs(n,it,_i,!1)),Lt(n,l),((ut&2)===0||n!==St)&&(n===St&&((ut&2)===0&&(Ka|=l),$t===4&&Xs(n,it,_i,!1)),Sn(n))}function J1(n,a,l){if((ut&6)!==0)throw Error(i(327));var h=!l&&(a&127)===0&&(a&n.expiredLanes)===0||ct(n,a),v=h?D3(n,a):rg(n,a,!0),y=h;do{if(v===0){al&&!h&&Xs(n,a,0,!1);break}else{if(l=n.current.alternate,y&&!M3(l)){v=rg(n,a,!1),y=!1;continue}if(v===2){if(y=a,n.errorRecoveryDisabledLanes&y)var R=0;else R=n.pendingLanes&-536870913,R=R!==0?R:R&536870912?536870912:0;if(R!==0){a=R;e:{var B=n;v=Mc;var K=B.current.memoizedState.isDehydrated;if(K&&(cl(B,R).flags|=256),R=rg(B,R,!1),R!==2){if(Kp&&!K){B.errorRecoveryDisabledLanes|=y,Ka|=y,v=4;break e}y=li,li=v,y!==null&&(li===null?li=y:li.push.apply(li,y))}v=R}if(y=!1,v!==2)continue}}if(v===1){cl(n,0),Xs(n,a,0,!0);break}e:{switch(h=n,y=v,y){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:Xs(h,a,_i,!Vs);break e;case 2:li=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(v=Hd+300-dt(),10<v)){if(Xs(h,a,_i,!Vs),Pe(h,0,!0)!==0)break e;os=a,h.timeoutHandle=Aw(Q1.bind(null,h,l,li,Wd,Zp,a,_i,Ka,ol,Vs,y,"Throttled",-0,0),v);break e}Q1(h,l,li,Wd,Zp,a,_i,Ka,ol,Vs,y,null,-0,0)}}break}while(!0);Sn(n)}function Q1(n,a,l,h,v,y,R,B,K,ne,de,fe,oe,ue){if(n.timeoutHandle=-1,fe=a.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Vn},q1(a,y,fe);var De=(y&62914560)===y?Hd-dt():(y&4194048)===y?K1-dt():0;if(De=mD(fe,De),De!==null){os=y,n.cancelPendingCommit=De(ow.bind(null,n,a,y,l,h,v,R,B,K,de,fe,null,oe,ue)),Xs(n,y,R,!ne);return}}ow(n,a,y,l,h,v,R,B,K)}function M3(n){for(var a=n;;){var l=a.tag;if((l===0||l===11||l===15)&&a.flags&16384&&(l=a.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var h=0;h<l.length;h++){var v=l[h],y=v.getSnapshot;v=v.value;try{if(!fi(y(),v))return!1}catch{return!1}}if(l=a.child,a.subtreeFlags&16384&&l!==null)l.return=a,a=l;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Xs(n,a,l,h){a&=~Xp,a&=~Ka,n.suspendedLanes|=a,n.pingedLanes&=~a,h&&(n.warmLanes|=a),h=n.expirationTimes;for(var v=a;0<v;){var y=31-or(v),R=1<<y;h[y]=-1,v&=~R}l!==0&&Da(n,l,a)}function qd(){return(ut&6)===0?(Dc(0),!1):!0}function tg(){if(et!==null){if(mt===0)var n=et.return;else n=et,Xn=$a=null,vp(n),Qo=null,mc=0,n=et;for(;n!==null;)M1(n.alternate,n),n=n.return;et=null}}function cl(n,a){var l=n.timeoutHandle;l!==-1&&(n.timeoutHandle=-1,X3(l)),l=n.cancelPendingCommit,l!==null&&(n.cancelPendingCommit=null,l()),os=0,tg(),St=n,et=l=Yn(n.current,null),it=a,mt=0,vi=null,Vs=!1,al=ct(n,a),Kp=!1,ol=_i=Xp=Ka=Gs=$t=0,li=Mc=null,Zp=!1,(a&8)!==0&&(a|=a&32);var h=n.entangledLanes;if(h!==0)for(n=n.entanglements,h&=a;0<h;){var v=31-or(h),y=1<<v;a|=n[v],h&=~y}return as=a,hd(),l}function ew(n,a){We=null,M.H=wc,a===Jo||a===bd?(a=gx(),mt=3):a===sp?(a=gx(),mt=4):mt=a===Lp?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,vi=a,et===null&&($t=1,jd(n,Mi(a,n.current)))}function tw(){var n=pi.current;return n===null?!0:(it&4194048)===it?ji===null:(it&62914560)===it||(it&536870912)!==0?n===ji:!1}function rw(){var n=M.H;return M.H=wc,n===null?wc:n}function iw(){var n=M.A;return M.A=N3,n}function Vd(){$t=4,Vs||(it&4194048)!==it&&pi.current!==null||(al=!0),(Gs&134217727)===0&&(Ka&134217727)===0||St===null||Xs(St,it,_i,!1)}function rg(n,a,l){var h=ut;ut|=2;var v=rw(),y=iw();(St!==n||it!==a)&&(Wd=null,cl(n,a)),a=!1;var R=$t;e:do try{if(mt!==0&&et!==null){var B=et,K=vi;switch(mt){case 8:tg(),R=6;break e;case 3:case 2:case 9:case 6:pi.current===null&&(a=!0);var ne=mt;if(mt=0,vi=null,ul(n,B,K,ne),l&&al){R=0;break e}break;default:ne=mt,mt=0,vi=null,ul(n,B,K,ne)}}T3(),R=$t;break}catch(de){ew(n,de)}while(!0);return a&&n.shellSuspendCounter++,Xn=$a=null,ut=h,M.H=v,M.A=y,et===null&&(St=null,it=0,hd()),R}function T3(){for(;et!==null;)nw(et)}function D3(n,a){var l=ut;ut|=2;var h=rw(),v=iw();St!==n||it!==a?(Wd=null,Fd=dt()+500,cl(n,a)):al=ct(n,a);e:do try{if(mt!==0&&et!==null){a=et;var y=vi;t:switch(mt){case 1:mt=0,vi=null,ul(n,a,y,1);break;case 2:case 9:if(mx(y)){mt=0,vi=null,sw(a);break}a=function(){mt!==2&&mt!==9||St!==n||(mt=7),Sn(n)},y.then(a,a);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:mx(y)?(mt=0,vi=null,sw(a)):(mt=0,vi=null,ul(n,a,y,7));break;case 5:var R=null;switch(et.tag){case 26:R=et.memoizedState;case 5:case 27:var B=et;if(R?Ww(R):B.stateNode.complete){mt=0,vi=null;var K=B.sibling;if(K!==null)et=K;else{var ne=B.return;ne!==null?(et=ne,Gd(ne)):et=null}break t}}mt=0,vi=null,ul(n,a,y,5);break;case 6:mt=0,vi=null,ul(n,a,y,6);break;case 8:tg(),$t=6;break e;default:throw Error(i(462))}}L3();break}catch(de){ew(n,de)}while(!0);return Xn=$a=null,M.H=h,M.A=v,ut=l,et!==null?0:(St=null,it=0,hd(),$t)}function L3(){for(;et!==null&&!Ge();)nw(et)}function nw(n){var a=N1(n.alternate,n,as);n.memoizedProps=n.pendingProps,a===null?Gd(n):et=a}function sw(n){var a=n,l=a.alternate;switch(a.tag){case 15:case 0:a=w1(l,a,a.pendingProps,a.type,void 0,it);break;case 11:a=w1(l,a,a.pendingProps,a.type.render,a.ref,it);break;case 5:vp(a);default:M1(l,a),a=et=ix(a,as),a=N1(l,a,as)}n.memoizedProps=n.pendingProps,a===null?Gd(n):et=a}function ul(n,a,l,h){Xn=$a=null,vp(a),Qo=null,mc=0;var v=a.return;try{if(x3(n,v,a,l,it)){$t=1,jd(n,Mi(l,n.current)),et=null;return}}catch(y){if(v!==null)throw et=v,y;$t=1,jd(n,Mi(l,n.current)),et=null;return}a.flags&32768?(st||h===1?n=!0:al||(it&536870912)!==0?n=!1:(Vs=n=!0,(h===2||h===9||h===3||h===6)&&(h=pi.current,h!==null&&h.tag===13&&(h.flags|=16384))),aw(a,n)):Gd(a)}function Gd(n){var a=n;do{if((a.flags&32768)!==0){aw(a,Vs);return}n=a.return;var l=C3(a.alternate,a,as);if(l!==null){et=l;return}if(a=a.sibling,a!==null){et=a;return}et=a=n}while(a!==null);$t===0&&($t=5)}function aw(n,a){do{var l=E3(n.alternate,n);if(l!==null){l.flags&=32767,et=l;return}if(l=n.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!a&&(n=n.sibling,n!==null)){et=n;return}et=n=l}while(n!==null);$t=6,et=null}function ow(n,a,l,h,v,y,R,B,K){n.cancelPendingCommit=null;do Yd();while(lr!==0);if((ut&6)!==0)throw Error(i(327));if(a!==null){if(a===n.current)throw Error(i(177));if(y=a.lanes|a.childLanes,y|=Wm,ei(n,l,y,R,B,K),n===St&&(et=St=null,it=0),ll=a,Ks=n,os=l,Jp=y,Qp=v,X1=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,P3(Gt,function(){return hw(),null})):(n.callbackNode=null,n.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=M.T,M.T=null,v=P.p,P.p=2,R=ut,ut|=4;try{R3(n,a,l)}finally{ut=R,P.p=v,M.T=h}}lr=1,lw(),cw(),uw()}}function lw(){if(lr===1){lr=0;var n=Ks,a=ll,l=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||l){l=M.T,M.T=null;var h=P.p;P.p=2;var v=ut;ut|=4;try{H1(a,n);var y=mg,R=Yb(n.containerInfo),B=y.focusedElem,K=y.selectionRange;if(R!==B&&B&&B.ownerDocument&&Gb(B.ownerDocument.documentElement,B)){if(K!==null&&Im(B)){var ne=K.start,de=K.end;if(de===void 0&&(de=ne),"selectionStart"in B)B.selectionStart=ne,B.selectionEnd=Math.min(de,B.value.length);else{var fe=B.ownerDocument||document,oe=fe&&fe.defaultView||window;if(oe.getSelection){var ue=oe.getSelection(),De=B.textContent.length,ze=Math.min(K.start,De),yt=K.end===void 0?ze:Math.min(K.end,De);!ue.extend&&ze>yt&&(R=yt,yt=ze,ze=R);var te=Vb(B,ze),Z=Vb(B,yt);if(te&&Z&&(ue.rangeCount!==1||ue.anchorNode!==te.node||ue.anchorOffset!==te.offset||ue.focusNode!==Z.node||ue.focusOffset!==Z.offset)){var ie=fe.createRange();ie.setStart(te.node,te.offset),ue.removeAllRanges(),ze>yt?(ue.addRange(ie),ue.extend(Z.node,Z.offset)):(ie.setEnd(Z.node,Z.offset),ue.addRange(ie))}}}}for(fe=[],ue=B;ue=ue.parentNode;)ue.nodeType===1&&fe.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof B.focus=="function"&&B.focus(),B=0;B<fe.length;B++){var he=fe[B];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}ah=!!fg,mg=fg=null}finally{ut=v,P.p=h,M.T=l}}n.current=a,lr=2}}function cw(){if(lr===2){lr=0;var n=Ks,a=ll,l=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||l){l=M.T,M.T=null;var h=P.p;P.p=2;var v=ut;ut|=4;try{P1(n,a.alternate,a)}finally{ut=v,P.p=h,M.T=l}}lr=3}}function uw(){if(lr===4||lr===3){lr=0,zt();var n=Ks,a=ll,l=os,h=X1;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?lr=5:(lr=0,ll=Ks=null,dw(n,n.pendingLanes));var v=n.pendingLanes;if(v===0&&(Ys=null),Zi(l),a=a.stateNode,gr&&typeof gr.onCommitFiberRoot=="function")try{gr.onCommitFiberRoot(yn,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=M.T,v=P.p,P.p=2,M.T=null;try{for(var y=n.onRecoverableError,R=0;R<h.length;R++){var B=h[R];y(B.value,{componentStack:B.stack})}}finally{M.T=a,P.p=v}}(os&3)!==0&&Yd(),Sn(n),v=n.pendingLanes,(l&261930)!==0&&(v&42)!==0?n===eg?Tc++:(Tc=0,eg=n):Tc=0,Dc(0)}}function dw(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,hc(a)))}function Yd(){return lw(),cw(),uw(),hw()}function hw(){if(lr!==5)return!1;var n=Ks,a=Jp;Jp=0;var l=Zi(os),h=M.T,v=P.p;try{P.p=32>l?32:l,M.T=null,l=Qp,Qp=null;var y=Ks,R=os;if(lr=0,ll=Ks=null,os=0,(ut&6)!==0)throw Error(i(331));var B=ut;if(ut|=4,G1(y.current),W1(y,y.current,R,l),ut=B,Dc(0,!1),gr&&typeof gr.onPostCommitFiberRoot=="function")try{gr.onPostCommitFiberRoot(yn,y)}catch{}return!0}finally{P.p=v,M.T=h,dw(n,a)}}function fw(n,a,l){a=Mi(l,a),a=Dp(n.stateNode,a,2),n=Hs(n,a,2),n!==null&&(Lt(n,2),Sn(n))}function pt(n,a,l){if(n.tag===3)fw(n,n,l);else for(;a!==null;){if(a.tag===3){fw(a,n,l);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Ys===null||!Ys.has(h))){n=Mi(l,n),l=m1(2),h=Hs(a,l,2),h!==null&&(p1(l,h,a,n),Lt(h,2),Sn(h));break}}a=a.return}}function ig(n,a,l){var h=n.pingCache;if(h===null){h=n.pingCache=new A3;var v=new Set;h.set(a,v)}else v=h.get(a),v===void 0&&(v=new Set,h.set(a,v));v.has(l)||(Kp=!0,v.add(l),n=j3.bind(null,n,a,l),a.then(n,n))}function j3(n,a,l){var h=n.pingCache;h!==null&&h.delete(a),n.pingedLanes|=n.suspendedLanes&l,n.warmLanes&=~l,St===n&&(it&l)===l&&($t===4||$t===3&&(it&62914560)===it&&300>dt()-Hd?(ut&2)===0&&cl(n,0):Xp|=l,ol===it&&(ol=0)),Sn(n)}function mw(n,a){a===0&&(a=zr()),n=Pa(n,a),n!==null&&(Lt(n,a),Sn(n))}function B3(n){var a=n.memoizedState,l=0;a!==null&&(l=a.retryLane),mw(n,l)}function O3(n,a){var l=0;switch(n.tag){case 31:case 13:var h=n.stateNode,v=n.memoizedState;v!==null&&(l=v.retryLane);break;case 19:h=n.stateNode;break;case 22:h=n.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(a),mw(n,l)}function P3(n,a){return Ye(n,a)}var Kd=null,dl=null,ng=!1,Xd=!1,sg=!1,Zs=0;function Sn(n){n!==dl&&n.next===null&&(dl===null?Kd=dl=n:dl=dl.next=n),Xd=!0,ng||(ng=!0,I3())}function Dc(n,a){if(!sg&&Xd){sg=!0;do for(var l=!1,h=Kd;h!==null;){if(n!==0){var v=h.pendingLanes;if(v===0)var y=0;else{var R=h.suspendedLanes,B=h.pingedLanes;y=(1<<31-or(42|n)+1)-1,y&=v&~(R&~B),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(l=!0,_w(h,y))}else y=it,y=Pe(h,h===St?y:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(y&3)===0||ct(h,y)||(l=!0,_w(h,y));h=h.next}while(l);sg=!1}}function z3(){pw()}function pw(){Xd=ng=!1;var n=0;Zs!==0&&K3()&&(n=Zs);for(var a=dt(),l=null,h=Kd;h!==null;){var v=h.next,y=gw(h,a);y===0?(h.next=null,l===null?Kd=v:l.next=v,v===null&&(dl=l)):(l=h,(n!==0||(y&3)!==0)&&(Xd=!0)),h=v}lr!==0&&lr!==5||Dc(n),Zs!==0&&(Zs=0)}function gw(n,a){for(var l=n.suspendedLanes,h=n.pingedLanes,v=n.expirationTimes,y=n.pendingLanes&-62914561;0<y;){var R=31-or(y),B=1<<R,K=v[R];K===-1?((B&l)===0||(B&h)!==0)&&(v[R]=Ct(B,a)):K<=a&&(n.expiredLanes|=B),y&=~B}if(a=St,l=it,l=Pe(n,n===a?l:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),h=n.callbackNode,l===0||n===a&&(mt===2||mt===9)||n.cancelPendingCommit!==null)return h!==null&&h!==null&&ft(h),n.callbackNode=null,n.callbackPriority=0;if((l&3)===0||ct(n,l)){if(a=l&-l,a===n.callbackPriority)return a;switch(h!==null&&ft(h),Zi(l)){case 2:case 8:l=_n;break;case 32:l=Gt;break;case 268435456:l=Jr;break;default:l=Gt}return h=vw.bind(null,n),l=Ye(l,h),n.callbackPriority=a,n.callbackNode=l,a}return h!==null&&h!==null&&ft(h),n.callbackPriority=2,n.callbackNode=null,2}function vw(n,a){if(lr!==0&&lr!==5)return n.callbackNode=null,n.callbackPriority=0,null;var l=n.callbackNode;if(Yd()&&n.callbackNode!==l)return null;var h=it;return h=Pe(n,n===St?h:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),h===0?null:(J1(n,h,a),gw(n,dt()),n.callbackNode!=null&&n.callbackNode===l?vw.bind(null,n):null)}function _w(n,a){if(Yd())return null;J1(n,a,!0)}function I3(){Z3(function(){(ut&6)!==0?Ye(Wr,z3):pw()})}function ag(){if(Zs===0){var n=Xo;n===0&&(n=Le,Le<<=1,(Le&261888)===0&&(Le=256)),Zs=n}return Zs}function yw(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:nd(""+n)}function bw(n,a){var l=a.ownerDocument.createElement("input");return l.name=a.name,l.value=a.value,n.id&&l.setAttribute("form",n.id),a.parentNode.insertBefore(l,a),n=new FormData(n),l.parentNode.removeChild(l),n}function $3(n,a,l,h,v){if(a==="submit"&&l&&l.stateNode===v){var y=yw((v[ii]||null).action),R=h.submitter;R&&(a=(a=R[ii]||null)?yw(a.formAction):R.getAttribute("formAction"),a!==null&&(y=a,R=null));var B=new ld("action","action",null,h,v);n.push({event:B,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Zs!==0){var K=R?bw(v,R):new FormData(v);Rp(l,{pending:!0,data:K,method:v.method,action:y},null,K)}}else typeof y=="function"&&(B.preventDefault(),K=R?bw(v,R):new FormData(v),Rp(l,{pending:!0,data:K,method:v.method,action:y},y,K))},currentTarget:v}]})}}for(var og=0;og<Fm.length;og++){var lg=Fm[og],U3=lg.toLowerCase(),H3=lg[0].toUpperCase()+lg.slice(1);Ji(U3,"on"+H3)}Ji(Zb,"onAnimationEnd"),Ji(Jb,"onAnimationIteration"),Ji(Qb,"onAnimationStart"),Ji("dblclick","onDoubleClick"),Ji("focusin","onFocus"),Ji("focusout","onBlur"),Ji(n3,"onTransitionRun"),Ji(s3,"onTransitionStart"),Ji(a3,"onTransitionCancel"),Ji(ex,"onTransitionEnd"),Oo("onMouseEnter",["mouseout","mouseover"]),Oo("onMouseLeave",["mouseout","mouseover"]),Oo("onPointerEnter",["pointerout","pointerover"]),Oo("onPointerLeave",["pointerout","pointerover"]),La("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),La("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),La("onBeforeInput",["compositionend","keypress","textInput","paste"]),La("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),La("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),La("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Lc="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(" "),F3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Lc));function xw(n,a){a=(a&4)!==0;for(var l=0;l<n.length;l++){var h=n[l],v=h.event;h=h.listeners;e:{var y=void 0;if(a)for(var R=h.length-1;0<=R;R--){var B=h[R],K=B.instance,ne=B.currentTarget;if(B=B.listener,K!==y&&v.isPropagationStopped())break e;y=B,v.currentTarget=ne;try{y(v)}catch(de){dd(de)}v.currentTarget=null,y=K}else for(R=0;R<h.length;R++){if(B=h[R],K=B.instance,ne=B.currentTarget,B=B.listener,K!==y&&v.isPropagationStopped())break e;y=B,v.currentTarget=ne;try{y(v)}catch(de){dd(de)}v.currentTarget=null,y=K}}}}function tt(n,a){var l=a[xm];l===void 0&&(l=a[xm]=new Set);var h=n+"__bubble";l.has(h)||(ww(a,n,2,!1),l.add(h))}function cg(n,a,l){var h=0;a&&(h|=4),ww(l,n,h,a)}var Zd="_reactListening"+Math.random().toString(36).slice(2);function ug(n){if(!n[Zd]){n[Zd]=!0,pb.forEach(function(l){l!=="selectionchange"&&(F3.has(l)||cg(l,!1,n),cg(l,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Zd]||(a[Zd]=!0,cg("selectionchange",!1,a))}}function ww(n,a,l,h){switch(Zw(a)){case 2:var v=vD;break;case 8:v=_D;break;default:v=Eg}l=v.bind(null,a,l,n),v=void 0,!Mm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(v=!0),h?v!==void 0?n.addEventListener(a,l,{capture:!0,passive:v}):n.addEventListener(a,l,!0):v!==void 0?n.addEventListener(a,l,{passive:v}):n.addEventListener(a,l,!1)}function dg(n,a,l,h,v){var y=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var R=h.tag;if(R===3||R===4){var B=h.stateNode.containerInfo;if(B===v)break;if(R===4)for(R=h.return;R!==null;){var K=R.tag;if((K===3||K===4)&&R.stateNode.containerInfo===v)return;R=R.return}for(;B!==null;){if(R=Lo(B),R===null)return;if(K=R.tag,K===5||K===6||K===26||K===27){h=y=R;continue e}B=B.parentNode}}h=h.return}kb(function(){var ne=y,de=Nm(l),fe=[];e:{var oe=tx.get(n);if(oe!==void 0){var ue=ld,De=n;switch(n){case"keypress":if(ad(l)===0)break e;case"keydown":case"keyup":ue=OT;break;case"focusin":De="focus",ue=jm;break;case"focusout":De="blur",ue=jm;break;case"beforeblur":case"afterblur":ue=jm;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=Mb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=CT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=IT;break;case Zb:case Jb:case Qb:ue=kT;break;case ex:ue=UT;break;case"scroll":case"scrollend":ue=wT;break;case"wheel":ue=FT;break;case"copy":case"cut":case"paste":ue=AT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=Db;break;case"toggle":case"beforetoggle":ue=qT}var ze=(a&4)!==0,yt=!ze&&(n==="scroll"||n==="scrollend"),te=ze?oe!==null?oe+"Capture":null:oe;ze=[];for(var Z=ne,ie;Z!==null;){var he=Z;if(ie=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ie===null||te===null||(he=tc(Z,te),he!=null&&ze.push(jc(Z,he,ie))),yt)break;Z=Z.return}0<ze.length&&(oe=new ue(oe,De,null,l,de),fe.push({event:oe,listeners:ze}))}}if((a&7)===0){e:{if(oe=n==="mouseover"||n==="pointerover",ue=n==="mouseout"||n==="pointerout",oe&&l!==km&&(De=l.relatedTarget||l.fromElement)&&(Lo(De)||De[Do]))break e;if((ue||oe)&&(oe=de.window===de?de:(oe=de.ownerDocument)?oe.defaultView||oe.parentWindow:window,ue?(De=l.relatedTarget||l.toElement,ue=ne,De=De?Lo(De):null,De!==null&&(yt=o(De),ze=De.tag,De!==yt||ze!==5&&ze!==27&&ze!==6)&&(De=null)):(ue=null,De=ne),ue!==De)){if(ze=Mb,he="onMouseLeave",te="onMouseEnter",Z="mouse",(n==="pointerout"||n==="pointerover")&&(ze=Db,he="onPointerLeave",te="onPointerEnter",Z="pointer"),yt=ue==null?oe:ec(ue),ie=De==null?oe:ec(De),oe=new ze(he,Z+"leave",ue,l,de),oe.target=yt,oe.relatedTarget=ie,he=null,Lo(de)===ne&&(ze=new ze(te,Z+"enter",De,l,de),ze.target=ie,ze.relatedTarget=yt,he=ze),yt=he,ue&&De)t:{for(ze=W3,te=ue,Z=De,ie=0,he=te;he;he=ze(he))ie++;he=0;for(var Oe=Z;Oe;Oe=ze(Oe))he++;for(;0<ie-he;)te=ze(te),ie--;for(;0<he-ie;)Z=ze(Z),he--;for(;ie--;){if(te===Z||Z!==null&&te===Z.alternate){ze=te;break t}te=ze(te),Z=ze(Z)}ze=null}else ze=null;ue!==null&&Sw(fe,oe,ue,ze,!1),De!==null&&yt!==null&&Sw(fe,yt,De,ze,!0)}}e:{if(oe=ne?ec(ne):window,ue=oe.nodeName&&oe.nodeName.toLowerCase(),ue==="select"||ue==="input"&&oe.type==="file")var ot=$b;else if(zb(oe))if(Ub)ot=t3;else{ot=QT;var je=JT}else ue=oe.nodeName,!ue||ue.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?ne&&Rm(ne.elementType)&&(ot=$b):ot=e3;if(ot&&(ot=ot(n,ne))){Ib(fe,ot,l,de);break e}je&&je(n,oe,ne),n==="focusout"&&ne&&oe.type==="number"&&ne.memoizedProps.value!=null&&Em(oe,"number",oe.value)}switch(je=ne?ec(ne):window,n){case"focusin":(zb(je)||je.contentEditable==="true")&&(Ho=je,$m=ne,cc=null);break;case"focusout":cc=$m=Ho=null;break;case"mousedown":Um=!0;break;case"contextmenu":case"mouseup":case"dragend":Um=!1,Kb(fe,l,de);break;case"selectionchange":if(i3)break;case"keydown":case"keyup":Kb(fe,l,de)}var Ve;if(Om)e:{switch(n){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else Uo?Ob(n,l)&&(nt="onCompositionEnd"):n==="keydown"&&l.keyCode===229&&(nt="onCompositionStart");nt&&(Lb&&l.locale!=="ko"&&(Uo||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&Uo&&(Ve=Nb()):(Bs=de,Tm="value"in Bs?Bs.value:Bs.textContent,Uo=!0)),je=Jd(ne,nt),0<je.length&&(nt=new Tb(nt,n,null,l,de),fe.push({event:nt,listeners:je}),Ve?nt.data=Ve:(Ve=Pb(l),Ve!==null&&(nt.data=Ve)))),(Ve=GT?YT(n,l):KT(n,l))&&(nt=Jd(ne,"onBeforeInput"),0<nt.length&&(je=new Tb("onBeforeInput","beforeinput",null,l,de),fe.push({event:je,listeners:nt}),je.data=Ve)),$3(fe,n,ne,l,de)}xw(fe,a)})}function jc(n,a,l){return{instance:n,listener:a,currentTarget:l}}function Jd(n,a){for(var l=a+"Capture",h=[];n!==null;){var v=n,y=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||y===null||(v=tc(n,l),v!=null&&h.unshift(jc(n,v,y)),v=tc(n,a),v!=null&&h.push(jc(n,v,y))),n.tag===3)return h;n=n.return}return[]}function W3(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Sw(n,a,l,h,v){for(var y=a._reactName,R=[];l!==null&&l!==h;){var B=l,K=B.alternate,ne=B.stateNode;if(B=B.tag,K!==null&&K===h)break;B!==5&&B!==26&&B!==27||ne===null||(K=ne,v?(ne=tc(l,y),ne!=null&&R.unshift(jc(l,ne,K))):v||(ne=tc(l,y),ne!=null&&R.push(jc(l,ne,K)))),l=l.return}R.length!==0&&n.push({event:a,listeners:R})}var q3=/\r\n?/g,V3=/\u0000|\uFFFD/g;function Cw(n){return(typeof n=="string"?n:""+n).replace(q3,`
|
|
49
|
+
`).replace(V3,"")}function Ew(n,a){return a=Cw(a),Cw(n)===a}function _t(n,a,l,h,v,y){switch(l){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||zo(n,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&zo(n,""+h);break;case"className":rd(n,"class",h);break;case"tabIndex":rd(n,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":rd(n,l,h);break;case"style":Eb(n,h,y);break;case"data":if(a!=="object"){rd(n,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||l!=="href")){n.removeAttribute(l);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){n.removeAttribute(l);break}h=nd(""+h),n.setAttribute(l,h);break;case"action":case"formAction":if(typeof h=="function"){n.setAttribute(l,"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 y=="function"&&(l==="formAction"?(a!=="input"&&_t(n,a,"name",v.name,v,null),_t(n,a,"formEncType",v.formEncType,v,null),_t(n,a,"formMethod",v.formMethod,v,null),_t(n,a,"formTarget",v.formTarget,v,null)):(_t(n,a,"encType",v.encType,v,null),_t(n,a,"method",v.method,v,null),_t(n,a,"target",v.target,v,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){n.removeAttribute(l);break}h=nd(""+h),n.setAttribute(l,h);break;case"onClick":h!=null&&(n.onclick=Vn);break;case"onScroll":h!=null&&tt("scroll",n);break;case"onScrollEnd":h!=null&&tt("scrollend",n);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(l=h.__html,l!=null){if(v.children!=null)throw Error(i(60));n.innerHTML=l}}break;case"multiple":n.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":n.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){n.removeAttribute("xlink:href");break}l=nd(""+h),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?n.setAttribute(l,""+h):n.removeAttribute(l);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":h&&typeof h!="function"&&typeof h!="symbol"?n.setAttribute(l,""):n.removeAttribute(l);break;case"capture":case"download":h===!0?n.setAttribute(l,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?n.setAttribute(l,h):n.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?n.setAttribute(l,h):n.removeAttribute(l);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?n.removeAttribute(l):n.setAttribute(l,h);break;case"popover":tt("beforetoggle",n),tt("toggle",n),td(n,"popover",h);break;case"xlinkActuate":qn(n,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":qn(n,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":qn(n,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":qn(n,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":qn(n,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":qn(n,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":qn(n,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":qn(n,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":qn(n,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":td(n,"is",h);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=bT.get(l)||l,td(n,l,h))}}function hg(n,a,l,h,v,y){switch(l){case"style":Eb(n,h,y);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(l=h.__html,l!=null){if(v.children!=null)throw Error(i(60));n.innerHTML=l}}break;case"children":typeof h=="string"?zo(n,h):(typeof h=="number"||typeof h=="bigint")&&zo(n,""+h);break;case"onScroll":h!=null&&tt("scroll",n);break;case"onScrollEnd":h!=null&&tt("scrollend",n);break;case"onClick":h!=null&&(n.onclick=Vn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!gb.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(v=l.endsWith("Capture"),a=l.slice(2,v?l.length-7:void 0),y=n[ii]||null,y=y!=null?y[l]:null,typeof y=="function"&&n.removeEventListener(a,y,v),typeof h=="function")){typeof y!="function"&&y!==null&&(l in n?n[l]=null:n.hasAttribute(l)&&n.removeAttribute(l)),n.addEventListener(a,h,v);break e}l in n?n[l]=h:h===!0?n.setAttribute(l,""):td(n,l,h)}}}function Dr(n,a,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":tt("error",n),tt("load",n);var h=!1,v=!1,y;for(y in l)if(l.hasOwnProperty(y)){var R=l[y];if(R!=null)switch(y){case"src":h=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:_t(n,a,y,R,l,null)}}v&&_t(n,a,"srcSet",l.srcSet,l,null),h&&_t(n,a,"src",l.src,l,null);return;case"input":tt("invalid",n);var B=y=R=v=null,K=null,ne=null;for(h in l)if(l.hasOwnProperty(h)){var de=l[h];if(de!=null)switch(h){case"name":v=de;break;case"type":R=de;break;case"checked":K=de;break;case"defaultChecked":ne=de;break;case"value":y=de;break;case"defaultValue":B=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(i(137,a));break;default:_t(n,a,h,de,l,null)}}xb(n,y,B,K,ne,R,v,!1);return;case"select":tt("invalid",n),h=R=y=null;for(v in l)if(l.hasOwnProperty(v)&&(B=l[v],B!=null))switch(v){case"value":y=B;break;case"defaultValue":R=B;break;case"multiple":h=B;default:_t(n,a,v,B,l,null)}a=y,l=R,n.multiple=!!h,a!=null?Po(n,!!h,a,!1):l!=null&&Po(n,!!h,l,!0);return;case"textarea":tt("invalid",n),y=v=h=null;for(R in l)if(l.hasOwnProperty(R)&&(B=l[R],B!=null))switch(R){case"value":h=B;break;case"defaultValue":v=B;break;case"children":y=B;break;case"dangerouslySetInnerHTML":if(B!=null)throw Error(i(91));break;default:_t(n,a,R,B,l,null)}Sb(n,h,v,y);return;case"option":for(K in l)if(l.hasOwnProperty(K)&&(h=l[K],h!=null))switch(K){case"selected":n.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:_t(n,a,K,h,l,null)}return;case"dialog":tt("beforetoggle",n),tt("toggle",n),tt("cancel",n),tt("close",n);break;case"iframe":case"object":tt("load",n);break;case"video":case"audio":for(h=0;h<Lc.length;h++)tt(Lc[h],n);break;case"image":tt("error",n),tt("load",n);break;case"details":tt("toggle",n);break;case"embed":case"source":case"link":tt("error",n),tt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ne in l)if(l.hasOwnProperty(ne)&&(h=l[ne],h!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:_t(n,a,ne,h,l,null)}return;default:if(Rm(a)){for(de in l)l.hasOwnProperty(de)&&(h=l[de],h!==void 0&&hg(n,a,de,h,l,void 0));return}}for(B in l)l.hasOwnProperty(B)&&(h=l[B],h!=null&&_t(n,a,B,h,l,null))}function G3(n,a,l,h){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,y=null,R=null,B=null,K=null,ne=null,de=null;for(ue in l){var fe=l[ue];if(l.hasOwnProperty(ue)&&fe!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":K=fe;default:h.hasOwnProperty(ue)||_t(n,a,ue,null,h,fe)}}for(var oe in h){var ue=h[oe];if(fe=l[oe],h.hasOwnProperty(oe)&&(ue!=null||fe!=null))switch(oe){case"type":y=ue;break;case"name":v=ue;break;case"checked":ne=ue;break;case"defaultChecked":de=ue;break;case"value":R=ue;break;case"defaultValue":B=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(i(137,a));break;default:ue!==fe&&_t(n,a,oe,ue,h,fe)}}Cm(n,R,B,K,ne,de,y,v);return;case"select":ue=R=B=oe=null;for(y in l)if(K=l[y],l.hasOwnProperty(y)&&K!=null)switch(y){case"value":break;case"multiple":ue=K;default:h.hasOwnProperty(y)||_t(n,a,y,null,h,K)}for(v in h)if(y=h[v],K=l[v],h.hasOwnProperty(v)&&(y!=null||K!=null))switch(v){case"value":oe=y;break;case"defaultValue":B=y;break;case"multiple":R=y;default:y!==K&&_t(n,a,v,y,h,K)}a=B,l=R,h=ue,oe!=null?Po(n,!!l,oe,!1):!!h!=!!l&&(a!=null?Po(n,!!l,a,!0):Po(n,!!l,l?[]:"",!1));return;case"textarea":ue=oe=null;for(B in l)if(v=l[B],l.hasOwnProperty(B)&&v!=null&&!h.hasOwnProperty(B))switch(B){case"value":break;case"children":break;default:_t(n,a,B,null,h,v)}for(R in h)if(v=h[R],y=l[R],h.hasOwnProperty(R)&&(v!=null||y!=null))switch(R){case"value":oe=v;break;case"defaultValue":ue=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(i(91));break;default:v!==y&&_t(n,a,R,v,h,y)}wb(n,oe,ue);return;case"option":for(var De in l)if(oe=l[De],l.hasOwnProperty(De)&&oe!=null&&!h.hasOwnProperty(De))switch(De){case"selected":n.selected=!1;break;default:_t(n,a,De,null,h,oe)}for(K in h)if(oe=h[K],ue=l[K],h.hasOwnProperty(K)&&oe!==ue&&(oe!=null||ue!=null))switch(K){case"selected":n.selected=oe&&typeof oe!="function"&&typeof oe!="symbol";break;default:_t(n,a,K,oe,h,ue)}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 ze in l)oe=l[ze],l.hasOwnProperty(ze)&&oe!=null&&!h.hasOwnProperty(ze)&&_t(n,a,ze,null,h,oe);for(ne in h)if(oe=h[ne],ue=l[ne],h.hasOwnProperty(ne)&&oe!==ue&&(oe!=null||ue!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,a));break;default:_t(n,a,ne,oe,h,ue)}return;default:if(Rm(a)){for(var yt in l)oe=l[yt],l.hasOwnProperty(yt)&&oe!==void 0&&!h.hasOwnProperty(yt)&&hg(n,a,yt,void 0,h,oe);for(de in h)oe=h[de],ue=l[de],!h.hasOwnProperty(de)||oe===ue||oe===void 0&&ue===void 0||hg(n,a,de,oe,h,ue);return}}for(var te in l)oe=l[te],l.hasOwnProperty(te)&&oe!=null&&!h.hasOwnProperty(te)&&_t(n,a,te,null,h,oe);for(fe in h)oe=h[fe],ue=l[fe],!h.hasOwnProperty(fe)||oe===ue||oe==null&&ue==null||_t(n,a,fe,oe,h,ue)}function Rw(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Y3(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,l=performance.getEntriesByType("resource"),h=0;h<l.length;h++){var v=l[h],y=v.transferSize,R=v.initiatorType,B=v.duration;if(y&&B&&Rw(R)){for(R=0,B=v.responseEnd,h+=1;h<l.length;h++){var K=l[h],ne=K.startTime;if(ne>B)break;var de=K.transferSize,fe=K.initiatorType;de&&Rw(fe)&&(K=K.responseEnd,R+=de*(K<B?1:(B-ne)/(K-ne)))}if(--h,a+=8*(y+R)/(v.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var fg=null,mg=null;function Qd(n){return n.nodeType===9?n:n.ownerDocument}function kw(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Nw(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function pg(n,a){return n==="textarea"||n==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var gg=null;function K3(){var n=window.event;return n&&n.type==="popstate"?n===gg?!1:(gg=n,!0):(gg=null,!1)}var Aw=typeof setTimeout=="function"?setTimeout:void 0,X3=typeof clearTimeout=="function"?clearTimeout:void 0,Mw=typeof Promise=="function"?Promise:void 0,Z3=typeof queueMicrotask=="function"?queueMicrotask:typeof Mw<"u"?function(n){return Mw.resolve(null).then(n).catch(J3)}:Aw;function J3(n){setTimeout(function(){throw n})}function Js(n){return n==="head"}function Tw(n,a){var l=a,h=0;do{var v=l.nextSibling;if(n.removeChild(l),v&&v.nodeType===8)if(l=v.data,l==="/$"||l==="/&"){if(h===0){n.removeChild(v),pl(a);return}h--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")h++;else if(l==="html")Bc(n.ownerDocument.documentElement);else if(l==="head"){l=n.ownerDocument.head,Bc(l);for(var y=l.firstChild;y;){var R=y.nextSibling,B=y.nodeName;y[Ql]||B==="SCRIPT"||B==="STYLE"||B==="LINK"&&y.rel.toLowerCase()==="stylesheet"||l.removeChild(y),y=R}}else l==="body"&&Bc(n.ownerDocument.body);l=v}while(l);pl(a)}function Dw(n,a){var l=n;n=0;do{var h=l.nextSibling;if(l.nodeType===1?a?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(a?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),h&&h.nodeType===8)if(l=h.data,l==="/$"){if(n===0)break;n--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||n++;l=h}while(l)}function vg(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var l=a;switch(a=a.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":vg(l),wm(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}n.removeChild(l)}}function Q3(n,a,l,h){for(;n.nodeType===1;){var v=l;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(h){if(!n[Ql])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(y=n.getAttribute("rel"),y==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(y!==v.rel||n.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||n.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||n.getAttribute("title")!==(v.title==null?null:v.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(y=n.getAttribute("src"),(y!==(v.src==null?null:v.src)||n.getAttribute("type")!==(v.type==null?null:v.type)||n.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&y&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var y=v.name==null?null:""+v.name;if(v.type==="hidden"&&n.getAttribute("name")===y)return n}else return n;if(n=Bi(n.nextSibling),n===null)break}return null}function eD(n,a,l){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!l||(n=Bi(n.nextSibling),n===null))return null;return n}function Lw(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=Bi(n.nextSibling),n===null))return null;return n}function _g(n){return n.data==="$?"||n.data==="$~"}function yg(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function tD(n,a){var l=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||l.readyState!=="loading")a();else{var h=function(){a(),l.removeEventListener("DOMContentLoaded",h)};l.addEventListener("DOMContentLoaded",h),n._reactRetry=h}}function Bi(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var bg=null;function jw(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var l=n.data;if(l==="/$"||l==="/&"){if(a===0)return Bi(n.nextSibling);a--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||a++}n=n.nextSibling}return null}function Bw(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var l=n.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(a===0)return n;a--}else l!=="/$"&&l!=="/&"||a++}n=n.previousSibling}return null}function Ow(n,a,l){switch(a=Qd(l),n){case"html":if(n=a.documentElement,!n)throw Error(i(452));return n;case"head":if(n=a.head,!n)throw Error(i(453));return n;case"body":if(n=a.body,!n)throw Error(i(454));return n;default:throw Error(i(451))}}function Bc(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);wm(n)}var Oi=new Map,Pw=new Set;function eh(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var ls=P.d;P.d={f:rD,r:iD,D:nD,C:sD,L:aD,m:oD,X:cD,S:lD,M:uD};function rD(){var n=ls.f(),a=qd();return n||a}function iD(n){var a=jo(n);a!==null&&a.tag===5&&a.type==="form"?e1(a):ls.r(n)}var hl=typeof document>"u"?null:document;function zw(n,a,l){var h=hl;if(h&&typeof a=="string"&&a){var v=Ni(a);v='link[rel="'+n+'"][href="'+v+'"]',typeof l=="string"&&(v+='[crossorigin="'+l+'"]'),Pw.has(v)||(Pw.add(v),n={rel:n,crossOrigin:l,href:a},h.querySelector(v)===null&&(a=h.createElement("link"),Dr(a,"link",n),vr(a),h.head.appendChild(a)))}}function nD(n){ls.D(n),zw("dns-prefetch",n,null)}function sD(n,a){ls.C(n,a),zw("preconnect",n,a)}function aD(n,a,l){ls.L(n,a,l);var h=hl;if(h&&n&&a){var v='link[rel="preload"][as="'+Ni(a)+'"]';a==="image"&&l&&l.imageSrcSet?(v+='[imagesrcset="'+Ni(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(v+='[imagesizes="'+Ni(l.imageSizes)+'"]')):v+='[href="'+Ni(n)+'"]';var y=v;switch(a){case"style":y=fl(n);break;case"script":y=ml(n)}Oi.has(y)||(n=p({rel:"preload",href:a==="image"&&l&&l.imageSrcSet?void 0:n,as:a},l),Oi.set(y,n),h.querySelector(v)!==null||a==="style"&&h.querySelector(Oc(y))||a==="script"&&h.querySelector(Pc(y))||(a=h.createElement("link"),Dr(a,"link",n),vr(a),h.head.appendChild(a)))}}function oD(n,a){ls.m(n,a);var l=hl;if(l&&n){var h=a&&typeof a.as=="string"?a.as:"script",v='link[rel="modulepreload"][as="'+Ni(h)+'"][href="'+Ni(n)+'"]',y=v;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=ml(n)}if(!Oi.has(y)&&(n=p({rel:"modulepreload",href:n},a),Oi.set(y,n),l.querySelector(v)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Pc(y)))return}h=l.createElement("link"),Dr(h,"link",n),vr(h),l.head.appendChild(h)}}}function lD(n,a,l){ls.S(n,a,l);var h=hl;if(h&&n){var v=Bo(h).hoistableStyles,y=fl(n);a=a||"default";var R=v.get(y);if(!R){var B={loading:0,preload:null};if(R=h.querySelector(Oc(y)))B.loading=5;else{n=p({rel:"stylesheet",href:n,"data-precedence":a},l),(l=Oi.get(y))&&xg(n,l);var K=R=h.createElement("link");vr(K),Dr(K,"link",n),K._p=new Promise(function(ne,de){K.onload=ne,K.onerror=de}),K.addEventListener("load",function(){B.loading|=1}),K.addEventListener("error",function(){B.loading|=2}),B.loading|=4,th(R,a,h)}R={type:"stylesheet",instance:R,count:1,state:B},v.set(y,R)}}}function cD(n,a){ls.X(n,a);var l=hl;if(l&&n){var h=Bo(l).hoistableScripts,v=ml(n),y=h.get(v);y||(y=l.querySelector(Pc(v)),y||(n=p({src:n,async:!0},a),(a=Oi.get(v))&&wg(n,a),y=l.createElement("script"),vr(y),Dr(y,"link",n),l.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},h.set(v,y))}}function uD(n,a){ls.M(n,a);var l=hl;if(l&&n){var h=Bo(l).hoistableScripts,v=ml(n),y=h.get(v);y||(y=l.querySelector(Pc(v)),y||(n=p({src:n,async:!0,type:"module"},a),(a=Oi.get(v))&&wg(n,a),y=l.createElement("script"),vr(y),Dr(y,"link",n),l.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},h.set(v,y))}}function Iw(n,a,l,h){var v=(v=ae.current)?eh(v):null;if(!v)throw Error(i(446));switch(n){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(a=fl(l.href),l=Bo(v).hoistableStyles,h=l.get(a),h||(h={type:"style",instance:null,count:0,state:null},l.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){n=fl(l.href);var y=Bo(v).hoistableStyles,R=y.get(n);if(R||(v=v.ownerDocument||v,R={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(n,R),(y=v.querySelector(Oc(n)))&&!y._p&&(R.instance=y,R.state.loading=5),Oi.has(n)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Oi.set(n,l),y||dD(v,n,l,R.state))),a&&h===null)throw Error(i(528,""));return R}if(a&&h!==null)throw Error(i(529,""));return null;case"script":return a=l.async,l=l.src,typeof l=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=ml(l),l=Bo(v).hoistableScripts,h=l.get(a),h||(h={type:"script",instance:null,count:0,state:null},l.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,n))}}function fl(n){return'href="'+Ni(n)+'"'}function Oc(n){return'link[rel="stylesheet"]['+n+"]"}function $w(n){return p({},n,{"data-precedence":n.precedence,precedence:null})}function dD(n,a,l,h){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?h.loading=1:(a=n.createElement("link"),h.preload=a,a.addEventListener("load",function(){return h.loading|=1}),a.addEventListener("error",function(){return h.loading|=2}),Dr(a,"link",l),vr(a),n.head.appendChild(a))}function ml(n){return'[src="'+Ni(n)+'"]'}function Pc(n){return"script[async]"+n}function Uw(n,a,l){if(a.count++,a.instance===null)switch(a.type){case"style":var h=n.querySelector('style[data-href~="'+Ni(l.href)+'"]');if(h)return a.instance=h,vr(h),h;var v=p({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return h=(n.ownerDocument||n).createElement("style"),vr(h),Dr(h,"style",v),th(h,l.precedence,n),a.instance=h;case"stylesheet":v=fl(l.href);var y=n.querySelector(Oc(v));if(y)return a.state.loading|=4,a.instance=y,vr(y),y;h=$w(l),(v=Oi.get(v))&&xg(h,v),y=(n.ownerDocument||n).createElement("link"),vr(y);var R=y;return R._p=new Promise(function(B,K){R.onload=B,R.onerror=K}),Dr(y,"link",h),a.state.loading|=4,th(y,l.precedence,n),a.instance=y;case"script":return y=ml(l.src),(v=n.querySelector(Pc(y)))?(a.instance=v,vr(v),v):(h=l,(v=Oi.get(y))&&(h=p({},l),wg(h,v)),n=n.ownerDocument||n,v=n.createElement("script"),vr(v),Dr(v,"link",h),n.head.appendChild(v),a.instance=v);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,th(h,l.precedence,n));return a.instance}function th(n,a,l){for(var h=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=h.length?h[h.length-1]:null,y=v,R=0;R<h.length;R++){var B=h[R];if(B.dataset.precedence===a)y=B;else if(y!==v)break}y?y.parentNode.insertBefore(n,y.nextSibling):(a=l.nodeType===9?l.head:l,a.insertBefore(n,a.firstChild))}function xg(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function wg(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var rh=null;function Hw(n,a,l){if(rh===null){var h=new Map,v=rh=new Map;v.set(l,h)}else v=rh,h=v.get(l),h||(h=new Map,v.set(l,h));if(h.has(n))return h;for(h.set(n,null),l=l.getElementsByTagName(n),v=0;v<l.length;v++){var y=l[v];if(!(y[Ql]||y[Nr]||n==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var R=y.getAttribute(a)||"";R=n+R;var B=h.get(R);B?B.push(y):h.set(R,[y])}}return h}function Fw(n,a,l){n=n.ownerDocument||n,n.head.insertBefore(l,a==="title"?n.querySelector("head > title"):null)}function hD(n,a,l){if(l===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return n=a.disabled,typeof a.precedence=="string"&&n==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Ww(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function fD(n,a,l,h){if(l.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var v=fl(h.href),y=a.querySelector(Oc(v));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=ih.bind(n),a.then(n,n)),l.state.loading|=4,l.instance=y,vr(y);return}y=a.ownerDocument||a,h=$w(h),(v=Oi.get(v))&&xg(h,v),y=y.createElement("link"),vr(y);var R=y;R._p=new Promise(function(B,K){R.onload=B,R.onerror=K}),Dr(y,"link",h),l.instance=y}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(l,a),(a=l.state.preload)&&(l.state.loading&3)===0&&(n.count++,l=ih.bind(n),a.addEventListener("load",l),a.addEventListener("error",l))}}var Sg=0;function mD(n,a){return n.stylesheets&&n.count===0&&sh(n,n.stylesheets),0<n.count||0<n.imgCount?function(l){var h=setTimeout(function(){if(n.stylesheets&&sh(n,n.stylesheets),n.unsuspend){var y=n.unsuspend;n.unsuspend=null,y()}},6e4+a);0<n.imgBytes&&Sg===0&&(Sg=62500*Y3());var v=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&sh(n,n.stylesheets),n.unsuspend)){var y=n.unsuspend;n.unsuspend=null,y()}},(n.imgBytes>Sg?50:800)+a);return n.unsuspend=l,function(){n.unsuspend=null,clearTimeout(h),clearTimeout(v)}}:null}function ih(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)sh(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var nh=null;function sh(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,nh=new Map,a.forEach(pD,n),nh=null,ih.call(n))}function pD(n,a){if(!(a.state.loading&4)){var l=nh.get(n);if(l)var h=l.get(null);else{l=new Map,nh.set(n,l);for(var v=n.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<v.length;y++){var R=v[y];(R.nodeName==="LINK"||R.getAttribute("media")!=="not all")&&(l.set(R.dataset.precedence,R),h=R)}h&&l.set(null,h)}v=a.instance,R=v.getAttribute("data-precedence"),y=l.get(R)||h,y===h&&l.set(null,v),l.set(R,v),this.count++,h=ih.bind(this),v.addEventListener("load",h),v.addEventListener("error",h),y?y.parentNode.insertBefore(v,y.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(v,n.firstChild)),a.state.loading|=4}}var zc={$$typeof:N,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function gD(n,a,l,h,v,y,R,B,K){this.tag=1,this.containerInfo=n,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=Ls(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ls(0),this.hiddenUpdates=Ls(null),this.identifierPrefix=h,this.onUncaughtError=v,this.onCaughtError=y,this.onRecoverableError=R,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function qw(n,a,l,h,v,y,R,B,K,ne,de,fe){return n=new gD(n,a,l,R,K,ne,de,fe,B),a=1,y===!0&&(a|=24),y=mi(3,null,null,a),n.current=y,y.stateNode=n,a=rp(),a.refCount++,n.pooledCache=a,a.refCount++,y.memoizedState={element:h,isDehydrated:l,cache:a},ap(y),n}function Vw(n){return n?(n=qo,n):qo}function Gw(n,a,l,h,v,y){v=Vw(v),h.context===null?h.context=v:h.pendingContext=v,h=Us(a),h.payload={element:l},y=y===void 0?null:y,y!==null&&(h.callback=y),l=Hs(n,h,a),l!==null&&(ci(l,n,a),gc(l,n,a))}function Yw(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l<a?l:a}}function Cg(n,a){Yw(n,a),(n=n.alternate)&&Yw(n,a)}function Kw(n){if(n.tag===13||n.tag===31){var a=Pa(n,67108864);a!==null&&ci(a,n,67108864),Cg(n,67108864)}}function Xw(n){if(n.tag===13||n.tag===31){var a=yi();a=To(a);var l=Pa(n,a);l!==null&&ci(l,n,a),Cg(n,a)}}var ah=!0;function vD(n,a,l,h){var v=M.T;M.T=null;var y=P.p;try{P.p=2,Eg(n,a,l,h)}finally{P.p=y,M.T=v}}function _D(n,a,l,h){var v=M.T;M.T=null;var y=P.p;try{P.p=8,Eg(n,a,l,h)}finally{P.p=y,M.T=v}}function Eg(n,a,l,h){if(ah){var v=Rg(h);if(v===null)dg(n,a,h,oh,l),Jw(n,h);else if(bD(v,n,a,l,h))h.stopPropagation();else if(Jw(n,h),a&4&&-1<yD.indexOf(n)){for(;v!==null;){var y=jo(v);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var R=gt(y.pendingLanes);if(R!==0){var B=y;for(B.pendingLanes|=2,B.entangledLanes|=2;R;){var K=1<<31-or(R);B.entanglements[1]|=K,R&=~K}Sn(y),(ut&6)===0&&(Fd=dt()+500,Dc(0))}}break;case 31:case 13:B=Pa(y,2),B!==null&&ci(B,y,2),qd(),Cg(y,2)}if(y=Rg(h),y===null&&dg(n,a,h,oh,l),y===v)break;v=y}v!==null&&h.stopPropagation()}else dg(n,a,h,null,l)}}function Rg(n){return n=Nm(n),kg(n)}var oh=null;function kg(n){if(oh=null,n=Lo(n),n!==null){var a=o(n);if(a===null)n=null;else{var l=a.tag;if(l===13){if(n=c(a),n!==null)return n;n=null}else if(l===31){if(n=d(a),n!==null)return n;n=null}else if(l===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return oh=n,null}function Zw(n){switch(n){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(Vt()){case Wr:return 2;case _n:return 8;case Gt:case Jt:return 32;case Jr:return 268435456;default:return 32}default:return 32}}var Ng=!1,Qs=null,ea=null,ta=null,Ic=new Map,$c=new Map,ra=[],yD="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 Jw(n,a){switch(n){case"focusin":case"focusout":Qs=null;break;case"dragenter":case"dragleave":ea=null;break;case"mouseover":case"mouseout":ta=null;break;case"pointerover":case"pointerout":Ic.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":$c.delete(a.pointerId)}}function Uc(n,a,l,h,v,y){return n===null||n.nativeEvent!==y?(n={blockedOn:a,domEventName:l,eventSystemFlags:h,nativeEvent:y,targetContainers:[v]},a!==null&&(a=jo(a),a!==null&&Kw(a)),n):(n.eventSystemFlags|=h,a=n.targetContainers,v!==null&&a.indexOf(v)===-1&&a.push(v),n)}function bD(n,a,l,h,v){switch(a){case"focusin":return Qs=Uc(Qs,n,a,l,h,v),!0;case"dragenter":return ea=Uc(ea,n,a,l,h,v),!0;case"mouseover":return ta=Uc(ta,n,a,l,h,v),!0;case"pointerover":var y=v.pointerId;return Ic.set(y,Uc(Ic.get(y)||null,n,a,l,h,v)),!0;case"gotpointercapture":return y=v.pointerId,$c.set(y,Uc($c.get(y)||null,n,a,l,h,v)),!0}return!1}function Qw(n){var a=Lo(n.target);if(a!==null){var l=o(a);if(l!==null){if(a=l.tag,a===13){if(a=c(l),a!==null){n.blockedOn=a,fb(n.priority,function(){Xw(l)});return}}else if(a===31){if(a=d(l),a!==null){n.blockedOn=a,fb(n.priority,function(){Xw(l)});return}}else if(a===3&&l.stateNode.current.memoizedState.isDehydrated){n.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}n.blockedOn=null}function lh(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var l=Rg(n.nativeEvent);if(l===null){l=n.nativeEvent;var h=new l.constructor(l.type,l);km=h,l.target.dispatchEvent(h),km=null}else return a=jo(l),a!==null&&Kw(a),n.blockedOn=l,!1;a.shift()}return!0}function eS(n,a,l){lh(n)&&l.delete(a)}function xD(){Ng=!1,Qs!==null&&lh(Qs)&&(Qs=null),ea!==null&&lh(ea)&&(ea=null),ta!==null&&lh(ta)&&(ta=null),Ic.forEach(eS),$c.forEach(eS)}function ch(n,a){n.blockedOn===a&&(n.blockedOn=null,Ng||(Ng=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,xD)))}var uh=null;function tS(n){uh!==n&&(uh=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){uh===n&&(uh=null);for(var a=0;a<n.length;a+=3){var l=n[a],h=n[a+1],v=n[a+2];if(typeof h!="function"){if(kg(h||l)===null)continue;break}var y=jo(l);y!==null&&(n.splice(a,3),a-=3,Rp(y,{pending:!0,data:v,method:l.method,action:h},h,v))}}))}function pl(n){function a(K){return ch(K,n)}Qs!==null&&ch(Qs,n),ea!==null&&ch(ea,n),ta!==null&&ch(ta,n),Ic.forEach(a),$c.forEach(a);for(var l=0;l<ra.length;l++){var h=ra[l];h.blockedOn===n&&(h.blockedOn=null)}for(;0<ra.length&&(l=ra[0],l.blockedOn===null);)Qw(l),l.blockedOn===null&&ra.shift();if(l=(n.ownerDocument||n).$$reactFormReplay,l!=null)for(h=0;h<l.length;h+=3){var v=l[h],y=l[h+1],R=v[ii]||null;if(typeof y=="function")R||tS(l);else if(R){var B=null;if(y&&y.hasAttribute("formAction")){if(v=y,R=y[ii]||null)B=R.formAction;else if(kg(v)!==null)continue}else B=R.action;typeof B=="function"?l[h+1]=B:(l.splice(h,3),h-=3),tS(l)}}}function rS(){function n(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(R){return v=R})},focusReset:"manual",scroll:"manual"})}function a(){v!==null&&(v(),v=null),h||setTimeout(l,20)}function l(){if(!h&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,v=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(l,100),function(){h=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),v!==null&&(v(),v=null)}}}function Ag(n){this._internalRoot=n}dh.prototype.render=Ag.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(i(409));var l=a.current,h=yi();Gw(l,h,n,a,null,null)},dh.prototype.unmount=Ag.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;Gw(n.current,2,null,n,null,null),qd(),a[Do]=null}};function dh(n){this._internalRoot=n}dh.prototype.unstable_scheduleHydration=function(n){if(n){var a=bm();n={blockedOn:null,target:n,priority:a};for(var l=0;l<ra.length&&a!==0&&a<ra[l].priority;l++);ra.splice(l,0,n),l===0&&Qw(n)}};var iS=t.version;if(iS!=="19.2.7")throw Error(i(527,iS,"19.2.7"));P.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(i(188)):(n=Object.keys(n).join(","),Error(i(268,n)));return n=f(a),n=n!==null?g(n):null,n=n===null?null:n.stateNode,n};var wD={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var hh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!hh.isDisabled&&hh.supportsFiber)try{yn=hh.inject(wD),gr=hh}catch{}}return Fc.createRoot=function(n,a){if(!s(n))throw Error(i(299));var l=!1,h="",v=u1,y=d1,R=h1;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(v=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(R=a.onRecoverableError)),a=qw(n,1,!1,null,null,l,h,null,v,y,R,rS),n[Do]=a.current,ug(n),new Ag(a)},Fc.hydrateRoot=function(n,a,l){if(!s(n))throw Error(i(299));var h=!1,v="",y=u1,R=d1,B=h1,K=null;return l!=null&&(l.unstable_strictMode===!0&&(h=!0),l.identifierPrefix!==void 0&&(v=l.identifierPrefix),l.onUncaughtError!==void 0&&(y=l.onUncaughtError),l.onCaughtError!==void 0&&(R=l.onCaughtError),l.onRecoverableError!==void 0&&(B=l.onRecoverableError),l.formState!==void 0&&(K=l.formState)),a=qw(n,1,!0,a,l??null,h,v,K,y,R,B,rS),a.context=Vw(null),l=a.current,h=yi(),h=To(h),v=Us(h),v.callback=null,Hs(l,v,h),l=h,a.current.lanes=l,Lt(a,l),Sn(a),n[Do]=a.current,ug(n),new dh(a)},Fc.version="19.2.7",Fc}var fS;function jD(){if(fS)return Dg.exports;fS=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Dg.exports=LD(),Dg.exports}var BD=jD();/**
|
|
50
|
+
* react-router v7.18.1
|
|
51
|
+
*
|
|
52
|
+
* Copyright (c) Remix Software Inc.
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
+
*
|
|
57
|
+
* @license MIT
|
|
58
|
+
*/var W0=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,lE=/^[\\/]{2}/;function OD(e,t){return t+e.replace(/\\/g,"/")}var mS="popstate";function pS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function PD(e={}){function t(i,s){var f;let o=(f=s.state)==null?void 0:f.masked,{pathname:c,search:d,hash:m}=o||i.location;return h_("",{pathname:c,search:d,hash:m},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function r(i,s){return typeof s=="string"?s:Su(s)}return ID(t,r,null,e)}function ar(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Vi(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function zD(){return Math.random().toString(36).substring(2,10)}function gS(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function h_(e,t,r=null,i,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Pu(t):t,state:r,key:t&&t.key||i||zD(),mask:s}}function Su({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Pu(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let i=e.indexOf("?");i>=0&&(t.search=e.substring(i),e=e.substring(0,i)),e&&(t.pathname=e)}return t}function ID(e,t,r,i={}){let{window:s=document.defaultView,v5Compat:o=!1}=i,c=s.history,d="POP",m=null,f=g();f==null&&(f=0,c.replaceState({...c.state,idx:f},""));function g(){return(c.state||{idx:null}).idx}function p(){d="POP";let E=g(),C=E==null?null:E-f;f=E,m&&m({action:d,location:S.location,delta:C})}function b(E,C){d="PUSH";let A=pS(E)?E:h_(S.location,E,C);f=g()+1;let N=gS(A,f),k=S.createHref(A.mask||A);try{c.pushState(N,"",k)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;s.location.assign(k)}o&&m&&m({action:d,location:S.location,delta:1})}function x(E,C){d="REPLACE";let A=pS(E)?E:h_(S.location,E,C);f=g();let N=gS(A,f),k=S.createHref(A.mask||A);c.replaceState(N,"",k),o&&m&&m({action:d,location:S.location,delta:0})}function w(E){return $D(s,E)}let S={get action(){return d},get location(){return e(s,c)},listen(E){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(mS,p),m=E,()=>{s.removeEventListener(mS,p),m=null}},createHref(E){return t(s,E)},createURL:w,encodeLocation(E){let C=w(E);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:b,replace:x,go(E){return c.go(E)}};return S}function $D(e,t,r=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),ar(i,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:Su(t);return s=s.replace(/ $/,"%20"),!r&&lE.test(s)&&(s=i+s),new URL(s,i)}function cE(e,t,r="/"){return UD(e,t,r,!1)}function UD(e,t,r,i,s){let o=typeof t=="string"?Pu(t):t,c=_s(o.pathname||"/",r);if(c==null)return null;let d=HD(e),m=null,f=QD(c);for(let g=0;m==null&&g<d.length;++g)m=JD(d[g],f,i);return m}function HD(e){let t=uE(e);return FD(t),t}function uE(e,t=[],r=[],i="",s=!1){let o=(c,d,m=s,f)=>{let g={relativePath:f===void 0?c.path||"":f,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(i)&&m)return;ar(g.relativePath.startsWith(i),`Absolute route path "${g.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(i.length)}let p=an([i,g.relativePath]),b=r.concat(g);c.children&&c.children.length>0&&(ar(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),uE(c.children,t,b,p,m)),!(c.path==null&&!c.index)&&t.push({path:p,score:XD(p,c.index),routesMeta:b.map((x,w)=>{let[S,E]=fE(x.relativePath,x.caseSensitive,w===b.length-1);return{...x,matcher:S,compiledParams:E}})})};return e.forEach((c,d)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))o(c,d);else for(let f of dE(c.path))o(c,d,!0,f)}),t}function dE(e){let t=e.split("/");if(t.length===0)return[];let[r,...i]=t,s=r.endsWith("?"),o=r.replace(/\?$/,"");if(i.length===0)return s?[o,""]:[o];let c=dE(i.join("/")),d=[];return d.push(...c.map(m=>m===""?o:[o,m].join("/"))),s&&d.push(...c),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function FD(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:ZD(t.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}var WD=/^:[\w-]+$/,qD=3,VD=2,GD=1,YD=10,KD=-2,vS=e=>e==="*";function XD(e,t){let r=e.split("/"),i=r.length;return r.some(vS)&&(i+=KD),t&&(i+=VD),r.filter(s=>!vS(s)).reduce((s,o)=>s+(WD.test(o)?qD:o===""?GD:YD),i)}function ZD(e,t){return e.length===t.length&&e.slice(0,-1).every((i,s)=>i===t[s])?e[e.length-1]-t[t.length-1]:0}function JD(e,t,r=!1){let{routesMeta:i}=e,s={},o="/",c=[];for(let d=0;d<i.length;++d){let m=i[d],f=d===i.length-1,g=o==="/"?t:t.slice(o.length)||"/",p={path:m.relativePath,caseSensitive:m.caseSensitive,end:f},b=m.matcher&&m.compiledParams?hE(p,g,m.matcher,m.compiledParams):nf(p,g),x=m.route;if(!b&&f&&r&&!i[i.length-1].route.index&&(b=nf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},g)),!b)return null;Object.assign(s,b.params),c.push({params:s,pathname:an([o,b.pathname]),pathnameBase:rL(an([o,b.pathnameBase])),route:x}),b.pathnameBase!=="/"&&(o=an([o,b.pathnameBase]))}return c}function nf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=fE(e.path,e.caseSensitive,e.end);return hE(e,t,r,i)}function hE(e,t,r,i){let s=t.match(r);if(!s)return null;let o=s[0],c=o.replace(/(.)\/+$/,"$1"),d=s.slice(1);return{params:i.reduce((f,{paramName:g,isOptional:p},b)=>{if(g==="*"){let w=d[b]||"";c=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const x=d[b];return p&&!x?f[g]=void 0:f[g]=(x||"").replace(/%2F/g,"/"),f},{}),pathname:o,pathnameBase:c,pattern:e}}function fE(e,t=!1,r=!0){Vi(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,m,f,g)=>{if(i.push({paramName:d,isOptional:m!=null}),m){let p=g.charAt(f+c.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),i]}function QD(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Vi(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function _s(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}function eL(e,t="/"){let{pathname:r,search:i="",hash:s=""}=typeof e=="string"?Pu(e):e,o;return r?(r=mE(r),r.startsWith("/")?o=_S(r.substring(1),"/"):o=_S(r,t)):o=t,{pathname:o,search:iL(i),hash:nL(s)}}function _S(e,t){let r=sf(t).split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function Og(e,t,r,i){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function tL(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function q0(e){let t=tL(e);return t.map((r,i)=>i===t.length-1?r.pathname:r.pathnameBase)}function Nf(e,t,r,i=!1){let s;typeof e=="string"?s=Pu(e):(s={...e},ar(!s.pathname||!s.pathname.includes("?"),Og("?","pathname","search",s)),ar(!s.pathname||!s.pathname.includes("#"),Og("#","pathname","hash",s)),ar(!s.search||!s.search.includes("#"),Og("#","search","hash",s)));let o=e===""||s.pathname==="",c=o?"/":s.pathname,d;if(c==null)d=r;else{let p=t.length-1;if(!i&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),p-=1;s.pathname=b.join("/")}d=p>=0?t[p]:"/"}let m=eL(s,d),f=c&&c!=="/"&&c.endsWith("/"),g=(o||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(f||g)&&(m.pathname+="/"),m}var mE=e=>e.replace(/[\\/]{2,}/g,"/"),an=e=>mE(e.join("/")),sf=e=>e.replace(/\/+$/,""),rL=e=>sf(e).replace(/^\/*/,"/"),iL=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,nL=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,sL=class{constructor(e,t,r,i=!1){this.status=e,this.statusText=t||"",this.internal=i,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function aL(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function oL(e){let t=e.map(r=>r.route.path).filter(Boolean);return an(t)||"/"}var pE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function gE(e,t){let r=e;if(typeof r!="string"||!W0.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let i=r,s=!1;if(pE)try{let o=new URL(window.location.href),c=lE.test(r)?new URL(OD(r,o.protocol)):new URL(r),d=_s(c.pathname,t);c.origin===o.origin&&d!=null?r=d+c.search+c.hash:s=!0}catch{Vi(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:s,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var vE=["POST","PUT","PATCH","DELETE"];new Set(vE);var lL=["GET",...vE];new Set(lL);var cL=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function uL(e){try{return cL.includes(new URL(e).protocol)}catch{return!1}}var Fl=_.createContext(null);Fl.displayName="DataRouter";var Af=_.createContext(null);Af.displayName="DataRouterState";var _E=_.createContext(!1);function dL(){return _.useContext(_E)}var yE=_.createContext({isTransitioning:!1});yE.displayName="ViewTransition";var hL=_.createContext(new Map);hL.displayName="Fetchers";var fL=_.createContext(null);fL.displayName="Await";var Ei=_.createContext(null);Ei.displayName="Navigation";var Mf=_.createContext(null);Mf.displayName="Location";var mn=_.createContext({outlet:null,matches:[],isDataRoute:!1});mn.displayName="Route";var V0=_.createContext(null);V0.displayName="RouteError";var bE="REACT_ROUTER_ERROR",mL="REDIRECT",pL="ROUTE_ERROR_RESPONSE";function gL(e){if(e.startsWith(`${bE}:${mL}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function vL(e){if(e.startsWith(`${bE}:${pL}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new sL(t.status,t.statusText,t.data)}catch{}}function _L(e,{relative:t}={}){ar(Wl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:i}=_.useContext(Ei),{hash:s,pathname:o,search:c}=zu(e,{relative:t}),d=o;return r!=="/"&&(d=o==="/"?r:an([r,o])),i.createHref({pathname:d,search:c,hash:s})}function Wl(){return _.useContext(Mf)!=null}function Pr(){return ar(Wl(),"useLocation() may be used only in the context of a <Router> component."),_.useContext(Mf).location}var xE="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function wE(e){_.useContext(Ei).static||_.useLayoutEffect(e)}function wa(){let{isDataRoute:e}=_.useContext(mn);return e?TL():yL()}function yL(){ar(Wl(),"useNavigate() may be used only in the context of a <Router> component.");let e=_.useContext(Fl),{basename:t,navigator:r}=_.useContext(Ei),{matches:i}=_.useContext(mn),{pathname:s}=Pr(),o=JSON.stringify(q0(i)),c=_.useRef(!1);return wE(()=>{c.current=!0}),_.useCallback((m,f={})=>{if(Vi(c.current,xE),!c.current)return;if(typeof m=="number"){r.go(m);return}let g=Nf(m,JSON.parse(o),s,f.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:an([t,g.pathname])),(f.replace?r.replace:r.push)(g,f.state,f)},[t,r,o,s,e])}_.createContext(null);function SE(){let{matches:e}=_.useContext(mn),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function zu(e,{relative:t}={}){let{matches:r}=_.useContext(mn),{pathname:i}=Pr(),s=JSON.stringify(q0(r));return _.useMemo(()=>Nf(e,JSON.parse(s),i,t==="path"),[e,s,i,t])}function bL(e,t){return CE(e)}function CE(e,t,r){ar(Wl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=_.useContext(Ei),{matches:s}=_.useContext(mn),o=s[s.length-1],c=o?o.params:{},d=o?o.pathname:"/",m=o?o.pathnameBase:"/",f=o&&o.route;{let E=f&&f.path||"";RE(d,!f||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${E}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
|
+
|
|
60
|
+
Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let g=Pr(),p;p=g;let b=p.pathname||"/",x=b;if(m!=="/"){let E=m.replace(/^\//,"").split("/");x="/"+b.replace(/^\//,"").split("/").slice(E.length).join("/")}let w=r&&r.state.matches.length?r.state.matches.map(E=>Object.assign(E,{route:r.manifest[E.route.id]||E.route})):cE(e,{pathname:x});return Vi(f||w!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Vi(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),EL(w&&w.map(E=>Object.assign({},E,{params:Object.assign({},c,E.params),pathname:an([m,i.encodeLocation?i.encodeLocation(E.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?m:an([m,i.encodeLocation?i.encodeLocation(E.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),s,r)}function xL(){let e=ML(),t=aL(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:i},o={padding:"2px 4px",backgroundColor:i},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=_.createElement(_.Fragment,null,_.createElement("p",null,"💿 Hey developer 👋"),_.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",_.createElement("code",{style:o},"ErrorBoundary")," or"," ",_.createElement("code",{style:o},"errorElement")," prop on your route.")),_.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},t),r?_.createElement("pre",{style:s},r):null,c)}var wL=_.createElement(xL,null),EE=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=vL(e.digest);r&&(e=r)}let t=e!==void 0?_.createElement(mn.Provider,{value:this.props.routeContext},_.createElement(V0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?_.createElement(SL,{error:e},t):t}};EE.contextType=_E;var Pg=new WeakMap;function SL({children:e,error:t}){let{basename:r}=_.useContext(Ei);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=gL(t.digest);if(i){let s=Pg.get(t);if(s)throw s;let o=gE(i.location,r),c=o.absoluteURL||o.to;if(uL(c))throw new Error("Invalid redirect location");if(pE&&!Pg.get(t))if(o.isExternal||i.reloadDocument)window.location.href=c;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:i.replace}));throw Pg.set(t,d),d}return _.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c}`})}}return e}function CL({routeContext:e,match:t,children:r}){let i=_.useContext(Fl);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(mn.Provider,{value:e},r)}function EL(e,t=[],r){let i=r==null?void 0:r.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let s=e,o=i==null?void 0:i.errors;if(o!=null){let g=s.findIndex(p=>p.route.id&&(o==null?void 0:o[p.route.id])!==void 0);ar(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,g+1))}let c=!1,d=-1;if(r&&i){c=i.renderFallback;for(let g=0;g<s.length;g++){let p=s[g];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=g),p.route.id){let{loaderData:b,errors:x}=i,w=p.route.loader&&!b.hasOwnProperty(p.route.id)&&(!x||x[p.route.id]===void 0);if(p.route.lazy||w){r.isStatic&&(c=!0),d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let m=r==null?void 0:r.onError,f=i&&m?(g,p)=>{var b,x;m(g,{location:i.location,params:((x=(b=i.matches)==null?void 0:b[0])==null?void 0:x.params)??{},pattern:oL(i.matches),errorInfo:p})}:void 0;return s.reduceRight((g,p,b)=>{let x,w=!1,S=null,E=null;i&&(x=o&&p.route.id?o[p.route.id]:void 0,S=p.route.errorElement||wL,c&&(d<0&&b===0?(RE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,E=null):d===b&&(w=!0,E=p.route.hydrateFallbackElement||null)));let C=t.concat(s.slice(0,b+1)),A=()=>{let N;return x?N=S:w?N=E:p.route.Component?N=_.createElement(p.route.Component,null):p.route.element?N=p.route.element:N=g,_.createElement(CL,{match:p,routeContext:{outlet:g,matches:C,isDataRoute:i!=null},children:N})};return i&&(p.route.ErrorBoundary||p.route.errorElement||b===0)?_.createElement(EE,{location:i.location,revalidation:i.revalidation,component:S,error:x,children:A(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:f}):A()},null)}function G0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function RL(e){let t=_.useContext(Fl);return ar(t,G0(e)),t}function kL(e){let t=_.useContext(Af);return ar(t,G0(e)),t}function NL(e){let t=_.useContext(mn);return ar(t,G0(e)),t}function Y0(e){let t=NL(e),r=t.matches[t.matches.length-1];return ar(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function AL(){return Y0("useRouteId")}function ML(){var i;let e=_.useContext(V0),t=kL("useRouteError"),r=Y0("useRouteError");return e!==void 0?e:(i=t.errors)==null?void 0:i[r]}function TL(){let{router:e}=RL("useNavigate"),t=Y0("useNavigate"),r=_.useRef(!1);return wE(()=>{r.current=!0}),_.useCallback(async(s,o={})=>{Vi(r.current,xE),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var yS={};function RE(e,t,r){!t&&!yS[e]&&(yS[e]=!0,Vi(!1,r))}_.memo(DL);function DL({routes:e,manifest:t,future:r,state:i,isStatic:s,onError:o}){return CE(e,void 0,{manifest:t,state:i,isStatic:s,onError:o})}function Al({to:e,replace:t,state:r,relative:i}){ar(Wl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=_.useContext(Ei);Vi(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=_.useContext(mn),{pathname:c}=Pr(),d=wa(),m=Nf(e,q0(o),c,i==="path"),f=JSON.stringify(m);return _.useEffect(()=>{d(JSON.parse(f),{replace:t,state:r,relative:i})},[d,f,i,t,r]),null}function LL({basename:e="/",children:t=null,location:r,navigationType:i="POP",navigator:s,static:o=!1,useTransitions:c}){ar(!Wl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),m=_.useMemo(()=>({basename:d,navigator:s,static:o,useTransitions:c,future:{}}),[d,s,o,c]);typeof r=="string"&&(r=Pu(r));let{pathname:f="/",search:g="",hash:p="",state:b=null,key:x="default",mask:w}=r,S=_.useMemo(()=>{let E=_s(f,d);return E==null?null:{location:{pathname:E,search:g,hash:p,state:b,key:x,mask:w},navigationType:i}},[d,f,g,p,b,x,i,w]);return Vi(S!=null,`<Router basename="${d}"> is not able to match the URL "${f}${g}${p}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:_.createElement(Ei.Provider,{value:m},_.createElement(Mf.Provider,{children:t,value:S}))}var Ih="get",$h="application/x-www-form-urlencoded";function Tf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function jL(e){return Tf(e)&&e.tagName.toLowerCase()==="button"}function BL(e){return Tf(e)&&e.tagName.toLowerCase()==="form"}function OL(e){return Tf(e)&&e.tagName.toLowerCase()==="input"}function PL(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function zL(e,t){return e.button===0&&(!t||t==="_self")&&!PL(e)}function f_(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let i=e[r];return t.concat(Array.isArray(i)?i.map(s=>[r,s]):[[r,i]])},[]))}function IL(e,t){let r=f_(e);return t&&t.forEach((i,s)=>{r.has(s)||t.getAll(s).forEach(o=>{r.append(s,o)})}),r}var fh=null;function $L(){if(fh===null)try{new FormData(document.createElement("form"),0),fh=!1}catch{fh=!0}return fh}var UL=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function zg(e){return e!=null&&!UL.has(e)?(Vi(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${$h}"`),null):e}function HL(e,t){let r,i,s,o,c;if(BL(e)){let d=e.getAttribute("action");i=d?_s(d,t):null,r=e.getAttribute("method")||Ih,s=zg(e.getAttribute("enctype"))||$h,o=new FormData(e)}else if(jL(e)||OL(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||d.getAttribute("action");if(i=m?_s(m,t):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||Ih,s=zg(e.getAttribute("formenctype"))||zg(d.getAttribute("enctype"))||$h,o=new FormData(d,e),!$L()){let{name:f,type:g,value:p}=e;if(g==="image"){let b=f?`${f}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else f&&o.append(f,p)}}else{if(Tf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Ih,i=null,s=$h,c=e}return o&&s==="text/plain"&&(c=o,o=void 0),{action:i,method:r.toLowerCase(),encType:s,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function K0(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function kE(e,t,r,i){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${i}`:s.pathname=`${s.pathname}.${i}`:s.pathname==="/"?s.pathname=`_root.${i}`:t&&_s(s.pathname,t)==="/"?s.pathname=`${sf(t)}/_root.${i}`:s.pathname=`${sf(s.pathname)}.${i}`,s}async function FL(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function WL(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function qL(e,t,r){let i=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let c=await FL(o,r);return c.links?c.links():[]}return[]}));return KL(i.flat(1).filter(WL).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function bS(e,t,r,i,s,o){let c=(m,f)=>r[f]?m.route.id!==r[f].route.id:!0,d=(m,f)=>{var g;return r[f].pathname!==m.pathname||((g=r[f].route.path)==null?void 0:g.endsWith("*"))&&r[f].params["*"]!==m.params["*"]};return o==="assets"?t.filter((m,f)=>c(m,f)||d(m,f)):o==="data"?t.filter((m,f)=>{var p;let g=i.routes[m.route.id];if(!g||!g.hasLoader)return!1;if(c(m,f)||d(m,f))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((p=r[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function VL(e,t,{includeHydrateFallback:r}={}){return GL(e.map(i=>{let s=t.routes[i.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function GL(e){return[...new Set(e)]}function YL(e){let t={},r=Object.keys(e).sort();for(let i of r)t[i]=e[i];return t}function KL(e,t){let r=new Set;return new Set(t),e.reduce((i,s)=>{let o=JSON.stringify(YL(s));return r.has(o)||(r.add(o),i.push({key:o,link:s})),i},[])}function X0(){let e=_.useContext(Fl);return K0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function XL(){let e=_.useContext(Af);return K0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Z0=_.createContext(void 0);Z0.displayName="FrameworkContext";function Df(){let e=_.useContext(Z0);return K0(e,"You must render this element inside a <HydratedRouter> element"),e}function ZL(e,t){let r=_.useContext(Z0),[i,s]=_.useState(!1),[o,c]=_.useState(!1),{onFocus:d,onBlur:m,onMouseEnter:f,onMouseLeave:g,onTouchStart:p}=t,b=_.useRef(null);_.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let S=C=>{C.forEach(A=>{c(A.isIntersecting)})},E=new IntersectionObserver(S,{threshold:.5});return b.current&&E.observe(b.current),()=>{E.disconnect()}}},[e]),_.useEffect(()=>{if(i){let S=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(S)}}},[i]);let x=()=>{s(!0)},w=()=>{s(!1),c(!1)};return r?e!=="intent"?[o,b,{}]:[o,b,{onFocus:Wc(d,x),onBlur:Wc(m,w),onMouseEnter:Wc(f,x),onMouseLeave:Wc(g,w),onTouchStart:Wc(p,x)}]:[!1,b,{}]}function Wc(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function JL({page:e,...t}){let r=dL(),{nonce:i}=Df(),{router:s}=X0(),o=_.useMemo(()=>cE(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?(t.nonce==null&&i&&(t={...t,nonce:i}),r?_.createElement(ej,{page:e,matches:o,...t}):_.createElement(tj,{page:e,matches:o,...t})):null}function QL(e){let{manifest:t,routeModules:r}=Df(),[i,s]=_.useState([]);return _.useEffect(()=>{let o=!1;return qL(e,t,r).then(c=>{o||s(c)}),()=>{o=!0}},[e,t,r]),i}function ej({page:e,matches:t,...r}){let i=Pr(),{future:s}=Df(),{basename:o}=X0(),c=_.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let d=kE(e,o,s.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,f=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?m=!0:f.push(g.route.id);return m&&f.length>0&&d.searchParams.set("_routes",f.join(",")),[d.pathname+d.search]},[o,s.v8_trailingSlashAwareDataRequests,e,i,t]);return _.createElement(_.Fragment,null,c.map(d=>_.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...r})))}function tj({page:e,matches:t,...r}){let i=Pr(),{future:s,manifest:o,routeModules:c}=Df(),{basename:d}=X0(),{loaderData:m,matches:f}=XL(),g=_.useMemo(()=>bS(e,t,f,o,i,"data"),[e,t,f,o,i]),p=_.useMemo(()=>bS(e,t,f,o,i,"assets"),[e,t,f,o,i]),b=_.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let S=new Set,E=!1;if(t.forEach(A=>{var k;let N=o.routes[A.route.id];!N||!N.hasLoader||(!g.some(O=>O.route.id===A.route.id)&&A.route.id in m&&((k=c[A.route.id])!=null&&k.shouldRevalidate)||N.hasClientLoader?E=!0:S.add(A.route.id))}),S.size===0)return[];let C=kE(e,d,s.v8_trailingSlashAwareDataRequests,"data");return E&&S.size>0&&C.searchParams.set("_routes",t.filter(A=>S.has(A.route.id)).map(A=>A.route.id).join(",")),[C.pathname+C.search]},[d,s.v8_trailingSlashAwareDataRequests,m,i,o,g,t,e,c]),x=_.useMemo(()=>VL(p,o),[p,o]),w=QL(p);return _.createElement(_.Fragment,null,b.map(S=>_.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...r})),x.map(S=>_.createElement("link",{key:S,rel:"modulepreload",href:S,...r})),w.map(({key:S,link:E})=>_.createElement("link",{key:S,nonce:r.nonce,...E,crossOrigin:E.crossOrigin??r.crossOrigin})))}function rj(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var ij=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{ij&&(window.__reactRouterVersion="7.18.1")}catch{}function nj({basename:e,children:t,useTransitions:r,window:i}){let s=_.useRef();s.current==null&&(s.current=PD({window:i,v5Compat:!0}));let o=s.current,[c,d]=_.useState({action:o.action,location:o.location}),m=_.useCallback(f=>{r===!1?d(f):_.startTransition(()=>d(f))},[r]);return _.useLayoutEffect(()=>o.listen(m),[o,m]),_.createElement(LL,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,useTransitions:r})}var NE=_.forwardRef(function({onClick:t,discover:r="render",prefetch:i="none",relative:s,reloadDocument:o,replace:c,mask:d,state:m,target:f,to:g,preventScrollReset:p,viewTransition:b,defaultShouldRevalidate:x,...w},S){let{basename:E,navigator:C,useTransitions:A}=_.useContext(Ei),N=typeof g=="string"&&W0.test(g),k=gE(g,E);g=k.to;let O=_L(g,{relative:s}),z=Pr(),H=null;if(d){let U=Nf(d,[],z.mask?z.mask.pathname:"/",!0);E!=="/"&&(U.pathname=U.pathname==="/"?E:an([E,U.pathname])),H=C.createHref(U)}let[D,G,Y]=ZL(i,w),W=oj(g,{replace:c,mask:d,state:m,target:f,preventScrollReset:p,relative:s,viewTransition:b,defaultShouldRevalidate:x,useTransitions:A});function L(U){t&&t(U),U.defaultPrevented||W(U)}let T=!(k.isExternal||o),j=_.createElement("a",{...w,...Y,href:(T?H:void 0)||k.absoluteURL||O,onClick:T?L:t,ref:rj(S,G),target:f,"data-discover":!N&&r==="render"?"true":void 0});return D&&!N?_.createElement(_.Fragment,null,j,_.createElement(JL,{page:O})):j});NE.displayName="Link";var ma=_.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:i="",end:s=!1,style:o,to:c,viewTransition:d,children:m,...f},g){let p=zu(c,{relative:f.relative}),b=Pr(),x=_.useContext(Af),{navigator:w,basename:S}=_.useContext(Ei),E=x!=null&&fj(p)&&d===!0,C=w.encodeLocation?w.encodeLocation(p).pathname:p.pathname,A=b.pathname,N=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;r||(A=A.toLowerCase(),N=N?N.toLowerCase():null,C=C.toLowerCase()),N&&S&&(N=_s(N,S)||N);const k=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let O=A===C||!s&&A.startsWith(C)&&A.charAt(k)==="/",z=N!=null&&(N===C||!s&&N.startsWith(C)&&N.charAt(C.length)==="/"),H={isActive:O,isPending:z,isTransitioning:E},D=O?t:void 0,G;typeof i=="function"?G=i(H):G=[i,O?"active":null,z?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let Y=typeof o=="function"?o(H):o;return _.createElement(NE,{...f,"aria-current":D,className:G,ref:g,style:Y,to:c,viewTransition:d},typeof m=="function"?m(H):m)});ma.displayName="NavLink";var sj=_.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:i,replace:s,state:o,method:c=Ih,action:d,onSubmit:m,relative:f,preventScrollReset:g,viewTransition:p,defaultShouldRevalidate:b,...x},w)=>{let{useTransitions:S}=_.useContext(Ei),E=dj(),C=hj(d,{relative:f}),A=c.toLowerCase()==="get"?"get":"post",N=typeof d=="string"&&W0.test(d),k=O=>{if(m&&m(O),O.defaultPrevented)return;O.preventDefault();let z=O.nativeEvent.submitter,H=(z==null?void 0:z.getAttribute("formmethod"))||c,D=()=>E(z||O.currentTarget,{fetcherKey:t,method:H,navigate:r,replace:s,state:o,relative:f,preventScrollReset:g,viewTransition:p,defaultShouldRevalidate:b});S&&r!==!1?_.startTransition(()=>D()):D()};return _.createElement("form",{ref:w,method:A,action:C,onSubmit:i?m:k,...x,"data-discover":!N&&e==="render"?"true":void 0})});sj.displayName="Form";function aj(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function AE(e){let t=_.useContext(Fl);return ar(t,aj(e)),t}function oj(e,{target:t,replace:r,mask:i,state:s,preventScrollReset:o,relative:c,viewTransition:d,defaultShouldRevalidate:m,useTransitions:f}={}){let g=wa(),p=Pr(),b=zu(e,{relative:c});return _.useCallback(x=>{if(zL(x,t)){x.preventDefault();let w=r!==void 0?r:Su(p)===Su(b),S=()=>g(e,{replace:w,mask:i,state:s,preventScrollReset:o,relative:c,viewTransition:d,defaultShouldRevalidate:m});f?_.startTransition(()=>S()):S()}},[p,g,b,r,i,s,t,e,o,c,d,m,f])}function lj(e){Vi(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=_.useRef(f_(e)),r=_.useRef(!1),i=Pr(),s=_.useMemo(()=>IL(i.search,r.current?null:t.current),[i.search]),o=wa(),c=_.useCallback((d,m)=>{const f=f_(typeof d=="function"?d(new URLSearchParams(s)):d);r.current=!0,o("?"+f,m)},[o,s]);return[s,c]}var cj=0,uj=()=>`__${String(++cj)}__`;function dj(){let{router:e}=AE("useSubmit"),{basename:t}=_.useContext(Ei),r=AL(),i=e.fetch,s=e.navigate;return _.useCallback(async(o,c={})=>{let{action:d,method:m,encType:f,formData:g,body:p}=HL(o,t);if(c.navigate===!1){let b=c.fetcherKey||uj();await i(b,r,c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:p,formMethod:c.method||m,formEncType:c.encType||f,flushSync:c.flushSync})}else await s(c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:p,formMethod:c.method||m,formEncType:c.encType||f,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[i,s,t,r])}function hj(e,{relative:t}={}){let{basename:r}=_.useContext(Ei),i=_.useContext(mn);ar(i,"useFormAction must be used inside a RouteContext");let[s]=i.matches.slice(-1),o={...zu(e||".",{relative:t})},c=Pr();if(e==null){o.search=c.search;let d=new URLSearchParams(o.search),m=d.getAll("index");if(m.some(g=>g==="")){d.delete("index"),m.filter(p=>p).forEach(p=>d.append("index",p));let g=d.toString();o.search=g?`?${g}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:an([r,o.pathname])),Su(o)}function fj(e,{relative:t}={}){let r=_.useContext(yE);ar(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=AE("useViewTransitionState"),s=zu(e,{relative:t});if(!r.isTransitioning)return!1;let o=_s(r.currentLocation.pathname,i)||r.currentLocation.pathname,c=_s(r.nextLocation.pathname,i)||r.nextLocation.pathname;return nf(s.pathname,c)!=null||nf(s.pathname,o)!=null}var _o=oE();const mj=H0(_o);function pj(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const gj=e=>{switch(e){case"success":return yj;case"info":return xj;case"warning":return bj;case"error":return wj;default:return null}},vj=Array(12).fill(0),_j=({visible:e,className:t})=>ye.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ye.createElement("div",{className:"sonner-spinner"},vj.map((r,i)=>ye.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),yj=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),bj=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),xj=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),wj=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Sj=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ye.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ye.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Cj=()=>{const[e,t]=ye.useState(document.hidden);return ye.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let m_=1;class Ej{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:i,...s}=t,o=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:m_++,c=this.toasts.find(m=>m.id===o),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),c?this.toasts=this.toasts.map(m=>m.id===o?(this.publish({...m,...t,id:o,title:i}),{...m,...t,id:o,dismissible:d,title:i}):m):this.addToast({title:i,...s,dismissible:d,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(i=>i({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let i;r.loading!==void 0&&(i=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=i!==void 0,c;const d=s.then(async f=>{if(c=["resolve",f],ye.isValidElement(f))o=!1,this.create({id:i,type:"default",message:f});else if(kj(f)&&!f.ok){o=!1;const p=typeof r.error=="function"?await r.error(`HTTP error! status: ${f.status}`):r.error,b=typeof r.description=="function"?await r.description(`HTTP error! status: ${f.status}`):r.description,w=typeof p=="object"&&!ye.isValidElement(p)?p:{message:p};this.create({id:i,type:"error",description:b,...w})}else if(f instanceof Error){o=!1;const p=typeof r.error=="function"?await r.error(f):r.error,b=typeof r.description=="function"?await r.description(f):r.description,w=typeof p=="object"&&!ye.isValidElement(p)?p:{message:p};this.create({id:i,type:"error",description:b,...w})}else if(r.success!==void 0){o=!1;const p=typeof r.success=="function"?await r.success(f):r.success,b=typeof r.description=="function"?await r.description(f):r.description,w=typeof p=="object"&&!ye.isValidElement(p)?p:{message:p};this.create({id:i,type:"success",description:b,...w})}}).catch(async f=>{if(c=["reject",f],r.error!==void 0){o=!1;const g=typeof r.error=="function"?await r.error(f):r.error,p=typeof r.description=="function"?await r.description(f):r.description,x=typeof g=="object"&&!ye.isValidElement(g)?g:{message:g};this.create({id:i,type:"error",description:p,...x})}}).finally(()=>{o&&(this.dismiss(i),i=void 0),r.finally==null||r.finally.call(r)}),m=()=>new Promise((f,g)=>d.then(()=>c[0]==="reject"?g(c[1]):f(c[1])).catch(g));return typeof i!="string"&&typeof i!="number"?{unwrap:m}:Object.assign(i,{unwrap:m})},this.custom=(t,r)=>{const i=(r==null?void 0:r.id)||m_++;return this.create({jsx:t(i),id:i,...r}),i},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const hi=new Ej,Rj=(e,t)=>{const r=(t==null?void 0:t.id)||m_++;return hi.addToast({title:e,...t,id:r}),r},kj=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Nj=Rj,Aj=()=>hi.toasts,Mj=()=>hi.getActiveToasts(),we=Object.assign(Nj,{success:hi.success,info:hi.info,warning:hi.warning,error:hi.error,custom:hi.custom,message:hi.message,promise:hi.promise,dismiss:hi.dismiss,loading:hi.loading},{getHistory:Aj,getToasts:Mj});pj("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function mh(e){return e.label!==void 0}const Tj=3,Dj="24px",Lj="16px",xS=4e3,jj=356,Bj=14,Oj=45,Pj=200;function Cn(...e){return e.filter(Boolean).join(" ")}function zj(e){const[t,r]=e.split("-"),i=[];return t&&i.push(t),r&&i.push(r),i}const Ij=e=>{var t,r,i,s,o,c,d,m,f;const{invert:g,toast:p,unstyled:b,interacting:x,setHeights:w,visibleToasts:S,heights:E,index:C,toasts:A,expanded:N,removeToast:k,defaultRichColors:O,closeButton:z,style:H,cancelButtonStyle:D,actionButtonStyle:G,className:Y="",descriptionClassName:W="",duration:L,position:T,gap:j,expandByDefault:U,classNames:M,icons:P,closeButtonAriaLabel:I="Close toast"}=e,[F,q]=ye.useState(null),[$,X]=ye.useState(null),[V,J]=ye.useState(!1),[le,ae]=ye.useState(!1),[ee,se]=ye.useState(!1),[ce,Se]=ye.useState(!1),[Re,Ne]=ye.useState(!1),[Q,re]=ye.useState(0),[be,pe]=ye.useState(0),Ee=ye.useRef(p.duration||L||xS),Ie=ye.useRef(null),Te=ye.useRef(null),Ye=C===0,ft=C+1<=S,Ge=p.type,zt=p.dismissible!==!1,dt=p.className||"",Vt=p.descriptionClassName||"",Wr=ye.useMemo(()=>E.findIndex(Pe=>Pe.toastId===p.id)||0,[E,p.id]),_n=ye.useMemo(()=>{var Pe;return(Pe=p.closeButton)!=null?Pe:z},[p.closeButton,z]),Gt=ye.useMemo(()=>p.duration||L||xS,[p.duration,L]),Jt=ye.useRef(0),Jr=ye.useRef(0),Xi=ye.useRef(0),Ri=ye.useRef(null),[yn,gr]=T.split("-"),Qr=ye.useMemo(()=>E.reduce((Pe,ct,Ct)=>Ct>=Wr?Pe:Pe+ct.height,0),[E,Wr]),or=Cj(),Mo=p.invert||g,Ds=Ge==="loading";Jr.current=ye.useMemo(()=>Wr*j+Qr,[Wr,Qr]),ye.useEffect(()=>{Ee.current=Gt},[Gt]),ye.useEffect(()=>{J(!0)},[]),ye.useEffect(()=>{const Pe=Te.current;if(Pe){const ct=Pe.getBoundingClientRect().height;return pe(ct),w(Ct=>[{toastId:p.id,height:ct,position:p.position},...Ct]),()=>w(Ct=>Ct.filter(zr=>zr.toastId!==p.id))}},[w,p.id]),ye.useLayoutEffect(()=>{if(!V)return;const Pe=Te.current,ct=Pe.style.height;Pe.style.height="auto";const Ct=Pe.getBoundingClientRect().height;Pe.style.height=ct,pe(Ct),w(zr=>zr.find(Lt=>Lt.toastId===p.id)?zr.map(Lt=>Lt.toastId===p.id?{...Lt,height:Ct}:Lt):[{toastId:p.id,height:Ct,position:p.position},...zr])},[V,p.title,p.description,w,p.id,p.jsx,p.action,p.cancel]);const ve=ye.useCallback(()=>{ae(!0),re(Jr.current),w(Pe=>Pe.filter(ct=>ct.toastId!==p.id)),setTimeout(()=>{k(p)},Pj)},[p,k,w,Jr]);ye.useEffect(()=>{if(p.promise&&Ge==="loading"||p.duration===1/0||p.type==="loading")return;let Pe;return N||x||or?(()=>{if(Xi.current<Jt.current){const zr=new Date().getTime()-Jt.current;Ee.current=Ee.current-zr}Xi.current=new Date().getTime()})():(()=>{Ee.current!==1/0&&(Jt.current=new Date().getTime(),Pe=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),ve()},Ee.current))})(),()=>clearTimeout(Pe)},[N,x,p,Ge,or,ve]),ye.useEffect(()=>{p.delete&&(ve(),p.onDismiss==null||p.onDismiss.call(p,p))},[ve,p.delete]);function Le(){var Pe;if(P!=null&&P.loading){var ct;return ye.createElement("div",{className:Cn(M==null?void 0:M.loader,p==null||(ct=p.classNames)==null?void 0:ct.loader,"sonner-loader"),"data-visible":Ge==="loading"},P.loading)}return ye.createElement(_j,{className:Cn(M==null?void 0:M.loader,p==null||(Pe=p.classNames)==null?void 0:Pe.loader),visible:Ge==="loading"})}const Je=p.icon||(P==null?void 0:P[Ge])||gj(Ge);var wt,gt;return ye.createElement("li",{tabIndex:0,ref:Te,className:Cn(Y,dt,M==null?void 0:M.toast,p==null||(t=p.classNames)==null?void 0:t.toast,M==null?void 0:M.default,M==null?void 0:M[Ge],p==null||(r=p.classNames)==null?void 0:r[Ge]),"data-sonner-toast":"","data-rich-colors":(wt=p.richColors)!=null?wt:O,"data-styled":!(p.jsx||p.unstyled||b),"data-mounted":V,"data-promise":!!p.promise,"data-swiped":Re,"data-removed":le,"data-visible":ft,"data-y-position":yn,"data-x-position":gr,"data-index":C,"data-front":Ye,"data-swiping":ee,"data-dismissible":zt,"data-type":Ge,"data-invert":Mo,"data-swipe-out":ce,"data-swipe-direction":$,"data-expanded":!!(N||U&&V),"data-testid":p.testId,style:{"--index":C,"--toasts-before":C,"--z-index":A.length-C,"--offset":`${le?Q:Jr.current}px`,"--initial-height":U?"auto":`${be}px`,...H,...p.style},onDragEnd:()=>{se(!1),q(null),Ri.current=null},onPointerDown:Pe=>{Pe.button!==2&&(Ds||!zt||(Ie.current=new Date,re(Jr.current),Pe.target.setPointerCapture(Pe.pointerId),Pe.target.tagName!=="BUTTON"&&(se(!0),Ri.current={x:Pe.clientX,y:Pe.clientY})))},onPointerUp:()=>{var Pe,ct,Ct;if(ce||!zt)return;Ri.current=null;const zr=Number(((Pe=Te.current)==null?void 0:Pe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ls=Number(((ct=Te.current)==null?void 0:ct.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Lt=new Date().getTime()-((Ct=Ie.current)==null?void 0:Ct.getTime()),ei=F==="x"?zr:Ls,Da=Math.abs(ei)/Lt;if(Math.abs(ei)>=Oj||Da>.11){re(Jr.current),p.onDismiss==null||p.onDismiss.call(p,p),X(F==="x"?zr>0?"right":"left":Ls>0?"down":"up"),ve(),Se(!0);return}else{var ti,ri;(ti=Te.current)==null||ti.style.setProperty("--swipe-amount-x","0px"),(ri=Te.current)==null||ri.style.setProperty("--swipe-amount-y","0px")}Ne(!1),se(!1),q(null)},onPointerMove:Pe=>{var ct,Ct,zr;if(!Ri.current||!zt||((ct=window.getSelection())==null?void 0:ct.toString().length)>0)return;const Lt=Pe.clientY-Ri.current.y,ei=Pe.clientX-Ri.current.x;var Da;const ti=(Da=e.swipeDirections)!=null?Da:zj(T);!F&&(Math.abs(ei)>1||Math.abs(Lt)>1)&&q(Math.abs(ei)>Math.abs(Lt)?"x":"y");let ri={x:0,y:0};const To=Zi=>1/(1.5+Math.abs(Zi)/20);if(F==="y"){if(ti.includes("top")||ti.includes("bottom"))if(ti.includes("top")&&Lt<0||ti.includes("bottom")&&Lt>0)ri.y=Lt;else{const Zi=Lt*To(Lt);ri.y=Math.abs(Zi)<Math.abs(Lt)?Zi:Lt}}else if(F==="x"&&(ti.includes("left")||ti.includes("right")))if(ti.includes("left")&&ei<0||ti.includes("right")&&ei>0)ri.x=ei;else{const Zi=ei*To(ei);ri.x=Math.abs(Zi)<Math.abs(ei)?Zi:ei}(Math.abs(ri.x)>0||Math.abs(ri.y)>0)&&Ne(!0),(Ct=Te.current)==null||Ct.style.setProperty("--swipe-amount-x",`${ri.x}px`),(zr=Te.current)==null||zr.style.setProperty("--swipe-amount-y",`${ri.y}px`)}},_n&&!p.jsx&&Ge!=="loading"?ye.createElement("button",{"aria-label":I,"data-disabled":Ds,"data-close-button":!0,onClick:Ds||!zt?()=>{}:()=>{ve(),p.onDismiss==null||p.onDismiss.call(p,p)},className:Cn(M==null?void 0:M.closeButton,p==null||(i=p.classNames)==null?void 0:i.closeButton)},(gt=P==null?void 0:P.close)!=null?gt:Sj):null,(Ge||p.icon||p.promise)&&p.icon!==null&&((P==null?void 0:P[Ge])!==null||p.icon)?ye.createElement("div",{"data-icon":"",className:Cn(M==null?void 0:M.icon,p==null||(s=p.classNames)==null?void 0:s.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||Le():null,p.type!=="loading"?Je:null):null,ye.createElement("div",{"data-content":"",className:Cn(M==null?void 0:M.content,p==null||(o=p.classNames)==null?void 0:o.content)},ye.createElement("div",{"data-title":"",className:Cn(M==null?void 0:M.title,p==null||(c=p.classNames)==null?void 0:c.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?ye.createElement("div",{"data-description":"",className:Cn(W,Vt,M==null?void 0:M.description,p==null||(d=p.classNames)==null?void 0:d.description)},typeof p.description=="function"?p.description():p.description):null),ye.isValidElement(p.cancel)?p.cancel:p.cancel&&mh(p.cancel)?ye.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||D,onClick:Pe=>{mh(p.cancel)&&zt&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,Pe),ve())},className:Cn(M==null?void 0:M.cancelButton,p==null||(m=p.classNames)==null?void 0:m.cancelButton)},p.cancel.label):null,ye.isValidElement(p.action)?p.action:p.action&&mh(p.action)?ye.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||G,onClick:Pe=>{mh(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,Pe),!Pe.defaultPrevented&&ve())},className:Cn(M==null?void 0:M.actionButton,p==null||(f=p.classNames)==null?void 0:f.actionButton)},p.action.label):null)};function wS(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function $j(e,t){const r={};return[e,t].forEach((i,s)=>{const o=s===1,c=o?"--mobile-offset":"--offset",d=o?Lj:Dj;function m(f){["top","right","bottom","left"].forEach(g=>{r[`${c}-${g}`]=typeof f=="number"?`${f}px`:f})}typeof i=="number"||typeof i=="string"?m(i):typeof i=="object"?["top","right","bottom","left"].forEach(f=>{i[f]===void 0?r[`${c}-${f}`]=d:r[`${c}-${f}`]=typeof i[f]=="number"?`${i[f]}px`:i[f]}):m(d)}),r}const Uj=ye.forwardRef(function(t,r){const{id:i,invert:s,position:o="bottom-right",hotkey:c=["altKey","KeyT"],expand:d,closeButton:m,className:f,offset:g,mobileOffset:p,theme:b="light",richColors:x,duration:w,style:S,visibleToasts:E=Tj,toastOptions:C,dir:A=wS(),gap:N=Bj,icons:k,containerAriaLabel:O="Notifications"}=t,[z,H]=ye.useState([]),D=ye.useMemo(()=>i?z.filter(V=>V.toasterId===i):z.filter(V=>!V.toasterId),[z,i]),G=ye.useMemo(()=>Array.from(new Set([o].concat(D.filter(V=>V.position).map(V=>V.position)))),[D,o]),[Y,W]=ye.useState([]),[L,T]=ye.useState(!1),[j,U]=ye.useState(!1),[M,P]=ye.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),I=ye.useRef(null),F=c.join("+").replace(/Key/g,"").replace(/Digit/g,""),q=ye.useRef(null),$=ye.useRef(!1),X=ye.useCallback(V=>{H(J=>{var le;return(le=J.find(ae=>ae.id===V.id))!=null&&le.delete||hi.dismiss(V.id),J.filter(({id:ae})=>ae!==V.id)})},[]);return ye.useEffect(()=>hi.subscribe(V=>{if(V.dismiss){requestAnimationFrame(()=>{H(J=>J.map(le=>le.id===V.id?{...le,delete:!0}:le))});return}setTimeout(()=>{mj.flushSync(()=>{H(J=>{const le=J.findIndex(ae=>ae.id===V.id);return le!==-1?[...J.slice(0,le),{...J[le],...V},...J.slice(le+1)]:[V,...J]})})})}),[z]),ye.useEffect(()=>{if(b!=="system"){P(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?P("dark"):P("light")),typeof window>"u")return;const V=window.matchMedia("(prefers-color-scheme: dark)");try{V.addEventListener("change",({matches:J})=>{P(J?"dark":"light")})}catch{V.addListener(({matches:le})=>{try{P(le?"dark":"light")}catch(ae){console.error(ae)}})}},[b]),ye.useEffect(()=>{z.length<=1&&T(!1)},[z]),ye.useEffect(()=>{const V=J=>{var le;if(c.every(se=>J[se]||J.code===se)){var ee;T(!0),(ee=I.current)==null||ee.focus()}J.code==="Escape"&&(document.activeElement===I.current||(le=I.current)!=null&&le.contains(document.activeElement))&&T(!1)};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[c]),ye.useEffect(()=>{if(I.current)return()=>{q.current&&(q.current.focus({preventScroll:!0}),q.current=null,$.current=!1)}},[I.current]),ye.createElement("section",{ref:r,"aria-label":`${O} ${F}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},G.map((V,J)=>{var le;const[ae,ee]=V.split("-");return D.length?ye.createElement("ol",{key:V,dir:A==="auto"?wS():A,tabIndex:-1,ref:I,className:f,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":ae,"data-x-position":ee,style:{"--front-toast-height":`${((le=Y[0])==null?void 0:le.height)||0}px`,"--width":`${jj}px`,"--gap":`${N}px`,...S,...$j(g,p)},onBlur:se=>{$.current&&!se.currentTarget.contains(se.relatedTarget)&&($.current=!1,q.current&&(q.current.focus({preventScroll:!0}),q.current=null))},onFocus:se=>{se.target instanceof HTMLElement&&se.target.dataset.dismissible==="false"||$.current||($.current=!0,q.current=se.relatedTarget)},onMouseEnter:()=>T(!0),onMouseMove:()=>T(!0),onMouseLeave:()=>{j||T(!1)},onDragEnd:()=>T(!1),onPointerDown:se=>{se.target instanceof HTMLElement&&se.target.dataset.dismissible==="false"||U(!0)},onPointerUp:()=>U(!1)},D.filter(se=>!se.position&&J===0||se.position===V).map((se,ce)=>{var Se,Re;return ye.createElement(Ij,{key:se.id,icons:k,index:ce,toast:se,defaultRichColors:x,duration:(Se=C==null?void 0:C.duration)!=null?Se:w,className:C==null?void 0:C.className,descriptionClassName:C==null?void 0:C.descriptionClassName,invert:s,visibleToasts:E,closeButton:(Re=C==null?void 0:C.closeButton)!=null?Re:m,interacting:j,position:V,style:C==null?void 0:C.style,unstyled:C==null?void 0:C.unstyled,classNames:C==null?void 0:C.classNames,cancelButtonStyle:C==null?void 0:C.cancelButtonStyle,actionButtonStyle:C==null?void 0:C.actionButtonStyle,closeButtonAriaLabel:C==null?void 0:C.closeButtonAriaLabel,removeToast:X,toasts:D.filter(Ne=>Ne.position==se.position),heights:Y.filter(Ne=>Ne.position==se.position),setHeights:W,expandByDefault:d,gap:N,expanded:L,swipeDirections:t.swipeDirections})})):null}))});/**
|
|
61
|
+
* @license lucide-react v0.475.0 - ISC
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the ISC license.
|
|
64
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
+
*/const Hj=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ME=(...e)=>e.filter((t,r,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===r).join(" ").trim();/**
|
|
66
|
+
* @license lucide-react v0.475.0 - ISC
|
|
67
|
+
*
|
|
68
|
+
* This source code is licensed under the ISC license.
|
|
69
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
+
*/var Fj={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
71
|
+
* @license lucide-react v0.475.0 - ISC
|
|
72
|
+
*
|
|
73
|
+
* This source code is licensed under the ISC license.
|
|
74
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
+
*/const Wj=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:s="",children:o,iconNode:c,...d},m)=>_.createElement("svg",{ref:m,...Fj,width:t,height:t,stroke:e,strokeWidth:i?Number(r)*24/Number(t):r,className:ME("lucide",s),...d},[...c.map(([f,g])=>_.createElement(f,g)),...Array.isArray(o)?o:[o]]));/**
|
|
76
|
+
* @license lucide-react v0.475.0 - ISC
|
|
77
|
+
*
|
|
78
|
+
* This source code is licensed under the ISC license.
|
|
79
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
+
*/const ke=(e,t)=>{const r=_.forwardRef(({className:i,...s},o)=>_.createElement(Wj,{ref:o,iconNode:t,className:ME(`lucide-${Hj(e)}`,i),...s}));return r.displayName=`${e}`,r};/**
|
|
81
|
+
* @license lucide-react v0.475.0 - ISC
|
|
82
|
+
*
|
|
83
|
+
* This source code is licensed under the ISC license.
|
|
84
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
+
*/const qj=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Pl=ke("ArrowLeft",qj);/**
|
|
86
|
+
* @license lucide-react v0.475.0 - ISC
|
|
87
|
+
*
|
|
88
|
+
* This source code is licensed under the ISC license.
|
|
89
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
+
*/const Vj=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Gj=ke("ArrowRight",Vj);/**
|
|
91
|
+
* @license lucide-react v0.475.0 - ISC
|
|
92
|
+
*
|
|
93
|
+
* This source code is licensed under the ISC license.
|
|
94
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
+
*/const Yj=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],J0=ke("Bot",Yj);/**
|
|
96
|
+
* @license lucide-react v0.475.0 - ISC
|
|
97
|
+
*
|
|
98
|
+
* This source code is licensed under the ISC license.
|
|
99
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
+
*/const Kj=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],TE=ke("Boxes",Kj);/**
|
|
101
|
+
* @license lucide-react v0.475.0 - ISC
|
|
102
|
+
*
|
|
103
|
+
* This source code is licensed under the ISC license.
|
|
104
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
+
*/const Xj=[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]],Q0=ke("Cable",Xj);/**
|
|
106
|
+
* @license lucide-react v0.475.0 - ISC
|
|
107
|
+
*
|
|
108
|
+
* This source code is licensed under the ISC license.
|
|
109
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
+
*/const Zj=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Lf=ke("Check",Zj);/**
|
|
111
|
+
* @license lucide-react v0.475.0 - ISC
|
|
112
|
+
*
|
|
113
|
+
* This source code is licensed under the ISC license.
|
|
114
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
+
*/const Jj=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ey=ke("ChevronDown",Jj);/**
|
|
116
|
+
* @license lucide-react v0.475.0 - ISC
|
|
117
|
+
*
|
|
118
|
+
* This source code is licensed under the ISC license.
|
|
119
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
+
*/const Qj=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],DE=ke("ChevronLeft",Qj);/**
|
|
121
|
+
* @license lucide-react v0.475.0 - ISC
|
|
122
|
+
*
|
|
123
|
+
* This source code is licensed under the ISC license.
|
|
124
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
+
*/const e4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],yo=ke("ChevronRight",e4);/**
|
|
126
|
+
* @license lucide-react v0.475.0 - ISC
|
|
127
|
+
*
|
|
128
|
+
* This source code is licensed under the ISC license.
|
|
129
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
+
*/const t4=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],r4=ke("ChevronUp",t4);/**
|
|
131
|
+
* @license lucide-react v0.475.0 - ISC
|
|
132
|
+
*
|
|
133
|
+
* This source code is licensed under the ISC license.
|
|
134
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
+
*/const i4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],LE=ke("CircleCheck",i4);/**
|
|
136
|
+
* @license lucide-react v0.475.0 - ISC
|
|
137
|
+
*
|
|
138
|
+
* This source code is licensed under the ISC license.
|
|
139
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
+
*/const n4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],s4=ke("CircleHelp",n4);/**
|
|
141
|
+
* @license lucide-react v0.475.0 - ISC
|
|
142
|
+
*
|
|
143
|
+
* This source code is licensed under the ISC license.
|
|
144
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
+
*/const a4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],o4=ke("CircleSlash",a4);/**
|
|
146
|
+
* @license lucide-react v0.475.0 - ISC
|
|
147
|
+
*
|
|
148
|
+
* This source code is licensed under the ISC license.
|
|
149
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
+
*/const l4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],c4=ke("CircleX",l4);/**
|
|
151
|
+
* @license lucide-react v0.475.0 - ISC
|
|
152
|
+
*
|
|
153
|
+
* This source code is licensed under the ISC license.
|
|
154
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
+
*/const u4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],d4=ke("Circle",u4);/**
|
|
156
|
+
* @license lucide-react v0.475.0 - ISC
|
|
157
|
+
*
|
|
158
|
+
* This source code is licensed under the ISC license.
|
|
159
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
+
*/const h4=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],f4=ke("Copy",h4);/**
|
|
161
|
+
* @license lucide-react v0.475.0 - ISC
|
|
162
|
+
*
|
|
163
|
+
* This source code is licensed under the ISC license.
|
|
164
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
+
*/const m4=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],p4=ke("Download",m4);/**
|
|
166
|
+
* @license lucide-react v0.475.0 - ISC
|
|
167
|
+
*
|
|
168
|
+
* This source code is licensed under the ISC license.
|
|
169
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
+
*/const g4=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Cu=ke("Earth",g4);/**
|
|
171
|
+
* @license lucide-react v0.475.0 - ISC
|
|
172
|
+
*
|
|
173
|
+
* This source code is licensed under the ISC license.
|
|
174
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
+
*/const v4=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],_4=ke("Ellipsis",v4);/**
|
|
176
|
+
* @license lucide-react v0.475.0 - ISC
|
|
177
|
+
*
|
|
178
|
+
* This source code is licensed under the ISC license.
|
|
179
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
+
*/const y4=[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]],b4=ke("Eraser",y4);/**
|
|
181
|
+
* @license lucide-react v0.475.0 - ISC
|
|
182
|
+
*
|
|
183
|
+
* This source code is licensed under the ISC license.
|
|
184
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
+
*/const x4=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],w4=ke("FileText",x4);/**
|
|
186
|
+
* @license lucide-react v0.475.0 - ISC
|
|
187
|
+
*
|
|
188
|
+
* This source code is licensed under the ISC license.
|
|
189
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
+
*/const S4=[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]],C4=ke("Fingerprint",S4);/**
|
|
191
|
+
* @license lucide-react v0.475.0 - ISC
|
|
192
|
+
*
|
|
193
|
+
* This source code is licensed under the ISC license.
|
|
194
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
+
*/const E4=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],R4=ke("Folder",E4);/**
|
|
196
|
+
* @license lucide-react v0.475.0 - ISC
|
|
197
|
+
*
|
|
198
|
+
* This source code is licensed under the ISC license.
|
|
199
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
+
*/const k4=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],N4=ke("GitBranch",k4);/**
|
|
201
|
+
* @license lucide-react v0.475.0 - ISC
|
|
202
|
+
*
|
|
203
|
+
* This source code is licensed under the ISC license.
|
|
204
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
+
*/const A4=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],jE=ke("House",A4);/**
|
|
206
|
+
* @license lucide-react v0.475.0 - ISC
|
|
207
|
+
*
|
|
208
|
+
* This source code is licensed under the ISC license.
|
|
209
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
+
*/const M4=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],BE=ke("KeyRound",M4);/**
|
|
211
|
+
* @license lucide-react v0.475.0 - ISC
|
|
212
|
+
*
|
|
213
|
+
* This source code is licensed under the ISC license.
|
|
214
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
+
*/const T4=[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]],ty=ke("Laptop",T4);/**
|
|
216
|
+
* @license lucide-react v0.475.0 - ISC
|
|
217
|
+
*
|
|
218
|
+
* This source code is licensed under the ISC license.
|
|
219
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
+
*/const D4=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],L4=ke("LayoutDashboard",D4);/**
|
|
221
|
+
* @license lucide-react v0.475.0 - ISC
|
|
222
|
+
*
|
|
223
|
+
* This source code is licensed under the ISC license.
|
|
224
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
+
*/const j4=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],B4=ke("Link2",j4);/**
|
|
226
|
+
* @license lucide-react v0.475.0 - ISC
|
|
227
|
+
*
|
|
228
|
+
* This source code is licensed under the ISC license.
|
|
229
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
+
*/const O4=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],P4=ke("ListChecks",O4);/**
|
|
231
|
+
* @license lucide-react v0.475.0 - ISC
|
|
232
|
+
*
|
|
233
|
+
* This source code is licensed under the ISC license.
|
|
234
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
+
*/const z4=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ht=ke("LoaderCircle",z4);/**
|
|
236
|
+
* @license lucide-react v0.475.0 - ISC
|
|
237
|
+
*
|
|
238
|
+
* This source code is licensed under the ISC license.
|
|
239
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
+
*/const I4=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],$4=ke("MapPin",I4);/**
|
|
241
|
+
* @license lucide-react v0.475.0 - ISC
|
|
242
|
+
*
|
|
243
|
+
* This source code is licensed under the ISC license.
|
|
244
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
+
*/const U4=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],H4=ke("MessageSquare",U4);/**
|
|
246
|
+
* @license lucide-react v0.475.0 - ISC
|
|
247
|
+
*
|
|
248
|
+
* This source code is licensed under the ISC license.
|
|
249
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
+
*/const F4=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]],p_=ke("MonitorSmartphone",F4);/**
|
|
251
|
+
* @license lucide-react v0.475.0 - ISC
|
|
252
|
+
*
|
|
253
|
+
* This source code is licensed under the ISC license.
|
|
254
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
+
*/const W4=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],q4=ke("Monitor",W4);/**
|
|
256
|
+
* @license lucide-react v0.475.0 - ISC
|
|
257
|
+
*
|
|
258
|
+
* This source code is licensed under the ISC license.
|
|
259
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
+
*/const V4=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],G4=ke("Moon",V4);/**
|
|
261
|
+
* @license lucide-react v0.475.0 - ISC
|
|
262
|
+
*
|
|
263
|
+
* This source code is licensed under the ISC license.
|
|
264
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
+
*/const Y4=[["path",{d:"M2.034 2.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.944L8.204 7.545a1 1 0 0 0-.66.66l-1.066 3.443a.5.5 0 0 1-.944.033z",key:"11pp1i"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"m11.8 11.8 8.4 8.4",key:"oogvdj"}]],K4=ke("MousePointerBan",Y4);/**
|
|
266
|
+
* @license lucide-react v0.475.0 - ISC
|
|
267
|
+
*
|
|
268
|
+
* This source code is licensed under the ISC license.
|
|
269
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
+
*/const X4=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],Z4=ke("MousePointerClick",X4);/**
|
|
271
|
+
* @license lucide-react v0.475.0 - ISC
|
|
272
|
+
*
|
|
273
|
+
* This source code is licensed under the ISC license.
|
|
274
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
+
*/const J4=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Q4=ke("PanelLeftClose",J4);/**
|
|
276
|
+
* @license lucide-react v0.475.0 - ISC
|
|
277
|
+
*
|
|
278
|
+
* This source code is licensed under the ISC license.
|
|
279
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
+
*/const eB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],OE=ke("PanelLeftOpen",eB);/**
|
|
281
|
+
* @license lucide-react v0.475.0 - ISC
|
|
282
|
+
*
|
|
283
|
+
* This source code is licensed under the ISC license.
|
|
284
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
+
*/const tB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],rB=ke("PanelRightClose",tB);/**
|
|
286
|
+
* @license lucide-react v0.475.0 - ISC
|
|
287
|
+
*
|
|
288
|
+
* This source code is licensed under the ISC license.
|
|
289
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
+
*/const iB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],nB=ke("PanelRightOpen",iB);/**
|
|
291
|
+
* @license lucide-react v0.475.0 - ISC
|
|
292
|
+
*
|
|
293
|
+
* This source code is licensed under the ISC license.
|
|
294
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
+
*/const sB=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],aB=ke("Pause",sB);/**
|
|
296
|
+
* @license lucide-react v0.475.0 - ISC
|
|
297
|
+
*
|
|
298
|
+
* This source code is licensed under the ISC license.
|
|
299
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
+
*/const oB=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],lB=ke("Pencil",oB);/**
|
|
301
|
+
* @license lucide-react v0.475.0 - ISC
|
|
302
|
+
*
|
|
303
|
+
* This source code is licensed under the ISC license.
|
|
304
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
+
*/const cB=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],PE=ke("Play",cB);/**
|
|
306
|
+
* @license lucide-react v0.475.0 - ISC
|
|
307
|
+
*
|
|
308
|
+
* This source code is licensed under the ISC license.
|
|
309
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
310
|
+
*/const uB=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Gi=ke("Plus",uB);/**
|
|
311
|
+
* @license lucide-react v0.475.0 - ISC
|
|
312
|
+
*
|
|
313
|
+
* This source code is licensed under the ISC license.
|
|
314
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
+
*/const dB=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],g_=ke("Power",dB);/**
|
|
316
|
+
* @license lucide-react v0.475.0 - ISC
|
|
317
|
+
*
|
|
318
|
+
* This source code is licensed under the ISC license.
|
|
319
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
320
|
+
*/const hB=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],mr=ke("RefreshCw",hB);/**
|
|
321
|
+
* @license lucide-react v0.475.0 - ISC
|
|
322
|
+
*
|
|
323
|
+
* This source code is licensed under the ISC license.
|
|
324
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
325
|
+
*/const fB=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],zE=ke("RotateCw",fB);/**
|
|
326
|
+
* @license lucide-react v0.475.0 - ISC
|
|
327
|
+
*
|
|
328
|
+
* This source code is licensed under the ISC license.
|
|
329
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
330
|
+
*/const mB=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],IE=ke("ScrollText",mB);/**
|
|
331
|
+
* @license lucide-react v0.475.0 - ISC
|
|
332
|
+
*
|
|
333
|
+
* This source code is licensed under the ISC license.
|
|
334
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
335
|
+
*/const pB=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],gB=ke("Search",pB);/**
|
|
336
|
+
* @license lucide-react v0.475.0 - ISC
|
|
337
|
+
*
|
|
338
|
+
* This source code is licensed under the ISC license.
|
|
339
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
340
|
+
*/const vB=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],$E=ke("Send",vB);/**
|
|
341
|
+
* @license lucide-react v0.475.0 - ISC
|
|
342
|
+
*
|
|
343
|
+
* This source code is licensed under the ISC license.
|
|
344
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
345
|
+
*/const _B=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],jf=ke("Server",_B);/**
|
|
346
|
+
* @license lucide-react v0.475.0 - ISC
|
|
347
|
+
*
|
|
348
|
+
* This source code is licensed under the ISC license.
|
|
349
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
350
|
+
*/const yB=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],bB=ke("Settings",yB);/**
|
|
351
|
+
* @license lucide-react v0.475.0 - ISC
|
|
352
|
+
*
|
|
353
|
+
* This source code is licensed under the ISC license.
|
|
354
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
355
|
+
*/const xB=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],wB=ke("Share2",xB);/**
|
|
356
|
+
* @license lucide-react v0.475.0 - ISC
|
|
357
|
+
*
|
|
358
|
+
* This source code is licensed under the ISC license.
|
|
359
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
360
|
+
*/const SB=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],CB=ke("ShieldAlert",SB);/**
|
|
361
|
+
* @license lucide-react v0.475.0 - ISC
|
|
362
|
+
*
|
|
363
|
+
* This source code is licensed under the ISC license.
|
|
364
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
365
|
+
*/const EB=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ry=ke("ShieldCheck",EB);/**
|
|
366
|
+
* @license lucide-react v0.475.0 - ISC
|
|
367
|
+
*
|
|
368
|
+
* This source code is licensed under the ISC license.
|
|
369
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
370
|
+
*/const RB=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]],UE=ke("ShieldOff",RB);/**
|
|
371
|
+
* @license lucide-react v0.475.0 - ISC
|
|
372
|
+
*
|
|
373
|
+
* This source code is licensed under the ISC license.
|
|
374
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
375
|
+
*/const kB=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],zl=ke("Smartphone",kB);/**
|
|
376
|
+
* @license lucide-react v0.475.0 - ISC
|
|
377
|
+
*
|
|
378
|
+
* This source code is licensed under the ISC license.
|
|
379
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
380
|
+
*/const NB=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],HE=ke("Sparkles",NB);/**
|
|
381
|
+
* @license lucide-react v0.475.0 - ISC
|
|
382
|
+
*
|
|
383
|
+
* This source code is licensed under the ISC license.
|
|
384
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
385
|
+
*/const AB=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],iy=ke("SquareTerminal",AB);/**
|
|
386
|
+
* @license lucide-react v0.475.0 - ISC
|
|
387
|
+
*
|
|
388
|
+
* This source code is licensed under the ISC license.
|
|
389
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
390
|
+
*/const MB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],TB=ke("Square",MB);/**
|
|
391
|
+
* @license lucide-react v0.475.0 - ISC
|
|
392
|
+
*
|
|
393
|
+
* This source code is licensed under the ISC license.
|
|
394
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
395
|
+
*/const DB=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],LB=ke("Sun",DB);/**
|
|
396
|
+
* @license lucide-react v0.475.0 - ISC
|
|
397
|
+
*
|
|
398
|
+
* This source code is licensed under the ISC license.
|
|
399
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
400
|
+
*/const jB=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],BB=ke("Terminal",jB);/**
|
|
401
|
+
* @license lucide-react v0.475.0 - ISC
|
|
402
|
+
*
|
|
403
|
+
* This source code is licensed under the ISC license.
|
|
404
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
405
|
+
*/const OB=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],ql=ke("Trash2",OB);/**
|
|
406
|
+
* @license lucide-react v0.475.0 - ISC
|
|
407
|
+
*
|
|
408
|
+
* This source code is licensed under the ISC license.
|
|
409
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
410
|
+
*/const PB=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ny=ke("TriangleAlert",PB);/**
|
|
411
|
+
* @license lucide-react v0.475.0 - ISC
|
|
412
|
+
*
|
|
413
|
+
* This source code is licensed under the ISC license.
|
|
414
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
415
|
+
*/const zB=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],IB=ke("Unlink",zB);/**
|
|
416
|
+
* @license lucide-react v0.475.0 - ISC
|
|
417
|
+
*
|
|
418
|
+
* This source code is licensed under the ISC license.
|
|
419
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
420
|
+
*/const $B=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],UB=ke("Workflow",$B);/**
|
|
421
|
+
* @license lucide-react v0.475.0 - ISC
|
|
422
|
+
*
|
|
423
|
+
* This source code is licensed under the ISC license.
|
|
424
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
425
|
+
*/const HB=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Il=ke("X",HB);function pn(e,t=[]){let r=[];function i(o,c){const d=_.createContext(c);d.displayName=o+"Context";const m=r.length;r=[...r,c];const f=p=>{var C;const{scope:b,children:x,...w}=p,S=((C=b==null?void 0:b[e])==null?void 0:C[m])||d,E=_.useMemo(()=>w,Object.values(w));return u.jsx(S.Provider,{value:E,children:x})};f.displayName=o+"Provider";function g(p,b,x={}){var C;const{optional:w=!1}=x,S=((C=b==null?void 0:b[e])==null?void 0:C[m])||d,E=_.useContext(S);if(E)return E;if(c!==void 0)return c;if(!w)throw new Error(`\`${p}\` must be used within \`${o}\``)}return[f,g]}const s=()=>{const o=r.map(c=>_.createContext(c));return function(d){const m=(d==null?void 0:d[e])||o;return _.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return s.scopeName=e,[i,FB(s,...t)]}function FB(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const c=i.reduce((d,{useScope:m,scopeName:f})=>{const p=m(o)[`__scope${f}`];return{...d,...p}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return r.scopeName=t.scopeName,r}function SS(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function WB(...e){return t=>{let r=!1;const i=e.map(s=>{const o=SS(s,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let s=0;s<i.length;s++){const o=i[s];typeof o=="function"?o():SS(e[s],null)}}}}function Qe(...e){return _.useCallback(WB(...e),e)}function Be(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)}}var Wt=globalThis!=null&&globalThis.document?_.useLayoutEffect:()=>{},qB=kf[" useId ".trim().toString()]||(()=>{}),VB=0;function on(e){const[t,r]=_.useState(qB());return Wt(()=>{r(i=>i??String(VB++))},[e]),t?`radix-${t}`:""}var GB=kf[" useInsertionEffect ".trim().toString()]||Wt;function co({prop:e,defaultProp:t,onChange:r=()=>{},caller:i}){const[s,o,c]=YB({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:s;{const g=_.useRef(e!==void 0);_.useEffect(()=>{const p=g.current;p!==d&&console.warn(`${i} is changing from ${p?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=d},[d,i])}const f=_.useCallback(g=>{var p;if(d){const b=KB(g)?g(e):g;b!==e&&((p=c.current)==null||p.call(c,b))}else o(g)},[d,e,o,c]);return[m,f]}function YB({defaultProp:e,onChange:t}){const[r,i]=_.useState(e),s=_.useRef(r),o=_.useRef(t);return GB(()=>{o.current=t},[t]),_.useEffect(()=>{var c;s.current!==r&&((c=o.current)==null||c.call(o,r),s.current=r)},[r,s]),[r,i,o]}function KB(e){return typeof e=="function"}function uo(e){const t=_.forwardRef((r,i)=>{let{children:s,...o}=r,c=null,d=!1;const m=[];CS(s)&&typeof ph=="function"&&(s=ph(s._payload)),_.Children.forEach(s,b=>{var x;if(tO(b)){d=!0;const w=b;let S="child"in w.props?w.props.child:w.props.children;CS(S)&&typeof ph=="function"&&(S=ph(S._payload)),c=JB(w,S),m.push((x=c==null?void 0:c.props)==null?void 0:x.children)}else m.push(b)}),c?c=_.cloneElement(c,void 0,m):!d&&_.Children.count(s)===1&&_.isValidElement(s)&&(c=s);const f=c?eO(c):void 0,g=Qe(i,f);if(!c){if(s||s===0)throw new Error(d?sO(e):nO(e));return s}const p=QB(o,c.props??{});return c.type!==_.Fragment&&(p.ref=i?g:f),_.cloneElement(c,p)});return t.displayName=`${e}.Slot`,t}var XB=uo("Slot"),ZB=Symbol.for("radix.slottable"),JB=(e,t)=>{if("child"in e.props){const r=e.props.child;return _.isValidElement(r)?_.cloneElement(r,void 0,e.props.children(r.props.children)):null}return _.isValidElement(t)?t:null};function QB(e,t){const r={...t};for(const i in t){const s=e[i],o=t[i];/^on[A-Z]/.test(i)?s&&o?r[i]=(...d)=>{const m=o(...d);return s(...d),m}:s&&(r[i]=s):i==="style"?r[i]={...s,...o}:i==="className"&&(r[i]=[s,o].filter(Boolean).join(" "))}return{...e,...r}}function eO(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function tO(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ZB}var rO=Symbol.for("react.lazy");function CS(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===rO&&"_payload"in e&&iO(e._payload)}function iO(e){return typeof e=="object"&&e!==null&&"then"in e}var nO=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,sO=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ph=kf[" use ".trim().toString()],aO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ue=aO.reduce((e,t)=>{const r=uo(`Primitive.${t}`),i=_.forwardRef((s,o)=>{const{asChild:c,...d}=s,m=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...d,ref:o})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function FE(e,t){e&&_o.flushSync(()=>e.dispatchEvent(t))}function hr(e){const t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>((...r)=>{var i;return(i=t.current)==null?void 0:i.call(t,...r)}),[])}var oO="DismissableLayer",v_="dismissableLayer.update",lO="dismissableLayer.pointerDownOutside",cO="dismissableLayer.focusOutside",ES,sy=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Bf=_.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:c,onInteractOutside:d,onDismiss:m,...f}=e,g=_.useContext(sy),[p,b]=_.useState(null),x=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=_.useState({}),S=Qe(t,b),E=Array.from(g.layers),[C]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),A=C?E.indexOf(C):-1,N=p?E.indexOf(p):-1,k=g.layersWithOutsidePointerEventsDisabled.size>0,O=N>=A,z=_.useRef(!1),H=mO(W=>{o==null||o(W),d==null||d(W),W.defaultPrevented||m==null||m()},{ownerDocument:x,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:z,dismissableSurfaces:g.dismissableSurfaces,shouldHandlePointerDownOutside:_.useCallback(W=>{if(!(W instanceof Node))return!1;const L=[...g.branches].some(T=>T.contains(W));return O&&!L},[g.branches,O])}),D=pO(W=>{if(i&&z.current)return;const L=W.target;[...g.branches].some(j=>j.contains(L))||(c==null||c(W),d==null||d(W),W.defaultPrevented||m==null||m())},x),G=p?N===E.length-1:!1,Y=hr(W=>{W.key==="Escape"&&(s==null||s(W),!W.defaultPrevented&&m&&(W.preventDefault(),m()))});return _.useEffect(()=>{if(G)return x.addEventListener("keydown",Y,{capture:!0}),()=>x.removeEventListener("keydown",Y,{capture:!0})},[x,G,Y]),_.useEffect(()=>{if(p)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(ES=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(p)),g.layers.add(p),RS(),()=>{r&&(g.layersWithOutsidePointerEventsDisabled.delete(p),g.layersWithOutsidePointerEventsDisabled.size===0&&(x.body.style.pointerEvents=ES))}},[p,x,r,g]),_.useEffect(()=>()=>{p&&(g.layers.delete(p),g.layersWithOutsidePointerEventsDisabled.delete(p),RS())},[p,g]),_.useEffect(()=>{const W=()=>w({});return document.addEventListener(v_,W),()=>document.removeEventListener(v_,W)},[]),u.jsx(Ue.div,{...f,ref:S,style:{pointerEvents:k?O?"auto":"none":void 0,...e.style},onFocusCapture:Be(e.onFocusCapture,D.onFocusCapture),onBlurCapture:Be(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:Be(e.onPointerDownCapture,H.onPointerDownCapture)})});Bf.displayName=oO;var uO="DismissableLayerBranch",dO=_.forwardRef((e,t)=>{const r=_.useContext(sy),i=_.useRef(null),s=Qe(t,i);return _.useEffect(()=>{const o=i.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),u.jsx(Ue.div,{...e,ref:s})});dO.displayName=uO;function hO(){const e=_.useContext(sy),[t,r]=_.useState(null);return _.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}var fO=()=>!0;function mO(e,t){const{ownerDocument:r=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:o,shouldHandlePointerDownOutside:c=fO}=t,d=hr(e),m=_.useRef(!1),f=_.useRef(!1),g=_.useRef(new Map),p=_.useRef(()=>{});return _.useEffect(()=>{function b(){f.current=!1,s.current=!1,g.current.clear()}function x(){return Array.from(g.current.values()).some(Boolean)}function w(N){if(!f.current)return;const k=N.target;k instanceof Node&&[...o].some(z=>z.contains(k))||g.current.set(N.type,!0),N.type==="click"&&window.setTimeout(()=>{f.current&&p.current()},0)}function S(N){f.current&&g.current.set(N.type,!1)}const E=N=>{if(N.target&&!m.current){let k=function(){r.removeEventListener("click",p.current);const z=x();b(),z||WE(lO,d,O,{discrete:!0})};if(!c(N.target)){r.removeEventListener("click",p.current),b(),m.current=!1;return}const O={originalEvent:N};f.current=!0,s.current=i&&N.button===0,g.current.clear(),!i||N.button!==0?k():(r.removeEventListener("click",p.current),p.current=k,r.addEventListener("click",p.current,{once:!0}))}else r.removeEventListener("click",p.current),b();m.current=!1},C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const N of C)r.addEventListener(N,w,!0),r.addEventListener(N,S);const A=window.setTimeout(()=>{r.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(A),r.removeEventListener("pointerdown",E),r.removeEventListener("click",p.current);for(const N of C)r.removeEventListener(N,w,!0),r.removeEventListener(N,S)}},[r,d,i,s,o,c]),{onPointerDownCapture:()=>m.current=!0}}function pO(e,t=globalThis==null?void 0:globalThis.document){const r=hr(e),i=_.useRef(!1);return _.useEffect(()=>{const s=o=>{o.target&&!i.current&&WE(cO,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function RS(){const e=new CustomEvent(v_);document.dispatchEvent(e)}function WE(e,t,r,{discrete:i}){const s=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),i?FE(s,o):s.dispatchEvent(o)}var Ig="focusScope.autoFocusOnMount",$g="focusScope.autoFocusOnUnmount",kS={bubbles:!1,cancelable:!0},gO="FocusScope",Of=_.forwardRef((e,t)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...c}=e,[d,m]=_.useState(null),f=hr(s),g=hr(o),p=_.useRef(null),b=Qe(t,m),x=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(i){let S=function(N){if(x.paused||!d)return;const k=N.target;d.contains(k)?p.current=k:ua(p.current,{select:!0})},E=function(N){if(x.paused||!d)return;const k=N.relatedTarget;k!==null&&(d.contains(k)||ua(p.current,{select:!0}))},C=function(N){if(document.activeElement===document.body)for(const O of N)O.removedNodes.length>0&&ua(d)};document.addEventListener("focusin",S),document.addEventListener("focusout",E);const A=new MutationObserver(C);return d&&A.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",E),A.disconnect()}}},[i,d,x.paused]),_.useEffect(()=>{if(d){AS.add(x);const S=document.activeElement;if(!d.contains(S)){const C=new CustomEvent(Ig,kS);d.addEventListener(Ig,f),d.dispatchEvent(C),C.defaultPrevented||(vO(wO(qE(d)),{select:!0}),document.activeElement===S&&ua(d))}return()=>{d.removeEventListener(Ig,f),setTimeout(()=>{const C=new CustomEvent($g,kS);d.addEventListener($g,g),d.dispatchEvent(C),C.defaultPrevented||ua(S??document.body,{select:!0}),d.removeEventListener($g,g),AS.remove(x)},0)}}},[d,f,g,x]);const w=_.useCallback(S=>{if(!r&&!i||x.paused)return;const E=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,C=document.activeElement;if(E&&C){const A=S.currentTarget,[N,k]=_O(A);N&&k?!S.shiftKey&&C===k?(S.preventDefault(),r&&ua(N,{select:!0})):S.shiftKey&&C===N&&(S.preventDefault(),r&&ua(k,{select:!0})):C===A&&S.preventDefault()}},[r,i,x.paused]);return u.jsx(Ue.div,{tabIndex:-1,...c,ref:b,onKeyDown:w})});Of.displayName=gO;function vO(e,{select:t=!1}={}){const r=document.activeElement;for(const i of e)if(ua(i,{select:t}),document.activeElement!==r)return}function _O(e){const t=qE(e),r=NS(t,e),i=NS(t.reverse(),e);return[r,i]}function qE(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const s=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||s?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function NS(e,t){const r=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(r?!i.checkVisibility({checkVisibilityCSS:!0}):yO(i,{upTo:t})))return i}function yO(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function bO(e){return e instanceof HTMLInputElement&&"select"in e}function ua(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&bO(e)&&t&&e.select()}}var AS=xO();function xO(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=MS(e,t),e.unshift(t)},remove(t){var r;e=MS(e,t),(r=e[0])==null||r.resume()}}}function MS(e,t){const r=[...e],i=r.indexOf(t);return i!==-1&&r.splice(i,1),r}function wO(e){return e.filter(t=>t.tagName!=="A")}var SO="Portal",Pf=_.forwardRef((e,t)=>{var d;const{container:r,...i}=e,[s,o]=_.useState(!1);Wt(()=>o(!0),[]);const c=r||s&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return c?_o.createPortal(u.jsx(Ue.div,{...i,ref:t}),c):null});Pf.displayName=SO;function CO(e,t){return _.useReducer((r,i)=>t[r][i]??r,e)}var gn=e=>{const{present:t,children:r}=e,i=EO(t),s=typeof r=="function"?r({present:i.isPresent}):_.Children.only(r),o=RO(i.ref,kO(s));return typeof r=="function"||i.isPresent?_.cloneElement(s,{ref:o}):null};gn.displayName="Presence";function EO(e){const[t,r]=_.useState(),i=_.useRef(null),s=_.useRef(e),o=_.useRef("none"),c=_.useRef(void 0),d=e?"mounted":"unmounted",[m,f]=CO(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{m==="mounted"?(o.current=c.current??qc(i.current),c.current=void 0):o.current="none"},[m]),Wt(()=>{const g=i.current,p=s.current;if(p!==e){const x=o.current,w=qc(g);e?(c.current=w,f("MOUNT")):w==="none"||(g==null?void 0:g.display)==="none"?f("UNMOUNT"):f(p&&x!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,f]),Wt(()=>{if(t){let g;const p=t.ownerDocument.defaultView??window,b=w=>{const E=qc(i.current).includes(CSS.escape(w.animationName));if(w.target===t&&E&&(f("ANIMATION_END"),!s.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",g=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},x=w=>{w.target===t&&(o.current=qc(i.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",b),t.addEventListener("animationend",b),()=>{p.clearTimeout(g),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",b),t.removeEventListener("animationend",b)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:_.useCallback(g=>{if(g){const p=getComputedStyle(g);i.current=p,c.current=qc(p)}else i.current=null;r(g)},[])}}function TS(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function RO(...e){const t=_.useRef(e);return t.current=e,_.useCallback(r=>{const i=t.current;let s=!1;const o=i.map(c=>{const d=TS(c,r);return!s&&typeof d=="function"&&(s=!0),d});if(s)return()=>{for(let c=0;c<o.length;c++){const d=o[c];typeof d=="function"?d():TS(i[c],null)}}},[])}function qc(e){return(e==null?void 0:e.animationName)||"none"}function kO(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var gh=0,En=null;function ay(){_.useEffect(()=>{En||(En={start:DS(),end:DS()});const{start:e,end:t}=En;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),gh++,()=>{gh===1&&(En==null||En.start.remove(),En==null||En.end.remove(),En=null),gh=Math.max(0,gh-1)}},[])}function DS(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var jn=function(){return jn=Object.assign||function(t){for(var r,i=1,s=arguments.length;i<s;i++){r=arguments[i];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},jn.apply(this,arguments)};function VE(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(r[i[s]]=e[i[s]]);return r}function NO(e,t,r){if(r||arguments.length===2)for(var i=0,s=t.length,o;i<s;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))}var Uh="right-scroll-bar-position",Hh="width-before-scroll-bar",AO="with-scroll-bars-hidden",MO="--removed-body-scroll-bar-size";function Ug(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function TO(e,t){var r=_.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(i){var s=r.value;s!==i&&(r.value=i,r.callback(i,s))}}}})[0];return r.callback=t,r.facade}var DO=typeof window<"u"?_.useLayoutEffect:_.useEffect,LS=new WeakMap;function LO(e,t){var r=TO(null,function(i){return e.forEach(function(s){return Ug(s,i)})});return DO(function(){var i=LS.get(r);if(i){var s=new Set(i),o=new Set(e),c=r.current;s.forEach(function(d){o.has(d)||Ug(d,null)}),o.forEach(function(d){s.has(d)||Ug(d,c)})}LS.set(r,e)},[e]),r}function jO(e){return e}function BO(e,t){t===void 0&&(t=jO);var r=[],i=!1,s={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(o){var c=t(o,i);return r.push(c),function(){r=r.filter(function(d){return d!==c})}},assignSyncMedium:function(o){for(i=!0;r.length;){var c=r;r=[],c.forEach(o)}r={push:function(d){return o(d)},filter:function(){return r}}},assignMedium:function(o){i=!0;var c=[];if(r.length){var d=r;r=[],d.forEach(o),c=r}var m=function(){var g=c;c=[],g.forEach(o)},f=function(){return Promise.resolve().then(m)};f(),r={push:function(g){c.push(g),f()},filter:function(g){return c=c.filter(g),r}}}};return s}function OO(e){e===void 0&&(e={});var t=BO(null);return t.options=jn({async:!0,ssr:!1},e),t}var GE=function(e){var t=e.sideCar,r=VE(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=t.read();if(!i)throw new Error("Sidecar medium not found");return _.createElement(i,jn({},r))};GE.isSideCarExport=!0;function PO(e,t){return e.useMedium(t),GE}var YE=OO(),Hg=function(){},zf=_.forwardRef(function(e,t){var r=_.useRef(null),i=_.useState({onScrollCapture:Hg,onWheelCapture:Hg,onTouchMoveCapture:Hg}),s=i[0],o=i[1],c=e.forwardProps,d=e.children,m=e.className,f=e.removeScrollBar,g=e.enabled,p=e.shards,b=e.sideCar,x=e.noRelative,w=e.noIsolation,S=e.inert,E=e.allowPinchZoom,C=e.as,A=C===void 0?"div":C,N=e.gapMode,k=VE(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=b,z=LO([r,t]),H=jn(jn({},k),s);return _.createElement(_.Fragment,null,g&&_.createElement(O,{sideCar:YE,removeScrollBar:f,shards:p,noRelative:x,noIsolation:w,inert:S,setCallbacks:o,allowPinchZoom:!!E,lockRef:r,gapMode:N}),c?_.cloneElement(_.Children.only(d),jn(jn({},H),{ref:z})):_.createElement(A,jn({},H,{className:m,ref:z}),d))});zf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};zf.classNames={fullWidth:Hh,zeroRight:Uh};var zO=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function IO(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=zO();return t&&e.setAttribute("nonce",t),e}function $O(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function UO(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var HO=function(){var e=0,t=null;return{add:function(r){e==0&&(t=IO())&&($O(t,r),UO(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},FO=function(){var e=HO();return function(t,r){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},KE=function(){var e=FO(),t=function(r){var i=r.styles,s=r.dynamic;return e(i,s),null};return t},WO={left:0,top:0,right:0,gap:0},Fg=function(e){return parseInt(e||"",10)||0},qO=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],i=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Fg(r),Fg(i),Fg(s)]},VO=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return WO;var t=qO(e),r=document.documentElement.clientWidth,i=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,i-r+t[2]-t[0])}},GO=KE(),Ll="data-scroll-locked",YO=function(e,t,r,i){var s=e.left,o=e.top,c=e.right,d=e.gap;return r===void 0&&(r="margin"),`
|
|
426
|
+
.`.concat(AO,` {
|
|
427
|
+
overflow: hidden `).concat(i,`;
|
|
428
|
+
padding-right: `).concat(d,"px ").concat(i,`;
|
|
429
|
+
}
|
|
430
|
+
body[`).concat(Ll,`] {
|
|
431
|
+
overflow: hidden `).concat(i,`;
|
|
432
|
+
overscroll-behavior: contain;
|
|
433
|
+
`).concat([t&&"position: relative ".concat(i,";"),r==="margin"&&`
|
|
434
|
+
padding-left: `.concat(s,`px;
|
|
435
|
+
padding-top: `).concat(o,`px;
|
|
436
|
+
padding-right: `).concat(c,`px;
|
|
437
|
+
margin-left:0;
|
|
438
|
+
margin-top:0;
|
|
439
|
+
margin-right: `).concat(d,"px ").concat(i,`;
|
|
440
|
+
`),r==="padding"&&"padding-right: ".concat(d,"px ").concat(i,";")].filter(Boolean).join(""),`
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.`).concat(Uh,` {
|
|
444
|
+
right: `).concat(d,"px ").concat(i,`;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.`).concat(Hh,` {
|
|
448
|
+
margin-right: `).concat(d,"px ").concat(i,`;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.`).concat(Uh," .").concat(Uh,` {
|
|
452
|
+
right: 0 `).concat(i,`;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.`).concat(Hh," .").concat(Hh,` {
|
|
456
|
+
margin-right: 0 `).concat(i,`;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
body[`).concat(Ll,`] {
|
|
460
|
+
`).concat(MO,": ").concat(d,`px;
|
|
461
|
+
}
|
|
462
|
+
`)},jS=function(){var e=parseInt(document.body.getAttribute(Ll)||"0",10);return isFinite(e)?e:0},KO=function(){_.useEffect(function(){return document.body.setAttribute(Ll,(jS()+1).toString()),function(){var e=jS()-1;e<=0?document.body.removeAttribute(Ll):document.body.setAttribute(Ll,e.toString())}},[])},XO=function(e){var t=e.noRelative,r=e.noImportant,i=e.gapMode,s=i===void 0?"margin":i;KO();var o=_.useMemo(function(){return VO(s)},[s]);return _.createElement(GO,{styles:YO(o,!t,s,r?"":"!important")})},__=!1;if(typeof window<"u")try{var vh=Object.defineProperty({},"passive",{get:function(){return __=!0,!0}});window.addEventListener("test",vh,vh),window.removeEventListener("test",vh,vh)}catch{__=!1}var gl=__?{passive:!1}:!1,ZO=function(e){return e.tagName==="TEXTAREA"},XE=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!ZO(e)&&r[t]==="visible")},JO=function(e){return XE(e,"overflowY")},QO=function(e){return XE(e,"overflowX")},BS=function(e,t){var r=t.ownerDocument,i=t;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var s=ZE(e,i);if(s){var o=JE(e,i),c=o[1],d=o[2];if(c>d)return!0}i=i.parentNode}while(i&&i!==r.body);return!1},e6=function(e){var t=e.scrollTop,r=e.scrollHeight,i=e.clientHeight;return[t,r,i]},t6=function(e){var t=e.scrollLeft,r=e.scrollWidth,i=e.clientWidth;return[t,r,i]},ZE=function(e,t){return e==="v"?JO(t):QO(t)},JE=function(e,t){return e==="v"?e6(t):t6(t)},r6=function(e,t){return e==="h"&&t==="rtl"?-1:1},i6=function(e,t,r,i,s){var o=r6(e,window.getComputedStyle(t).direction),c=o*i,d=r.target,m=t.contains(d),f=!1,g=c>0,p=0,b=0;do{if(!d)break;var x=JE(e,d),w=x[0],S=x[1],E=x[2],C=S-E-o*w;(w||C)&&ZE(e,d)&&(p+=C,b+=w);var A=d.parentNode;d=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!m&&d!==document.body||m&&(t.contains(d)||t===d));return(g&&Math.abs(p)<1||!g&&Math.abs(b)<1)&&(f=!0),f},_h=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},OS=function(e){return[e.deltaX,e.deltaY]},PS=function(e){return e&&"current"in e?e.current:e},n6=function(e,t){return e[0]===t[0]&&e[1]===t[1]},s6=function(e){return`
|
|
463
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
464
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
465
|
+
`)},a6=0,vl=[];function o6(e){var t=_.useRef([]),r=_.useRef([0,0]),i=_.useRef(),s=_.useState(a6++)[0],o=_.useState(KE)[0],c=_.useRef(e);_.useEffect(function(){c.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var S=NO([e.lockRef.current],(e.shards||[]).map(PS),!0).filter(Boolean);return S.forEach(function(E){return E.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),S.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var d=_.useCallback(function(S,E){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!c.current.allowPinchZoom;var C=_h(S),A=r.current,N="deltaX"in S?S.deltaX:A[0]-C[0],k="deltaY"in S?S.deltaY:A[1]-C[1],O,z=S.target,H=Math.abs(N)>Math.abs(k)?"h":"v";if("touches"in S&&H==="h"&&z.type==="range")return!1;var D=window.getSelection(),G=D&&D.anchorNode,Y=G?G===z||G.contains(z):!1;if(Y)return!1;var W=BS(H,z);if(!W)return!0;if(W?O=H:(O=H==="v"?"h":"v",W=BS(H,z)),!W)return!1;if(!i.current&&"changedTouches"in S&&(N||k)&&(i.current=O),!O)return!0;var L=i.current||O;return i6(L,E,S,L==="h"?N:k)},[]),m=_.useCallback(function(S){var E=S;if(!(!vl.length||vl[vl.length-1]!==o)){var C="deltaY"in E?OS(E):_h(E),A=t.current.filter(function(O){return O.name===E.type&&(O.target===E.target||E.target===O.shadowParent)&&n6(O.delta,C)})[0];if(A&&A.should){E.cancelable&&E.preventDefault();return}if(!A){var N=(c.current.shards||[]).map(PS).filter(Boolean).filter(function(O){return O.contains(E.target)}),k=N.length>0?d(E,N[0]):!c.current.noIsolation;k&&E.cancelable&&E.preventDefault()}}},[]),f=_.useCallback(function(S,E,C,A){var N={name:S,delta:E,target:C,should:A,shadowParent:l6(C)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(k){return k!==N})},1)},[]),g=_.useCallback(function(S){r.current=_h(S),i.current=void 0},[]),p=_.useCallback(function(S){f(S.type,OS(S),S.target,d(S,e.lockRef.current))},[]),b=_.useCallback(function(S){f(S.type,_h(S),S.target,d(S,e.lockRef.current))},[]);_.useEffect(function(){return vl.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:b}),document.addEventListener("wheel",m,gl),document.addEventListener("touchmove",m,gl),document.addEventListener("touchstart",g,gl),function(){vl=vl.filter(function(S){return S!==o}),document.removeEventListener("wheel",m,gl),document.removeEventListener("touchmove",m,gl),document.removeEventListener("touchstart",g,gl)}},[]);var x=e.removeScrollBar,w=e.inert;return _.createElement(_.Fragment,null,w?_.createElement(o,{styles:s6(s)}):null,x?_.createElement(XO,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function l6(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const c6=PO(YE,o6);var If=_.forwardRef(function(e,t){return _.createElement(zf,jn({},e,{ref:t,sideCar:c6}))});If.classNames=zf.classNames;var u6=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},_l=new WeakMap,yh=new WeakMap,bh={},Wg=0,QE=function(e){return e&&(e.host||QE(e.parentNode))},d6=function(e,t){return t.map(function(r){if(e.contains(r))return r;var i=QE(r);return i&&e.contains(i)?i:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},h6=function(e,t,r,i){var s=d6(t,Array.isArray(e)?e:[e]);bh[r]||(bh[r]=new WeakMap);var o=bh[r],c=[],d=new Set,m=new Set(s),f=function(p){!p||d.has(p)||(d.add(p),f(p.parentNode))};s.forEach(f);var g=function(p){!p||m.has(p)||Array.prototype.forEach.call(p.children,function(b){if(d.has(b))g(b);else try{var x=b.getAttribute(i),w=x!==null&&x!=="false",S=(_l.get(b)||0)+1,E=(o.get(b)||0)+1;_l.set(b,S),o.set(b,E),c.push(b),S===1&&w&&yh.set(b,!0),E===1&&b.setAttribute(r,"true"),w||b.setAttribute(i,"true")}catch(C){console.error("aria-hidden: cannot operate on ",b,C)}})};return g(t),d.clear(),Wg++,function(){c.forEach(function(p){var b=_l.get(p)-1,x=o.get(p)-1;_l.set(p,b),o.set(p,x),b||(yh.has(p)||p.removeAttribute(i),yh.delete(p)),x||p.removeAttribute(r)}),Wg--,Wg||(_l=new WeakMap,_l=new WeakMap,yh=new WeakMap,bh={})}},oy=function(e,t,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),s=u6(e);return s?(i.push.apply(i,Array.from(s.querySelectorAll("[aria-live], script"))),h6(i,s,r,"aria-hidden")):function(){return null}},$f="Dialog",[eR,tR]=pn($f),[f6,vn]=eR($f),ly=e=>{const{__scopeDialog:t,children:r,open:i,defaultOpen:s,onOpenChange:o,modal:c=!0}=e,d=_.useRef(null),m=_.useRef(null),[f,g]=co({prop:i,defaultProp:s??!1,onChange:o,caller:$f});return u.jsx(f6,{scope:t,triggerRef:d,contentRef:m,contentId:on(),titleId:on(),descriptionId:on(),open:f,onOpenChange:g,onOpenToggle:_.useCallback(()=>g(p=>!p),[g]),modal:c,children:r})};ly.displayName=$f;var rR="DialogTrigger",Uf=_.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=vn(rR,r),o=Qe(t,s.triggerRef);return u.jsx(Ue.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":dy(s.open),...i,ref:o,onClick:Be(e.onClick,s.onOpenToggle)})});Uf.displayName=rR;var cy="DialogPortal",[m6,iR]=eR(cy,{forceMount:void 0}),uy=e=>{const{__scopeDialog:t,forceMount:r,children:i,container:s}=e,o=vn(cy,t);return u.jsx(m6,{scope:t,forceMount:r,children:_.Children.map(i,c=>u.jsx(gn,{present:r||o.open,children:u.jsx(Pf,{asChild:!0,container:s,children:c})}))})};uy.displayName=cy;var af="DialogOverlay",Hf=_.forwardRef((e,t)=>{const r=iR(af,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,o=vn(af,e.__scopeDialog);return o.modal?u.jsx(gn,{present:i||o.open,children:u.jsx(g6,{...s,ref:t})}):null});Hf.displayName=af;var p6=uo("DialogOverlay.RemoveScroll"),g6=_.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=vn(af,r),o=hO(),c=Qe(t,o);return u.jsx(If,{as:p6,allowPinchZoom:!0,shards:[s.contentRef],children:u.jsx(Ue.div,{"data-state":dy(s.open),...i,ref:c,style:{pointerEvents:"auto",...i.style}})})}),$l="DialogContent",Ff=_.forwardRef((e,t)=>{const r=iR($l,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,o=vn($l,e.__scopeDialog);return u.jsx(gn,{present:i||o.open,children:o.modal?u.jsx(v6,{...s,ref:t}):u.jsx(_6,{...s,ref:t})})});Ff.displayName=$l;var v6=_.forwardRef((e,t)=>{const r=vn($l,e.__scopeDialog),i=_.useRef(null),s=Qe(t,r.contentRef,i);return _.useEffect(()=>{const o=i.current;if(o)return oy(o)},[]),u.jsx(nR,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Be(e.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=r.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0;(c.button===2||d)&&o.preventDefault()}),onFocusOutside:Be(e.onFocusOutside,o=>o.preventDefault())})}),_6=_.forwardRef((e,t)=>{const r=vn($l,e.__scopeDialog),i=_.useRef(!1),s=_.useRef(!1);return u.jsx(nR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,d;(c=e.onCloseAutoFocus)==null||c.call(e,o),o.defaultPrevented||(i.current||(d=r.triggerRef.current)==null||d.focus(),o.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:o=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(i.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=o.target;((f=r.triggerRef.current)==null?void 0:f.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),nR=_.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,...c}=e,d=vn($l,r);return ay(),u.jsx(u.Fragment,{children:u.jsx(Of,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:o,children:u.jsx(Bf,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":dy(d.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})}),sR="DialogTitle",Wf=_.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=vn(sR,r);return u.jsx(Ue.h2,{id:s.titleId,...i,ref:t})});Wf.displayName=sR;var aR="DialogDescription",qf=_.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=vn(aR,r);return u.jsx(Ue.p,{id:s.descriptionId,...i,ref:t})});qf.displayName=aR;var oR="DialogClose",bo=_.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=vn(oR,r);return u.jsx(Ue.button,{type:"button",...i,ref:t,onClick:Be(e.onClick,()=>s.onOpenChange(!1))})});bo.displayName=oR;function dy(e){return e?"open":"closed"}var lR="AlertDialog",[y6]=pn(lR,[tR]),ws=tR(),cR=e=>{const{__scopeAlertDialog:t,...r}=e,i=ws(t);return u.jsx(ly,{...i,...r,modal:!0})};cR.displayName=lR;var b6="AlertDialogTrigger",uR=_.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=ws(r);return u.jsx(Uf,{...s,...i,ref:t})});uR.displayName=b6;var x6="AlertDialogPortal",dR=e=>{const{__scopeAlertDialog:t,...r}=e,i=ws(t);return u.jsx(uy,{...i,...r})};dR.displayName=x6;var w6="AlertDialogOverlay",hR=_.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=ws(r);return u.jsx(Hf,{...s,...i,ref:t})});hR.displayName=w6;var fR="AlertDialogContent",[S6,C6]=y6(fR),mR=_.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:i,...s}=e,o=ws(r),c=_.useRef(null),d=Qe(t,c),m=_.useRef(null);return u.jsx(S6,{scope:r,cancelRef:m,children:u.jsx(Ff,{role:"alertdialog",...o,...s,ref:d,onOpenAutoFocus:Be(s.onOpenAutoFocus,f=>{var g;f.preventDefault(),(g=m.current)==null||g.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:i})})});mR.displayName=fR;var E6="AlertDialogTitle",pR=_.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=ws(r);return u.jsx(Wf,{...s,...i,ref:t})});pR.displayName=E6;var R6="AlertDialogDescription",gR=_.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=ws(r);return u.jsx(qf,{...s,...i,ref:t})});gR.displayName=R6;var k6="AlertDialogAction",vR=_.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=ws(r);return u.jsx(bo,{...s,...i,ref:t})});vR.displayName=k6;var _R="AlertDialogCancel",yR=_.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,{cancelRef:s}=C6(_R,r),o=ws(r),c=Qe(t,s);return u.jsx(bo,{...o,...i,ref:c})});yR.displayName=_R;var N6=cR,bR=uR,A6=dR,xR=hR,wR=mR,SR=vR,CR=yR,ER=pR,RR=gR;function kR(e){var t,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=kR(e[t]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function hy(){for(var e,t,r=0,i="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=kR(e))&&(i&&(i+=" "),i+=t);return i}const M6=(e,t)=>{const r=new Array(e.length+t.length);for(let i=0;i<e.length;i++)r[i]=e[i];for(let i=0;i<t.length;i++)r[e.length+i]=t[i];return r},T6=(e,t)=>({classGroupId:e,validator:t}),NR=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),of="-",zS=[],D6="arbitrary..",L6=e=>{const t=B6(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return j6(c);const d=c.split(of),m=d[0]===""&&d.length>1?1:0;return AR(d,m,t)},getConflictingClassGroupIds:(c,d)=>{if(d){const m=i[c],f=r[c];return m?f?M6(f,m):m:f||zS}return r[c]||zS}}},AR=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],o=r.nextPart.get(s);if(o){const f=AR(e,t+1,o);if(f)return f}const c=r.validators;if(c===null)return;const d=t===0?e.join(of):e.slice(t).join(of),m=c.length;for(let f=0;f<m;f++){const g=c[f];if(g.validator(d))return g.classGroupId}},j6=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),i=t.slice(0,r);return i?D6+i:void 0})(),B6=e=>{const{theme:t,classGroups:r}=e;return O6(r,t)},O6=(e,t)=>{const r=NR();for(const i in e){const s=e[i];fy(s,r,i,t)}return r},fy=(e,t,r,i)=>{const s=e.length;for(let o=0;o<s;o++){const c=e[o];P6(c,t,r,i)}},P6=(e,t,r,i)=>{if(typeof e=="string"){z6(e,t,r);return}if(typeof e=="function"){I6(e,t,r,i);return}$6(e,t,r,i)},z6=(e,t,r)=>{const i=e===""?t:MR(t,e);i.classGroupId=r},I6=(e,t,r,i)=>{if(U6(e)){fy(e(i),t,r,i);return}t.validators===null&&(t.validators=[]),t.validators.push(T6(r,e))},$6=(e,t,r,i)=>{const s=Object.entries(e),o=s.length;for(let c=0;c<o;c++){const[d,m]=s[c];fy(m,MR(t,d),r,i)}},MR=(e,t)=>{let r=e;const i=t.split(of),s=i.length;for(let o=0;o<s;o++){const c=i[o];let d=r.nextPart.get(c);d||(d=NR(),r.nextPart.set(c,d)),r=d}return r},U6=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,H6=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),i=Object.create(null);const s=(o,c)=>{r[o]=c,t++,t>e&&(t=0,i=r,r=Object.create(null))};return{get(o){let c=r[o];if(c!==void 0)return c;if((c=i[o])!==void 0)return s(o,c),c},set(o,c){o in r?r[o]=c:s(o,c)}}},y_="!",IS=":",F6=[],$S=(e,t,r,i,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:i,isExternal:s}),W6=e=>{const{prefix:t,experimentalParseClassName:r}=e;let i=s=>{const o=[];let c=0,d=0,m=0,f;const g=s.length;for(let S=0;S<g;S++){const E=s[S];if(c===0&&d===0){if(E===IS){o.push(s.slice(m,S)),m=S+1;continue}if(E==="/"){f=S;continue}}E==="["?c++:E==="]"?c--:E==="("?d++:E===")"&&d--}const p=o.length===0?s:s.slice(m);let b=p,x=!1;p.endsWith(y_)?(b=p.slice(0,-1),x=!0):p.startsWith(y_)&&(b=p.slice(1),x=!0);const w=f&&f>m?f-m:void 0;return $S(o,x,b,w)};if(t){const s=t+IS,o=i;i=c=>c.startsWith(s)?o(c.slice(s.length)):$S(F6,!1,c,void 0,!0)}if(r){const s=i;i=o=>r({className:o,parseClassName:s})}return i},q6=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,i)=>{t.set(r,1e6+i)}),r=>{const i=[];let s=[];for(let o=0;o<r.length;o++){const c=r[o],d=c[0]==="[",m=t.has(c);d||m?(s.length>0&&(s.sort(),i.push(...s),s=[]),i.push(c)):s.push(c)}return s.length>0&&(s.sort(),i.push(...s)),i}},V6=e=>({cache:H6(e.cacheSize),parseClassName:W6(e),sortModifiers:q6(e),postfixLookupClassGroupIds:G6(e),...L6(e)}),G6=e=>{const t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let i=0;i<r.length;i++)t[r[i]]=!0;return t},Y6=/\s+/,K6=(e,t)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:s,sortModifiers:o,postfixLookupClassGroupIds:c}=t,d=[],m=e.trim().split(Y6);let f="";for(let g=m.length-1;g>=0;g-=1){const p=m[g],{isExternal:b,modifiers:x,hasImportantModifier:w,baseClassName:S,maybePostfixModifierPosition:E}=r(p);if(b){f=p+(f.length>0?" "+f:f);continue}let C=!!E,A;if(C){const H=S.substring(0,E);A=i(H);const D=A&&c[A]?i(S):void 0;D&&D!==A&&(A=D,C=!1)}else A=i(S);if(!A){if(!C){f=p+(f.length>0?" "+f:f);continue}if(A=i(S),!A){f=p+(f.length>0?" "+f:f);continue}C=!1}const N=x.length===0?"":x.length===1?x[0]:o(x).join(":"),k=w?N+y_:N,O=k+A;if(d.indexOf(O)>-1)continue;d.push(O);const z=s(A,C);for(let H=0;H<z.length;++H){const D=z[H];d.push(k+D)}f=p+(f.length>0?" "+f:f)}return f},X6=(...e)=>{let t=0,r,i,s="";for(;t<e.length;)(r=e[t++])&&(i=TR(r))&&(s&&(s+=" "),s+=i);return s},TR=e=>{if(typeof e=="string")return e;let t,r="";for(let i=0;i<e.length;i++)e[i]&&(t=TR(e[i]))&&(r&&(r+=" "),r+=t);return r},Z6=(e,...t)=>{let r,i,s,o;const c=m=>{const f=t.reduce((g,p)=>p(g),e());return r=V6(f),i=r.cache.get,s=r.cache.set,o=d,d(m)},d=m=>{const f=i(m);if(f)return f;const g=K6(m,r);return s(m,g),g};return o=c,(...m)=>o(X6(...m))},J6=[],cr=e=>{const t=r=>r[e]||J6;return t.isThemeGetter=!0,t},DR=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,LR=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Q6=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,e8=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,t8=/\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$/,r8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,i8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,n8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,na=e=>Q6.test(e),Xe=e=>!!e&&!Number.isNaN(Number(e)),Rn=e=>!!e&&Number.isInteger(Number(e)),qg=e=>e.endsWith("%")&&Xe(e.slice(0,-1)),cs=e=>e8.test(e),jR=()=>!0,s8=e=>t8.test(e)&&!r8.test(e),my=()=>!1,a8=e=>i8.test(e),o8=e=>n8.test(e),l8=e=>!Ae(e)&&!Me(e),c8=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),u8=e=>Sa(e,PR,my),Ae=e=>DR.test(e),Xa=e=>Sa(e,zR,s8),US=e=>Sa(e,_8,Xe),d8=e=>Sa(e,$R,jR),h8=e=>Sa(e,IR,my),HS=e=>Sa(e,BR,my),f8=e=>Sa(e,OR,o8),xh=e=>Sa(e,UR,a8),Me=e=>LR.test(e),Vc=e=>xo(e,zR),m8=e=>xo(e,IR),FS=e=>xo(e,BR),p8=e=>xo(e,PR),g8=e=>xo(e,OR),wh=e=>xo(e,UR,!0),v8=e=>xo(e,$R,!0),Sa=(e,t,r)=>{const i=DR.exec(e);return i?i[1]?t(i[1]):r(i[2]):!1},xo=(e,t,r=!1)=>{const i=LR.exec(e);return i?i[1]?t(i[1]):r:!1},BR=e=>e==="position"||e==="percentage",OR=e=>e==="image"||e==="url",PR=e=>e==="length"||e==="size"||e==="bg-size",zR=e=>e==="length",_8=e=>e==="number",IR=e=>e==="family-name",$R=e=>e==="number"||e==="weight",UR=e=>e==="shadow",y8=()=>{const e=cr("color"),t=cr("font"),r=cr("text"),i=cr("font-weight"),s=cr("tracking"),o=cr("leading"),c=cr("breakpoint"),d=cr("container"),m=cr("spacing"),f=cr("radius"),g=cr("shadow"),p=cr("inset-shadow"),b=cr("text-shadow"),x=cr("drop-shadow"),w=cr("blur"),S=cr("perspective"),E=cr("aspect"),C=cr("ease"),A=cr("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...k(),Me,Ae],z=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto","contain","none"],D=()=>[Me,Ae,m],G=()=>[na,"full","auto",...D()],Y=()=>[Rn,"none","subgrid",Me,Ae],W=()=>["auto",{span:["full",Rn,Me,Ae]},Rn,Me,Ae],L=()=>[Rn,"auto",Me,Ae],T=()=>["auto","min","max","fr",Me,Ae],j=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...D()],P=()=>[na,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],I=()=>[na,"screen","full","dvw","lvw","svw","min","max","fit",...D()],F=()=>[na,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],q=()=>[e,Me,Ae],$=()=>[...k(),FS,HS,{position:[Me,Ae]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",p8,u8,{size:[Me,Ae]}],J=()=>[qg,Vc,Xa],le=()=>["","none","full",f,Me,Ae],ae=()=>["",Xe,Vc,Xa],ee=()=>["solid","dashed","dotted","double"],se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>[Xe,qg,FS,HS],Se=()=>["","none",w,Me,Ae],Re=()=>["none",Xe,Me,Ae],Ne=()=>["none",Xe,Me,Ae],Q=()=>[Xe,Me,Ae],re=()=>[na,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[cs],breakpoint:[cs],color:[jR],container:[cs],"drop-shadow":[cs],ease:["in","out","in-out"],font:[l8],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[cs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[cs],shadow:[cs],spacing:["px",Xe],text:[cs],"text-shadow":[cs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",na,Ae,Me,E]}],container:["container"],"container-type":[{"@container":["","normal","size",Me,Ae]}],"container-named":[c8],columns:[{columns:[Xe,Ae,Me,d]}],"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:O()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:H()}],"overscroll-x":[{"overscroll-x":H()}],"overscroll-y":[{"overscroll-y":H()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:G()}],"inset-x":[{"inset-x":G()}],"inset-y":[{"inset-y":G()}],start:[{"inset-s":G(),start:G()}],end:[{"inset-e":G(),end:G()}],"inset-bs":[{"inset-bs":G()}],"inset-be":[{"inset-be":G()}],top:[{top:G()}],right:[{right:G()}],bottom:[{bottom:G()}],left:[{left:G()}],visibility:["visible","invisible","collapse"],z:[{z:[Rn,"auto",Me,Ae]}],basis:[{basis:[na,"full","auto",d,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Xe,na,"auto","initial","none",Ae]}],grow:[{grow:["",Xe,Me,Ae]}],shrink:[{shrink:["",Xe,Me,Ae]}],order:[{order:[Rn,"first","last","none",Me,Ae]}],"grid-cols":[{"grid-cols":Y()}],"col-start-end":[{col:W()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":Y()}],"row-start-end":[{row:W()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":T()}],"auto-rows":[{"auto-rows":T()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...j(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...j()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":j()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pbs:[{pbs:D()}],pbe:[{pbe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:P()}],"inline-size":[{inline:["auto",...I()]}],"min-inline-size":[{"min-inline":["auto",...I()]}],"max-inline-size":[{"max-inline":["none",...I()]}],"block-size":[{block:["auto",...F()]}],"min-block-size":[{"min-block":["auto",...F()]}],"max-block-size":[{"max-block":["none",...F()]}],w:[{w:[d,"screen",...P()]}],"min-w":[{"min-w":[d,"screen","none",...P()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[c]},...P()]}],h:[{h:["screen","lh",...P()]}],"min-h":[{"min-h":["screen","lh","none",...P()]}],"max-h":[{"max-h":["screen","lh",...P()]}],"font-size":[{text:["base",r,Vc,Xa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,v8,d8]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",qg,Ae]}],"font-family":[{font:[m8,h8,t]}],"font-features":[{"font-features":[Ae]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Me,Ae]}],"line-clamp":[{"line-clamp":[Xe,"none",Me,US]}],leading:[{leading:[o,...D()]}],"list-image":[{"list-image":["none",Me,Ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Me,Ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[Xe,"from-font","auto",Me,Xa]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[Xe,"auto",Me,Ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"tab-size":[{tab:[Rn,Me,Ae]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Me,Ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Me,Ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:$()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Rn,Me,Ae],radial:["",Me,Ae],conic:[Rn,Me,Ae]},g8,f8]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:J()}],"gradient-via-pos":[{via:J()}],"gradient-to-pos":[{to:J()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:le()}],"rounded-s":[{"rounded-s":le()}],"rounded-e":[{"rounded-e":le()}],"rounded-t":[{"rounded-t":le()}],"rounded-r":[{"rounded-r":le()}],"rounded-b":[{"rounded-b":le()}],"rounded-l":[{"rounded-l":le()}],"rounded-ss":[{"rounded-ss":le()}],"rounded-se":[{"rounded-se":le()}],"rounded-ee":[{"rounded-ee":le()}],"rounded-es":[{"rounded-es":le()}],"rounded-tl":[{"rounded-tl":le()}],"rounded-tr":[{"rounded-tr":le()}],"rounded-br":[{"rounded-br":le()}],"rounded-bl":[{"rounded-bl":le()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-bs":[{"border-bs":q()}],"border-color-be":[{"border-be":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Xe,Me,Ae]}],"outline-w":[{outline:["",Xe,Vc,Xa]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",g,wh,xh]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",p,wh,xh]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[Xe,Xa]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",b,wh,xh]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[Xe,Me,Ae]}],"mix-blend":[{"mix-blend":[...se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Xe]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[Me,Ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[Xe]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:$()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Me,Ae]}],filter:[{filter:["","none",Me,Ae]}],blur:[{blur:Se()}],brightness:[{brightness:[Xe,Me,Ae]}],contrast:[{contrast:[Xe,Me,Ae]}],"drop-shadow":[{"drop-shadow":["","none",x,wh,xh]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",Xe,Me,Ae]}],"hue-rotate":[{"hue-rotate":[Xe,Me,Ae]}],invert:[{invert:["",Xe,Me,Ae]}],saturate:[{saturate:[Xe,Me,Ae]}],sepia:[{sepia:["",Xe,Me,Ae]}],"backdrop-filter":[{"backdrop-filter":["","none",Me,Ae]}],"backdrop-blur":[{"backdrop-blur":Se()}],"backdrop-brightness":[{"backdrop-brightness":[Xe,Me,Ae]}],"backdrop-contrast":[{"backdrop-contrast":[Xe,Me,Ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Xe,Me,Ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Xe,Me,Ae]}],"backdrop-invert":[{"backdrop-invert":["",Xe,Me,Ae]}],"backdrop-opacity":[{"backdrop-opacity":[Xe,Me,Ae]}],"backdrop-saturate":[{"backdrop-saturate":[Xe,Me,Ae]}],"backdrop-sepia":[{"backdrop-sepia":["",Xe,Me,Ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Me,Ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Xe,"initial",Me,Ae]}],ease:[{ease:["linear","initial",C,Me,Ae]}],delay:[{delay:[Xe,Me,Ae]}],animate:[{animate:["none",A,Me,Ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Me,Ae]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:Re()}],"rotate-x":[{"rotate-x":Re()}],"rotate-y":[{"rotate-y":Re()}],"rotate-z":[{"rotate-z":Re()}],scale:[{scale:Ne()}],"scale-x":[{"scale-x":Ne()}],"scale-y":[{"scale-y":Ne()}],"scale-z":[{"scale-z":Ne()}],"scale-3d":["scale-3d"],skew:[{skew:Q()}],"skew-x":[{"skew-x":Q()}],"skew-y":[{"skew-y":Q()}],transform:[{transform:[Me,Ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:re()}],"translate-x":[{"translate-x":re()}],"translate-y":[{"translate-y":re()}],"translate-z":[{"translate-z":re()}],"translate-none":["translate-none"],zoom:[{zoom:[Rn,Me,Ae]}],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Me,Ae]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":q()}],"scrollbar-track-color":[{"scrollbar-track":q()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mbs":[{"scroll-mbs":D()}],"scroll-mbe":[{"scroll-mbe":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pbs":[{"scroll-pbs":D()}],"scroll-pbe":[{"scroll-pbe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Me,Ae]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[Xe,Vc,Xa,US]}],stroke:[{stroke:["none",...q()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},HR=Z6(y8);function at(...e){return HR(hy(e))}const WS=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,qS=hy,FR=(e,t)=>r=>{var i;if((t==null?void 0:t.variants)==null)return qS(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:o}=t,c=Object.keys(s).map(f=>{const g=r==null?void 0:r[f],p=o==null?void 0:o[f];if(g===null)return null;const b=WS(g)||WS(p);return s[f][b]}),d=r&&Object.entries(r).reduce((f,g)=>{let[p,b]=g;return b===void 0||(f[p]=b),f},{}),m=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((f,g)=>{let{class:p,className:b,...x}=g;return Object.entries(x).every(w=>{let[S,E]=w;return Array.isArray(E)?E.includes({...o,...d}[S]):{...o,...d}[S]===E})?[...f,p,b]:f},[]);return qS(e,c,m,r==null?void 0:r.class,r==null?void 0:r.className)},b8=FR("group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-lg border border-transparent bg-clip-padding text-sm font-medium transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)]","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}}),ge=_.forwardRef(({className:e,variant:t,size:r,asChild:i=!1,...s},o)=>{const c=i?XB:"button";return u.jsx(c,{ref:o,"data-slot":"button","data-variant":t??"default","data-size":r??"default",className:at(b8({variant:t,size:r,className:e})),...s})});ge.displayName="Button";function Ca(e){return u.jsx(N6,{"data-slot":"alert-dialog",...e})}const Ea=_.forwardRef((e,t)=>u.jsx(bR,{ref:t,"data-slot":"alert-dialog-trigger",...e}));Ea.displayName=bR.displayName;function x8(e){return u.jsx(A6,{"data-slot":"alert-dialog-portal",...e})}const WR=_.forwardRef(({className:e,...t},r)=>u.jsx(xR,{ref:r,"data-slot":"alert-dialog-overlay",className:at("fixed inset-0 z-50 bg-black/10 duration-100 supports-[backdrop-filter]:backdrop-blur-xs data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t}));WR.displayName=xR.displayName;const Ss=_.forwardRef(({className:e,size:t="default",...r},i)=>u.jsxs(x8,{children:[u.jsx(WR,{}),u.jsx(wR,{ref:i,"data-slot":"alert-dialog-content","data-size":t,className:at("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] min-w-0 -translate-x-1/2 -translate-y-1/2 grid-cols-1 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 [&>*]:min-w-0",e),...r})]}));Ss.displayName=wR.displayName;function Ra({className:e,...t}){return u.jsx("div",{"data-slot":"alert-dialog-header",className:at("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function ka({className:e,...t}){return u.jsx("div",{"data-slot":"alert-dialog-footer",className:at("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}const Cs=_.forwardRef(({className:e,...t},r)=>u.jsx(ER,{ref:r,"data-slot":"alert-dialog-title",className:at("text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t}));Cs.displayName=ER.displayName;const Es=_.forwardRef(({className:e,...t},r)=>u.jsx(RR,{ref:r,"data-slot":"alert-dialog-description",className:at("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t}));Es.displayName=RR.displayName;const Rs=_.forwardRef(({className:e,variant:t="default",size:r="default",...i},s)=>u.jsx(ge,{variant:t,size:r,asChild:!0,children:u.jsx(SR,{ref:s,"data-slot":"alert-dialog-action",className:at(e),...i})}));Rs.displayName=SR.displayName;const ks=_.forwardRef(({className:e,variant:t="outline",size:r="default",...i},s)=>u.jsx(ge,{variant:t,size:r,asChild:!0,children:u.jsx(CR,{ref:s,"data-slot":"alert-dialog-cancel",className:at(e),...i})}));ks.displayName=CR.displayName;function wo(e){return u.jsx(ly,{"data-slot":"dialog",...e})}const qR=_.forwardRef((e,t)=>u.jsx(Uf,{ref:t,"data-slot":"dialog-trigger",...e}));qR.displayName=Uf.displayName;function w8(e){return u.jsx(uy,{"data-slot":"dialog-portal",...e})}const Iu=_.forwardRef((e,t)=>u.jsx(bo,{ref:t,"data-slot":"dialog-close",...e}));Iu.displayName=bo.displayName;const VR=_.forwardRef(({className:e,...t},r)=>u.jsx(Hf,{ref:r,"data-slot":"dialog-overlay",className:at("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-[backdrop-filter]:backdrop-blur-xs data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t}));VR.displayName=Hf.displayName;const Na=_.forwardRef(({className:e,children:t,showCloseButton:r=!0,...i},s)=>u.jsxs(w8,{children:[u.jsx(VR,{}),u.jsxs(Ff,{ref:s,"data-slot":"dialog-content",className:at("fixed top-1/2 left-1/2 z-50 grid w-full min-w-0 max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 grid-cols-1 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 [&>*]:min-w-0",e),...i,children:[t,r&&u.jsx(bo,{"data-slot":"dialog-close",asChild:!0,children:u.jsxs(ge,{variant:"ghost",size:"icon-sm",className:"absolute top-2 right-2",children:[u.jsx(Il,{"aria-hidden":"true"}),u.jsx("span",{className:"sr-only",children:"Close"})]})})]})]}));Na.displayName=Ff.displayName;function So({className:e,...t}){return u.jsx("div",{"data-slot":"dialog-header",className:at("flex flex-col gap-2",e),...t})}function $u({className:e,showCloseButton:t=!1,children:r,...i}){return u.jsxs("div",{"data-slot":"dialog-footer",className:at("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...i,children:[r,t&&u.jsx(bo,{asChild:!0,children:u.jsx(ge,{variant:"outline",children:"Close"})})]})}const Aa=_.forwardRef(({className:e,...t},r)=>u.jsx(Wf,{ref:r,"data-slot":"dialog-title",className:at("text-base leading-none font-medium",e),...t}));Aa.displayName=Wf.displayName;const Vf=_.forwardRef(({className:e,...t},r)=>u.jsx(qf,{ref:r,"data-slot":"dialog-description",className:at("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t}));Vf.displayName=qf.displayName;function py(e){const t=e+"CollectionProvider",[r,i]=pn(t),[s,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),c=S=>{const{scope:E,children:C}=S,A=_.useRef(null),N=_.useRef(new Map).current;return u.jsx(s,{scope:E,itemMap:N,collectionRef:A,children:C})};c.displayName=t;const d=e+"CollectionSlot",m=uo(d),f=_.forwardRef((S,E)=>{const{scope:C,children:A}=S,N=o(d,C),k=Qe(E,N.collectionRef);return u.jsx(m,{ref:k,children:A})});f.displayName=d;const g=e+"CollectionItemSlot",p="data-radix-collection-item",b=uo(g),x=_.forwardRef((S,E)=>{const{scope:C,children:A,...N}=S,k=_.useRef(null),O=Qe(E,k),z=o(g,C);return _.useEffect(()=>(z.itemMap.set(k,{ref:k,...N}),()=>void z.itemMap.delete(k))),u.jsx(b,{[p]:"",ref:O,children:A})});x.displayName=g;function w(S){const E=o(e+"CollectionConsumer",S);return _.useCallback(()=>{const A=E.collectionRef.current;if(!A)return[];const N=Array.from(A.querySelectorAll(`[${p}]`));return Array.from(E.itemMap.values()).sort((z,H)=>N.indexOf(z.ref.current)-N.indexOf(H.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:c,Slot:f,ItemSlot:x},w,i]}var S8=_.createContext(void 0);function Uu(e){const t=_.useContext(S8);return e||t||"ltr"}const C8=["top","right","bottom","left"],ya=Math.min,Si=Math.max,lf=Math.round,Sh=Math.floor,Pn=e=>({x:e,y:e}),E8={left:"right",right:"left",bottom:"top",top:"bottom"};function b_(e,t,r){return Si(e,ya(t,r))}function ys(e,t){return typeof e=="function"?e(t):e}function bs(e){return e.split("-")[0]}function Vl(e){return e.split("-")[1]}function gy(e){return e==="x"?"y":"x"}function vy(e){return e==="y"?"height":"width"}function Bn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function _y(e){return gy(Bn(e))}function R8(e,t,r){r===void 0&&(r=!1);const i=Vl(e),s=_y(e),o=vy(s);let c=s==="x"?i===(r?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(c=cf(c)),[c,cf(c)]}function k8(e){const t=cf(e);return[x_(e),t,x_(t)]}function x_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const VS=["left","right"],GS=["right","left"],N8=["top","bottom"],A8=["bottom","top"];function M8(e,t,r){switch(e){case"top":case"bottom":return r?t?GS:VS:t?VS:GS;case"left":case"right":return t?N8:A8;default:return[]}}function T8(e,t,r,i){const s=Vl(e);let o=M8(bs(e),r==="start",i);return s&&(o=o.map(c=>c+"-"+s),t&&(o=o.concat(o.map(x_)))),o}function cf(e){const t=bs(e);return E8[t]+e.slice(t.length)}function D8(e){return{top:0,right:0,bottom:0,left:0,...e}}function GR(e){return typeof e!="number"?D8(e):{top:e,right:e,bottom:e,left:e}}function uf(e){const{x:t,y:r,width:i,height:s}=e;return{width:i,height:s,top:r,left:t,right:t+i,bottom:r+s,x:t,y:r}}function YS(e,t,r){let{reference:i,floating:s}=e;const o=Bn(t),c=_y(t),d=vy(c),m=bs(t),f=o==="y",g=i.x+i.width/2-s.width/2,p=i.y+i.height/2-s.height/2,b=i[d]/2-s[d]/2;let x;switch(m){case"top":x={x:g,y:i.y-s.height};break;case"bottom":x={x:g,y:i.y+i.height};break;case"right":x={x:i.x+i.width,y:p};break;case"left":x={x:i.x-s.width,y:p};break;default:x={x:i.x,y:i.y}}switch(Vl(t)){case"start":x[c]-=b*(r&&f?-1:1);break;case"end":x[c]+=b*(r&&f?-1:1);break}return x}async function L8(e,t){var r;t===void 0&&(t={});const{x:i,y:s,platform:o,rects:c,elements:d,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:g="viewport",elementContext:p="floating",altBoundary:b=!1,padding:x=0}=ys(t,e),w=GR(x),E=d[b?p==="floating"?"reference":"floating":p],C=uf(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(E)))==null||r?E:E.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(d.floating)),boundary:f,rootBoundary:g,strategy:m})),A=p==="floating"?{x:i,y:s,width:c.floating.width,height:c.floating.height}:c.reference,N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d.floating)),k=await(o.isElement==null?void 0:o.isElement(N))?await(o.getScale==null?void 0:o.getScale(N))||{x:1,y:1}:{x:1,y:1},O=uf(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:A,offsetParent:N,strategy:m}):A);return{top:(C.top-O.top+w.top)/k.y,bottom:(O.bottom-C.bottom+w.bottom)/k.y,left:(C.left-O.left+w.left)/k.x,right:(O.right-C.right+w.right)/k.x}}const j8=50,B8=async(e,t,r)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:c}=r,d=c.detectOverflow?c:{...c,detectOverflow:L8},m=await(c.isRTL==null?void 0:c.isRTL(t));let f=await c.getElementRects({reference:e,floating:t,strategy:s}),{x:g,y:p}=YS(f,i,m),b=i,x=0;const w={};for(let S=0;S<o.length;S++){const E=o[S];if(!E)continue;const{name:C,fn:A}=E,{x:N,y:k,data:O,reset:z}=await A({x:g,y:p,initialPlacement:i,placement:b,strategy:s,middlewareData:w,rects:f,platform:d,elements:{reference:e,floating:t}});g=N??g,p=k??p,w[C]={...w[C],...O},z&&x<j8&&(x++,typeof z=="object"&&(z.placement&&(b=z.placement),z.rects&&(f=z.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:s}):z.rects),{x:g,y:p}=YS(f,b,m)),S=-1)}return{x:g,y:p,placement:b,strategy:s,middlewareData:w}},O8=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:i,placement:s,rects:o,platform:c,elements:d,middlewareData:m}=t,{element:f,padding:g=0}=ys(e,t)||{};if(f==null)return{};const p=GR(g),b={x:r,y:i},x=_y(s),w=vy(x),S=await c.getDimensions(f),E=x==="y",C=E?"top":"left",A=E?"bottom":"right",N=E?"clientHeight":"clientWidth",k=o.reference[w]+o.reference[x]-b[x]-o.floating[w],O=b[x]-o.reference[x],z=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f));let H=z?z[N]:0;(!H||!await(c.isElement==null?void 0:c.isElement(z)))&&(H=d.floating[N]||o.floating[w]);const D=k/2-O/2,G=H/2-S[w]/2-1,Y=ya(p[C],G),W=ya(p[A],G),L=Y,T=H-S[w]-W,j=H/2-S[w]/2+D,U=b_(L,j,T),M=!m.arrow&&Vl(s)!=null&&j!==U&&o.reference[w]/2-(j<L?Y:W)-S[w]/2<0,P=M?j<L?j-L:j-T:0;return{[x]:b[x]+P,data:{[x]:U,centerOffset:j-U-P,...M&&{alignmentOffset:P}},reset:M}}}),P8=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,i;const{placement:s,middlewareData:o,rects:c,initialPlacement:d,platform:m,elements:f}=t,{mainAxis:g=!0,crossAxis:p=!0,fallbackPlacements:b,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...E}=ys(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const C=bs(s),A=Bn(d),N=bs(d)===d,k=await(m.isRTL==null?void 0:m.isRTL(f.floating)),O=b||(N||!S?[cf(d)]:k8(d)),z=w!=="none";!b&&z&&O.push(...T8(d,S,w,k));const H=[d,...O],D=await m.detectOverflow(t,E),G=[];let Y=((i=o.flip)==null?void 0:i.overflows)||[];if(g&&G.push(D[C]),p){const j=R8(s,c,k);G.push(D[j[0]],D[j[1]])}if(Y=[...Y,{placement:s,overflows:G}],!G.every(j=>j<=0)){var W,L;const j=(((W=o.flip)==null?void 0:W.index)||0)+1,U=H[j];if(U&&(!(p==="alignment"?A!==Bn(U):!1)||Y.every(I=>Bn(I.placement)===A?I.overflows[0]>0:!0)))return{data:{index:j,overflows:Y},reset:{placement:U}};let M=(L=Y.filter(P=>P.overflows[0]<=0).sort((P,I)=>P.overflows[1]-I.overflows[1])[0])==null?void 0:L.placement;if(!M)switch(x){case"bestFit":{var T;const P=(T=Y.filter(I=>{if(z){const F=Bn(I.placement);return F===A||F==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(F=>F>0).reduce((F,q)=>F+q,0)]).sort((I,F)=>I[1]-F[1])[0])==null?void 0:T[0];P&&(M=P);break}case"initialPlacement":M=d;break}if(s!==M)return{reset:{placement:M}}}return{}}}};function KS(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function XS(e){return C8.some(t=>e[t]>=0)}const z8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:i}=t,{strategy:s="referenceHidden",...o}=ys(e,t);switch(s){case"referenceHidden":{const c=await i.detectOverflow(t,{...o,elementContext:"reference"}),d=KS(c,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:XS(d)}}}case"escaped":{const c=await i.detectOverflow(t,{...o,altBoundary:!0}),d=KS(c,r.floating);return{data:{escapedOffsets:d,escaped:XS(d)}}}default:return{}}}}},YR=new Set(["left","top"]);async function I8(e,t){const{placement:r,platform:i,elements:s}=e,o=await(i.isRTL==null?void 0:i.isRTL(s.floating)),c=bs(r),d=Vl(r),m=Bn(r)==="y",f=YR.has(c)?-1:1,g=o&&m?-1:1,p=ys(t,e);let{mainAxis:b,crossAxis:x,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return d&&typeof w=="number"&&(x=d==="end"?w*-1:w),m?{x:x*g,y:b*f}:{x:b*f,y:x*g}}const $8=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,i;const{x:s,y:o,placement:c,middlewareData:d}=t,m=await I8(t,e);return c===((r=d.offset)==null?void 0:r.placement)&&(i=d.arrow)!=null&&i.alignmentOffset?{}:{x:s+m.x,y:o+m.y,data:{...m,placement:c}}}}},U8=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:i,placement:s,platform:o}=t,{mainAxis:c=!0,crossAxis:d=!1,limiter:m={fn:C=>{let{x:A,y:N}=C;return{x:A,y:N}}},...f}=ys(e,t),g={x:r,y:i},p=await o.detectOverflow(t,f),b=Bn(bs(s)),x=gy(b);let w=g[x],S=g[b];if(c){const C=x==="y"?"top":"left",A=x==="y"?"bottom":"right",N=w+p[C],k=w-p[A];w=b_(N,w,k)}if(d){const C=b==="y"?"top":"left",A=b==="y"?"bottom":"right",N=S+p[C],k=S-p[A];S=b_(N,S,k)}const E=m.fn({...t,[x]:w,[b]:S});return{...E,data:{x:E.x-r,y:E.y-i,enabled:{[x]:c,[b]:d}}}}}},H8=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:i,placement:s,rects:o,middlewareData:c}=t,{offset:d=0,mainAxis:m=!0,crossAxis:f=!0}=ys(e,t),g={x:r,y:i},p=Bn(s),b=gy(p);let x=g[b],w=g[p];const S=ys(d,t),E=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(m){const N=b==="y"?"height":"width",k=o.reference[b]-o.floating[N]+E.mainAxis,O=o.reference[b]+o.reference[N]-E.mainAxis;x<k?x=k:x>O&&(x=O)}if(f){var C,A;const N=b==="y"?"width":"height",k=YR.has(bs(s)),O=o.reference[p]-o.floating[N]+(k&&((C=c.offset)==null?void 0:C[p])||0)+(k?0:E.crossAxis),z=o.reference[p]+o.reference[N]+(k?0:((A=c.offset)==null?void 0:A[p])||0)-(k?E.crossAxis:0);w<O?w=O:w>z&&(w=z)}return{[b]:x,[p]:w}}}},F8=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,i;const{placement:s,rects:o,platform:c,elements:d}=t,{apply:m=()=>{},...f}=ys(e,t),g=await c.detectOverflow(t,f),p=bs(s),b=Vl(s),x=Bn(s)==="y",{width:w,height:S}=o.floating;let E,C;p==="top"||p==="bottom"?(E=p,C=b===(await(c.isRTL==null?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(C=p,E=b==="end"?"top":"bottom");const A=S-g.top-g.bottom,N=w-g.left-g.right,k=ya(S-g[E],A),O=ya(w-g[C],N),z=!t.middlewareData.shift;let H=k,D=O;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(D=N),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(H=A),z&&!b){const Y=Si(g.left,0),W=Si(g.right,0),L=Si(g.top,0),T=Si(g.bottom,0);x?D=w-2*(Y!==0||W!==0?Y+W:Si(g.left,g.right)):H=S-2*(L!==0||T!==0?L+T:Si(g.top,g.bottom))}await m({...t,availableWidth:D,availableHeight:H});const G=await c.getDimensions(d.floating);return w!==G.width||S!==G.height?{reset:{rects:!0}}:{}}}};function Gf(){return typeof window<"u"}function Gl(e){return KR(e)?(e.nodeName||"").toLowerCase():"#document"}function Ci(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Fn(e){var t;return(t=(KR(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function KR(e){return Gf()?e instanceof Node||e instanceof Ci(e).Node:!1}function ln(e){return Gf()?e instanceof Element||e instanceof Ci(e).Element:!1}function Ns(e){return Gf()?e instanceof HTMLElement||e instanceof Ci(e).HTMLElement:!1}function ZS(e){return!Gf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ci(e).ShadowRoot}function Hu(e){const{overflow:t,overflowX:r,overflowY:i,display:s}=cn(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+r)&&s!=="inline"&&s!=="contents"}function W8(e){return/^(table|td|th)$/.test(Gl(e))}function Yf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const q8=/transform|translate|scale|rotate|perspective|filter/,V8=/paint|layout|strict|content/,Za=e=>!!e&&e!=="none";let Vg;function yy(e){const t=ln(e)?cn(e):e;return Za(t.transform)||Za(t.translate)||Za(t.scale)||Za(t.rotate)||Za(t.perspective)||!by()&&(Za(t.backdropFilter)||Za(t.filter))||q8.test(t.willChange||"")||V8.test(t.contain||"")}function G8(e){let t=ba(e);for(;Ns(t)&&!Ul(t);){if(yy(t))return t;if(Yf(t))return null;t=ba(t)}return null}function by(){return Vg==null&&(Vg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Vg}function Ul(e){return/^(html|body|#document)$/.test(Gl(e))}function cn(e){return Ci(e).getComputedStyle(e)}function Kf(e){return ln(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ba(e){if(Gl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ZS(e)&&e.host||Fn(e);return ZS(t)?t.host:t}function XR(e){const t=ba(e);return Ul(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ns(t)&&Hu(t)?t:XR(t)}function Eu(e,t,r){var i;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=XR(e),o=s===((i=e.ownerDocument)==null?void 0:i.body),c=Ci(s);if(o){const d=w_(c);return t.concat(c,c.visualViewport||[],Hu(s)?s:[],d&&r?Eu(d):[])}else return t.concat(s,Eu(s,[],r))}function w_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ZR(e){const t=cn(e);let r=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const s=Ns(e),o=s?e.offsetWidth:r,c=s?e.offsetHeight:i,d=lf(r)!==o||lf(i)!==c;return d&&(r=o,i=c),{width:r,height:i,$:d}}function xy(e){return ln(e)?e:e.contextElement}function jl(e){const t=xy(e);if(!Ns(t))return Pn(1);const r=t.getBoundingClientRect(),{width:i,height:s,$:o}=ZR(t);let c=(o?lf(r.width):r.width)/i,d=(o?lf(r.height):r.height)/s;return(!c||!Number.isFinite(c))&&(c=1),(!d||!Number.isFinite(d))&&(d=1),{x:c,y:d}}const Y8=Pn(0);function JR(e){const t=Ci(e);return!by()||!t.visualViewport?Y8:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function K8(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Ci(e)?!1:t}function ho(e,t,r,i){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),o=xy(e);let c=Pn(1);t&&(i?ln(i)&&(c=jl(i)):c=jl(e));const d=K8(o,r,i)?JR(o):Pn(0);let m=(s.left+d.x)/c.x,f=(s.top+d.y)/c.y,g=s.width/c.x,p=s.height/c.y;if(o){const b=Ci(o),x=i&&ln(i)?Ci(i):i;let w=b,S=w_(w);for(;S&&i&&x!==w;){const E=jl(S),C=S.getBoundingClientRect(),A=cn(S),N=C.left+(S.clientLeft+parseFloat(A.paddingLeft))*E.x,k=C.top+(S.clientTop+parseFloat(A.paddingTop))*E.y;m*=E.x,f*=E.y,g*=E.x,p*=E.y,m+=N,f+=k,w=Ci(S),S=w_(w)}}return uf({width:g,height:p,x:m,y:f})}function Xf(e,t){const r=Kf(e).scrollLeft;return t?t.left+r:ho(Fn(e)).left+r}function QR(e,t){const r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-Xf(e,r),s=r.top+t.scrollTop;return{x:i,y:s}}function X8(e){let{elements:t,rect:r,offsetParent:i,strategy:s}=e;const o=s==="fixed",c=Fn(i),d=t?Yf(t.floating):!1;if(i===c||d&&o)return r;let m={scrollLeft:0,scrollTop:0},f=Pn(1);const g=Pn(0),p=Ns(i);if((p||!p&&!o)&&((Gl(i)!=="body"||Hu(c))&&(m=Kf(i)),p)){const x=ho(i);f=jl(i),g.x=x.x+i.clientLeft,g.y=x.y+i.clientTop}const b=c&&!p&&!o?QR(c,m):Pn(0);return{width:r.width*f.x,height:r.height*f.y,x:r.x*f.x-m.scrollLeft*f.x+g.x+b.x,y:r.y*f.y-m.scrollTop*f.y+g.y+b.y}}function Z8(e){return Array.from(e.getClientRects())}function J8(e){const t=Fn(e),r=Kf(e),i=e.ownerDocument.body,s=Si(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),o=Si(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let c=-r.scrollLeft+Xf(e);const d=-r.scrollTop;return cn(i).direction==="rtl"&&(c+=Si(t.clientWidth,i.clientWidth)-s),{width:s,height:o,x:c,y:d}}const JS=25;function Q8(e,t){const r=Ci(e),i=Fn(e),s=r.visualViewport;let o=i.clientWidth,c=i.clientHeight,d=0,m=0;if(s){o=s.width,c=s.height;const g=by();(!g||g&&t==="fixed")&&(d=s.offsetLeft,m=s.offsetTop)}const f=Xf(i);if(f<=0){const g=i.ownerDocument,p=g.body,b=getComputedStyle(p),x=g.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,w=Math.abs(i.clientWidth-p.clientWidth-x);w<=JS&&(o-=w)}else f<=JS&&(o+=f);return{width:o,height:c,x:d,y:m}}function eP(e,t){const r=ho(e,!0,t==="fixed"),i=r.top+e.clientTop,s=r.left+e.clientLeft,o=Ns(e)?jl(e):Pn(1),c=e.clientWidth*o.x,d=e.clientHeight*o.y,m=s*o.x,f=i*o.y;return{width:c,height:d,x:m,y:f}}function QS(e,t,r){let i;if(t==="viewport")i=Q8(e,r);else if(t==="document")i=J8(Fn(e));else if(ln(t))i=eP(t,r);else{const s=JR(e);i={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return uf(i)}function ek(e,t){const r=ba(e);return r===t||!ln(r)||Ul(r)?!1:cn(r).position==="fixed"||ek(r,t)}function tP(e,t){const r=t.get(e);if(r)return r;let i=Eu(e,[],!1).filter(d=>ln(d)&&Gl(d)!=="body"),s=null;const o=cn(e).position==="fixed";let c=o?ba(e):e;for(;ln(c)&&!Ul(c);){const d=cn(c),m=yy(c);!m&&d.position==="fixed"&&(s=null),(o?!m&&!s:!m&&d.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Hu(c)&&!m&&ek(e,c))?i=i.filter(g=>g!==c):s=d,c=ba(c)}return t.set(e,i),i}function rP(e){let{element:t,boundary:r,rootBoundary:i,strategy:s}=e;const c=[...r==="clippingAncestors"?Yf(t)?[]:tP(t,this._c):[].concat(r),i],d=QS(t,c[0],s);let m=d.top,f=d.right,g=d.bottom,p=d.left;for(let b=1;b<c.length;b++){const x=QS(t,c[b],s);m=Si(x.top,m),f=ya(x.right,f),g=ya(x.bottom,g),p=Si(x.left,p)}return{width:f-p,height:g-m,x:p,y:m}}function iP(e){const{width:t,height:r}=ZR(e);return{width:t,height:r}}function nP(e,t,r){const i=Ns(t),s=Fn(t),o=r==="fixed",c=ho(e,!0,o,t);let d={scrollLeft:0,scrollTop:0};const m=Pn(0);function f(){m.x=Xf(s)}if(i||!i&&!o)if((Gl(t)!=="body"||Hu(s))&&(d=Kf(t)),i){const x=ho(t,!0,o,t);m.x=x.x+t.clientLeft,m.y=x.y+t.clientTop}else s&&f();o&&!i&&s&&f();const g=s&&!i&&!o?QR(s,d):Pn(0),p=c.left+d.scrollLeft-m.x-g.x,b=c.top+d.scrollTop-m.y-g.y;return{x:p,y:b,width:c.width,height:c.height}}function Gg(e){return cn(e).position==="static"}function eC(e,t){if(!Ns(e)||cn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Fn(e)===r&&(r=r.ownerDocument.body),r}function tk(e,t){const r=Ci(e);if(Yf(e))return r;if(!Ns(e)){let s=ba(e);for(;s&&!Ul(s);){if(ln(s)&&!Gg(s))return s;s=ba(s)}return r}let i=eC(e,t);for(;i&&W8(i)&&Gg(i);)i=eC(i,t);return i&&Ul(i)&&Gg(i)&&!yy(i)?r:i||G8(e)||r}const sP=async function(e){const t=this.getOffsetParent||tk,r=this.getDimensions,i=await r(e.floating);return{reference:nP(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function aP(e){return cn(e).direction==="rtl"}const oP={convertOffsetParentRelativeRectToViewportRelativeRect:X8,getDocumentElement:Fn,getClippingRect:rP,getOffsetParent:tk,getElementRects:sP,getClientRects:Z8,getDimensions:iP,getScale:jl,isElement:ln,isRTL:aP};function rk(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function lP(e,t){let r=null,i;const s=Fn(e);function o(){var d;clearTimeout(i),(d=r)==null||d.disconnect(),r=null}function c(d,m){d===void 0&&(d=!1),m===void 0&&(m=1),o();const f=e.getBoundingClientRect(),{left:g,top:p,width:b,height:x}=f;if(d||t(),!b||!x)return;const w=Sh(p),S=Sh(s.clientWidth-(g+b)),E=Sh(s.clientHeight-(p+x)),C=Sh(g),N={rootMargin:-w+"px "+-S+"px "+-E+"px "+-C+"px",threshold:Si(0,ya(1,m))||1};let k=!0;function O(z){const H=z[0].intersectionRatio;if(H!==m){if(!k)return c();H?c(!1,H):i=setTimeout(()=>{c(!1,1e-7)},1e3)}H===1&&!rk(f,e.getBoundingClientRect())&&c(),k=!1}try{r=new IntersectionObserver(O,{...N,root:s.ownerDocument})}catch{r=new IntersectionObserver(O,N)}r.observe(e)}return c(!0),o}function cP(e,t,r,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:m=!1}=i,f=xy(e),g=s||o?[...f?Eu(f):[],...t?Eu(t):[]]:[];g.forEach(C=>{s&&C.addEventListener("scroll",r,{passive:!0}),o&&C.addEventListener("resize",r)});const p=f&&d?lP(f,r):null;let b=-1,x=null;c&&(x=new ResizeObserver(C=>{let[A]=C;A&&A.target===f&&x&&t&&(x.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var N;(N=x)==null||N.observe(t)})),r()}),f&&!m&&x.observe(f),t&&x.observe(t));let w,S=m?ho(e):null;m&&E();function E(){const C=ho(e);S&&!rk(S,C)&&r(),S=C,w=requestAnimationFrame(E)}return r(),()=>{var C;g.forEach(A=>{s&&A.removeEventListener("scroll",r),o&&A.removeEventListener("resize",r)}),p==null||p(),(C=x)==null||C.disconnect(),x=null,m&&cancelAnimationFrame(w)}}const uP=$8,dP=U8,hP=P8,fP=F8,mP=z8,tC=O8,pP=H8,gP=(e,t,r)=>{const i=new Map,s={platform:oP,...r},o={...s.platform,_c:i};return B8(e,t,{...s,platform:o})};var vP=typeof document<"u",_P=function(){},Fh=vP?_.useLayoutEffect:_P;function df(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,i,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(i=r;i--!==0;)if(!df(e[i],t[i]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!{}.hasOwnProperty.call(t,s[i]))return!1;for(i=r;i--!==0;){const o=s[i];if(!(o==="_owner"&&e.$$typeof)&&!df(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function ik(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function rC(e,t){const r=ik(e);return Math.round(t*r)/r}function Yg(e){const t=_.useRef(e);return Fh(()=>{t.current=e}),t}function yP(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:i=[],platform:s,elements:{reference:o,floating:c}={},transform:d=!0,whileElementsMounted:m,open:f}=e,[g,p]=_.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[b,x]=_.useState(i);df(b,i)||x(i);const[w,S]=_.useState(null),[E,C]=_.useState(null),A=_.useCallback(I=>{I!==z.current&&(z.current=I,S(I))},[]),N=_.useCallback(I=>{I!==H.current&&(H.current=I,C(I))},[]),k=o||w,O=c||E,z=_.useRef(null),H=_.useRef(null),D=_.useRef(g),G=m!=null,Y=Yg(m),W=Yg(s),L=Yg(f),T=_.useCallback(()=>{if(!z.current||!H.current)return;const I={placement:t,strategy:r,middleware:b};W.current&&(I.platform=W.current),gP(z.current,H.current,I).then(F=>{const q={...F,isPositioned:L.current!==!1};j.current&&!df(D.current,q)&&(D.current=q,_o.flushSync(()=>{p(q)}))})},[b,t,r,W,L]);Fh(()=>{f===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,p(I=>({...I,isPositioned:!1})))},[f]);const j=_.useRef(!1);Fh(()=>(j.current=!0,()=>{j.current=!1}),[]),Fh(()=>{if(k&&(z.current=k),O&&(H.current=O),k&&O){if(Y.current)return Y.current(k,O,T);T()}},[k,O,T,Y,G]);const U=_.useMemo(()=>({reference:z,floating:H,setReference:A,setFloating:N}),[A,N]),M=_.useMemo(()=>({reference:k,floating:O}),[k,O]),P=_.useMemo(()=>{const I={position:r,left:0,top:0};if(!M.floating)return I;const F=rC(M.floating,g.x),q=rC(M.floating,g.y);return d?{...I,transform:"translate("+F+"px, "+q+"px)",...ik(M.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:F,top:q}},[r,d,M.floating,g.x,g.y]);return _.useMemo(()=>({...g,update:T,refs:U,elements:M,floatingStyles:P}),[g,T,U,M,P])}const bP=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:i,padding:s}=typeof e=="function"?e(r):e;return i&&t(i)?i.current!=null?tC({element:i.current,padding:s}).fn(r):{}:i?tC({element:i,padding:s}).fn(r):{}}}},xP=(e,t)=>{const r=uP(e);return{name:r.name,fn:r.fn,options:[e,t]}},wP=(e,t)=>{const r=dP(e);return{name:r.name,fn:r.fn,options:[e,t]}},SP=(e,t)=>({fn:pP(e).fn,options:[e,t]}),CP=(e,t)=>{const r=hP(e);return{name:r.name,fn:r.fn,options:[e,t]}},EP=(e,t)=>{const r=fP(e);return{name:r.name,fn:r.fn,options:[e,t]}},RP=(e,t)=>{const r=mP(e);return{name:r.name,fn:r.fn,options:[e,t]}},kP=(e,t)=>{const r=bP(e);return{name:r.name,fn:r.fn,options:[e,t]}};var NP="Arrow",nk=_.forwardRef((e,t)=>{const{children:r,width:i=10,height:s=5,...o}=e;return u.jsx(Ue.svg,{...o,ref:t,width:i,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});nk.displayName=NP;var AP=nk;function MP(e){const[t,r]=_.useState(void 0);return Wt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let c,d;if("borderBoxSize"in o){const m=o.borderBoxSize,f=Array.isArray(m)?m[0]:m;c=f.inlineSize,d=f.blockSize}else c=e.offsetWidth,d=e.offsetHeight;r({width:c,height:d})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else r(void 0)},[e]),t}var wy="Popper",[sk,Zf]=pn(wy),[TP,ak]=sk(wy),ok=e=>{const{__scopePopper:t,children:r}=e,[i,s]=_.useState(null),[o,c]=_.useState(void 0);return u.jsx(TP,{scope:t,anchor:i,onAnchorChange:s,placementState:o,setPlacementState:c,children:r})};ok.displayName=wy;var lk="PopperAnchor",ck=_.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:i,...s}=e,o=ak(lk,r),c=_.useRef(null),d=o.onAnchorChange,m=_.useCallback(w=>{c.current=w,w&&d(w)},[d]),f=Qe(t,m),g=_.useRef(null);_.useEffect(()=>{if(!i)return;const w=g.current;g.current=i.current,w!==g.current&&d(g.current)});const p=o.placementState&&Cy(o.placementState),b=p==null?void 0:p[0],x=p==null?void 0:p[1];return i?null:u.jsx(Ue.div,{"data-radix-popper-side":b,"data-radix-popper-align":x,...s,ref:f})});ck.displayName=lk;var Sy="PopperContent",[DP,LP]=sk(Sy),uk=_.forwardRef((e,t)=>{var se,ce,Se,Re,Ne,Q;const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:o="center",alignOffset:c=0,arrowPadding:d=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:g=0,sticky:p="partial",hideWhenDetached:b=!1,updatePositionStrategy:x="optimized",onPlaced:w,...S}=e,E=ak(Sy,r),[C,A]=_.useState(null),N=Qe(t,A),[k,O]=_.useState(null),z=MP(k),H=(z==null?void 0:z.width)??0,D=(z==null?void 0:z.height)??0,G=i+(o!=="center"?"-"+o:""),Y=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},W=Array.isArray(f)?f:[f],L=W.length>0,T={padding:Y,boundary:W.filter(BP),altBoundary:L},{refs:j,floatingStyles:U,placement:M,isPositioned:P,middlewareData:I}=yP({strategy:"fixed",placement:G,whileElementsMounted:(...re)=>cP(...re,{animationFrame:x==="always"}),elements:{reference:E.anchor},middleware:[xP({mainAxis:s+D,alignmentAxis:c}),m&&wP({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?SP():void 0,...T}),m&&CP({...T}),EP({...T,apply:({elements:re,rects:be,availableWidth:pe,availableHeight:Ee})=>{const{width:Ie,height:Te}=be.reference,Ye=re.floating.style;Ye.setProperty("--radix-popper-available-width",`${pe}px`),Ye.setProperty("--radix-popper-available-height",`${Ee}px`),Ye.setProperty("--radix-popper-anchor-width",`${Ie}px`),Ye.setProperty("--radix-popper-anchor-height",`${Te}px`)}}),k&&kP({element:k,padding:d}),OP({arrowWidth:H,arrowHeight:D}),b&&RP({strategy:"referenceHidden",...T,boundary:L?T.boundary:void 0})]}),F=E.setPlacementState;Wt(()=>(F(M),()=>{F(void 0)}),[M,F]);const[q,$]=Cy(M),X=hr(w);Wt(()=>{P&&(X==null||X())},[P,X]);const V=(se=I.arrow)==null?void 0:se.x,J=(ce=I.arrow)==null?void 0:ce.y,le=((Se=I.arrow)==null?void 0:Se.centerOffset)!==0,[ae,ee]=_.useState();return Wt(()=>{C&&ee(window.getComputedStyle(C).zIndex)},[C]),u.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:P?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[(Re=I.transformOrigin)==null?void 0:Re.x,(Ne=I.transformOrigin)==null?void 0:Ne.y].join(" "),...((Q=I.hide)==null?void 0:Q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(DP,{scope:r,placedSide:q,placedAlign:$,onArrowChange:O,arrowX:V,arrowY:J,shouldHideArrow:le,children:u.jsx(Ue.div,{"data-side":q,"data-align":$,...S,ref:N,style:{...S.style,animation:P?void 0:"none"}})})})});uk.displayName=Sy;var dk="PopperArrow",jP={top:"bottom",right:"left",bottom:"top",left:"right"},hk=_.forwardRef(function(t,r){const{__scopePopper:i,...s}=t,o=LP(dk,i),c=jP[o.placedSide];return u.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:u.jsx(AP,{...s,ref:r,style:{...s.style,display:"block"}})})});hk.displayName=dk;function BP(e){return e!==null}var OP=e=>({name:"transformOrigin",options:e,fn(t){var E,C,A;const{placement:r,rects:i,middlewareData:s}=t,c=((E=s.arrow)==null?void 0:E.centerOffset)!==0,d=c?0:e.arrowWidth,m=c?0:e.arrowHeight,[f,g]=Cy(r),p={start:"0%",center:"50%",end:"100%"}[g],b=(((C=s.arrow)==null?void 0:C.x)??0)+d/2,x=(((A=s.arrow)==null?void 0:A.y)??0)+m/2;let w="",S="";return f==="bottom"?(w=c?p:`${b}px`,S=`${-m}px`):f==="top"?(w=c?p:`${b}px`,S=`${i.floating.height+m}px`):f==="right"?(w=`${-m}px`,S=c?p:`${x}px`):f==="left"&&(w=`${i.floating.width+m}px`,S=c?p:`${x}px`),{data:{x:w,y:S}}}});function Cy(e){const[t,r="center"]=e.split("-");return[t,r]}var fk=ok,mk=ck,pk=uk,gk=hk,Kg=!1;function PP(){const[e,t]=_.useState(Kg);return _.useEffect(()=>{Kg||(Kg=!0,t(!0))},[]),e}var vk=kf[" useSyncExternalStore ".trim().toString()];function zP(){return()=>{}}function IP(){return vk(zP,()=>!0,()=>!1)}var $P=typeof vk=="function"?IP:PP,Xg="rovingFocusGroup.onEntryFocus",UP={bubbles:!1,cancelable:!0},Fu="RovingFocusGroup",[S_,_k,HP]=py(Fu),[FP,Jf]=pn(Fu,[HP]),[WP,qP]=FP(Fu),yk=_.forwardRef((e,t)=>u.jsx(S_.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(S_.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(VP,{...e,ref:t})})}));yk.displayName=Fu;var VP=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:i,loop:s=!1,dir:o,currentTabStopId:c,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:g=!1,...p}=e,b=_.useRef(null),x=Qe(t,b),w=Uu(o),[S,E]=co({prop:c,defaultProp:d??null,onChange:m,caller:Fu}),[C,A]=_.useState(!1),N=hr(f),k=_k(r),O=_.useRef(!1),[z,H]=_.useState(0);return _.useEffect(()=>{const D=b.current;if(D)return D.addEventListener(Xg,N),()=>D.removeEventListener(Xg,N)},[N]),u.jsx(WP,{scope:r,orientation:i,dir:w,loop:s,currentTabStopId:S,onItemFocus:_.useCallback(D=>E(D),[E]),onItemShiftTab:_.useCallback(()=>A(!0),[]),onFocusableItemAdd:_.useCallback(()=>H(D=>D+1),[]),onFocusableItemRemove:_.useCallback(()=>H(D=>D-1),[]),children:u.jsx(Ue.div,{tabIndex:C||z===0?-1:0,"data-orientation":i,...p,ref:x,style:{outline:"none",...e.style},onMouseDown:Be(e.onMouseDown,()=>{O.current=!0}),onFocus:Be(e.onFocus,D=>{const G=!O.current;if(D.target===D.currentTarget&&G&&!C){const Y=new CustomEvent(Xg,UP);if(D.currentTarget.dispatchEvent(Y),!Y.defaultPrevented){const W=k().filter(M=>M.focusable),L=W.find(M=>M.active),T=W.find(M=>M.id===S),U=[L,T,...W].filter(Boolean).map(M=>M.ref.current);wk(U,g)}}O.current=!1}),onBlur:Be(e.onBlur,()=>A(!1))})})}),bk="RovingFocusGroupItem",xk=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:o,children:c,...d}=e,m=on(),f=o||m,g=qP(bk,r),p=g.currentTabStopId===f,b=_k(r),{onFocusableItemAdd:x,onFocusableItemRemove:w,currentTabStopId:S}=g,E=$P();return Wt(()=>{if(!(!E||!i))return x(),()=>w()},[E,i,x,w]),_.useEffect(()=>{if(!(E||!i))return x(),()=>w()},[E,i,x,w]),u.jsx(S_.ItemSlot,{scope:r,id:f,focusable:i,active:s,children:u.jsx(Ue.span,{tabIndex:p?0:-1,"data-orientation":g.orientation,...d,ref:t,onMouseDown:Be(e.onMouseDown,C=>{i?g.onItemFocus(f):C.preventDefault()}),onFocus:Be(e.onFocus,()=>g.onItemFocus(f)),onKeyDown:Be(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){g.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const A=KP(C,g.orientation,g.dir);if(A!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let k=b().filter(O=>O.focusable).map(O=>O.ref.current);if(A==="last")k.reverse();else if(A==="prev"||A==="next"){A==="prev"&&k.reverse();const O=k.indexOf(C.currentTarget);k=g.loop?XP(k,O+1):k.slice(O+1)}setTimeout(()=>wk(k))}}),children:typeof c=="function"?c({isCurrentTabStop:p,hasTabStop:S!=null}):c})})});xk.displayName=bk;var GP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function YP(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function KP(e,t,r){const i=YP(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return GP[i]}function wk(e,t=!1){const r=document.activeElement;for(const i of e)if(i===r||(i.focus({preventScroll:t}),document.activeElement!==r))return}function XP(e,t){return e.map((r,i)=>e[(t+i)%e.length])}var Sk=yk,Ck=xk,C_=["Enter"," "],ZP=["ArrowDown","PageUp","Home"],Ek=["ArrowUp","PageDown","End"],JP=[...ZP,...Ek],QP={ltr:[...C_,"ArrowRight"],rtl:[...C_,"ArrowLeft"]},ez={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Wu="Menu",[Ru,tz,rz]=py(Wu),[Co,Rk]=pn(Wu,[rz,Zf,Jf]),Qf=Zf(),kk=Jf(),[iz,Eo]=Co(Wu),[nz,qu]=Co(Wu),Nk=e=>{const{__scopeMenu:t,open:r=!1,children:i,dir:s,onOpenChange:o,modal:c=!0}=e,d=Qf(t),[m,f]=_.useState(null),g=_.useRef(!1),p=hr(o),b=Uu(s);return _.useEffect(()=>{const x=()=>{g.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>g.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),_.useEffect(()=>{if(!r)return;const x=()=>p(!1);return window.addEventListener("blur",x),()=>window.removeEventListener("blur",x)},[r,p]),u.jsx(fk,{...d,children:u.jsx(iz,{scope:t,open:r,onOpenChange:p,content:m,onContentChange:f,children:u.jsx(nz,{scope:t,onClose:_.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:g,dir:b,modal:c,children:i})})})};Nk.displayName=Wu;var sz="MenuAnchor",Ey=_.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,s=Qf(r);return u.jsx(mk,{...s,...i,ref:t})});Ey.displayName=sz;var Ry="MenuPortal",[az,Ak]=Co(Ry,{forceMount:void 0}),Mk=e=>{const{__scopeMenu:t,forceMount:r,children:i,container:s}=e,o=Eo(Ry,t);return u.jsx(az,{scope:t,forceMount:r,children:u.jsx(gn,{present:r||o.open,children:u.jsx(Pf,{asChild:!0,container:s,children:i})})})};Mk.displayName=Ry;var Wi="MenuContent",[oz,ky]=Co(Wi),Tk=_.forwardRef((e,t)=>{const r=Ak(Wi,e.__scopeMenu),{forceMount:i=r.forceMount,...s}=e,o=Eo(Wi,e.__scopeMenu),c=qu(Wi,e.__scopeMenu);return u.jsx(Ru.Provider,{scope:e.__scopeMenu,children:u.jsx(gn,{present:i||o.open,children:u.jsx(Ru.Slot,{scope:e.__scopeMenu,children:c.modal?u.jsx(lz,{...s,ref:t}):u.jsx(cz,{...s,ref:t})})})})}),lz=_.forwardRef((e,t)=>{const r=Eo(Wi,e.__scopeMenu),i=_.useRef(null),s=Qe(t,i);return _.useEffect(()=>{const o=i.current;if(o)return oy(o)},[]),u.jsx(Ny,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Be(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),cz=_.forwardRef((e,t)=>{const r=Eo(Wi,e.__scopeMenu);return u.jsx(Ny,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),uz=uo("MenuContent.ScrollLock"),Ny=_.forwardRef((e,t)=>{const{__scopeMenu:r,loop:i=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:c,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:g,onFocusOutside:p,onInteractOutside:b,onDismiss:x,disableOutsideScroll:w,...S}=e,E=Eo(Wi,r),C=qu(Wi,r),A=Qf(r),N=kk(r),k=tz(r),[O,z]=_.useState(null),H=_.useRef(null),D=Qe(t,H,E.onContentChange),G=_.useRef(0),Y=_.useRef(""),W=_.useRef(0),L=_.useRef(null),T=_.useRef("right"),j=_.useRef(0),U=w?If:_.Fragment,M=w?{as:uz,allowPinchZoom:!0}:void 0,P=F=>{var ee,se;const q=Y.current+F,$=k().filter(ce=>!ce.disabled),X=document.activeElement,V=(ee=$.find(ce=>ce.ref.current===X))==null?void 0:ee.textValue,J=$.map(ce=>ce.textValue),le=wz(J,q,V),ae=(se=$.find(ce=>ce.textValue===le))==null?void 0:se.ref.current;(function ce(Se){Y.current=Se,window.clearTimeout(G.current),Se!==""&&(G.current=window.setTimeout(()=>ce(""),1e3))})(q),ae&&setTimeout(()=>ae.focus())};_.useEffect(()=>()=>window.clearTimeout(G.current),[]),ay();const I=_.useCallback(F=>{var $,X;return T.current===(($=L.current)==null?void 0:$.side)&&Cz(F,(X=L.current)==null?void 0:X.area)},[]);return u.jsx(oz,{scope:r,searchRef:Y,onItemEnter:_.useCallback(F=>{I(F)&&F.preventDefault()},[I]),onItemLeave:_.useCallback(F=>{var q;I(F)||((q=H.current)==null||q.focus(),z(null))},[I]),onTriggerLeave:_.useCallback(F=>{I(F)&&F.preventDefault()},[I]),pointerGraceTimerRef:W,onPointerGraceIntentChange:_.useCallback(F=>{L.current=F},[]),children:u.jsx(U,{...M,children:u.jsx(Of,{asChild:!0,trapped:s,onMountAutoFocus:Be(o,F=>{var q;F.preventDefault(),(q=H.current)==null||q.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:u.jsx(Bf,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:f,onPointerDownOutside:g,onFocusOutside:p,onInteractOutside:b,onDismiss:x,children:u.jsx(Sk,{asChild:!0,...N,dir:C.dir,orientation:"vertical",loop:i,currentTabStopId:O,onCurrentTabStopIdChange:z,onEntryFocus:Be(m,F=>{C.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(pk,{role:"menu","aria-orientation":"vertical","data-state":Gk(E.open),"data-radix-menu-content":"",dir:C.dir,...A,...S,ref:D,style:{outline:"none",...S.style},onKeyDown:Be(S.onKeyDown,F=>{const $=F.target.closest("[data-radix-menu-content]")===F.currentTarget,X=F.ctrlKey||F.altKey||F.metaKey,V=F.key.length===1;$&&(F.key==="Tab"&&F.preventDefault(),!X&&V&&P(F.key));const J=H.current;if(F.target!==J||!JP.includes(F.key))return;F.preventDefault();const ae=k().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);Ek.includes(F.key)&&ae.reverse(),bz(ae)}),onBlur:Be(e.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(G.current),Y.current="")}),onPointerMove:Be(e.onPointerMove,ku(F=>{const q=F.target,$=j.current!==F.clientX;if(F.currentTarget.contains(q)&&$){const X=F.clientX>j.current?"right":"left";T.current=X,j.current=F.clientX}}))})})})})})})});Tk.displayName=Wi;var dz="MenuGroup",Ay=_.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return u.jsx(Ue.div,{role:"group",...i,ref:t})});Ay.displayName=dz;var hz="MenuLabel",Dk=_.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return u.jsx(Ue.div,{...i,ref:t})});Dk.displayName=hz;var hf="MenuItem",iC="menu.itemSelect",em=_.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:i,...s}=e,o=_.useRef(null),c=qu(hf,e.__scopeMenu),d=ky(hf,e.__scopeMenu),m=Qe(t,o),f=_.useRef(!1),g=()=>{const p=o.current;if(!r&&p){const b=new CustomEvent(iC,{bubbles:!0,cancelable:!0});p.addEventListener(iC,x=>i==null?void 0:i(x),{once:!0}),FE(p,b),b.defaultPrevented?f.current=!1:c.onClose()}};return u.jsx(Lk,{...s,ref:m,disabled:r,onClick:Be(e.onClick,g),onPointerDown:p=>{var b;(b=e.onPointerDown)==null||b.call(e,p),f.current=!0},onPointerUp:Be(e.onPointerUp,p=>{var b;f.current||(b=p.currentTarget)==null||b.click()}),onKeyDown:Be(e.onKeyDown,p=>{r||p.target!==p.currentTarget||d.searchRef.current!==""&&p.key===" "||C_.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});em.displayName=hf;var Lk=_.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:i=!1,textValue:s,...o}=e,c=ky(hf,r),d=kk(r),m=_.useRef(null),f=Qe(t,m),[g,p]=_.useState(!1),[b,x]=_.useState("");return _.useEffect(()=>{const w=m.current;w&&x((w.textContent??"").trim())},[o.children]),u.jsx(Ru.ItemSlot,{scope:r,disabled:i,textValue:s??b,children:u.jsx(Ck,{asChild:!0,...d,focusable:!i,children:u.jsx(Ue.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...o,ref:f,onPointerMove:Be(e.onPointerMove,ku(w=>{i?c.onItemLeave(w):(c.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Be(e.onPointerLeave,ku(w=>c.onItemLeave(w))),onFocus:Be(e.onFocus,()=>p(!0)),onBlur:Be(e.onBlur,()=>p(!1))})})})}),fz="MenuCheckboxItem",jk=_.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:i,...s}=e;return u.jsx(Ik,{scope:e.__scopeMenu,checked:r,children:u.jsx(em,{role:"menuitemcheckbox","aria-checked":ff(r)?"mixed":r,...s,ref:t,"data-state":Ty(r),onSelect:Be(s.onSelect,()=>i==null?void 0:i(ff(r)?!0:!r),{checkForDefaultPrevented:!1})})})});jk.displayName=fz;var Bk="MenuRadioGroup",[mz,pz]=Co(Bk,{value:void 0,onValueChange:()=>{}}),Ok=_.forwardRef((e,t)=>{const{value:r,onValueChange:i,...s}=e,o=hr(i);return u.jsx(mz,{scope:e.__scopeMenu,value:r,onValueChange:o,children:u.jsx(Ay,{...s,ref:t})})});Ok.displayName=Bk;var Pk="MenuRadioItem",zk=_.forwardRef((e,t)=>{const{value:r,...i}=e,s=pz(Pk,e.__scopeMenu),o=r===s.value;return u.jsx(Ik,{scope:e.__scopeMenu,checked:o,children:u.jsx(em,{role:"menuitemradio","aria-checked":o,...i,ref:t,"data-state":Ty(o),onSelect:Be(i.onSelect,()=>{var c;return(c=s.onValueChange)==null?void 0:c.call(s,r)},{checkForDefaultPrevented:!1})})})});zk.displayName=Pk;var My="MenuItemIndicator",[Ik,gz]=Co(My,{checked:!1}),$k=_.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:i,...s}=e,o=gz(My,r);return u.jsx(gn,{present:i||ff(o.checked)||o.checked===!0,children:u.jsx(Ue.span,{...s,ref:t,"data-state":Ty(o.checked)})})});$k.displayName=My;var vz="MenuSeparator",Uk=_.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return u.jsx(Ue.div,{role:"separator","aria-orientation":"horizontal",...i,ref:t})});Uk.displayName=vz;var _z="MenuArrow",Hk=_.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,s=Qf(r);return u.jsx(gk,{...s,...i,ref:t})});Hk.displayName=_z;var yz="MenuSub",[aY,Fk]=Co(yz),uu="MenuSubTrigger",Wk=_.forwardRef((e,t)=>{const r=Eo(uu,e.__scopeMenu),i=qu(uu,e.__scopeMenu),s=Fk(uu,e.__scopeMenu),o=ky(uu,e.__scopeMenu),c=_.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=o,f={__scopeMenu:e.__scopeMenu},g=_.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);_.useEffect(()=>g,[g]),_.useEffect(()=>{const b=d.current;return()=>{window.clearTimeout(b),m(null)}},[d,m]);const p=Qe(t,s.onTriggerChange);return u.jsx(Ey,{asChild:!0,...f,children:u.jsx(Lk,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?s.contentId:void 0,"data-state":Gk(r.open),...e,ref:p,onClick:b=>{var x;(x=e.onClick)==null||x.call(e,b),!(e.disabled||b.defaultPrevented)&&(b.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Be(e.onPointerMove,ku(b=>{o.onItemEnter(b),!b.defaultPrevented&&!e.disabled&&!r.open&&!c.current&&(o.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{r.onOpenChange(!0),g()},100))})),onPointerLeave:Be(e.onPointerLeave,ku(b=>{var w,S;g();const x=(w=r.content)==null?void 0:w.getBoundingClientRect();if(x){const E=(S=r.content)==null?void 0:S.dataset.side,C=E==="right",A=C?-5:5,N=x[C?"left":"right"],k=x[C?"right":"left"];o.onPointerGraceIntentChange({area:[{x:b.clientX+A,y:b.clientY},{x:N,y:x.top},{x:k,y:x.top},{x:k,y:x.bottom},{x:N,y:x.bottom}],side:E}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(b),b.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Be(e.onKeyDown,b=>{var w;e.disabled||b.target!==b.currentTarget||o.searchRef.current!==""&&b.key===" "||QP[i.dir].includes(b.key)&&(r.onOpenChange(!0),(w=r.content)==null||w.focus(),b.preventDefault())})})})});Wk.displayName=uu;var qk="MenuSubContent",Vk=_.forwardRef((e,t)=>{const r=Ak(Wi,e.__scopeMenu),{forceMount:i=r.forceMount,align:s="start",...o}=e,c=Eo(Wi,e.__scopeMenu),d=qu(Wi,e.__scopeMenu),m=Fk(qk,e.__scopeMenu),f=_.useRef(null),g=Qe(t,f);return u.jsx(Ru.Provider,{scope:e.__scopeMenu,children:u.jsx(gn,{present:i||c.open,children:u.jsx(Ru.Slot,{scope:e.__scopeMenu,children:u.jsx(Ny,{id:m.contentId,"aria-labelledby":m.triggerId,...o,ref:g,align:s,side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var b;d.isUsingKeyboardRef.current&&((b=f.current)==null||b.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:Be(e.onFocusOutside,p=>{p.target!==m.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:Be(e.onEscapeKeyDown,p=>{d.onClose(),p.preventDefault()}),onKeyDown:Be(e.onKeyDown,p=>{var w;const b=p.currentTarget.contains(p.target),x=ez[d.dir].includes(p.key);b&&x&&(c.onOpenChange(!1),(w=m.trigger)==null||w.focus(),p.preventDefault())})})})})})});Vk.displayName=qk;function Gk(e){return e?"open":"closed"}function ff(e){return e==="indeterminate"}function Ty(e){return ff(e)?"indeterminate":e?"checked":"unchecked"}function bz(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function xz(e,t){return e.map((r,i)=>e[(t+i)%e.length])}function wz(e,t,r){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let c=xz(e,Math.max(o,0));s.length===1&&(c=c.filter(f=>f!==r));const m=c.find(f=>f.toLowerCase().startsWith(s.toLowerCase()));return m!==r?m:void 0}function Sz(e,t){const{x:r,y:i}=e;let s=!1;for(let o=0,c=t.length-1;o<t.length;c=o++){const d=t[o],m=t[c],f=d.x,g=d.y,p=m.x,b=m.y;g>i!=b>i&&r<(p-f)*(i-g)/(b-g)+f&&(s=!s)}return s}function Cz(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return Sz(r,t)}function ku(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Ez=Nk,Rz=Ey,kz=Mk,Nz=Tk,Az=Ay,Mz=Dk,Tz=em,Dz=jk,Lz=Ok,jz=zk,Bz=$k,Oz=Uk,Pz=Hk,zz=Wk,Iz=Vk,tm="DropdownMenu",[$z]=pn(tm,[Rk]),Kr=Rk(),[Uz,Yk]=$z(tm),Kk=e=>{const{__scopeDropdownMenu:t,children:r,dir:i,open:s,defaultOpen:o,onOpenChange:c,modal:d=!0}=e,m=Kr(t),f=_.useRef(null),[g,p]=co({prop:s,defaultProp:o??!1,onChange:c,caller:tm});return u.jsx(Uz,{scope:t,triggerId:on(),triggerRef:f,contentId:on(),open:g,onOpenChange:p,onOpenToggle:_.useCallback(()=>p(b=>!b),[p]),modal:d,children:u.jsx(Ez,{...m,open:g,onOpenChange:p,dir:i,modal:d,children:r})})};Kk.displayName=tm;var Xk="DropdownMenuTrigger",Zk=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:i=!1,...s}=e,o=Yk(Xk,r),c=Kr(r),d=Qe(t,o.triggerRef);return u.jsx(Rz,{asChild:!0,...c,children:u.jsx(Ue.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...s,ref:d,onPointerDown:Be(e.onPointerDown,m=>{!i&&m.button===0&&m.ctrlKey===!1&&(o.onOpenToggle(),o.open||m.preventDefault())}),onKeyDown:Be(e.onKeyDown,m=>{i||(["Enter"," "].includes(m.key)&&o.onOpenToggle(),m.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(m.key)&&m.preventDefault())})})})});Zk.displayName=Xk;var Hz="DropdownMenuPortal",Jk=e=>{const{__scopeDropdownMenu:t,...r}=e,i=Kr(t);return u.jsx(kz,{...i,...r})};Jk.displayName=Hz;var Qk="DropdownMenuContent",eN=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Yk(Qk,r),o=Kr(r),c=_.useRef(!1);return u.jsx(Nz,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...i,ref:t,onCloseAutoFocus:Be(e.onCloseAutoFocus,d=>{var m;c.current||(m=s.triggerRef.current)==null||m.focus(),c.current=!1,d.preventDefault()}),onInteractOutside:Be(e.onInteractOutside,d=>{const m=d.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,g=m.button===2||f;(!s.modal||g)&&(c.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eN.displayName=Qk;var Fz="DropdownMenuGroup",Wz=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Kr(r);return u.jsx(Az,{...s,...i,ref:t})});Wz.displayName=Fz;var qz="DropdownMenuLabel",Vz=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Kr(r);return u.jsx(Mz,{...s,...i,ref:t})});Vz.displayName=qz;var Gz="DropdownMenuItem",tN=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Kr(r);return u.jsx(Tz,{...s,...i,ref:t})});tN.displayName=Gz;var Yz="DropdownMenuCheckboxItem",Kz=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Kr(r);return u.jsx(Dz,{...s,...i,ref:t})});Kz.displayName=Yz;var Xz="DropdownMenuRadioGroup",Zz=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Kr(r);return u.jsx(Lz,{...s,...i,ref:t})});Zz.displayName=Xz;var Jz="DropdownMenuRadioItem",Qz=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Kr(r);return u.jsx(jz,{...s,...i,ref:t})});Qz.displayName=Jz;var eI="DropdownMenuItemIndicator",tI=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Kr(r);return u.jsx(Bz,{...s,...i,ref:t})});tI.displayName=eI;var rI="DropdownMenuSeparator",iI=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Kr(r);return u.jsx(Oz,{...s,...i,ref:t})});iI.displayName=rI;var nI="DropdownMenuArrow",sI=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Kr(r);return u.jsx(Pz,{...s,...i,ref:t})});sI.displayName=nI;var aI="DropdownMenuSubTrigger",oI=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Kr(r);return u.jsx(zz,{...s,...i,ref:t})});oI.displayName=aI;var lI="DropdownMenuSubContent",cI=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Kr(r);return u.jsx(Iz,{...s,...i,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});cI.displayName=lI;var uI=Kk,rN=Zk,dI=Jk,iN=eN,nN=tN;function E_(e){return u.jsx(uI,{"data-slot":"dropdown-menu",...e})}const mf=_.forwardRef((e,t)=>u.jsx(rN,{ref:t,"data-slot":"dropdown-menu-trigger",...e}));mf.displayName=rN.displayName;const pf=_.forwardRef(({className:e,sideOffset:t=4,collisionPadding:r=8,...i},s)=>u.jsx(dI,{children:u.jsx(iN,{ref:s,"data-slot":"dropdown-menu-content",sideOffset:t,collisionPadding:r,className:at("cn-menu-translucent z-50 min-w-36 origin-[var(--radix-dropdown-menu-content-transform-origin)] overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})}));pf.displayName=iN.displayName;const gf=_.forwardRef(({className:e,variant:t="default",...r},i)=>u.jsx(nN,{ref:i,"data-slot":"dropdown-menu-item","data-variant":t,className:at("relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t==="destructive"&&"text-destructive focus:bg-destructive/10 focus:text-destructive dark:focus:bg-destructive/20",e),...r}));gf.displayName=nN.displayName;const xt=_.forwardRef(({className:e,type:t,...r},i)=>u.jsx("input",{ref:i,type:t,"data-slot":"input",className:at("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...r}));xt.displayName="Input";function rm({className:e,...t}){return u.jsx("textarea",{"data-slot":"textarea",className:at("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function hI({idPrefix:e,fields:t,activeFieldId:r,answers:i,otherValues:s,otherSelections:o,errors:c={},disabled:d=!1,onNavigate:m,onAnswerChange:f,onOtherValueChange:g,onOtherSelectionChange:p}){const b=_.useRef(null),x=_.useRef(void 0),w=_.useRef(void 0),S=t.findIndex(D=>D.id===r),E=S>=0?S:0,C=t[E],A=C?c[C.id]:void 0,N=C?i[C.id]:void 0;if(_.useEffect(()=>{if(!C)return;const D=x.current!==void 0&&x.current!==C.id,G=!!A&&w.current!==A;if(x.current=C.id,w.current=A,!D&&!G)return;const Y=b.current,W=(Y==null?void 0:Y.querySelector('input[aria-invalid="true"]:not([disabled]), textarea[aria-invalid="true"]:not([disabled])'))??(Y==null?void 0:Y.querySelector("input:checked:not([disabled])"))??(Y==null?void 0:Y.querySelector("input:not([disabled]), textarea:not([disabled])"));W==null||W.focus()},[A,C]),!C)return null;const k=`${e}-field-${E}`,O=C.description?`${k}-description`:void 0,z=A?`${k}-error`:void 0,H=[O,z].filter(Boolean).join(" ")||void 0;return u.jsxs("div",{className:"grid gap-3",children:[t.length>1&&u.jsxs("div",{className:"grid gap-1.5",children:[u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsxs("div",{"aria-live":"polite",className:"font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:["Question ",E+1," of ",t.length]}),u.jsx("div",{className:"text-[11px] text-muted-foreground",children:C.required?"Required":"Optional"})]}),u.jsx("div",{role:"progressbar","aria-label":"Question progress","aria-valuemin":1,"aria-valuemax":t.length,"aria-valuenow":E+1,className:"h-1 overflow-hidden rounded-full bg-muted",children:u.jsx("div",{className:"h-full rounded-full bg-primary transition-[width]",style:{width:`${(E+1)/t.length*100}%`}})})]}),u.jsx("div",{ref:b,children:C.type==="text"?u.jsxs("div",{className:"grid gap-1.5",children:[u.jsxs("label",{htmlFor:k,className:"text-xs font-medium text-foreground",children:[C.label,C.required&&u.jsx(aC,{})]}),C.description&&u.jsx("p",{id:O,className:"text-[11px] leading-relaxed text-muted-foreground",children:C.description}),C.multiline&&!C.secret?u.jsx(rm,{id:k,value:typeof N=="string"?N:"",disabled:d,placeholder:C.placeholder,"aria-invalid":A?!0:void 0,"aria-describedby":H,required:C.required,onChange:D=>f(C.id,D.target.value)}):u.jsx(xt,{id:k,type:C.secret?"password":"text",autoComplete:"off",value:typeof N=="string"?N:"",disabled:d,placeholder:C.placeholder,"aria-invalid":A?!0:void 0,"aria-describedby":H,required:C.required,onChange:D=>f(C.id,D.target.value)}),u.jsx(sC,{id:z,error:A})]}):u.jsxs("fieldset",{disabled:d,role:C.multiple?void 0:"radiogroup","aria-required":!C.multiple&&C.required?!0:void 0,"aria-invalid":A?!0:void 0,"aria-describedby":H,className:"grid gap-1.5",children:[u.jsxs("legend",{className:"text-xs font-medium text-foreground",children:[C.label,C.required&&u.jsx(aC,{})]}),C.description&&u.jsx("p",{id:O,className:"text-[11px] leading-relaxed text-muted-foreground",children:C.description}),u.jsxs("div",{className:"grid gap-1.5",children:[C.options.map((D,G)=>{const Y=`${k}-option-${G}`,W=C.multiple?Array.isArray(N)&&N.includes(D.value):o[C.id]!==!0&&N===D.value;return u.jsx(nC,{id:Y,name:C.multiple?void 0:k,type:C.multiple?"checkbox":"radio",checked:W,label:D.label,description:D.description,onChange:L=>{if(C.multiple){const T=Array.isArray(N)?N:[];f(C.id,L?[...T.filter(j=>j!==D.value),D.value]:T.filter(j=>j!==D.value))}else f(C.id,D.value),p(C.id,!1)}},D.value)}),C.allowOther&&u.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-border bg-background/60 px-2.5 py-2 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5",children:[u.jsx(nC,{id:`${k}-other`,name:C.multiple?void 0:k,type:C.multiple?"checkbox":"radio",checked:o[C.id]===!0,label:"Other",embedded:!0,onChange:D=>{p(C.id,D),D&&!C.multiple&&f(C.id,"")}}),u.jsx(xt,{value:s[C.id]??"",disabled:d||o[C.id]!==!0,"aria-label":`Other answer for ${C.label}`,"aria-invalid":A?!0:void 0,"aria-describedby":H,placeholder:"Enter another answer",onChange:D=>g(C.id,D.target.value)})]}),!C.required&&!C.multiple&&(o[C.id]===!0||typeof N=="string"&&N.length>0)&&u.jsx(ge,{type:"button",size:"xs",variant:"ghost",className:"justify-self-start text-muted-foreground",onClick:()=>{f(C.id,""),p(C.id,!1)},children:"Clear selection"})]}),u.jsx(sC,{id:z,error:A})]})}),t.length>1&&u.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-border/70 pt-2",children:[u.jsxs(ge,{type:"button",size:"xs",variant:"ghost",disabled:d||E===0,onClick:()=>m(t[E-1].id),children:[u.jsx(DE,{}),"Previous"]}),u.jsxs(ge,{type:"button",size:"xs",variant:"outline",disabled:d||E===t.length-1,onClick:()=>m(t[E+1].id),children:["Next",u.jsx(yo,{})]})]})]})}function nC({id:e,name:t,type:r,checked:i,label:s,description:o,embedded:c=!1,onChange:d}){return u.jsxs("label",{htmlFor:e,className:at("flex cursor-pointer items-start gap-2 text-xs text-foreground",!c&&"rounded-lg border border-border bg-background/60 px-2.5 py-2 transition-colors hover:bg-muted/60 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5"),children:[u.jsxs("span",{className:"relative mt-0.5 size-4 shrink-0",children:[u.jsx("input",{id:e,type:r,name:t,checked:i,className:"peer size-4 appearance-none rounded-sm border border-input bg-background outline-none transition-colors checked:border-primary checked:bg-primary focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-60",onChange:m=>d(m.target.checked)}),u.jsx(Lf,{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 size-4 stroke-[3] text-primary-foreground opacity-0 peer-checked:opacity-100"})]}),u.jsxs("span",{className:"min-w-0",children:[u.jsx("span",{className:"block",children:s}),o&&u.jsx("span",{className:"mt-0.5 block text-[11px] leading-relaxed text-muted-foreground",children:o})]})]})}function sC({id:e,error:t}){return t?u.jsx("p",{id:e,role:"alert",className:"text-[11px] text-destructive",children:t}):null}function aC(){return u.jsxs(u.Fragment,{children:[u.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-destructive",children:"*"}),u.jsx("span",{className:"sr-only",children:" (required)"})]})}function fo({className:e,size:t="default",...r}){return u.jsxs("div",{"data-slot":"native-select-wrapper","data-size":t,className:at("group/native-select relative w-fit has-[select:disabled]:opacity-50",e),children:[u.jsx("select",{"data-slot":"native-select","data-size":t,className:"h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",...r}),u.jsx(ey,{"aria-hidden":"true","data-slot":"native-select-icon",className:"pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none"})]})}var fI=Object.defineProperty,xs=(e,t)=>fI(e,"name",{value:t,configurable:!0});function sN(e,t){return _.useReducer((r,i)=>t[r][i]??r,e)}xs(sN,"useStateMachine");var im=xs(e=>{const{present:t,children:r}=e,i=aN(t),s=typeof r=="function"?r({present:i.isPresent}):_.Children.only(r),o=oN(i.ref,lN(s));return typeof r=="function"||i.isPresent?_.cloneElement(s,{ref:o}):null},"Presence");function aN(e){const[t,r]=_.useState(),i=_.useRef(null),s=_.useRef(e),o=_.useRef("none"),c=_.useRef(void 0),d=e?"mounted":"unmounted",[m,f]=sN(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{m==="mounted"?(o.current=c.current??El(i.current),c.current=void 0):o.current="none"},[m]),Wt(()=>{const g=i.current,p=s.current;if(p!==e){const x=o.current,w=El(g);e?(c.current=w,f("MOUNT")):w==="none"||(g==null?void 0:g.display)==="none"?f("UNMOUNT"):f(p&&x!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,f]),Wt(()=>{if(t){let g;const p=t.ownerDocument.defaultView??window,b=xs(w=>{const E=El(i.current).includes(CSS.escape(w.animationName));if(w.target===t&&E&&(f("ANIMATION_END"),!s.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",g=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},"handleAnimationEnd"),x=xs(w=>{w.target===t&&(o.current=El(i.current))},"handleAnimationStart");return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",b),t.addEventListener("animationend",b),()=>{p.clearTimeout(g),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",b),t.removeEventListener("animationend",b)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:_.useCallback(g=>{if(g){const p=getComputedStyle(g);i.current=p,c.current=El(p)}else i.current=null;r(g)},[])}}xs(aN,"usePresence");function R_(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}xs(R_,"setRef");function oN(...e){const t=_.useRef(e);return t.current=e,_.useCallback(r=>{const i=t.current;let s=!1;const o=i.map(c=>{const d=R_(c,r);return!s&&typeof d=="function"&&(s=!0),d});if(s)return()=>{for(let c=0;c<o.length;c++){const d=o[c];typeof d=="function"?d():R_(i[c],null)}}},[])}xs(oN,"useStableComposedRefs");function El(e){return(e==null?void 0:e.animationName)||"none"}xs(El,"getAnimationName");function lN(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}xs(lN,"getElementRef");function k_(e,[t,r]){return Math.min(r,Math.max(t,e))}var mI=Object.defineProperty,Yl=(e,t)=>mI(e,"name",{value:t,configurable:!0}),cN=!!(typeof window<"u"&&window.document&&window.document.createElement);function va(e,t,{checkForDefaultPrevented:r=!0}={}){return Yl(function(s){if(e==null||e(s),r===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)},"handleEvent")}Yl(va,"composeEventHandlers");function pI(e){var t;if(!cN)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Yl(pI,"getOwnerWindow");function N_(e){if(!cN)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Yl(N_,"getOwnerDocument");function uN(e,t=!1){const{activeElement:r}=N_(e);if(!(r!=null&&r.nodeName))return null;if(dN(r)&&r.contentDocument)return uN(r.contentDocument.body,t);if(t){const i=r.getAttribute("aria-activedescendant");if(i){const s=N_(r).getElementById(i);if(s)return s}}return r}Yl(uN,"getActiveElement");function dN(e){return e.tagName==="IFRAME"}Yl(dN,"isFrame");var gI=Object.defineProperty,rt=(e,t)=>gI(e,"name",{value:t,configurable:!0});function hN(e,t){return _.useReducer((r,i)=>t[r][i]??r,e)}rt(hN,"useStateMachine");var fN="ScrollArea",[mN]=pn(fN),[vI,Ki]=mN(fN),_I=_.forwardRef(rt(function(t,r){const{__scopeScrollArea:i,type:s="hover",dir:o,scrollHideDelay:c=600,...d}=t,[m,f]=_.useState(null),[g,p]=_.useState(null),[b,x]=_.useState(null),[w,S]=_.useState(null),[E,C]=_.useState(null),[A,N]=_.useState(0),[k,O]=_.useState(0),[z,H]=_.useState(!1),[D,G]=_.useState(!1),Y=Qe(r,f),W=Uu(o);return u.jsx(vI,{scope:i,type:s,dir:W,scrollHideDelay:c,scrollArea:m,viewport:g,onViewportChange:p,content:b,onContentChange:x,scrollbarX:w,onScrollbarXChange:S,scrollbarXEnabled:z,onScrollbarXEnabledChange:H,scrollbarY:E,onScrollbarYChange:C,scrollbarYEnabled:D,onScrollbarYEnabledChange:G,onCornerWidthChange:N,onCornerHeightChange:O,children:u.jsx(Ue.div,{dir:W,...d,ref:Y,style:{position:"relative","--radix-scroll-area-corner-width":A+"px","--radix-scroll-area-corner-height":k+"px",...t.style}})})},"ScrollArea")),yI="ScrollAreaViewport",bI=_.forwardRef(rt(function(t,r){const{__scopeScrollArea:i,children:s,nonce:o,...c}=t,d=Ki(yI,i),m=_.useRef(null),f=Qe(r,m,d.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx(xI,{nonce:o}),u.jsx(Ue.div,{"data-radix-scroll-area-viewport":"",...c,ref:f,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...t.style},children:u.jsx("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})},"ScrollAreaViewport")),xI=_.memo(rt(function({nonce:t}){return u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t})},"ScrollAreaViewportStyle"),(e,t)=>e.nonce===t.nonce),As="ScrollAreaScrollbar",pN=_.forwardRef(rt(function(t,r){const{forceMount:i,...s}=t,o=Ki(As,t.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:d}=o,m=t.orientation==="horizontal";return _.useEffect(()=>(m?c(!0):d(!0),()=>{m?c(!1):d(!1)}),[m,c,d]),o.type==="hover"?u.jsx(wI,{...s,ref:r,forceMount:i}):o.type==="scroll"?u.jsx(SI,{...s,ref:r,forceMount:i}):o.type==="auto"?u.jsx(gN,{...s,ref:r,forceMount:i}):o.type==="always"?u.jsx(Dy,{...s,ref:r,"data-state":"visible"}):null},"ScrollAreaScrollbar")),wI=_.forwardRef(rt(function(t,r){const{forceMount:i,...s}=t,o=Ki(As,t.__scopeScrollArea),[c,d]=_.useState(!1);return _.useEffect(()=>{const m=o.scrollArea;let f=0;if(m){const g=rt(()=>{window.clearTimeout(f),d(!0)},"handlePointerEnter"),p=rt(()=>{f=window.setTimeout(()=>d(!1),o.scrollHideDelay)},"handlePointerLeave");return m.addEventListener("pointerenter",g),m.addEventListener("pointerleave",p),()=>{window.clearTimeout(f),m.removeEventListener("pointerenter",g),m.removeEventListener("pointerleave",p)}}},[o.scrollArea,o.scrollHideDelay]),u.jsx(im,{present:i||c,children:u.jsx(gN,{"data-state":c?"visible":"hidden",...s,ref:r})})},"ScrollAreaScrollbarHover")),SI=_.forwardRef(rt(function(t,r){const{forceMount:i,...s}=t,o=Ki(As,t.__scopeScrollArea),c=t.orientation==="horizontal",d=Gu(()=>f("SCROLL_END"),100),[m,f]=hN("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return _.useEffect(()=>{if(m==="idle"){const g=window.setTimeout(()=>f("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(g)}},[m,o.scrollHideDelay,f]),_.useEffect(()=>{const g=o.viewport,p=c?"scrollLeft":"scrollTop";if(g){let b=g[p];const x=rt(()=>{const w=g[p];b!==w&&(f("SCROLL"),d()),b=w},"handleScroll");return g.addEventListener("scroll",x),()=>g.removeEventListener("scroll",x)}},[o.viewport,c,f,d]),u.jsx(im,{present:i||m!=="hidden",children:u.jsx(Dy,{"data-state":m==="hidden"?"hidden":"visible",...s,ref:r,onPointerEnter:va(t.onPointerEnter,()=>f("POINTER_ENTER")),onPointerLeave:va(t.onPointerLeave,()=>f("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),gN=_.forwardRef(rt(function(t,r){const i=Ki(As,t.__scopeScrollArea),{forceMount:s,...o}=t,[c,d]=_.useState(!1),m=t.orientation==="horizontal",f=Gu(()=>{if(i.viewport){const g=i.viewport.offsetWidth<i.viewport.scrollWidth,p=i.viewport.offsetHeight<i.viewport.scrollHeight;d(m?g:p)}},10);return mo(i.viewport,f),mo(i.content,f),u.jsx(im,{present:s||c,children:u.jsx(Dy,{"data-state":c?"visible":"hidden",...o,ref:r})})},"ScrollAreaScrollbarAuto")),Dy=_.forwardRef(rt(function(t,r){const{orientation:i="vertical",...s}=t,o=Ki(As,t.__scopeScrollArea),c=_.useRef(null),d=_.useRef(0),[m,f]=_.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),g=Ly(m.viewport,m.content),p={...s,sizes:m,onSizesChange:f,hasThumb:g>0&&g<1,onThumbChange:rt(x=>c.current=x,"onThumbChange"),onThumbPointerUp:rt(()=>d.current=0,"onThumbPointerUp"),onThumbPointerDown:rt(x=>d.current=x,"onThumbPointerDown")};function b(x,w){return bN(x,d.current,m,w)}return rt(b,"getScrollPosition"),i==="horizontal"?u.jsx(CI,{...p,ref:r,onThumbPositionChange:()=>{if(o.viewport&&c.current){const x=o.viewport.scrollLeft,w=M_(x,m,o.dir);c.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:x=>{o.viewport&&(o.viewport.scrollLeft=x)},onDragScroll:x=>{o.viewport&&(o.viewport.scrollLeft=b(x,o.dir))}}):i==="vertical"?u.jsx(EI,{...p,ref:r,onThumbPositionChange:()=>{if(o.viewport&&c.current){const x=o.viewport.scrollTop,w=M_(x,m);c.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:x=>{o.viewport&&(o.viewport.scrollTop=x)},onDragScroll:x=>{o.viewport&&(o.viewport.scrollTop=b(x))}}):null},"ScrollAreaScrollbarVisible")),CI=_.forwardRef(rt(function(t,r){const{sizes:i,onSizesChange:s,...o}=t,c=Ki(As,t.__scopeScrollArea),[d,m]=_.useState(),f=_.useRef(null),g=Qe(r,f,c.onScrollbarXChange);return _.useEffect(()=>{f.current&&m(getComputedStyle(f.current))},[f]),u.jsx(_N,{"data-orientation":"horizontal",...o,ref:g,sizes:i,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Vu(i)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.x),onDragScroll:p=>t.onDragScroll(p.x),onWheelScroll:(p,b)=>{if(c.viewport){const x=c.viewport.scrollLeft+p.deltaX;t.onWheelScroll(x),By(x,b)&&p.preventDefault()}},onResize:()=>{f.current&&c.viewport&&d&&s({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:f.current.clientWidth,paddingStart:Nu(d.paddingLeft),paddingEnd:Nu(d.paddingRight)}})}})},"ScrollAreaScrollbarX")),EI=_.forwardRef(rt(function(t,r){const{sizes:i,onSizesChange:s,...o}=t,c=Ki(As,t.__scopeScrollArea),[d,m]=_.useState(),f=_.useRef(null),g=Qe(r,f,c.onScrollbarYChange);return _.useEffect(()=>{f.current&&m(getComputedStyle(f.current))},[f]),u.jsx(_N,{"data-orientation":"vertical",...o,ref:g,sizes:i,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Vu(i)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.y),onDragScroll:p=>t.onDragScroll(p.y),onWheelScroll:(p,b)=>{if(c.viewport){const x=c.viewport.scrollTop+p.deltaY;t.onWheelScroll(x),By(x,b)&&p.preventDefault()}},onResize:()=>{f.current&&c.viewport&&d&&s({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:f.current.clientHeight,paddingStart:Nu(d.paddingTop),paddingEnd:Nu(d.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[RI,vN]=mN(As),_N=_.forwardRef(rt(function(t,r){const{__scopeScrollArea:i,sizes:s,hasThumb:o,onThumbChange:c,onThumbPointerUp:d,onThumbPointerDown:m,onThumbPositionChange:f,onDragScroll:g,onWheelScroll:p,onResize:b,...x}=t,w=Ki(As,i),[S,E]=_.useState(null),C=Qe(r,E),A=_.useRef(null),N=_.useRef(""),k=w.viewport,O=s.content-s.viewport,z=hr(p),H=hr(f),D=Gu(b,10);function G(Y){if(A.current){const W=Y.clientX-A.current.left,L=Y.clientY-A.current.top;g({x:W,y:L})}}return rt(G,"handleDragScroll"),_.useEffect(()=>{const Y=rt(W=>{const L=W.target;(S==null?void 0:S.contains(L))&&z(W,O)},"handleWheel");return document.addEventListener("wheel",Y,{passive:!1}),()=>document.removeEventListener("wheel",Y,{passive:!1})},[k,S,O,z]),_.useEffect(H,[s,H]),mo(S,D),mo(w.content,D),u.jsx(RI,{scope:i,scrollbar:S,hasThumb:o,onThumbChange:hr(c),onThumbPointerUp:hr(d),onThumbPositionChange:H,onThumbPointerDown:hr(m),children:u.jsx(Ue.div,{...x,ref:C,style:{position:"absolute",...x.style},onPointerDown:va(t.onPointerDown,Y=>{Y.button===0&&(Y.target.setPointerCapture(Y.pointerId),A.current=S.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),G(Y))}),onPointerMove:va(t.onPointerMove,G),onPointerUp:va(t.onPointerUp,Y=>{const W=Y.target;W.hasPointerCapture(Y.pointerId)&&W.releasePointerCapture(Y.pointerId),document.body.style.webkitUserSelect=N.current,w.viewport&&(w.viewport.style.scrollBehavior=""),A.current=null})})})},"ScrollAreaScrollbarImpl")),A_="ScrollAreaThumb",kI=_.forwardRef(rt(function(t,r){const{forceMount:i,...s}=t,o=vN(A_,t.__scopeScrollArea);return u.jsx(im,{present:i||o.hasThumb,children:u.jsx(NI,{ref:r,...s})})},"ScrollAreaThumb")),NI=_.forwardRef(rt(function(t,r){const{__scopeScrollArea:i,style:s,...o}=t,c=Ki(A_,i),d=vN(A_,i),{onThumbPositionChange:m}=d,f=Qe(r,d.onThumbChange),g=_.useRef(void 0),p=Gu(()=>{g.current&&(g.current(),g.current=void 0)},100);return _.useEffect(()=>{const b=c.viewport;if(b){const x=rt(()=>{if(p(),!g.current){const w=TI(b,m);g.current=w,m()}},"handleScroll");return m(),b.addEventListener("scroll",x),()=>b.removeEventListener("scroll",x)}},[c.viewport,p,m]),u.jsx(Ue.div,{"data-state":d.hasThumb?"visible":"hidden",...o,ref:f,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:va(t.onPointerDownCapture,b=>{const w=b.target.getBoundingClientRect(),S=b.clientX-w.left,E=b.clientY-w.top;d.onThumbPointerDown({x:S,y:E})}),onPointerUp:va(t.onPointerUp,d.onThumbPointerUp)})},"ScrollAreaThumbImpl")),yN="ScrollAreaCorner",AI=_.forwardRef(rt(function(t,r){const i=Ki(yN,t.__scopeScrollArea),s=!!(i.scrollbarX&&i.scrollbarY);return i.type!=="scroll"&&s?u.jsx(MI,{...t,ref:r}):null},"ScrollAreaCorner")),MI=_.forwardRef(rt(function(t,r){const{__scopeScrollArea:i,...s}=t,o=Ki(yN,i),[c,d]=_.useState(0),[m,f]=_.useState(0),g=!!(c&&m),{onCornerWidthChange:p,onCornerHeightChange:b}=o;return mo(o.scrollbarX,()=>{var w;const x=((w=o.scrollbarX)==null?void 0:w.offsetHeight)||0;o.onCornerHeightChange(x),f(x)}),mo(o.scrollbarY,()=>{var w;const x=((w=o.scrollbarY)==null?void 0:w.offsetWidth)||0;o.onCornerWidthChange(x),d(x)}),_.useEffect(()=>()=>{p(0),b(0)},[p,b]),g?u.jsx(Ue.div,{...s,ref:r,style:{width:c,height:m,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null},"ScrollAreaCornerImpl"));function Nu(e){return e?parseInt(e,10):0}rt(Nu,"toInt");function Ly(e,t){const r=e/t;return isNaN(r)?0:r}rt(Ly,"getThumbRatio");function Vu(e){const t=Ly(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=(e.scrollbar.size-r)*t;return Math.max(i,18)}rt(Vu,"getThumbSize");function bN(e,t,r,i="ltr"){const s=Vu(r),o=s/2,c=t||o,d=s-c,m=r.scrollbar.paddingStart+c,f=r.scrollbar.size-r.scrollbar.paddingEnd-d,g=r.content-r.viewport,p=i==="ltr"?[0,g]:[g*-1,0];return jy([m,f],p)(e)}rt(bN,"getScrollPositionFromPointer");function M_(e,t,r="ltr"){const i=Vu(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,c=t.content-t.viewport,d=o-i,m=r==="ltr"?[0,c]:[c*-1,0],f=k_(e,m);return jy([0,c],[0,d])(f)}rt(M_,"getThumbOffsetFromScroll");function jy(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const i=(t[1]-t[0])/(e[1]-e[0]);return t[0]+i*(r-e[0])}}rt(jy,"linearScale");function By(e,t){return e>0&&e<t}rt(By,"isScrollingWithinScrollbarBounds");var TI=rt((e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},i=0;return rt((function s(){const o={left:e.scrollLeft,top:e.scrollTop},c=r.left!==o.left,d=r.top!==o.top;(c||d)&&t(),r=o,i=window.requestAnimationFrame(s)}),"loop")(),()=>window.cancelAnimationFrame(i)},"addUnlinkedScrollListener");function Gu(e,t){const r=hr(e),i=_.useRef(0);return _.useEffect(()=>()=>window.clearTimeout(i.current),[]),_.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(r,t)},[r,t])}rt(Gu,"useDebounceCallback");function mo(e,t){const r=hr(t);Wt(()=>{let i=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(i),s.unobserve(e)}}},[e,r])}rt(mo,"useResizeObserver");var xN=_I,DI=bI,LI=AI;const un=_.forwardRef(({className:e,children:t,viewportClassName:r,viewportRef:i,viewportProps:s,scrollbars:o="vertical",type:c="auto",...d},m)=>u.jsxs(xN,{ref:m,"data-slot":"scroll-area",type:c,className:at("relative overflow-hidden",e),...d,children:[u.jsx(DI,{ref:i,"data-slot":"scroll-area-viewport",className:at("size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-2 focus-visible:ring-[var(--ring)]/45",o==="vertical"&&"[&>div]:!block [&>div]:min-w-0 [&>div]:w-full",r),...s,children:t}),o!=="horizontal"&&u.jsx(T_,{orientation:"vertical"}),o!=="vertical"&&u.jsx(T_,{orientation:"horizontal"}),u.jsx(LI,{"data-slot":"scroll-area-corner"})]}));un.displayName=xN.displayName;const T_=_.forwardRef(({className:e,orientation:t="vertical",style:r,...i},s)=>u.jsx(pN,{ref:s,"data-slot":"scroll-area-scrollbar",orientation:t,className:at("group flex touch-none select-none p-px transition-colors",t==="vertical"&&"h-full w-2",t==="horizontal"&&"h-2 flex-col",e),style:{...t==="vertical"?{right:2}:{bottom:2},...r},...i,children:u.jsx(kI,{"data-slot":"scroll-area-thumb",className:at("relative flex-1 rounded-full bg-[var(--scrollbar-thumb)] transition-colors group-hover:bg-[var(--scrollbar-thumb-hover)] active:bg-[var(--scrollbar-thumb-active)]",t==="vertical"?"min-h-8 w-full":"h-full min-w-8")})}));T_.displayName=pN.displayName;function jI(e){const t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var wN=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),BI="VisuallyHidden",OI=_.forwardRef((e,t)=>u.jsx(Ue.span,{...e,ref:t,style:{...wN,...e.style}}));OI.displayName=BI;var PI=[" ","Enter","ArrowUp","ArrowDown"],zI=[" ","Enter"],po="Select",[nm,sm,II]=py(po),[Ro]=pn(po,[II,Zf]),am=Zf(),[$I,Ma]=Ro(po),[UI,HI]=Ro(po),FI="SelectProvider";function SN(e){const{__scopeSelect:t,children:r,open:i,defaultOpen:s,onOpenChange:o,value:c,defaultValue:d,onValueChange:m,dir:f,name:g,autoComplete:p,disabled:b,required:x,form:w,internal_do_not_use_render:S}=e,E=am(t),[C,A]=_.useState(null),[N,k]=_.useState(null),[O,z]=_.useState(!1),H=Uu(f),[D,G]=co({prop:i,defaultProp:s??!1,onChange:o,caller:po}),[Y,W]=co({prop:c,defaultProp:d,onChange:m,caller:po}),L=_.useRef(null),T=_.useRef(Y);_.useEffect(()=>{const X=w?C==null?void 0:C.ownerDocument.getElementById(w):C==null?void 0:C.form;if(X instanceof HTMLFormElement){const V=()=>W(T.current);return X.addEventListener("reset",V),()=>X.removeEventListener("reset",V)}},[w,C,W]);const j=C?!!w||!!C.closest("form"):!0,[U,M]=_.useState(new Set),P=on(),I=Array.from(U).map(X=>X.props.value).join(";"),F=_.useCallback(X=>{M(V=>new Set(V).add(X))},[]),q=_.useCallback(X=>{M(V=>{const J=new Set(V);return J.delete(X),J})},[]),$={required:x,trigger:C,onTriggerChange:A,valueNode:N,onValueNodeChange:k,valueNodeHasChildren:O,onValueNodeHasChildrenChange:z,contentId:P,value:Y,onValueChange:W,open:D,onOpenChange:G,dir:H,triggerPointerDownPosRef:L,disabled:b,name:g,autoComplete:p,form:w,nativeOptions:U,nativeSelectKey:I,isFormControl:j};return u.jsx(fk,{...E,children:u.jsx($I,{scope:t,...$,children:u.jsx(nm.Provider,{scope:t,children:u.jsx(UI,{scope:t,onNativeOptionAdd:F,onNativeOptionRemove:q,children:i7(S)?S($):r})})})})}SN.displayName=FI;var CN=e=>{const{__scopeSelect:t,children:r,...i}=e;return u.jsx(SN,{__scopeSelect:t,...i,internal_do_not_use_render:({isFormControl:s})=>u.jsxs(u.Fragment,{children:[r,s?u.jsx(WN,{__scopeSelect:t}):null]})})};CN.displayName=po;var EN="SelectTrigger",Oy=_.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:i=!1,...s}=e,o=am(r),c=Ma(EN,r),d=c.disabled||i,m=Qe(t,c.onTriggerChange),f=sm(r),g=_.useRef("touch"),[p,b,x]=qN(S=>{const E=f().filter(N=>!N.disabled),C=E.find(N=>N.value===c.value),A=VN(E,S,C);A!==void 0&&c.onValueChange(A.value)}),w=S=>{d||(c.onOpenChange(!0),x()),S&&(c.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return u.jsx(mk,{asChild:!0,...o,children:u.jsx(Ue.button,{type:"button",role:"combobox","aria-controls":c.open?c.contentId:void 0,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":om(c.value)?"":void 0,...s,ref:m,onClick:Be(s.onClick,S=>{S.currentTarget.focus(),g.current!=="mouse"&&w(S)}),onPointerDown:Be(s.onPointerDown,S=>{g.current=S.pointerType;const E=S.target;E.hasPointerCapture(S.pointerId)&&E.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(w(S),S.preventDefault())}),onKeyDown:Be(s.onKeyDown,S=>{const E=p.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&b(S.key),!(E&&S.key===" ")&&PI.includes(S.key)&&(w(),S.preventDefault())})})})});Oy.displayName=EN;var RN="SelectValue",Py=_.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:s,children:o,placeholder:c="",...d}=e,m=Ma(RN,r),{onValueNodeHasChildrenChange:f}=m,g=o!==void 0,p=Qe(t,m.onValueNodeChange);Wt(()=>{f(g)},[f,g]);const b=om(m.value);return u.jsx(Ue.span,{...d,asChild:b?!1:d.asChild,ref:p,style:{pointerEvents:"none"},children:u.jsx(_.Fragment,{children:b?c:o},b?"placeholder":"value")})});Py.displayName=RN;var WI="SelectIcon",kN=_.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,...s}=e;return u.jsx(Ue.span,{"aria-hidden":!0,...s,ref:t,children:i||"▼"})});kN.displayName=WI;var NN="SelectPortal",[qI,VI]=Ro(NN,{forceMount:void 0}),AN=e=>{const{__scopeSelect:t,forceMount:r,...i}=e;return u.jsx(qI,{scope:e.__scopeSelect,forceMount:r,children:u.jsx(Pf,{asChild:!0,...i})})};AN.displayName=NN;var xa="SelectContent",zy=_.forwardRef((e,t)=>{const r=VI(xa,e.__scopeSelect),{forceMount:i=r.forceMount,...s}=e,o=Ma(xa,e.__scopeSelect),[c,d]=_.useState();return Wt(()=>{d(new DocumentFragment)},[]),u.jsx(gn,{present:i||o.open,children:({present:m})=>m?u.jsx(DN,{...s,ref:t}):u.jsx(MN,{...s,fragment:c})})});zy.displayName=xa;var MN=_.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,fragment:s}=e;return s?_o.createPortal(u.jsx(TN,{scope:r,children:u.jsx(nm.Slot,{scope:r,children:u.jsx("div",{ref:t,children:i})})}),s):null});MN.displayName="SelectContentFragment";var nn=10,[TN,Ta]=Ro(xa),GI="SelectContentImpl",YI=uo("SelectContent.RemoveScroll"),DN=_.forwardRef((e,t)=>{const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:c,side:d,sideOffset:m,align:f,alignOffset:g,arrowPadding:p,collisionBoundary:b,collisionPadding:x,sticky:w,hideWhenDetached:S,avoidCollisions:E,...C}=e,A=Ma(xa,r),[N,k]=_.useState(null),[O,z]=_.useState(null),H=Qe(t,k),[D,G]=_.useState(null),[Y,W]=_.useState(null),L=sm(r),[T,j]=_.useState(!1),U=_.useRef(!1);_.useEffect(()=>{if(N)return oy(N)},[N]),ay();const M=_.useCallback(ee=>{const[se,...ce]=L().map(Ne=>Ne.ref.current),[Se]=ce.slice(-1),Re=document.activeElement;for(const Ne of ee)if(Ne===Re||(Ne==null||Ne.scrollIntoView({block:"nearest"}),Ne===se&&O&&(O.scrollTop=0),Ne===Se&&O&&(O.scrollTop=O.scrollHeight),Ne==null||Ne.focus(),document.activeElement!==Re))return},[L,O]),P=_.useCallback(()=>M([D,N]),[M,D,N]);_.useEffect(()=>{T&&P()},[T,P]);const{onOpenChange:I,triggerPointerDownPosRef:F}=A;_.useEffect(()=>{if(N){let ee={x:0,y:0};const se=Se=>{var Re,Ne;ee={x:Math.abs(Math.round(Se.pageX)-(((Re=F.current)==null?void 0:Re.x)??0)),y:Math.abs(Math.round(Se.pageY)-(((Ne=F.current)==null?void 0:Ne.y)??0))}},ce=Se=>{ee.x<=10&&ee.y<=10?Se.preventDefault():Se.composedPath().includes(N)||I(!1),document.removeEventListener("pointermove",se),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",ce,{capture:!0})}}},[N,I,F]),_.useEffect(()=>{const ee=()=>I(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[I]);const[q,$]=qN(ee=>{const se=L().filter(Re=>!Re.disabled),ce=se.find(Re=>Re.ref.current===document.activeElement),Se=VN(se,ee,ce);Se&&setTimeout(()=>{var Re;return(Re=Se.ref.current)==null?void 0:Re.focus()})}),X=_.useCallback((ee,se,ce)=>{const Se=!U.current&&!ce;(A.value!==void 0&&A.value===se||Se)&&(G(ee),Se&&(U.current=!0))},[A.value]),V=_.useCallback(()=>N==null?void 0:N.focus(),[N]),J=_.useCallback((ee,se,ce)=>{const Se=!U.current&&!ce;(A.value!==void 0&&A.value===se||Se)&&W(ee)},[A.value]),le=i==="popper"?D_:LN,ae=le===D_?{side:d,sideOffset:m,align:f,alignOffset:g,arrowPadding:p,collisionBoundary:b,collisionPadding:x,sticky:w,hideWhenDetached:S,avoidCollisions:E}:{};return u.jsx(TN,{scope:r,content:N,viewport:O,onViewportChange:z,itemRefCallback:X,selectedItem:D,onItemLeave:V,itemTextRefCallback:J,focusSelectedItem:P,selectedItemText:Y,position:i,isPositioned:T,searchRef:q,children:u.jsx(If,{as:YI,allowPinchZoom:!0,children:u.jsx(Of,{asChild:!0,trapped:A.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:Be(s,ee=>{var se;(se=A.trigger)==null||se.focus({preventScroll:!0}),ee.preventDefault()}),children:u.jsx(Bf,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:u.jsx(le,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:ee=>ee.preventDefault(),...C,...ae,onPlaced:()=>j(!0),ref:H,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:Be(C.onKeyDown,ee=>{const se=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!se&&ee.key.length===1&&$(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let Se=L().filter(Re=>!Re.disabled).map(Re=>Re.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(Se=Se.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const Re=ee.target,Ne=Se.indexOf(Re);Se=Se.slice(Ne+1)}setTimeout(()=>M(Se)),ee.preventDefault()}})})})})})})});DN.displayName=GI;var KI="SelectItemAlignedPosition",LN=_.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:i,...s}=e,o=Ma(xa,r),c=Ta(xa,r),[d,m]=_.useState(null),[f,g]=_.useState(null),p=Qe(t,g),b=sm(r),x=_.useRef(!1),w=_.useRef(!0),{viewport:S,selectedItem:E,selectedItemText:C,focusSelectedItem:A}=c,N=_.useCallback(()=>{if(o.trigger&&o.valueNode&&d&&f&&S&&E&&C){const H=o.trigger.getBoundingClientRect(),D=f.getBoundingClientRect(),G=o.valueNode.getBoundingClientRect(),Y=C.getBoundingClientRect();if(o.dir!=="rtl"){const Re=Y.left-D.left,Ne=G.left-Re,Q=H.left-Ne,re=H.width+Q,be=Math.max(re,D.width),pe=window.innerWidth-nn,Ee=k_(Ne,[nn,Math.max(nn,pe-be)]);d.style.minWidth=re+"px",d.style.left=Ee+"px"}else{const Re=D.right-Y.right,Ne=window.innerWidth-G.right-Re,Q=window.innerWidth-H.right-Ne,re=H.width+Q,be=Math.max(re,D.width),pe=window.innerWidth-nn,Ee=k_(Ne,[nn,Math.max(nn,pe-be)]);d.style.minWidth=re+"px",d.style.right=Ee+"px"}const W=b(),L=window.innerHeight-nn*2,T=S.scrollHeight,j=window.getComputedStyle(f),U=parseInt(j.borderTopWidth,10),M=parseInt(j.paddingTop,10),P=parseInt(j.borderBottomWidth,10),I=parseInt(j.paddingBottom,10),F=U+M+T+I+P,q=Math.min(E.offsetHeight*5,F),$=window.getComputedStyle(S),X=parseInt($.paddingTop,10),V=parseInt($.paddingBottom,10),J=H.top+H.height/2-nn,le=L-J,ae=E.offsetHeight/2,ee=E.offsetTop+ae,se=U+M+ee,ce=F-se;if(se<=J){const Re=W.length>0&&E===W[W.length-1].ref.current;d.style.bottom="0px";const Ne=f.clientHeight-S.offsetTop-S.offsetHeight,Q=Math.max(le,ae+(Re?V:0)+Ne+P),re=se+Q;d.style.height=re+"px"}else{const Re=W.length>0&&E===W[0].ref.current;d.style.top="0px";const Q=Math.max(J,U+S.offsetTop+(Re?X:0)+ae)+ce;d.style.height=Q+"px",S.scrollTop=se-J+S.offsetTop}d.style.margin=`${nn}px 0`,d.style.minHeight=q+"px",d.style.maxHeight=L+"px",i==null||i(),requestAnimationFrame(()=>x.current=!0)}},[b,o.trigger,o.valueNode,d,f,S,E,C,o.dir,i]);Wt(()=>N(),[N]);const[k,O]=_.useState();Wt(()=>{f&&O(window.getComputedStyle(f).zIndex)},[f]);const z=_.useCallback(H=>{H&&w.current===!0&&(N(),A==null||A(),w.current=!1)},[N,A]);return u.jsx(ZI,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:x,onScrollButtonChange:z,children:u.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:u.jsx(Ue.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});LN.displayName=KI;var XI="SelectPopperPosition",D_=_.forwardRef((e,t)=>{const{__scopeSelect:r,align:i="start",collisionPadding:s=nn,...o}=e,c=am(r);return u.jsx(pk,{...c,...o,ref:t,align:i,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});D_.displayName=XI;var[ZI,Iy]=Ro(xa,{}),L_="SelectViewport",jN=_.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:i,...s}=e,o=Ta(L_,r),c=Iy(L_,r),d=Qe(t,o.onViewportChange),m=_.useRef(0);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),u.jsx(nm.Slot,{scope:r,children:u.jsx(Ue.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Be(s.onScroll,f=>{const g=f.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:b}=c;if(b!=null&&b.current&&p){const x=Math.abs(m.current-g.scrollTop);if(x>0){const w=window.innerHeight-nn*2,S=parseFloat(p.style.minHeight),E=parseFloat(p.style.height),C=Math.max(S,E);if(C<w){const A=C+x,N=Math.min(w,A),k=A-N;p.style.height=N+"px",p.style.bottom==="0px"&&(g.scrollTop=k>0?k:0,p.style.justifyContent="flex-end")}}}m.current=g.scrollTop})})})]})});jN.displayName=L_;var BN="SelectGroup",[JI,QI]=Ro(BN),$y=_.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=on();return u.jsx(JI,{scope:r,id:s,children:u.jsx(Ue.div,{role:"group","aria-labelledby":s,...i,ref:t})})});$y.displayName=BN;var ON="SelectLabel",Uy=_.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=QI(ON,r);return u.jsx(Ue.div,{id:s.id,...i,ref:t})});Uy.displayName=ON;var vf="SelectItem",[e7,PN]=Ro(vf),Hy=_.forwardRef((e,t)=>{const{__scopeSelect:r,value:i,disabled:s=!1,textValue:o,...c}=e,d=Ma(vf,r),m=Ta(vf,r),f=d.value===i,[g,p]=_.useState(o??""),[b,x]=_.useState(!1),w=hr(N=>{var k;return(k=m.itemRefCallback)==null?void 0:k.call(m,N,i,s)}),S=Qe(t,w),E=on(),C=_.useRef("touch"),A=()=>{s||(d.onValueChange(i),d.onOpenChange(!1))};return u.jsx(e7,{scope:r,value:i,disabled:s,textId:E,isSelected:f,onItemTextChange:_.useCallback(N=>{p(k=>k||((N==null?void 0:N.textContent)??"").trim())},[]),children:u.jsx(nm.ItemSlot,{scope:r,value:i,disabled:s,textValue:g,children:u.jsx(Ue.div,{role:"option","aria-labelledby":E,"data-highlighted":b?"":void 0,"aria-selected":f&&b,"data-state":f?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...c,ref:S,onFocus:Be(c.onFocus,()=>x(!0)),onBlur:Be(c.onBlur,()=>x(!1)),onClick:Be(c.onClick,()=>{C.current!=="mouse"&&A()}),onPointerUp:Be(c.onPointerUp,()=>{C.current==="mouse"&&A()}),onPointerDown:Be(c.onPointerDown,N=>{C.current=N.pointerType}),onPointerMove:Be(c.onPointerMove,N=>{var k;C.current=N.pointerType,s?(k=m.onItemLeave)==null||k.call(m):C.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Be(c.onPointerLeave,N=>{var k;N.currentTarget===document.activeElement&&((k=m.onItemLeave)==null||k.call(m))}),onKeyDown:Be(c.onKeyDown,N=>{var O;s||N.target!==N.currentTarget||((O=m.searchRef)==null?void 0:O.current)!==""&&N.key===" "||(zI.includes(N.key)&&A(),N.key===" "&&N.preventDefault())})})})})});Hy.displayName=vf;var du="SelectItemText",zN=_.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:s,...o}=e,c=Ma(du,r),d=Ta(du,r),m=PN(du,r),f=HI(du,r),[g,p]=_.useState(null),b=hr(A=>{var N;return(N=d.itemTextRefCallback)==null?void 0:N.call(d,A,m.value,m.disabled)}),x=Qe(t,p,m.onItemTextChange,b),w=g==null?void 0:g.textContent,S=_.useMemo(()=>u.jsx("option",{value:m.value,disabled:m.disabled,children:w},m.value),[m.disabled,m.value,w]),{onNativeOptionAdd:E,onNativeOptionRemove:C}=f;return Wt(()=>(E(S),()=>C(S)),[E,C,S]),u.jsxs(u.Fragment,{children:[u.jsx(Ue.span,{id:m.textId,...o,ref:x}),m.isSelected&&c.valueNode&&!c.valueNodeHasChildren&&!om(c.value)?_o.createPortal(o.children,c.valueNode):null]})});zN.displayName=du;var IN="SelectItemIndicator",$N=_.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return PN(IN,r).isSelected?u.jsx(Ue.span,{"aria-hidden":!0,...i,ref:t}):null});$N.displayName=IN;var j_="SelectScrollUpButton",Fy=_.forwardRef((e,t)=>{const r=Ta(j_,e.__scopeSelect),i=Iy(j_,e.__scopeSelect),[s,o]=_.useState(!1),c=Qe(t,i.onScrollButtonChange);return Wt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const f=m.scrollTop>0;o(f)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?u.jsx(UN,{...e,ref:c,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});Fy.displayName=j_;var B_="SelectScrollDownButton",Wy=_.forwardRef((e,t)=>{const r=Ta(B_,e.__scopeSelect),i=Iy(B_,e.__scopeSelect),[s,o]=_.useState(!1),c=Qe(t,i.onScrollButtonChange);return Wt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const f=m.scrollHeight-m.clientHeight,g=Math.ceil(m.scrollTop)<f;o(g)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?u.jsx(UN,{...e,ref:c,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});Wy.displayName=B_;var UN=_.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:i,...s}=e,o=Ta("SelectScrollButton",r),c=_.useRef(null),d=sm(r),m=_.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return _.useEffect(()=>()=>m(),[m]),Wt(()=>{var g;const f=d().find(p=>p.ref.current===document.activeElement);(g=f==null?void 0:f.ref.current)==null||g.scrollIntoView({block:"nearest"})},[d]),u.jsx(Ue.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Be(s.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(i,50))}),onPointerMove:Be(s.onPointerMove,()=>{var f;(f=o.onItemLeave)==null||f.call(o),c.current===null&&(c.current=window.setInterval(i,50))}),onPointerLeave:Be(s.onPointerLeave,()=>{m()})})}),t7="SelectSeparator",qy=_.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return u.jsx(Ue.div,{"aria-hidden":!0,...i,ref:t})});qy.displayName=t7;var HN="SelectArrow",r7=_.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=am(r);return Ta(HN,r).position==="popper"?u.jsx(gk,{...s,...i,ref:t}):null});r7.displayName=HN;var FN="SelectBubbleInput",WN=_.forwardRef(({__scopeSelect:e,...t},r)=>{const i=Ma(FN,e),{value:s,onValueChange:o,required:c,disabled:d,name:m,autoComplete:f,form:g}=i,{nativeOptions:p,nativeSelectKey:b}=i,x=_.useRef(null),w=Qe(r,x),S=s??"",E=jI(S),C=Array.from(p).some(A=>(A.props.value??"")==="");return _.useEffect(()=>{const A=x.current;if(!A)return;const N=window.HTMLSelectElement.prototype,O=Object.getOwnPropertyDescriptor(N,"value").set;if(E!==S&&O){const z=new Event("change",{bubbles:!0});O.call(A,S),A.dispatchEvent(z)}},[E,S]),u.jsxs(Ue.select,{"aria-hidden":!0,required:c,tabIndex:-1,name:m,autoComplete:f,disabled:d,form:g,onChange:A=>o(A.target.value),...t,style:{...wN,...t.style},ref:w,defaultValue:S,children:[om(s)&&!C?u.jsx("option",{value:""}):null,Array.from(p)]},b)});WN.displayName=FN;function i7(e){return typeof e=="function"}function om(e){return e===""||e===void 0}function qN(e){const t=hr(e),r=_.useRef(""),i=_.useRef(0),s=_.useCallback(c=>{const d=r.current+c;t(d),(function m(f){r.current=f,window.clearTimeout(i.current),f!==""&&(i.current=window.setTimeout(()=>m(""),1e3))})(d)},[t]),o=_.useCallback(()=>{r.current="",window.clearTimeout(i.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,s,o]}function VN(e,t,r){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let c=n7(e,Math.max(o,0));s.length===1&&(c=c.filter(f=>f!==r));const m=c.find(f=>f.textValue.toLowerCase().startsWith(s.toLowerCase()));return m!==r?m:void 0}function n7(e,t){return e.map((r,i)=>e[(t+i)%e.length])}function lm(e){return u.jsx(CN,{"data-slot":"select",...e})}const O_=_.forwardRef(({className:e,...t},r)=>u.jsx($y,{ref:r,"data-slot":"select-group",className:at("scroll-my-1 p-1",e),...t}));O_.displayName=$y.displayName;const Yu=_.forwardRef((e,t)=>u.jsx(Py,{ref:t,"data-slot":"select-value",...e}));Yu.displayName=Py.displayName;const Ku=_.forwardRef(({className:e,size:t="default",children:r,...i},s)=>u.jsxs(Oy,{ref:s,"data-slot":"select-trigger","data-size":t,className:at("flex w-full min-w-0 items-center justify-between gap-1.5 whitespace-nowrap rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&>span]:min-w-0 [&>span]:truncate [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i,children:[r,u.jsx(kN,{asChild:!0,children:u.jsx(ey,{"aria-hidden":"true",className:"pointer-events-none size-4 shrink-0 text-muted-foreground"})})]}));Ku.displayName=Oy.displayName;const GN=_.forwardRef(({className:e,...t},r)=>u.jsx(Fy,{ref:r,"data-slot":"select-scroll-up-button",className:at("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:u.jsx(r4,{"aria-hidden":"true"})}));GN.displayName=Fy.displayName;const YN=_.forwardRef(({className:e,...t},r)=>u.jsx(Wy,{ref:r,"data-slot":"select-scroll-down-button",className:at("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:u.jsx(ey,{"aria-hidden":"true"})}));YN.displayName=Wy.displayName;const Xu=_.forwardRef(({className:e,children:t,position:r="popper",align:i="center",sideOffset:s=4,collisionPadding:o=8,...c},d)=>u.jsx(AN,{children:u.jsxs(zy,{ref:d,"data-slot":"select-content","data-align-trigger":r==="item-aligned",position:r,align:i,sideOffset:s,collisionPadding:o,className:at("cn-menu-translucent relative z-50 max-h-[var(--radix-select-content-available-height)] min-w-36 origin-[var(--radix-select-content-transform-origin)] overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"w-[var(--radix-select-trigger-width)] data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),...c,children:[u.jsx(GN,{}),u.jsx(jN,{"data-position":r,className:at("p-1",r==="popper"&&"min-w-[var(--radix-select-trigger-width)]"),children:t}),u.jsx(YN,{})]})}));Xu.displayName=zy.displayName;const P_=_.forwardRef(({className:e,...t},r)=>u.jsx(Uy,{ref:r,"data-slot":"select-label",className:at("px-1.5 py-1 text-xs text-muted-foreground",e),...t}));P_.displayName=Uy.displayName;const zn=_.forwardRef(({className:e,children:t,...r},i)=>u.jsxs(Hy,{ref:i,"data-slot":"select-item",className:at("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[u.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:u.jsx($N,{children:u.jsx(Lf,{"aria-hidden":"true",className:"pointer-events-none"})})}),u.jsx(zN,{children:t})]}));zn.displayName=Hy.displayName;const Vy=_.forwardRef(({className:e,...t},r)=>u.jsx(qy,{ref:r,"data-slot":"select-separator",className:at("pointer-events-none -mx-1 my-1 h-px bg-border",e),...t}));Vy.displayName=qy.displayName;var cm="Tabs",[s7]=pn(cm,[Jf]),KN=Jf(),[a7,Gy]=s7(cm),XN=_.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,onValueChange:s,defaultValue:o,orientation:c="horizontal",dir:d,activationMode:m="automatic",...f}=e,g=Uu(d),[p,b]=co({prop:i,onChange:s,defaultProp:o??"",caller:cm});return u.jsx(a7,{scope:r,baseId:on(),value:p,onValueChange:b,orientation:c,dir:g,activationMode:m,children:u.jsx(Ue.div,{dir:g,"data-orientation":c,...f,ref:t})})});XN.displayName=cm;var ZN="TabsList",JN=_.forwardRef((e,t)=>{const{__scopeTabs:r,loop:i=!0,...s}=e,o=Gy(ZN,r),c=KN(r);return u.jsx(Sk,{asChild:!0,...c,orientation:o.orientation,dir:o.dir,loop:i,children:u.jsx(Ue.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});JN.displayName=ZN;var QN="TabsTrigger",eA=_.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,disabled:s=!1,...o}=e,c=Gy(QN,r),d=KN(r),m=iA(c.baseId,i),f=nA(c.baseId,i),g=i===c.value;return u.jsx(Ck,{asChild:!0,...d,focusable:!s,active:g,children:u.jsx(Ue.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":f,"data-state":g?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:m,...o,ref:t,onMouseDown:Be(e.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?c.onValueChange(i):p.preventDefault()}),onKeyDown:Be(e.onKeyDown,p=>{s||p.target!==p.currentTarget||[" ","Enter"].includes(p.key)&&c.onValueChange(i)}),onFocus:Be(e.onFocus,()=>{const p=c.activationMode!=="manual";!g&&!s&&p&&c.onValueChange(i)})})})});eA.displayName=QN;var tA="TabsContent",rA=_.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,forceMount:s,children:o,...c}=e,d=Gy(tA,r),m=iA(d.baseId,i),f=nA(d.baseId,i),g=i===d.value,p=_.useRef(g);return _.useEffect(()=>{const b=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(b)},[]),u.jsx(gn,{present:s||g,children:({present:b})=>u.jsx(Ue.div,{"data-state":g?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!b,id:f,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:b&&o})})});rA.displayName=tA;function iA(e,t){return`${e}-trigger-${t}`}function nA(e,t){return`${e}-content-${t}`}var o7=XN,l7=JN,c7=eA,u7=rA;const Et={sessions:"/sessions",emulator:"/settings/emulator",overview:"/settings/overview",runtimes:"/settings/runtimes",providers:"/settings/providers",agents:"/settings/agents",skills:"/settings/skills",channels:"/settings/channels",instances:"/settings/instances",logs:"/settings/logs"},Au="/settings",sA=Et.overview,d7="/runtimes/:runtimeSelector/sessions",h7="/runtimes/:runtimeSelector/sessions/:sessionId",Mu="!invalid-runtime-owner",f7=/^[A-Za-z0-9][A-Za-z0-9._~-]{0,255}$/,m7={emulator:"/emulator",overview:"/overview",runtimes:"/runtimes",providers:"/providers",agents:"/agents",skills:"/skills",channels:"/channels",instances:"/instances",logs:"/logs"};function aA(e){const t=e.length>1?e.replace(/\/+$/,""):e;if(z_(t)||t===Et.sessions||t.startsWith(`${Et.sessions}/`))return"sessions";const r=Object.entries(Et).find(([,i])=>i===t);return(r==null?void 0:r[0])??"sessions"}function p7(e){const t=aA(e);return t==="sessions"?null:t}function z_(e){const t=/^\/runtimes\/([^/]+)\/sessions(?:\/[^/]+)?\/?$/.exec(e);if(!t)return null;try{return lA(decodeURIComponent(t[1]))}catch{return Mu}}function oA(e){const t=new URLSearchParams(e).getAll("runtime");return t.length===0?null:t.length!==1?Mu:lA(t[0])}function lA(e){return f7.test(e)?e:Mu}function I_(e,t){return`/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}`}function so(e){return`/runtimes/${encodeURIComponent(e)}/sessions`}function cA(e,t){const r=e==null?void 0:e.returnTo;return typeof r=="string"&&r.startsWith("/")&&!r.startsWith("//")&&r!==Au&&!r.startsWith(`${Au}/`)?r:t}class Wh extends Error{constructor(r,i,s,o){super(r);Ir(this,"status");Ir(this,"code");Ir(this,"outcome");this.name="ApiRequestError",this.status=i,this.code=s,this.outcome=o}}const g7="/api/runtimes/capability",v7="x-rynx-runtime-capability";let Rl;async function _7(e,t,r){const i=location.protocol==="https:"?"wss":"ws",s=await Tu(r.refreshCapability),o=new URLSearchParams({capability:s,role:r.role??"owner",cols:String(r.cols),rows:String(r.rows)});return`${i}://${location.host}/api/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/terminal?${o.toString()}`}function y7(e){const t=location.protocol==="https:"?"wss":"ws",r=new URLSearchParams;e&&r.set("device",e);const i=r.toString();return`${t}://${location.host}/api/emulator/touch${i?`?${i}`:""}`}async function b7(e,t,r,i){const s=i?`${Ui(i,e)}/interactions/${encodeURIComponent(t)}/resolve`:`/api/sessions/${encodeURIComponent(e)}/interactions/${encodeURIComponent(t)}/resolve`,o={method:"POST",body:JSON.stringify({resolution:r})};return(i?await Bt(s,o):await Fe(s,o)).disposition}async function Fe(e,t={}){return uA(e,{},t)}async function uA(e,t,r={}){const i=new Headers(r.headers);r.body&&i.set("content-type","application/json");const s=await fetch(e,{...r,headers:i});if(!s.ok){let c=`${s.status}`,d,m;try{const f=await s.json();typeof f.error=="string"&&(d=f.error,c=f.error),(f.outcome==="not_started"||f.outcome==="unknown")&&(m=f.outcome)}catch{}throw new Wh(c,s.status,d,m)}const o=await s.text();return o?JSON.parse(o):t}async function Tu(e=!1){return e&&(Rl=void 0),Rl||(Rl=Fe(g7,{cache:"no-store"}).then(({capability:t})=>{if(typeof t!="string"||!/^[A-Za-z0-9_-]{43}$/.test(t))throw new Error("invalid Runtime Web capability");return t}).catch(t=>{throw Rl=void 0,t})),Rl}async function Bt(e,t){const r=async s=>{const o=new Headers(t.headers);return o.set(v7,s),Fe(e,{...t,headers:o})},i=await Tu();try{return await r(i)}catch(s){if(!(s instanceof Error)||s.message!=="invalid_runtime_capability")throw s;return Rl=void 0,r(await Tu())}}async function Zg(e,t={}){const r=new Headers(t.headers),i=await fetch(e,{...t,headers:r});if(!i.ok){let s=`${i.status}`;try{const o=await i.json();o.error&&(s=o.error)}catch{}throw new Error(s)}return i.blob()}async function oC(e,t,r,i){const s=new Headers({"content-type":"application/json"}),o=await fetch(e,{method:"POST",headers:s,body:t===void 0?void 0:JSON.stringify(t),signal:i});await dA(o,r)}async function x7(e,t,r){const i=await fetch(e,{signal:r});await dA(i,t)}async function dA(e,t){if(!e.ok||!e.body){let o=`${e.status}`;try{const c=await e.json();c.error&&(o=c.error)}catch{}throw new Error(o)}const r=e.body.getReader(),i=new TextDecoder;let s="";for(;;){const{done:o,value:c}=await r.read();if(o)break;s+=i.decode(c,{stream:!0});let d;for(;(d=s.indexOf(`
|
|
466
|
+
|
|
467
|
+
`))!==-1;){const m=s.slice(0,d);s=s.slice(d+2);const f=w7(m);f&&t(f)}}}function w7(e){let t="message",r="";for(const s of e.split(`
|
|
468
|
+
`))s.startsWith("event:")?t=s.slice(6).trim():s.startsWith("data:")&&(r+=s.slice(5).trim());if(!t&&!r)return null;let i={};try{r&&(i=JSON.parse(r))}catch{}return{event:t,data:i}}function $_(e,t){return e?`/api/runtimes/${encodeURIComponent(e)}/emulator/${t}`:`/api/emulator/${t}`}function Gc(e,t,r){const i=$_(e,t);return e?Bt(i,r):Fe(i,r)}function Ui(e,t,r){const i=`/api/runtimes/${encodeURIComponent(e)}/sessions`;if(t===void 0)return i;const s=`${i}/${encodeURIComponent(t)}`;return r?`${s}/${r}`:s}function kl(e,t,...r){const i=`${Ui(e,t)}/browser`;return r.length===0?i:`${i}/${r.map(s=>encodeURIComponent(s)).join("/")}`}function Ja(e,t,r){const i=`${Ui(e,t)}/emulator`;return r?`${i}/${r}`:i}function S7(e,t,r){const i=new URLSearchParams({bindingId:r});return`${Ui(e,t)}/emulator/frame?${i.toString()}`}function Yc(e,t,r,i,s){return Bt(kl(e,t,"pages",i,s),{method:"POST",body:JSON.stringify({browserGeneration:r})})}function Jg(e,t,r){return e?Ui(e,t,r):`/api/sessions/${encodeURIComponent(t)}/${r}`}const xe={meta:()=>Fe("/api/meta"),listRuntimeShareAddresses:()=>Fe("/api/runtime-server/share-addresses",{cache:"no-store"}).then(e=>e.addresses),shareRuntime:e=>Bt("/api/runtime-server/share",{method:"POST",body:JSON.stringify(e)}),listRuntimeAccess:()=>Fe("/api/runtime-server/access").then(e=>e.clients),revokeRuntimeAccess:e=>Bt(`/api/runtime-server/access/${encodeURIComponent(e)}`,{method:"DELETE"}),listRuntimes:()=>Fe("/api/runtimes").then(e=>e.runtimes),listProviderClis:e=>Fe(`/api/runtimes/${encodeURIComponent(e)}/provider-clis`,{cache:"no-store"}),startProviderCliOperation:(e,t,r)=>Bt(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/${encodeURIComponent(t)}/${r}`,{method:"POST",body:JSON.stringify({})}),getProviderCliJob:(e,t)=>Fe(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/jobs/${encodeURIComponent(t)}`,{cache:"no-store"}).then(r=>r.job),pairRuntime:e=>Bt("/api/runtimes/pair",{method:"POST",body:JSON.stringify(e)}),testRuntime:e=>Bt(`/api/runtimes/${encodeURIComponent(e)}/test`,{method:"POST",body:JSON.stringify({})}),forgetRuntime:e=>Bt(`/api/runtimes/${encodeURIComponent(e)}`,{method:"DELETE"}),getRuntimeBrowserState:(e,t)=>uA(kl(e,t),null),openRuntimeBrowser:(e,t,r)=>Bt(kl(e,t,"open"),{method:"POST",body:JSON.stringify(r===void 0?{}:{url:r})}),closeRuntimeBrowser:(e,t,r)=>Bt(kl(e,t,"close"),{method:"POST",body:JSON.stringify({browserGeneration:r})}),createRuntimeBrowserPage:(e,t,r,i)=>Bt(kl(e,t,"pages"),{method:"POST",body:JSON.stringify({browserGeneration:r,...i===void 0?{}:{url:i}})}),closeRuntimeBrowserPage:(e,t,r,i)=>Yc(e,t,r,i,"close"),activateRuntimeBrowserPage:(e,t,r,i)=>Yc(e,t,r,i,"activate"),navigateRuntimeBrowserPage:(e,t,r,i,s)=>Bt(kl(e,t,"pages",i,"navigate"),{method:"POST",body:JSON.stringify({browserGeneration:r,url:s})}),backRuntimeBrowserPage:(e,t,r,i)=>Yc(e,t,r,i,"back"),forwardRuntimeBrowserPage:(e,t,r,i)=>Yc(e,t,r,i,"forward"),reloadRuntimeBrowserPage:(e,t,r,i)=>Yc(e,t,r,i,"reload"),getSessionEmulator:(e,t)=>Fe(Ja(e,t)).then(r=>r.binding),listSessionEmulatorDevices:(e,t)=>Fe(Ja(e,t,"devices")).then(r=>r.devices),attachSessionEmulator:(e,t,r)=>Bt(Ja(e,t,"attach"),{method:"POST",body:JSON.stringify({device:r})}),detachSessionEmulator:(e,t,r)=>Bt(Ja(e,t,"detach"),{method:"POST",body:JSON.stringify({bindingId:r})}),tapSessionEmulator:(e,t,r,i,s)=>Bt(Ja(e,t,"tap"),{method:"POST",body:JSON.stringify({bindingId:r,x:i,y:s})}),gestureSessionEmulator:(e,t,r,i)=>Bt(Ja(e,t,"gesture"),{method:"POST",body:JSON.stringify({bindingId:r,points:i})}),buttonSessionEmulator:(e,t,r,i)=>Bt(Ja(e,t,"button"),{method:"POST",body:JSON.stringify({bindingId:r,name:i})}),sessionEmulatorFrameBlob:(e,t,r,i)=>Zg(S7(e,t,r),{signal:i,cache:"no-store"}),channelTypes:()=>Fe("/api/channel-types").then(e=>e.channelTypes),listChannels:()=>Fe("/api/channels").then(e=>e.channels),createChannel:e=>Fe("/api/channels",{method:"POST",body:JSON.stringify(e)}),updateChannel:(e,t)=>Fe(`/api/channels/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)}),deleteChannel:e=>Fe(`/api/channels/${encodeURIComponent(e)}`,{method:"DELETE"}),authorizeChannel:(e,t,r)=>oC(`/api/channels/${encodeURIComponent(e)}/authorize`,void 0,t,r),listInstances:()=>Fe("/api/instances").then(e=>e.instances),createInstance:e=>Fe("/api/instances",{method:"POST",body:JSON.stringify(e)}),updateInstance:(e,t)=>Fe(`/api/instances/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)}),instanceAction:(e,t)=>Fe(`/api/instances/${encodeURIComponent(e)}/${t}`,{method:"POST"}),deleteInstance:e=>Fe(`/api/instances/${encodeURIComponent(e)}`,{method:"DELETE"}),emulatorDevices:e=>Fe($_(e,"devices")).then(t=>t.devices),activeEmulator:e=>Fe($_(e,"active")).then(t=>t.active),attachEmulator:(e,t)=>Gc(t,"attach",{method:"POST",body:JSON.stringify({device:e})}),tapEmulator:(e,t,r,i)=>Gc(i,"tap",{method:"POST",body:JSON.stringify({x:e,y:t,device:r})}),gestureEmulator:(e,t,r)=>Gc(r,"gesture",{method:"POST",body:JSON.stringify({points:e,device:t})}),buttonEmulator:(e,t,r)=>Gc(r,"button",{method:"POST",body:JSON.stringify({name:e,device:t})}),shutdownEmulator:(e,t)=>Gc(t,"shutdown",{method:"POST",body:JSON.stringify({device:e})}),emulatorVideoStreamUrl:e=>`/api/emulator/video${e?`?device=${encodeURIComponent(e)}`:""}`,emulatorFrameBlob:e=>Zg(`/api/emulator/frame${e?`?device=${encodeURIComponent(e)}`:""}`),screenshotEmulator:(e,t)=>Fe("/api/emulator/screenshot",{method:"POST",body:JSON.stringify({device:e,out:t})}),emulatorScreenshotBlob:e=>Zg(`/api/emulator/screenshot-file?file=${encodeURIComponent(e)}`),listAgents:()=>Fe("/api/agents").then(e=>e.agents),getAgent:e=>Fe(`/api/agents/${encodeURIComponent(e)}`),writeAgent:e=>Fe("/api/agents",{method:"POST",body:JSON.stringify(e)}),deleteAgent:e=>Fe(`/api/agents/${encodeURIComponent(e)}`,{method:"DELETE"}),listSkills:()=>Fe("/api/skills").then(e=>e.skills),getSkill:e=>Fe(`/api/skills/${encodeURIComponent(e)}`),readSkillFile:(e,t)=>Fe(`/api/skills/${encodeURIComponent(e)}/file?path=${encodeURIComponent(t)}`),installSkill:e=>Fe("/api/skills",{method:"POST",body:JSON.stringify(e)}).then(t=>t.skills),deleteSkill:e=>Fe(`/api/skills/${encodeURIComponent(e)}`,{method:"DELETE"}),logs:(e,t=200)=>Fe(`/api/logs?lines=${t}${e?`&instance=${encodeURIComponent(e)}`:""}`).then(r=>r.logs),listSessions:e=>Fe(e?Ui(e):"/api/sessions").then(t=>t.sessions),listSessionAgentOptions:e=>Fe(`${Ui(e)}/agent-options`).then(t=>t.agents),listSessionLaunchOptions:e=>Fe(`${Ui(e)}/launch-options`),createSession:(e,t)=>{const r=t?Ui(t):"/api/sessions",i={method:"POST",body:JSON.stringify(e)};return t?Bt(r,i):Fe(r,i)},sendSessionMessage:(e,t,r,i,s)=>s?Bt(Ui(s,e,"messages"),{method:"POST",body:JSON.stringify({message:t}),signal:i}).then(()=>{}):oC(`/api/sessions/${encodeURIComponent(e)}/messages`,{message:t},r,i),startSessionTerminal:(e,t)=>Bt(Ui(e,t,"terminal/start"),{method:"POST",body:"{}"}),streamSession:(e,t,r,i)=>x7(Jg(i,e,"stream"),t,r),getSessionHistory:e=>Fe(`/api/sessions/${encodeURIComponent(e)}/history`).then(t=>t.items),getSessionSnapshot:(e,t,r)=>Fe(Jg(r,e,"snapshot"),{signal:t}),closeSession:(e,t)=>{const r=t?Ui(t,e):`/api/sessions/${encodeURIComponent(e)}`,i={method:"DELETE"};return t?Bt(r,i):Fe(r,i)},interruptSession:(e,t)=>{const r=Jg(t,e,"interrupt"),i={method:"POST"};return t?Bt(r,i):Fe(r,i)}},hA="rynx.control.runtime-target.v1",fA={selector:"local",daemonId:"local",displayName:"This device",binding:"local"};function C7(e){var t;if(!e)return"local";try{return((t=e.getItem(hA))==null?void 0:t.trim())||"local"}catch{return"local"}}function lC(e,t){if(e)try{e.setItem(hA,t)}catch{}}function E7(e){const t=new Map;for(const r of e)!r.selector||t.has(r.selector)||t.set(r.selector,r);return t.has("local")||t.set("local",fA),[...t.values()].sort((r,i)=>r.selector==="local"?-1:i.selector==="local"?1:r.displayName.localeCompare(i.displayName))}const mA=_.createContext(null);function R7({children:e}){const t=Pr(),r=wa(),i=z_(t.pathname)??(t.pathname===Et.sessions?oA(t.search):null),[s,o]=_.useState(()=>C7(typeof window>"u"?void 0:window.localStorage)),c=i??s,[d,m]=_.useState([fA]),f=_.useCallback(x=>{m(E7(x))},[]),g=_.useCallback(async()=>{try{f(await xe.listRuntimes())}catch(x){we.error(`Failed to load Runtimes: ${x.message}`)}},[f]);_.useEffect(()=>{g()},[g]),_.useEffect(()=>{!i||i===Mu||(o(i),lC(typeof window>"u"?void 0:window.localStorage,i))},[i]);const p=_.useCallback(x=>{const w=x.trim();if(!w)return;o(w),lC(typeof window>"u"?void 0:window.localStorage,w),(t.pathname===Et.sessions||t.pathname.startsWith(`${Et.sessions}/`)||z_(t.pathname)!==null)&&i!==w&&r(so(w))},[t.pathname,r,i]),b=_.useMemo(()=>{const x=d.find(S=>S.selector===c)??(c===Mu?{selector:c,daemonId:c,displayName:"Invalid Runtime URL",binding:"direct"}:{selector:c,daemonId:c,displayName:`${c} (unavailable)`,binding:c==="local"?"local":"direct"}),w=c!=="local";return{runtimes:d,runtimeSelector:c,runtimeRoute:w?c:void 0,selectedRuntime:x,isRemoteRuntime:w,selectRuntime:p,refreshRuntimes:g,updateRuntimes:f}},[g,c,d,p,f]);return u.jsx(mA.Provider,{value:b,children:e})}function Kl(){const e=_.useContext(mA);if(!e)throw new Error("useRuntimeTarget must be used inside RuntimeTargetProvider");return e}const cC="!add-runtime";function k7(){const e=Pr(),t=wa(),{runtimes:r,runtimeSelector:i,selectedRuntime:s,selectRuntime:o}=Kl(),c=r.some(m=>m.selector===i)?r:[...r,s],d=m=>{if(m===cC){t(Et.runtimes,{state:{returnTo:`${e.pathname}${e.search}${e.hash}`}});return}o(m)};return u.jsx("div",{className:"ml-auto w-44 max-w-full sm:w-60",children:u.jsxs(lm,{value:i,onValueChange:d,children:[u.jsxs(Ku,{className:"h-10 w-full min-w-0 gap-1.5 border-0 bg-transparent px-2 font-mono text-[10px] shadow-none hover:bg-[var(--accent)] focus-visible:ring-2 sm:h-7","aria-label":"Active Runtime",children:[u.jsx("span",{className:"hidden shrink-0 uppercase tracking-[0.12em] text-[var(--muted-foreground)] sm:inline",children:"Runtime ·"}),u.jsx(Yu,{placeholder:"Select Runtime"})]}),u.jsxs(Xu,{align:"end",children:[c.map(m=>{const f=m.binding==="local"?ty:jf;return u.jsx(zn,{value:m.selector,children:u.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[u.jsx(f,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),u.jsx("span",{className:"truncate",children:m.displayName})]})},m.selector)}),u.jsx(Vy,{}),u.jsx(zn,{value:cC,children:u.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[u.jsx(Gi,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),u.jsx("span",{children:"Add Runtime…"})]})})]})]})})}function qe(...e){return HR(hy(e))}function N7({children:e,theme:t,onToggleTheme:r}){const i=Pr(),{runtimeSelector:s}=Kl(),o=aA(i.pathname),c=i.pathname===Au||i.pathname.startsWith(`${Au}/`),d=cA(i.state,so(s)),m=c?d:sA,f=c?void 0:{returnTo:`${i.pathname}${i.search}${i.hash}`};return u.jsxs("div",{className:"grid h-dvh min-h-0 grid-rows-[minmax(0,1fr)_2.5rem] overflow-hidden bg-[var(--background)] sm:grid-rows-[minmax(0,1fr)_2rem]",children:[u.jsx("main",{className:"min-h-0 overflow-hidden focus:outline-none",children:e}),u.jsxs("footer",{className:"app-no-drag flex min-w-0 items-center gap-3 border-t border-[var(--border)] bg-[var(--muted)]/24 px-2 font-mono text-[10px] text-[var(--muted-foreground)] sm:px-3",children:[u.jsx("span",{className:"hidden truncate uppercase tracking-[0.12em] min-[480px]:block",children:c?o==="emulator"?"Emulator · local device":"Settings · local configuration":"Session workbench"}),u.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[c?u.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 px-1",children:[u.jsx("span",{className:"text-[var(--foreground)]",children:"Control Plane"}),u.jsx("span",{"aria-hidden":"true",children:"·"}),u.jsx("span",{children:"This device"})]}):u.jsx(k7,{}),u.jsx("span",{className:"h-3.5 w-px bg-[var(--border)]","aria-hidden":"true"}),u.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[u.jsx(ge,{variant:"ghost",size:"icon-xs",className:"shrink-0",onClick:r,"aria-label":t==="dark"?"Use light mode":"Use dark mode",title:t==="dark"?"Light mode":"Dark mode",children:t==="dark"?u.jsx(LB,{}):u.jsx(G4,{})}),u.jsx(ge,{asChild:!0,variant:"ghost",size:"icon-xs",className:qe("shrink-0",c&&"text-[var(--primary)]"),children:u.jsx(ma,{to:m,state:f,"aria-label":c?"Back to app":"Settings",title:c?"Back to app":"Settings",children:u.jsx(bB,{})})})]})]})]})]})}const U_="/assets/rynx-wordmark-LL1QRYHD.png",pA=[{label:"General",items:[{id:"overview",label:"Overview",icon:L4}]},{label:"Connections",items:[{id:"runtimes",label:"Runtimes",icon:jf}]},{label:"Devices",items:[{id:"emulator",label:"Emulator",icon:zl}]},{label:"Agents",items:[{id:"providers",label:"Providers",icon:iy},{id:"agents",label:"Agents",icon:J0},{id:"skills",label:"Skills",icon:HE}]},{label:"Integrations",items:[{id:"channels",label:"Channels",icon:Q0},{id:"instances",label:"Instances",icon:TE}]},{label:"Diagnostics",items:[{id:"logs",label:"Logs",icon:IE}]}],A7=pA.flatMap(e=>e.items);function M7({activeView:e,children:t}){const r=wa(),i=Pr(),{runtimeSelector:s}=Kl(),o=cA(i.state,so(s)),c={returnTo:o};return u.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-[var(--background)] md:grid md:grid-cols-[14rem_minmax(0,1fr)]",children:[u.jsxs("aside",{className:"hidden min-h-0 flex-col border-r border-[var(--border)] bg-[var(--muted)]/18 md:flex",children:[u.jsxs("div",{className:"app-drag-region desktop-macos-titlebar-inset border-b border-[var(--border)] p-2.5",children:[u.jsx("div",{className:"mb-2 flex h-7 items-center px-0.5",children:u.jsxs(ma,{to:o,className:"app-no-drag flex w-fit items-center gap-2","aria-label":"Rynx",children:[u.jsx("img",{src:U_,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"}),u.jsx("span",{className:"label-caps text-[8px] text-[var(--muted-foreground)]",children:"control"})]})}),u.jsx(ge,{asChild:!0,variant:"ghost",size:"sm",className:"app-no-drag w-full justify-start gap-2 px-2",children:u.jsxs(ma,{to:o,children:[u.jsx(Pl,{className:"size-3.5"}),"Back to app"]})})]}),u.jsx(un,{className:"min-h-0 flex-1",children:u.jsx("nav",{className:"space-y-4 p-3","aria-label":"Settings",children:pA.map(d=>u.jsxs("div",{children:[u.jsx("div",{className:"label-caps mb-1 px-2 text-[9px] text-[var(--muted-foreground)]",children:d.label}),u.jsx("div",{className:"grid gap-0.5",children:d.items.map(({id:m,label:f,icon:g})=>u.jsxs(ma,{to:Et[m],state:c,"aria-current":e===m?"page":void 0,className:qe("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors",e===m?"bg-[var(--primary)]/10 text-[var(--primary)]":"text-[var(--muted-foreground)] hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]"),children:[u.jsx(g,{className:"size-3.5 shrink-0"}),f]},m))})]},d.label))})})]}),u.jsxs("div",{className:"app-drag-region flex h-14 shrink-0 items-center gap-2 border-b border-[var(--border)] bg-[var(--muted)]/18 px-3 md:hidden",children:[u.jsx(ma,{to:o,className:"app-no-drag shrink-0","aria-label":"Rynx",children:u.jsx("img",{src:U_,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"})}),u.jsx(ge,{asChild:!0,variant:"ghost",size:"sm",className:"app-no-drag shrink-0 gap-1.5 px-2",children:u.jsxs(ma,{to:o,children:[u.jsx(Pl,{className:"size-3.5"}),"Back"]})}),u.jsx(fo,{"aria-label":"Settings page",value:e,className:"ml-auto min-w-0 flex-1",onChange:d=>r(Et[d.target.value],{state:c}),children:A7.map(({id:d,label:m})=>u.jsx("option",{value:d,children:m},d))})]}),e==="emulator"?u.jsx("section",{className:"min-h-0 flex-1 overflow-hidden",children:t}):u.jsx(un,{className:"min-h-0 flex-1",children:u.jsx("section",{className:"p-4 sm:p-6",children:t})})]})}var T7="Label",gA=_.forwardRef((e,t)=>u.jsx(Ue.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));gA.displayName=T7;var D7=gA;const Fr=_.forwardRef(({className:e,...t},r)=>u.jsx(D7,{ref:r,className:qe("text-xs font-medium text-[var(--muted-foreground)]",e),...t}));Fr.displayName="Label";function vA({onInstalled:e,triggerLabel:t="Install skill",triggerVariant:r="default"}){const[i,s]=_.useState(!1),[o,c]=_.useState(""),[d,m]=_.useState(""),[f,g]=_.useState(""),[p,b]=_.useState(!1);function x(){c(""),m(""),g("")}const w=(()=>{const A=o.trim();return!A||!d.trim()?A:`${A}#${d.trim()}`})(),S=!!d.trim()&&o.includes("#");async function E(){const A=w;if(A){if(S){we.error("Source already pins a ref with '#' — clear one of the two.");return}b(!0);try{const N=await xe.installSkill({tool:"skills-cli",source:A,...f.trim()?{skill:f.trim()}:{}});we.success(`Installed ${f.trim()||A}`),e(N),x(),s(!1)}catch(N){we.error(`Install failed: ${N.message}`)}finally{b(!1)}}}const C=["npx skills add",w||"<source>",f.trim()&&`--skill ${f.trim()}`].filter(Boolean).join(" ");return u.jsxs(wo,{open:i,onOpenChange:A=>{s(A),A||x()},children:[u.jsx(qR,{asChild:!0,children:u.jsxs(ge,{size:"sm",variant:r,children:[u.jsx(Gi,{})," ",t]})}),u.jsxs(Na,{children:[u.jsxs(So,{children:[u.jsx(Aa,{children:"Install a skill"}),u.jsxs(Vf,{children:["From the open skills ecosystem (skills.sh). Runs ",u.jsx("code",{children:"npx skills add"})," into the global catalog (",u.jsx("code",{children:"~/.rynx/skills"}),")."]})]}),u.jsxs("div",{className:"grid gap-3",children:[u.jsxs("div",{className:"grid gap-1.5",children:[u.jsxs(Fr,{children:["Source ",u.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),u.jsx(xt,{value:o,autoFocus:!0,placeholder:"vercel-labs/skills or https://github.com/owner/repo",onChange:A=>c(A.target.value)}),u.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["A repo (",u.jsx("code",{children:"owner/repo"}),"), a git URL, or a namespace."]})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsxs("div",{className:"grid gap-1.5",children:[u.jsx(Fr,{children:"Skill"}),u.jsx(xt,{value:f,placeholder:"find-skills",onChange:A=>g(A.target.value)}),u.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Optional — when a repo ships several."})]}),u.jsxs("div",{className:"grid gap-1.5",children:[u.jsx(Fr,{children:"Branch"}),u.jsx(xt,{value:d,placeholder:"main",onChange:A=>m(A.target.value)}),u.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["Optional — a git ref, sent as ",u.jsx("code",{children:"#<branch>"}),"."]})]})]}),u.jsx("pre",{className:"overflow-x-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-2.5 font-mono text-xs text-[var(--muted-foreground)]",children:C})]}),u.jsxs($u,{children:[u.jsx(ge,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),u.jsx(ge,{onClick:E,disabled:p||!o.trim(),children:p?"Installing…":"Install"})]})]})]})}const L7=["codex","traex","claude"],j7=["none","minimal","low","medium","high","xhigh","max","ultra"],B7=["read-only","workspace-write","danger-full-access"],O7=["never","on-failure","on-request","untrusted"],P7=["acceptEdits","auto","bypassPermissions","manual","dontAsk","plan"];function z7({value:e,onChange:t}){return u.jsxs("div",{className:"grid gap-4",children:[u.jsx(Zt,{label:"Display name",help:"Shown in the UI; the id (left) is the directory name.",children:u.jsx(xt,{value:e.name??"",placeholder:"My agent",onChange:r=>t({...e,name:r.target.value})})}),u.jsx(Zt,{label:"Description",children:u.jsx(xt,{value:e.description??"",placeholder:"What this agent does",onChange:r=>t({...e,description:r.target.value})})}),u.jsx(Zt,{label:"Instructions",help:"Inline system prompt, or a path to a .md under the agent dir.",children:u.jsx(rm,{value:e.instructions??"",className:"min-h-[14rem]",placeholder:"You are a helpful agent.",onChange:r=>t({...e,instructions:r.target.value})})})]})}function I7({value:e,onChange:t}){const r=e.executor??{},i=r.retry??{},s=c=>t({...e,executor:{...r,...c}}),o=c=>t({...e,executor:{...r,retry:{...i,...c}}});return u.jsxs("div",{className:"grid gap-4",children:[u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(Zt,{label:"Runtime",children:u.jsx(bu,{value:r.runtime,options:L7,required:!0,onChange:c=>s({runtime:c})})}),u.jsx(Zt,{label:"Reasoning effort",children:u.jsx(bu,{value:r.reasoningEffort,options:j7,onChange:c=>s({reasoningEffort:c})})})]}),u.jsx(Zt,{label:"Model",help:"Blank inherits the runtime default.",children:u.jsx(xt,{value:r.model??"",placeholder:"runtime default",onChange:c=>s({model:c.target.value||void 0})})}),u.jsx("div",{className:"label-caps pt-1 text-xs text-[var(--muted-foreground)]",children:"Execution budget"}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(Zt,{label:"Timeout (s)",help:"End-to-end wall-clock cap.",children:u.jsx(Kc,{value:r.timeout,onChange:c=>s({timeout:c})})}),u.jsx(Zt,{label:"Max iterations",help:"claude only (→ --max-turns).",children:u.jsx(Kc,{value:r.maxIterations,onChange:c=>s({maxIterations:c})})}),u.jsx(Zt,{label:"Context window",help:"codex/traex token budget.",children:u.jsx(Kc,{value:r.contextWindow,onChange:c=>s({contextWindow:c})})}),u.jsx(Zt,{label:"Retry: max retries",children:u.jsx(Kc,{value:i.maxRetries,onChange:c=>o({maxRetries:c})})}),u.jsx(Zt,{label:"Retry: timeout/req (s)",children:u.jsx(Kc,{value:i.timeoutPerRequestSeconds,onChange:c=>o({timeoutPerRequestSeconds:c})})})]})]})}function $7({value:e,onChange:t}){var o;const r=e.osEnv??{},i=c=>t({...e,osEnv:{...r,...c}}),s=((o=e.executor)==null?void 0:o.runtime)??"codex";return u.jsxs("div",{className:"grid gap-4",children:[u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s==="claude"?u.jsx(Zt,{label:"Permission mode",help:"Claude's approval axis (--permission-mode).",children:u.jsx(bu,{value:r.permissionMode,options:P7,onChange:c=>i({permissionMode:c})})}):u.jsxs(u.Fragment,{children:[u.jsx(Zt,{label:"Sandbox",children:u.jsx(bu,{value:r.sandbox,options:B7,onChange:c=>i({sandbox:c})})}),u.jsx(Zt,{label:"Approval policy",help:"Codex's approval axis.",children:u.jsx(bu,{value:r.approvalPolicy,options:O7,onChange:c=>i({approvalPolicy:c})})})]}),u.jsx(Zt,{label:"Working directory (cwd)",children:u.jsx(xt,{value:r.cwd??"",placeholder:"(inherit)",onChange:c=>i({cwd:c.target.value||void 0})})}),u.jsx(Zt,{label:"Full auto",children:u.jsxs("label",{className:"flex h-8 items-center gap-2 text-sm",children:[u.jsx("input",{type:"checkbox",className:"size-4",checked:!!r.fullAuto,onChange:c=>i({fullAuto:c.target.checked||void 0})}),u.jsx("span",{className:"text-[var(--muted-foreground)]",children:"enable"})]})})]}),u.jsx(Zt,{label:"Allowed dirs",help:"Extra writable roots beyond the base allow-list.",children:u.jsx(F_,{items:r.allowedDirs??[],placeholder:"/path/to/dir",onChange:c=>i({allowedDirs:c})})})]})}function U7({value:e,onChange:t}){const r=e.tools??{},i=s=>t({...e,tools:{...r,...s}});return u.jsxs("div",{className:"grid gap-4",children:[u.jsx(Zt,{label:"Allowed tools",help:"claude only; codex/traex ignore.",children:u.jsx(F_,{items:r.allowed??[],placeholder:"ToolName",onChange:s=>i({allowed:s})})}),u.jsx(Zt,{label:"Disallowed tools",children:u.jsx(F_,{items:r.disallowed??[],placeholder:"ToolName",onChange:s=>i({disallowed:s})})}),u.jsx(Zt,{label:"MCP servers",help:"HTTP transport only.",children:u.jsx(F7,{rows:r.mcp??[],onChange:s=>i({mcp:s})})})]})}function H7({value:e,onChange:t}){const r=e.skills??[],[i,s]=_.useState(null);_.useEffect(()=>{xe.listSkills().then(s).catch(g=>{s([]),we.error(`Load skills failed: ${g.message}`)})},[]);const o=new Set(r.map(g=>g.name)),c=g=>{g.ref&&t({...e,skills:[...r,{...g.ref}]})},d=g=>t({...e,skills:r.filter(p=>p.name!==g)}),m=new Set((i??[]).map(g=>g.name)),f=r.map(g=>g.name).filter(g=>!m.has(g));return u.jsxs("div",{className:"grid gap-4",children:[u.jsx(Zt,{label:"Skills",help:"Empty = no skills (hermetic). Each selection copies the skill's install recipe into the spec, so the agent installs its own skills wherever it runs.",children:i===null?u.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Loading…"}):i.length===0&&f.length===0?u.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"No skills installed yet — install one below."}):u.jsxs("div",{className:"grid gap-0.5 rounded-md border border-[var(--border)] p-1.5",children:[i.map(g=>u.jsxs("label",{className:"flex items-start gap-2 rounded-sm p-1.5 "+(g.ref?"cursor-pointer hover:bg-[var(--muted)]/50":"opacity-60"),children:[u.jsx("input",{type:"checkbox",className:"mt-0.5 size-4 shrink-0",disabled:!g.ref,checked:o.has(g.name),onChange:p=>p.target.checked?c(g):d(g.name)}),u.jsxs("span",{className:"grid",children:[u.jsxs("span",{className:"font-mono text-sm",children:[g.name,!g.ref&&u.jsx("span",{className:"ml-1 text-xs text-[var(--warning)]",children:"(no install recipe — reinstall to make selectable)"})]}),u.jsx("span",{className:"line-clamp-2 text-xs text-[var(--muted-foreground)]",children:g.description})]})]},g.name)),f.map(g=>u.jsxs("label",{className:"flex items-center gap-2 rounded-sm p-1.5",children:[u.jsx("input",{type:"checkbox",className:"size-4 shrink-0",checked:!0,onChange:()=>d(g)}),u.jsxs("span",{className:"font-mono text-sm",children:[g," ",u.jsx("span",{className:"text-xs text-[var(--muted-foreground)]",children:"(declared in the spec; installs at run time)"})]})]},g))]})}),u.jsx("div",{children:u.jsx(vA,{onInstalled:s,triggerVariant:"outline"})})]})}function _A(e){const{skills:t,...r}=e,i=H_(r)??{};return Array.isArray(t)&&t.length>0&&(i.skills=t),i}function H_(e){if(Array.isArray(e)){const t=e.map(H_).filter(r=>r!==void 0);return t.length>0?t:void 0}if(e&&typeof e=="object"){const t={};for(const[r,i]of Object.entries(e)){const s=H_(i);s!==void 0&&(t[r]=s)}return Object.keys(t).length>0?t:void 0}if(typeof e=="string"){const t=e.trim();return t===""?void 0:t}return e}function Zt({label:e,help:t,children:r}){return u.jsxs("div",{className:"grid content-start gap-1.5",children:[u.jsx(Fr,{children:e}),r,t&&u.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:t})]})}const Qg="__default__";function bu({value:e,options:t,onChange:r,disabled:i,required:s}){return u.jsxs(lm,{value:e??(s?t[0]:Qg),disabled:i,onValueChange:o=>r(o===Qg?void 0:o),children:[u.jsx(Ku,{children:u.jsx(Yu,{})}),u.jsxs(Xu,{children:[!s&&u.jsx(zn,{value:Qg,children:u.jsx("span",{className:"text-[var(--muted-foreground)]",children:"Unset"})}),t.map(o=>u.jsx(zn,{value:o,children:o},o))]})]})}function Kc({value:e,onChange:t}){return u.jsx(xt,{type:"number",value:e??"",onChange:r=>{const i=r.target.value;t(i===""?void 0:Number(i))}})}function F_({items:e,placeholder:t,onChange:r}){const i=(o,c)=>r(e.map((d,m)=>m===o?c:d)),s=o=>r(e.filter((c,d)=>d!==o));return u.jsxs("div",{className:"grid gap-1.5",children:[e.map((o,c)=>u.jsxs("div",{className:"flex gap-1.5",children:[u.jsx(xt,{value:o,placeholder:t,onChange:d=>i(c,d.target.value)}),u.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>s(c),children:u.jsx(Il,{})})]},c)),u.jsxs(ge,{variant:"outline",size:"sm",className:"justify-self-start",onClick:()=>r([...e,""]),children:[u.jsx(Gi,{})," Add"]})]})}function F7({rows:e,onChange:t}){const r=_.useRef(0),[i,s]=_.useState(()=>e.map(()=>r.current++)),o=(m,f)=>t(e.map((g,p)=>p===m?{...g,...f}:g)),c=m=>{t(e.filter((f,g)=>g!==m)),s(i.filter((f,g)=>g!==m))},d=()=>{t([...e,{name:"",url:""}]),s([...i,r.current++])};return u.jsxs("div",{className:"grid gap-2",children:[e.map((m,f)=>u.jsxs("div",{className:"grid gap-2 rounded-md border border-[var(--border)] p-3",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx(xt,{className:"w-1/3",value:m.name??"",placeholder:"name",onChange:g=>o(f,{name:g.target.value})}),u.jsx("span",{className:"label-caps rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]",children:"HTTP"}),u.jsx(xt,{value:m.url??"",placeholder:"https://server/mcp",onChange:g=>o(f,{url:g.target.value})}),u.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>c(f),children:u.jsx(Il,{})})]}),u.jsx(W7,{headers:m.headers??{},onChange:g=>o(f,{headers:g})})]},i[f]??f)),u.jsxs(ge,{variant:"outline",size:"sm",className:"justify-self-start",onClick:d,children:[u.jsx(Gi,{})," Add MCP server"]})]})}function W7({headers:e,onChange:t}){const[r,i]=_.useState(()=>Object.entries(e).map(([d,m])=>({k:d,v:m})));function s(d){i(d);const m={};for(const{k:f,v:g}of d){const p=f.trim();p&&(m[p]=g)}t(Object.keys(m).length>0?m:void 0)}const o=(d,m)=>s(r.map((f,g)=>g===d?{...f,...m}:f)),c=d=>s(r.filter((m,f)=>f!==d));return u.jsxs("div",{className:"grid gap-1.5",children:[r.map((d,m)=>u.jsxs("div",{className:"flex gap-1.5",children:[u.jsx(xt,{className:"w-1/3 font-mono text-xs",value:d.k,placeholder:"Header",onChange:f=>o(m,{k:f.target.value})}),u.jsx(xt,{className:"font-mono text-xs",value:d.v,placeholder:"value",onChange:f=>o(m,{v:f.target.value})}),u.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>c(m),children:u.jsx(Il,{})})]},m)),u.jsxs(ge,{variant:"ghost",size:"sm",className:"justify-self-start text-[var(--muted-foreground)]",onClick:()=>s([...r,{k:"",v:""}]),children:[u.jsx(Gi,{})," Add header"]})]})}function Yi({className:e,...t}){return u.jsx("div",{className:qe("glass rounded-xl border border-[var(--border)] text-[var(--card-foreground)]",e),...t})}function $n({className:e,...t}){return u.jsx("div",{className:qe("flex items-center justify-between gap-3 px-5 py-4 border-b border-[var(--border)]",e),...t})}function dn({className:e,...t}){return u.jsx("h3",{className:qe("text-sm font-semibold tracking-tight",e),...t})}function hn({className:e,...t}){return u.jsx("div",{className:qe("p-5",e),...t})}const ev=/^[a-z0-9][a-z0-9-]{0,63}$/,W_=[{id:"identity",label:"Identity",blurb:"Name, description, and system instructions."},{id:"model",label:"Model & Budget",blurb:"Runtime, model, reasoning effort, and execution limits."},{id:"environment",label:"Environment",blurb:"Sandbox, per-runtime approvals, working dir, writable roots."},{id:"tools",label:"Tools & MCP",blurb:"Allowed/disallowed tools and MCP servers."},{id:"skills",label:"Skills",blurb:"Which skills this agent can use."},{id:"review",label:"Review",blurb:"Confirm and save."}];function q7({initial:e,onClose:t,onSaved:r}){const i=e.id==="",[s,o]=_.useState(e.id),[c,d]=_.useState(e.spec),[m,f]=_.useState("identity"),[g,p]=_.useState("form"),[b,x]=_.useState(()=>JSON.stringify(e.spec,null,2)),[w,S]=_.useState(!1);function E(A){if(A!==g)if(A==="json")x(JSON.stringify(c,null,2)),p("json");else try{d(JSON.parse(b)),p("form")}catch(N){we.error(`Invalid JSON: ${N.message}`)}}async function C(){const A=s.trim();if(i&&!ev.test(A))return f("identity"),we.error(A?"Invalid agent id — use lowercase letters, digits, or hyphens":"Agent id is required");let N;if(g==="json")try{N=JSON.parse(b)}catch(k){return we.error(`Invalid JSON: ${k.message}`)}else N=c;S(!0);try{await xe.writeAgent({..._A(N),id:s.trim()}),we.success(`Agent "${s}" saved`),await r()}catch(k){we.error(`Save failed: ${k.message}`)}finally{S(!1)}}return u.jsxs("div",{className:"grid gap-5",children:[u.jsxs("div",{className:"flex items-start justify-between gap-4",children:[u.jsxs("div",{className:"grid gap-1",children:[u.jsxs("button",{type:"button",onClick:t,className:"inline-flex w-fit items-center gap-1 text-xs text-[var(--muted-foreground)] hover:text-[var(--foreground)]",children:[u.jsx(Pl,{className:"size-3.5"})," Agents"]}),u.jsx("h1",{className:"text-xl font-semibold",children:i?"New agent":`Edit "${e.id}"`})]}),u.jsx("div",{className:"inline-flex rounded-md border border-[var(--border)] p-0.5",children:["form","json"].map(A=>u.jsx("button",{type:"button",onClick:()=>E(A),className:qe("rounded-sm px-3 py-1 text-sm capitalize transition-colors",g===A?"bg-[var(--primary)] text-[var(--primary-foreground)]":"text-[var(--muted-foreground)] hover:text-[var(--foreground)]"),children:A},A))})]}),g==="json"?u.jsx(rm,{value:b,onChange:A=>x(A.target.value),className:"min-h-[28rem] font-mono text-xs"}):u.jsxs("div",{className:"grid grid-cols-[12rem_1fr] gap-6",children:[u.jsx("nav",{className:"sticky top-6 grid h-fit gap-0.5",children:W_.map(A=>u.jsx("button",{type:"button",onClick:()=>f(A.id),className:qe("rounded-md px-3 py-2 text-left text-sm transition-colors",m===A.id?"bg-[var(--muted)] font-medium text-[var(--foreground)]":"text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50"),children:A.label},A.id))}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"mb-4",children:[u.jsx("h2",{className:"text-base font-semibold",children:uC(m).label}),u.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:uC(m).blurb})]}),u.jsxs("div",{className:"rounded-lg border border-[var(--border)] p-5",children:[m==="identity"&&u.jsxs("div",{className:"grid gap-4",children:[u.jsxs("div",{className:"grid gap-1.5",children:[u.jsxs(Fr,{children:["Agent ID ",u.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),u.jsx(xt,{value:s,disabled:!i,onChange:A=>o(A.target.value),placeholder:"polly","aria-invalid":i&&s.trim()!==""&&!ev.test(s.trim())}),i&&s.trim()!==""&&!ev.test(s.trim())?u.jsx("p",{className:"text-xs text-[var(--destructive)]",children:"Use 1–64 lowercase letters, digits, or hyphens, starting with a letter or digit."}):u.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["The config directory name. References (",u.jsx("code",{children:"/agent <id>"}),", bindings) use it; it can't change after creation."]})]}),u.jsx(z7,{value:c,onChange:d})]}),m==="model"&&u.jsx(I7,{value:c,onChange:d}),m==="environment"&&u.jsx($7,{value:c,onChange:d}),m==="tools"&&u.jsx(U7,{value:c,onChange:d}),m==="skills"&&u.jsx(H7,{value:c,onChange:d}),m==="review"&&u.jsx(V7,{id:s,spec:c})]})]})]}),u.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] pt-4",children:[u.jsx(ge,{variant:"outline",onClick:t,children:"Cancel"}),u.jsx(ge,{onClick:C,disabled:w,children:w?"Saving…":"Save"})]})]})}function uC(e){return W_.find(t=>t.id===e)??W_[0]}function V7({id:e,spec:t}){var s,o,c,d,m,f;const r=_A(t),i=[["Agent ID",e||"—"],["Display name",((s=t.name)==null?void 0:s.trim())||"—"],["Runtime",((o=t.executor)==null?void 0:o.runtime)??"default"],["Model",((d=(c=t.executor)==null?void 0:c.model)==null?void 0:d.trim())||"runtime default"],["Skills",G7(t.skills)],["MCP servers",String(((f=(m=t.tools)==null?void 0:m.mcp)==null?void 0:f.filter(g=>{var p;return(p=g.url)==null?void 0:p.trim()}).length)??0)]];return u.jsxs("div",{className:"grid gap-4",children:[u.jsx("dl",{className:"grid grid-cols-[10rem_1fr] gap-x-4 gap-y-2 text-sm",children:i.map(([g,p])=>u.jsxs("div",{className:"contents",children:[u.jsx("dt",{className:"text-[var(--muted-foreground)]",children:g}),u.jsx("dd",{className:"font-medium",children:p})]},g))}),u.jsxs("div",{className:"grid gap-1.5",children:[u.jsx(Fr,{children:"Resulting spec"}),u.jsx("pre",{className:"max-h-72 overflow-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-3 font-mono text-xs",children:JSON.stringify({id:e||void 0,...r},null,2)})]})]})}function G7(e){return e!=null&&e.length?`${e.length} declared`:"None"}const Y7={instructions:"You are a helpful agent.",executor:{runtime:"claude",model:"claude-sonnet-4-6",reasoningEffort:"medium",timeout:1800,retry:{maxRetries:2}},osEnv:{sandbox:"danger-full-access",approvalPolicy:"never"}};function K7({agents:e,onChange:t}){const[r,i]=_.useState(null);function s(){i({id:"",spec:structuredClone(Y7)})}async function o(c){try{const d=await xe.getAgent(c);delete d.id,i({id:c,spec:d})}catch(d){we.error(`Load failed: ${d.message}`)}}return r?u.jsx(q7,{initial:r,onClose:()=>i(null),onSaved:async()=>{i(null),await t()}}):u.jsxs(Yi,{children:[u.jsxs($n,{children:[u.jsxs(dn,{children:["Agents ",u.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:e.length})]}),u.jsxs(ge,{size:"sm",onClick:s,children:[u.jsx(Gi,{})," New agent"]})]}),u.jsx(hn,{className:"p-0",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"label-caps border-b border-[var(--border)] text-left text-xs text-[var(--muted-foreground)]",children:[u.jsx("th",{className:"px-5 py-2.5 font-medium",children:"Agent"}),u.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Runtime"}),u.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Model"}),u.jsx("th",{className:"px-5 py-2.5 text-right font-medium",children:"Actions"})]})}),u.jsxs("tbody",{children:[e.length===0&&u.jsx("tr",{children:u.jsx("td",{colSpan:4,className:"px-5 py-8 text-center text-[var(--muted-foreground)]",children:"No agents yet."})}),e.map(c=>u.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0 hover:bg-[var(--muted)]/40",children:[u.jsxs("td",{className:"px-5 py-3",children:[u.jsx("div",{className:"font-medium",children:c.name??c.id}),u.jsx("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:c.id})]}),u.jsx("td",{className:"px-3 py-3 text-[var(--muted-foreground)]",children:c.runtime??"—"}),u.jsx("td",{className:"px-3 py-3 text-[var(--muted-foreground)]",children:c.model??"—"}),u.jsx("td",{className:"px-5 py-3",children:u.jsxs("div",{className:"flex justify-end gap-1.5",children:[u.jsxs(ge,{variant:"ghost",size:"sm",onClick:()=>void o(c.id),children:[u.jsx(lB,{})," Edit"]}),u.jsx(X7,{id:c.id,onChange:t})]})})]},c.id))]})]})})]})}function X7({id:e,onChange:t}){return u.jsxs(Ca,{children:[u.jsx(Ea,{asChild:!0,children:u.jsx(ge,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:u.jsx(ql,{})})}),u.jsxs(Ss,{children:[u.jsxs(Ra,{children:[u.jsxs(Cs,{children:['Delete agent "',e,'"?']}),u.jsx(Es,{children:"Removes its config directory. Instances bound to it fall back to defaults."})]}),u.jsxs(ka,{children:[u.jsx(ks,{children:"Cancel"}),u.jsx(Rs,{variant:"destructive",onClick:async()=>{try{await xe.deleteAgent(e),we.success(`Agent "${e}" deleted`),await t()}catch(r){we.error(`Delete failed: ${r.message}`)}},children:"Delete"})]})]})]})}const Z7=FR("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium",{variants:{variant:{default:"border-transparent bg-[var(--secondary)] text-[var(--secondary-foreground)]",success:"border-transparent bg-[var(--success)]/15 text-[var(--success)]",warning:"border-transparent bg-[var(--warning)]/15 text-[var(--warning)]",destructive:"border-transparent bg-[var(--destructive)]/15 text-[var(--destructive)]",outline:"text-[var(--muted-foreground)]"}},defaultVariants:{variant:"default"}});function fr({className:e,variant:t,...r}){return u.jsx("span",{className:qe(Z7({variant:t}),e),...r})}var yl={},tv,dC;function J7(){return dC||(dC=1,tv=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),tv}var rv={},sa={},hC;function ko(){if(hC)return sa;hC=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return sa.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},sa.getSymbolTotalCodewords=function(i){return t[i]},sa.getBCHDigit=function(r){let i=0;for(;r!==0;)i++,r>>>=1;return i},sa.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');e=i},sa.isKanjiModeEnabled=function(){return typeof e<"u"},sa.toSJIS=function(i){return e(i)},sa}var iv={},fC;function Yy(){return fC||(fC=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+r)}}e.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},e.from=function(i,s){if(e.isValid(i))return i;try{return t(i)}catch{return s}}})(iv)),iv}var nv,mC;function Q7(){if(mC)return nv;mC=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const r=Math.floor(t/8);return(this.buffer[r]>>>7-t%8&1)===1},put:function(t,r){for(let i=0;i<r;i++)this.putBit((t>>>r-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),t&&(this.buffer[r]|=128>>>this.length%8),this.length++}},nv=e,nv}var sv,pC;function e$(){if(pC)return sv;pC=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,r,i,s){const o=t*this.size+r;this.data[o]=i,s&&(this.reservedBit[o]=!0)},e.prototype.get=function(t,r){return this.data[t*this.size+r]},e.prototype.xor=function(t,r,i){this.data[t*this.size+r]^=i},e.prototype.isReserved=function(t,r){return this.reservedBit[t*this.size+r]},sv=e,sv}var av={},gC;function t$(){return gC||(gC=1,(function(e){const t=ko().getSymbolSize;e.getRowColCoords=function(i){if(i===1)return[];const s=Math.floor(i/7)+2,o=t(i),c=o===145?26:Math.ceil((o-13)/(2*s-2))*2,d=[o-7];for(let m=1;m<s-1;m++)d[m]=d[m-1]-c;return d.push(6),d.reverse()},e.getPositions=function(i){const s=[],o=e.getRowColCoords(i),c=o.length;for(let d=0;d<c;d++)for(let m=0;m<c;m++)d===0&&m===0||d===0&&m===c-1||d===c-1&&m===0||s.push([o[d],o[m]]);return s}})(av)),av}var ov={},vC;function r$(){if(vC)return ov;vC=1;const e=ko().getSymbolSize,t=7;return ov.getPositions=function(i){const s=e(i);return[[0,0],[s-t,0],[0,s-t]]},ov}var lv={},_C;function i$(){return _C||(_C=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(s){return s!=null&&s!==""&&!isNaN(s)&&s>=0&&s<=7},e.from=function(s){return e.isValid(s)?parseInt(s,10):void 0},e.getPenaltyN1=function(s){const o=s.size;let c=0,d=0,m=0,f=null,g=null;for(let p=0;p<o;p++){d=m=0,f=g=null;for(let b=0;b<o;b++){let x=s.get(p,b);x===f?d++:(d>=5&&(c+=t.N1+(d-5)),f=x,d=1),x=s.get(b,p),x===g?m++:(m>=5&&(c+=t.N1+(m-5)),g=x,m=1)}d>=5&&(c+=t.N1+(d-5)),m>=5&&(c+=t.N1+(m-5))}return c},e.getPenaltyN2=function(s){const o=s.size;let c=0;for(let d=0;d<o-1;d++)for(let m=0;m<o-1;m++){const f=s.get(d,m)+s.get(d,m+1)+s.get(d+1,m)+s.get(d+1,m+1);(f===4||f===0)&&c++}return c*t.N2},e.getPenaltyN3=function(s){const o=s.size;let c=0,d=0,m=0;for(let f=0;f<o;f++){d=m=0;for(let g=0;g<o;g++)d=d<<1&2047|s.get(f,g),g>=10&&(d===1488||d===93)&&c++,m=m<<1&2047|s.get(g,f),g>=10&&(m===1488||m===93)&&c++}return c*t.N3},e.getPenaltyN4=function(s){let o=0;const c=s.data.length;for(let m=0;m<c;m++)o+=s.data[m];return Math.abs(Math.ceil(o*100/c/5)-10)*t.N4};function r(i,s,o){switch(i){case e.Patterns.PATTERN000:return(s+o)%2===0;case e.Patterns.PATTERN001:return s%2===0;case e.Patterns.PATTERN010:return o%3===0;case e.Patterns.PATTERN011:return(s+o)%3===0;case e.Patterns.PATTERN100:return(Math.floor(s/2)+Math.floor(o/3))%2===0;case e.Patterns.PATTERN101:return s*o%2+s*o%3===0;case e.Patterns.PATTERN110:return(s*o%2+s*o%3)%2===0;case e.Patterns.PATTERN111:return(s*o%3+(s+o)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}e.applyMask=function(s,o){const c=o.size;for(let d=0;d<c;d++)for(let m=0;m<c;m++)o.isReserved(m,d)||o.xor(m,d,r(s,m,d))},e.getBestMask=function(s,o){const c=Object.keys(e.Patterns).length;let d=0,m=1/0;for(let f=0;f<c;f++){o(f),e.applyMask(f,s);const g=e.getPenaltyN1(s)+e.getPenaltyN2(s)+e.getPenaltyN3(s)+e.getPenaltyN4(s);e.applyMask(f,s),g<m&&(m=g,d=f)}return d}})(lv)),lv}var Ch={},yC;function yA(){if(yC)return Ch;yC=1;const e=Yy(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Ch.getBlocksCount=function(s,o){switch(o){case e.L:return t[(s-1)*4+0];case e.M:return t[(s-1)*4+1];case e.Q:return t[(s-1)*4+2];case e.H:return t[(s-1)*4+3];default:return}},Ch.getTotalCodewordsCount=function(s,o){switch(o){case e.L:return r[(s-1)*4+0];case e.M:return r[(s-1)*4+1];case e.Q:return r[(s-1)*4+2];case e.H:return r[(s-1)*4+3];default:return}},Ch}var cv={},Xc={},bC;function n$(){if(bC)return Xc;bC=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let i=1;for(let s=0;s<255;s++)e[s]=i,t[i]=s,i<<=1,i&256&&(i^=285);for(let s=255;s<512;s++)e[s]=e[s-255]})(),Xc.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},Xc.exp=function(i){return e[i]},Xc.mul=function(i,s){return i===0||s===0?0:e[t[i]+t[s]]},Xc}var xC;function s$(){return xC||(xC=1,(function(e){const t=n$();e.mul=function(i,s){const o=new Uint8Array(i.length+s.length-1);for(let c=0;c<i.length;c++)for(let d=0;d<s.length;d++)o[c+d]^=t.mul(i[c],s[d]);return o},e.mod=function(i,s){let o=new Uint8Array(i);for(;o.length-s.length>=0;){const c=o[0];for(let m=0;m<s.length;m++)o[m]^=t.mul(s[m],c);let d=0;for(;d<o.length&&o[d]===0;)d++;o=o.slice(d)}return o},e.generateECPolynomial=function(i){let s=new Uint8Array([1]);for(let o=0;o<i;o++)s=e.mul(s,new Uint8Array([1,t.exp(o)]));return s}})(cv)),cv}var uv,wC;function a$(){if(wC)return uv;wC=1;const e=s$();function t(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(i){this.degree=i,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const s=new Uint8Array(i.length+this.degree);s.set(i);const o=e.mod(s,this.genPoly),c=this.degree-o.length;if(c>0){const d=new Uint8Array(this.degree);return d.set(o,c),d}return o},uv=t,uv}var dv={},hv={},fv={},SC;function bA(){return SC||(SC=1,fv.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),fv}var kn={},CC;function xA(){if(CC)return kn;CC=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r
|
|
469
|
+
]))+`;kn.KANJI=new RegExp(r,"g"),kn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),kn.BYTE=new RegExp(i,"g"),kn.NUMERIC=new RegExp(e,"g"),kn.ALPHANUMERIC=new RegExp(t,"g");const s=new RegExp("^"+r+"$"),o=new RegExp("^"+e+"$"),c=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return kn.testKanji=function(m){return s.test(m)},kn.testNumeric=function(m){return o.test(m)},kn.testAlphanumeric=function(m){return c.test(m)},kn}var EC;function No(){return EC||(EC=1,(function(e){const t=bA(),r=xA();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(o,c){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!t.isValid(c))throw new Error("Invalid version: "+c);return c>=1&&c<10?o.ccBits[0]:c<27?o.ccBits[1]:o.ccBits[2]},e.getBestModeForData=function(o){return r.testNumeric(o)?e.NUMERIC:r.testAlphanumeric(o)?e.ALPHANUMERIC:r.testKanji(o)?e.KANJI:e.BYTE},e.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},e.isValid=function(o){return o&&o.bit&&o.ccBits};function i(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+s)}}e.from=function(o,c){if(e.isValid(o))return o;try{return i(o)}catch{return c}}})(hv)),hv}var RC;function o$(){return RC||(RC=1,(function(e){const t=ko(),r=yA(),i=Yy(),s=No(),o=bA(),c=7973,d=t.getBCHDigit(c);function m(b,x,w){for(let S=1;S<=40;S++)if(x<=e.getCapacity(S,w,b))return S}function f(b,x){return s.getCharCountIndicator(b,x)+4}function g(b,x){let w=0;return b.forEach(function(S){const E=f(S.mode,x);w+=E+S.getBitsLength()}),w}function p(b,x){for(let w=1;w<=40;w++)if(g(b,w)<=e.getCapacity(w,x,s.MIXED))return w}e.from=function(x,w){return o.isValid(x)?parseInt(x,10):w},e.getCapacity=function(x,w,S){if(!o.isValid(x))throw new Error("Invalid QR Code version");typeof S>"u"&&(S=s.BYTE);const E=t.getSymbolTotalCodewords(x),C=r.getTotalCodewordsCount(x,w),A=(E-C)*8;if(S===s.MIXED)return A;const N=A-f(S,x);switch(S){case s.NUMERIC:return Math.floor(N/10*3);case s.ALPHANUMERIC:return Math.floor(N/11*2);case s.KANJI:return Math.floor(N/13);case s.BYTE:default:return Math.floor(N/8)}},e.getBestVersionForData=function(x,w){let S;const E=i.from(w,i.M);if(Array.isArray(x)){if(x.length>1)return p(x,E);if(x.length===0)return 1;S=x[0]}else S=x;return m(S.mode,S.getLength(),E)},e.getEncodedBits=function(x){if(!o.isValid(x)||x<7)throw new Error("Invalid QR Code version");let w=x<<12;for(;t.getBCHDigit(w)-d>=0;)w^=c<<t.getBCHDigit(w)-d;return x<<12|w}})(dv)),dv}var mv={},kC;function l$(){if(kC)return mv;kC=1;const e=ko(),t=1335,r=21522,i=e.getBCHDigit(t);return mv.getEncodedBits=function(o,c){const d=o.bit<<3|c;let m=d<<10;for(;e.getBCHDigit(m)-i>=0;)m^=t<<e.getBCHDigit(m)-i;return(d<<10|m)^r},mv}var pv={},gv,NC;function c$(){if(NC)return gv;NC=1;const e=No();function t(r){this.mode=e.NUMERIC,this.data=r.toString()}return t.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(i){let s,o,c;for(s=0;s+3<=this.data.length;s+=3)o=this.data.substr(s,3),c=parseInt(o,10),i.put(c,10);const d=this.data.length-s;d>0&&(o=this.data.substr(s),c=parseInt(o,10),i.put(c,d*3+1))},gv=t,gv}var vv,AC;function u$(){if(AC)return vv;AC=1;const e=No(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function r(i){this.mode=e.ALPHANUMERIC,this.data=i}return r.getBitsLength=function(s){return 11*Math.floor(s/2)+6*(s%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(s){let o;for(o=0;o+2<=this.data.length;o+=2){let c=t.indexOf(this.data[o])*45;c+=t.indexOf(this.data[o+1]),s.put(c,11)}this.data.length%2&&s.put(t.indexOf(this.data[o]),6)},vv=r,vv}var _v,MC;function d$(){if(MC)return _v;MC=1;const e=No();function t(r){this.mode=e.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return t.getBitsLength=function(i){return i*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){for(let i=0,s=this.data.length;i<s;i++)r.put(this.data[i],8)},_v=t,_v}var yv,TC;function h$(){if(TC)return yv;TC=1;const e=No(),t=ko();function r(i){this.mode=e.KANJI,this.data=i}return r.getBitsLength=function(s){return s*13},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(i){let s;for(s=0;s<this.data.length;s++){let o=t.toSJIS(this.data[s]);if(o>=33088&&o<=40956)o-=33088;else if(o>=57408&&o<=60351)o-=49472;else throw new Error("Invalid SJIS character: "+this.data[s]+`
|
|
470
|
+
Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),i.put(o,13)}},yv=r,yv}var bv={exports:{}},DC;function f$(){return DC||(DC=1,(function(e){var t={single_source_shortest_paths:function(r,i,s){var o={},c={};c[i]=0;var d=t.PriorityQueue.make();d.push(i,0);for(var m,f,g,p,b,x,w,S,E;!d.empty();){m=d.pop(),f=m.value,p=m.cost,b=r[f]||{};for(g in b)b.hasOwnProperty(g)&&(x=b[g],w=p+x,S=c[g],E=typeof c[g]>"u",(E||S>w)&&(c[g]=w,d.push(g,w),o[g]=f))}if(typeof s<"u"&&typeof c[s]>"u"){var C=["Could not find a path from ",i," to ",s,"."].join("");throw new Error(C)}return o},extract_shortest_path_from_predecessor_list:function(r,i){for(var s=[],o=i;o;)s.push(o),r[o],o=r[o];return s.reverse(),s},find_path:function(r,i,s){var o=t.single_source_shortest_paths(r,i,s);return t.extract_shortest_path_from_predecessor_list(o,s)},PriorityQueue:{make:function(r){var i=t.PriorityQueue,s={},o;r=r||{};for(o in i)i.hasOwnProperty(o)&&(s[o]=i[o]);return s.queue=[],s.sorter=r.sorter||i.default_sorter,s},default_sorter:function(r,i){return r.cost-i.cost},push:function(r,i){var s={value:r,cost:i};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(bv)),bv.exports}var LC;function m$(){return LC||(LC=1,(function(e){const t=No(),r=c$(),i=u$(),s=d$(),o=h$(),c=xA(),d=ko(),m=f$();function f(C){return unescape(encodeURIComponent(C)).length}function g(C,A,N){const k=[];let O;for(;(O=C.exec(N))!==null;)k.push({data:O[0],index:O.index,mode:A,length:O[0].length});return k}function p(C){const A=g(c.NUMERIC,t.NUMERIC,C),N=g(c.ALPHANUMERIC,t.ALPHANUMERIC,C);let k,O;return d.isKanjiModeEnabled()?(k=g(c.BYTE,t.BYTE,C),O=g(c.KANJI,t.KANJI,C)):(k=g(c.BYTE_KANJI,t.BYTE,C),O=[]),A.concat(N,k,O).sort(function(H,D){return H.index-D.index}).map(function(H){return{data:H.data,mode:H.mode,length:H.length}})}function b(C,A){switch(A){case t.NUMERIC:return r.getBitsLength(C);case t.ALPHANUMERIC:return i.getBitsLength(C);case t.KANJI:return o.getBitsLength(C);case t.BYTE:return s.getBitsLength(C)}}function x(C){return C.reduce(function(A,N){const k=A.length-1>=0?A[A.length-1]:null;return k&&k.mode===N.mode?(A[A.length-1].data+=N.data,A):(A.push(N),A)},[])}function w(C){const A=[];for(let N=0;N<C.length;N++){const k=C[N];switch(k.mode){case t.NUMERIC:A.push([k,{data:k.data,mode:t.ALPHANUMERIC,length:k.length},{data:k.data,mode:t.BYTE,length:k.length}]);break;case t.ALPHANUMERIC:A.push([k,{data:k.data,mode:t.BYTE,length:k.length}]);break;case t.KANJI:A.push([k,{data:k.data,mode:t.BYTE,length:f(k.data)}]);break;case t.BYTE:A.push([{data:k.data,mode:t.BYTE,length:f(k.data)}])}}return A}function S(C,A){const N={},k={start:{}};let O=["start"];for(let z=0;z<C.length;z++){const H=C[z],D=[];for(let G=0;G<H.length;G++){const Y=H[G],W=""+z+G;D.push(W),N[W]={node:Y,lastCount:0},k[W]={};for(let L=0;L<O.length;L++){const T=O[L];N[T]&&N[T].node.mode===Y.mode?(k[T][W]=b(N[T].lastCount+Y.length,Y.mode)-b(N[T].lastCount,Y.mode),N[T].lastCount+=Y.length):(N[T]&&(N[T].lastCount=Y.length),k[T][W]=b(Y.length,Y.mode)+4+t.getCharCountIndicator(Y.mode,A))}}O=D}for(let z=0;z<O.length;z++)k[O[z]].end=0;return{map:k,table:N}}function E(C,A){let N;const k=t.getBestModeForData(C);if(N=t.from(A,k),N!==t.BYTE&&N.bit<k.bit)throw new Error('"'+C+'" cannot be encoded with mode '+t.toString(N)+`.
|
|
471
|
+
Suggested mode is: `+t.toString(k));switch(N===t.KANJI&&!d.isKanjiModeEnabled()&&(N=t.BYTE),N){case t.NUMERIC:return new r(C);case t.ALPHANUMERIC:return new i(C);case t.KANJI:return new o(C);case t.BYTE:return new s(C)}}e.fromArray=function(A){return A.reduce(function(N,k){return typeof k=="string"?N.push(E(k,null)):k.data&&N.push(E(k.data,k.mode)),N},[])},e.fromString=function(A,N){const k=p(A,d.isKanjiModeEnabled()),O=w(k),z=S(O,N),H=m.find_path(z.map,"start","end"),D=[];for(let G=1;G<H.length-1;G++)D.push(z.table[H[G]].node);return e.fromArray(x(D))},e.rawSplit=function(A){return e.fromArray(p(A,d.isKanjiModeEnabled()))}})(pv)),pv}var jC;function p$(){if(jC)return rv;jC=1;const e=ko(),t=Yy(),r=Q7(),i=e$(),s=t$(),o=r$(),c=i$(),d=yA(),m=a$(),f=o$(),g=l$(),p=No(),b=m$();function x(z,H){const D=z.size,G=o.getPositions(H);for(let Y=0;Y<G.length;Y++){const W=G[Y][0],L=G[Y][1];for(let T=-1;T<=7;T++)if(!(W+T<=-1||D<=W+T))for(let j=-1;j<=7;j++)L+j<=-1||D<=L+j||(T>=0&&T<=6&&(j===0||j===6)||j>=0&&j<=6&&(T===0||T===6)||T>=2&&T<=4&&j>=2&&j<=4?z.set(W+T,L+j,!0,!0):z.set(W+T,L+j,!1,!0))}}function w(z){const H=z.size;for(let D=8;D<H-8;D++){const G=D%2===0;z.set(D,6,G,!0),z.set(6,D,G,!0)}}function S(z,H){const D=s.getPositions(H);for(let G=0;G<D.length;G++){const Y=D[G][0],W=D[G][1];for(let L=-2;L<=2;L++)for(let T=-2;T<=2;T++)L===-2||L===2||T===-2||T===2||L===0&&T===0?z.set(Y+L,W+T,!0,!0):z.set(Y+L,W+T,!1,!0)}}function E(z,H){const D=z.size,G=f.getEncodedBits(H);let Y,W,L;for(let T=0;T<18;T++)Y=Math.floor(T/3),W=T%3+D-8-3,L=(G>>T&1)===1,z.set(Y,W,L,!0),z.set(W,Y,L,!0)}function C(z,H,D){const G=z.size,Y=g.getEncodedBits(H,D);let W,L;for(W=0;W<15;W++)L=(Y>>W&1)===1,W<6?z.set(W,8,L,!0):W<8?z.set(W+1,8,L,!0):z.set(G-15+W,8,L,!0),W<8?z.set(8,G-W-1,L,!0):W<9?z.set(8,15-W-1+1,L,!0):z.set(8,15-W-1,L,!0);z.set(G-8,8,1,!0)}function A(z,H){const D=z.size;let G=-1,Y=D-1,W=7,L=0;for(let T=D-1;T>0;T-=2)for(T===6&&T--;;){for(let j=0;j<2;j++)if(!z.isReserved(Y,T-j)){let U=!1;L<H.length&&(U=(H[L]>>>W&1)===1),z.set(Y,T-j,U),W--,W===-1&&(L++,W=7)}if(Y+=G,Y<0||D<=Y){Y-=G,G=-G;break}}}function N(z,H,D){const G=new r;D.forEach(function(j){G.put(j.mode.bit,4),G.put(j.getLength(),p.getCharCountIndicator(j.mode,z)),j.write(G)});const Y=e.getSymbolTotalCodewords(z),W=d.getTotalCodewordsCount(z,H),L=(Y-W)*8;for(G.getLengthInBits()+4<=L&&G.put(0,4);G.getLengthInBits()%8!==0;)G.putBit(0);const T=(L-G.getLengthInBits())/8;for(let j=0;j<T;j++)G.put(j%2?17:236,8);return k(G,z,H)}function k(z,H,D){const G=e.getSymbolTotalCodewords(H),Y=d.getTotalCodewordsCount(H,D),W=G-Y,L=d.getBlocksCount(H,D),T=G%L,j=L-T,U=Math.floor(G/L),M=Math.floor(W/L),P=M+1,I=U-M,F=new m(I);let q=0;const $=new Array(L),X=new Array(L);let V=0;const J=new Uint8Array(z.buffer);for(let ce=0;ce<L;ce++){const Se=ce<j?M:P;$[ce]=J.slice(q,q+Se),X[ce]=F.encode($[ce]),q+=Se,V=Math.max(V,Se)}const le=new Uint8Array(G);let ae=0,ee,se;for(ee=0;ee<V;ee++)for(se=0;se<L;se++)ee<$[se].length&&(le[ae++]=$[se][ee]);for(ee=0;ee<I;ee++)for(se=0;se<L;se++)le[ae++]=X[se][ee];return le}function O(z,H,D,G){let Y;if(Array.isArray(z))Y=b.fromArray(z);else if(typeof z=="string"){let U=H;if(!U){const M=b.rawSplit(z);U=f.getBestVersionForData(M,D)}Y=b.fromString(z,U||40)}else throw new Error("Invalid data");const W=f.getBestVersionForData(Y,D);if(!W)throw new Error("The amount of data is too big to be stored in a QR Code");if(!H)H=W;else if(H<W)throw new Error(`
|
|
472
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
473
|
+
Minimum version required to store current data is: `+W+`.
|
|
474
|
+
`);const L=N(H,D,Y),T=e.getSymbolSize(H),j=new i(T);return x(j,H),w(j),S(j,H),C(j,D,0),H>=7&&E(j,H),A(j,L),isNaN(G)&&(G=c.getBestMask(j,C.bind(null,j,D))),c.applyMask(G,j),C(j,D,G),{modules:j,version:H,errorCorrectionLevel:D,maskPattern:G,segments:Y}}return rv.create=function(H,D){if(typeof H>"u"||H==="")throw new Error("No input text");let G=t.M,Y,W;return typeof D<"u"&&(G=t.from(D.errorCorrectionLevel,t.M),Y=f.from(D.version),W=c.from(D.maskPattern),D.toSJISFunc&&e.setToSJISFunction(D.toSJISFunc)),O(H,Y,G,W)},rv}var xv={},wv={},BC;function wA(){return BC||(BC=1,(function(e){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let i=r.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+r);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(o){return[o,o]}))),i.length===6&&i.push("F","F");const s=parseInt(i.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+i.slice(0,6).join("")}}e.getOptions=function(i){i||(i={}),i.color||(i.color={});const s=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,o=i.width&&i.width>=21?i.width:void 0,c=i.scale||4;return{width:o,scale:o?4:c,margin:s,color:{dark:t(i.color.dark||"#000000ff"),light:t(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},e.getScale=function(i,s){return s.width&&s.width>=i+s.margin*2?s.width/(i+s.margin*2):s.scale},e.getImageWidth=function(i,s){const o=e.getScale(i,s);return Math.floor((i+s.margin*2)*o)},e.qrToImageData=function(i,s,o){const c=s.modules.size,d=s.modules.data,m=e.getScale(c,o),f=Math.floor((c+o.margin*2)*m),g=o.margin*m,p=[o.color.light,o.color.dark];for(let b=0;b<f;b++)for(let x=0;x<f;x++){let w=(b*f+x)*4,S=o.color.light;if(b>=g&&x>=g&&b<f-g&&x<f-g){const E=Math.floor((b-g)/m),C=Math.floor((x-g)/m);S=p[d[E*c+C]?1:0]}i[w++]=S.r,i[w++]=S.g,i[w++]=S.b,i[w]=S.a}}})(wv)),wv}var OC;function g$(){return OC||(OC=1,(function(e){const t=wA();function r(s,o,c){s.clearRect(0,0,o.width,o.height),o.style||(o.style={}),o.height=c,o.width=c,o.style.height=c+"px",o.style.width=c+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(o,c,d){let m=d,f=c;typeof m>"u"&&(!c||!c.getContext)&&(m=c,c=void 0),c||(f=i()),m=t.getOptions(m);const g=t.getImageWidth(o.modules.size,m),p=f.getContext("2d"),b=p.createImageData(g,g);return t.qrToImageData(b.data,o,m),r(p,f,g),p.putImageData(b,0,0),f},e.renderToDataURL=function(o,c,d){let m=d;typeof m>"u"&&(!c||!c.getContext)&&(m=c,c=void 0),m||(m={});const f=e.render(o,c,m),g=m.type||"image/png",p=m.rendererOpts||{};return f.toDataURL(g,p.quality)}})(xv)),xv}var Sv={},PC;function v$(){if(PC)return Sv;PC=1;const e=wA();function t(s,o){const c=s.a/255,d=o+'="'+s.hex+'"';return c<1?d+" "+o+'-opacity="'+c.toFixed(2).slice(1)+'"':d}function r(s,o,c){let d=s+o;return typeof c<"u"&&(d+=" "+c),d}function i(s,o,c){let d="",m=0,f=!1,g=0;for(let p=0;p<s.length;p++){const b=Math.floor(p%o),x=Math.floor(p/o);!b&&!f&&(f=!0),s[p]?(g++,p>0&&b>0&&s[p-1]||(d+=f?r("M",b+c,.5+x+c):r("m",m,0),m=0,f=!1),b+1<o&&s[p+1]||(d+=r("h",g),g=0)):m++}return d}return Sv.render=function(o,c,d){const m=e.getOptions(c),f=o.modules.size,g=o.modules.data,p=f+m.margin*2,b=m.color.light.a?"<path "+t(m.color.light,"fill")+' d="M0 0h'+p+"v"+p+'H0z"/>':"",x="<path "+t(m.color.dark,"stroke")+' d="'+i(g,f,m.margin)+'"/>',w='viewBox="0 0 '+p+" "+p+'"',E='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+w+' shape-rendering="crispEdges">'+b+x+`</svg>
|
|
475
|
+
`;return typeof d=="function"&&d(null,E),E},Sv}var zC;function _$(){if(zC)return yl;zC=1;const e=J7(),t=p$(),r=g$(),i=v$();function s(o,c,d,m,f){const g=[].slice.call(arguments,1),p=g.length,b=typeof g[p-1]=="function";if(!b&&!e())throw new Error("Callback required as last argument");if(b){if(p<2)throw new Error("Too few arguments provided");p===2?(f=d,d=c,c=m=void 0):p===3&&(c.getContext&&typeof f>"u"?(f=m,m=void 0):(f=m,m=d,d=c,c=void 0))}else{if(p<1)throw new Error("Too few arguments provided");return p===1?(d=c,c=m=void 0):p===2&&!c.getContext&&(m=d,d=c,c=void 0),new Promise(function(x,w){try{const S=t.create(d,m);x(o(S,c,m))}catch(S){w(S)}})}try{const x=t.create(d,m);f(null,o(x,c,m))}catch(x){f(x)}}return yl.create=t.create,yl.toCanvas=s.bind(null,r.render),yl.toDataURL=s.bind(null,r.renderToDataURL),yl.toString=s.bind(null,function(o,c,d){return i.render(o,d)}),yl}var y$=_$();const b$=H0(y$);function IC({lines:e}){const t=_.useRef(null);return _.useEffect(()=>{var r;(r=t.current)==null||r.scrollTo({top:t.current.scrollHeight})},[e]),e.length===0?null:u.jsx("div",{ref:t,className:"max-h-48 overflow-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-2 font-mono text-xs",children:e.map((r,i)=>u.jsx("div",{className:"whitespace-pre-wrap break-all",children:r},i))})}function SA({channelId:e,onDone:t,onCancel:r}){const[i,s]=_.useState("running"),[o,c]=_.useState(),[d,m]=_.useState(),[f,g]=_.useState([]),[p,b]=_.useState();return _.useEffect(()=>{const x=new AbortController;let w=!1;const S=E=>{switch(E.event){case"qr":{const C=String(E.data.url??"");m(C),b$.toDataURL(C,{margin:1,width:224}).then(c).catch(()=>{});break}case"link":m(String(E.data.url??""));break;case"status":g(C=>[...C,String(E.data.text??"")]);break;case"done":w=!0,s("done"),t();break;case"error":w=!0,s("error"),b(String(E.data.message??"authorization failed"));break;default:E.data.url?m(String(E.data.url)):g(C=>[...C,JSON.stringify(E.data)])}};return xe.authorizeChannel(e,S,x.signal).then(()=>{w||(s("error"),b("connection closed before completion"))}).catch(E=>{x.signal.aborted||w||(s("error"),b(E instanceof Error?E.message:String(E)))}),()=>x.abort()},[e,t]),i==="done"?u.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Authorized — credentials saved."}):i==="error"?u.jsxs("div",{className:"grid gap-2",children:[u.jsxs("p",{className:"text-sm text-[var(--destructive)]",children:["Authorization failed: ",p]}),u.jsx(IC,{lines:f}),u.jsx(ge,{variant:"outline",size:"sm",onClick:r,children:"Close"})]}):u.jsxs("div",{className:"grid gap-3 text-center",children:[o?u.jsx("img",{src:o,alt:"Scan to authorize",className:"mx-auto rounded-md border border-[var(--border)] bg-white p-2",width:224,height:224}):u.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Starting authorization…"}),d&&u.jsx("a",{href:d,target:"_blank",rel:"noreferrer",className:"break-all text-xs text-[var(--primary)] underline",children:"Or open this link"}),u.jsx(IC,{lines:f}),u.jsx(ge,{variant:"outline",size:"sm",onClick:r,children:"Cancel"})]})}function x$(e,t){const r={};for(const i of e){const s=t[i.key]??i.default;if(i.type==="boolean"){r[i.key]=typeof s=="boolean"?s:!1;continue}if(s==null||String(s).trim()===""){if(i.required)throw new Error(`${i.label} is required`);continue}if(i.type==="number"){const o=typeof s=="number"?s:Number(s);if(!Number.isFinite(o))throw new Error(`${i.label} must be a number`);r[i.key]=o;continue}r[i.key]=String(s).trim()}return r}function w$({schema:e,values:t,onChange:r}){function i(s,o){r({...t,[s]:o})}return u.jsx("div",{className:"grid gap-3",children:e.map(s=>u.jsx(S$,{label:s.label,help:s.help,required:s.required,children:s.type==="boolean"?u.jsx("input",{type:"checkbox",className:"size-4",checked:!!(t[s.key]??s.default??!1),onChange:o=>i(s.key,o.target.checked)}):s.type==="select"?u.jsx(fo,{className:"w-full",value:String(t[s.key]??s.default??""),onChange:o=>i(s.key,o.target.value),children:(s.options??[]).map(o=>u.jsx("option",{value:o.value,children:o.label},o.value))}):u.jsx(xt,{type:s.type==="secret"?"password":s.type==="number"?"number":"text",value:String(t[s.key]??s.default??""),onChange:o=>i(s.key,o.target.value)})},s.key))})}function S$({label:e,help:t,required:r,children:i}){return u.jsxs("div",{className:"grid gap-1.5",children:[u.jsxs(Fr,{children:[e,r&&u.jsx("span",{className:"ml-0.5 text-[var(--destructive)]",children:"*"})]}),i,t&&u.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:t})]})}function C$(e){return!!(e.options&&Object.keys(e.options).length>0)}function E$({channels:e,channelTypes:t,onChange:r}){const[i,s]=_.useState(!1),[o,c]=_.useState(null),d=_.useMemo(()=>new Map(t.map(f=>[f.type,f])),[t]);async function m(f,g){try{await g(),we.success(f),await r()}catch(p){we.error(`${f} failed: ${p.message}`)}}return u.jsxs(Yi,{children:[u.jsxs($n,{children:[u.jsxs(dn,{children:["Channels ",u.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:e.length})]}),u.jsxs(ge,{size:"sm",onClick:()=>s(!0),disabled:t.length===0,children:[u.jsx(Gi,{})," Add channel"]})]}),u.jsx(hn,{className:"p-0",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"label-caps border-b border-[var(--border)] text-left text-xs text-[var(--muted-foreground)]",children:[u.jsx("th",{className:"px-5 py-2.5 font-medium",children:"Channel"}),u.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Type"}),u.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Credentials"}),u.jsx("th",{className:"px-5 py-2.5 text-right font-medium",children:"Actions"})]})}),u.jsxs("tbody",{children:[e.length===0&&u.jsx("tr",{children:u.jsx("td",{colSpan:4,className:"px-5 py-8 text-center text-[var(--muted-foreground)]",children:t.length===0?"No chat plugins installed. Install one via: rynx plugin manage install <source>.":"No channels. Add one to configure a connection."})}),e.map(f=>{var g;return u.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0 hover:bg-[var(--muted)]/40",children:[u.jsxs("td",{className:"px-5 py-3",children:[u.jsx("div",{className:"font-medium",children:f.name}),u.jsx("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:f.id})]}),u.jsx("td",{className:"px-3 py-3 text-[var(--muted-foreground)]",children:f.type}),u.jsx("td",{className:"px-3 py-3",children:C$(f)?u.jsx(fr,{variant:"success",children:"● set"}):u.jsx(fr,{variant:"outline",children:"○ needs setup"})}),u.jsx("td",{className:"px-5 py-3",children:u.jsxs("div",{className:"flex justify-end gap-1.5",children:[((g=d.get(f.type))==null?void 0:g.authorize)&&u.jsxs(ge,{variant:"ghost",size:"sm",onClick:()=>c(f),children:[u.jsx(BE,{})," Authorize"]}),u.jsx(R$,{name:f.name,onDeleted:()=>m("Deleted",()=>xe.deleteChannel(f.id))})]})})]},f.id)})]})]})}),i&&u.jsx(k$,{channelTypes:t,onClose:()=>s(!1),onAdded:async()=>{s(!1),await r()}}),o&&u.jsx(wo,{open:!0,onOpenChange:f=>!f&&c(null),children:u.jsxs(Na,{children:[u.jsx(So,{children:u.jsxs(Aa,{children:['Authorize "',o.name,'"']})}),u.jsx(SA,{channelId:o.id,onDone:()=>{we.success("Authorized"),c(null),r()},onCancel:()=>c(null)})]})})]})}function R$({name:e,onDeleted:t}){return u.jsxs(Ca,{children:[u.jsx(Ea,{asChild:!0,children:u.jsx(ge,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:u.jsx(ql,{})})}),u.jsxs(Ss,{children:[u.jsxs(Ra,{children:[u.jsxs(Cs,{children:['Delete channel "',e,'"?']}),u.jsx(Es,{children:"This removes its credentials and any instance bound to it (which is stopped first)."})]}),u.jsxs(ka,{children:[u.jsx(ks,{children:"Cancel"}),u.jsx(Rs,{variant:"destructive",onClick:t,children:"Delete"})]})]})]})}function k$({channelTypes:e,onClose:t,onAdded:r}){var A;const[i,s]=_.useState(""),[o,c]=_.useState(((A=e[0])==null?void 0:A.type)??""),[d,m]=_.useState("manual"),[f,g]=_.useState({}),[p,b]=_.useState(null),x=_.useMemo(()=>e.find(N=>N.type===o),[e,o]),w=(x==null?void 0:x.configSchema)??[],S=!!(x!=null&&x.authorize);function E(N){c(N),g({});const k=e.find(O=>O.type===N);m(k!=null&&k.authorize?"authorize":"manual")}async function C(){if(!i.trim())return we.error("Channel name is required");if(!o)return we.error("Pick a channel type");try{if(d==="authorize"){const{id:N}=await xe.createChannel({name:i.trim(),type:o});b(N)}else await xe.createChannel({name:i.trim(),type:o,options:x$(w,f)}),we.success(`Channel "${i}" created`),await r()}catch(N){we.error(`Create failed: ${N.message}`)}}return u.jsx(wo,{open:!0,onOpenChange:N=>!N&&t(),children:u.jsxs(Na,{children:[u.jsx(So,{children:u.jsx(Aa,{children:"Add channel"})}),p?u.jsx(SA,{channelId:p,onDone:async()=>{we.success(`Channel "${i}" authorized`),await r()},onCancel:()=>void r()}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"grid gap-3",children:[u.jsx(Cv,{label:"Channel name",children:u.jsx(xt,{value:i,onChange:N=>s(N.target.value),placeholder:"lark-prod"})}),u.jsx(Cv,{label:"Type",children:u.jsx(fo,{value:o,onChange:N=>E(N.target.value),className:"w-full",children:e.map(N=>u.jsx("option",{value:N.type,children:N.type},N.type))})}),S&&u.jsx(Cv,{label:"Setup",children:u.jsxs(fo,{value:d,onChange:N=>m(N.target.value),className:"w-full",children:[u.jsx("option",{value:"authorize",children:"Scan / authorize"}),u.jsx("option",{value:"manual",children:"Enter credentials manually"})]})}),d==="manual"&&w.length>0&&u.jsx(w$,{schema:w,values:f,onChange:g})]}),u.jsxs($u,{children:[u.jsx(Iu,{asChild:!0,children:u.jsx(ge,{variant:"outline",children:"Cancel"})}),u.jsx(ge,{onClick:C,children:d==="authorize"?"Create & authorize":"Create"})]})]})]})})}function Cv({label:e,children:t}){return u.jsxs("div",{className:"grid gap-1.5",children:[u.jsx(Fr,{children:e}),t]})}const N$=700,A$=250,$C=33333,qh=new Uint8Array([0,0,0,1]);function M$(e,t){const r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}function Ev(e,t){for(let r=t;r<=e.length-3;r+=1)if(!(e[r]!==0||e[r+1]!==0)){if(e[r+2]===1)return{index:r,length:3};if(r<=e.length-4&&e[r+2]===0&&e[r+3]===1)return{index:r,length:4}}return null}function UC(e,t){const r=M$(e,t),i=Ev(r,0);if(!i)return{nals:[],pending:r.slice(Math.max(0,r.length-4))};const s=[];let o=i.index,c=i.index+i.length,d=Ev(r,c);for(;d;)d.index>c&&s.push(r.slice(c,d.index)),o=d.index,c=d.index+d.length,d=Ev(r,c);return{nals:s,pending:r.slice(o)}}function um(e){return e[0]&31}function T$(e){if(um(e)!==7||e.length<4)return null;const t=r=>r.toString(16).padStart(2,"0").toUpperCase();return`avc1.${t(e[1])}${t(e[2])}${t(e[3])}`}function D$(e){const t=e.reduce((s,o)=>s+qh.length+o.length,0),r=new Uint8Array(t);let i=0;for(const s of e)r.set(qh,i),i+=qh.length,r.set(s,i),i+=s.length;return r}function HC(e){const t=um(e);return t===1||t===5}function L$(e){return e.some(t=>um(t)===5)}function Rv(e,t,r,i){(e.width!==r||e.height!==i)&&(e.width=r,e.height=i);const s=e.getContext("2d");s&&s.drawImage(t,0,0,r,i)}function j$(e,t){return new Promise((r,i)=>{if(t.aborted){i(t.reason);return}const s=window.setTimeout(r,e);t.addEventListener("abort",()=>{window.clearTimeout(s),i(t.reason)},{once:!0})})}function FC(e){return e instanceof Error?e.message:String(e)}function B$(e){return e instanceof DOMException&&e.name==="AbortError"}function O$({device:e,alt:t,mediaRef:r,onFrameSize:i}){const s=_.useRef(null),o=_.useRef(!1),c=_.useRef(!1),d=_.useRef(null),[m,f]=_.useState("video"),[g,p]=_.useState(!1),[b,x]=_.useState("Loading preview..."),w=_.useCallback(C=>{s.current=C,r==null||r(C)},[r]),S=_.useCallback(()=>{o.current||(o.current=!0,p(!0),x(""))},[]),E=_.useCallback((C,A)=>{const N=d.current;(N==null?void 0:N.width)===C&&N.height===A||(d.current={width:C,height:A},i==null||i(C,A))},[i]);return _.useEffect(()=>{o.current=!1,c.current=!1,d.current=null,p(!1),x("Loading preview..."),f("video")},[e]),_.useEffect(()=>{if(m!=="video"||o.current)return;let C=!1;return(async()=>{try{const N=await xe.emulatorFrameBlob(e);if(C||o.current)return;const k=await createImageBitmap(N);try{const O=s.current;O&&!o.current&&(Rv(O,k,k.width,k.height),E(k.width,k.height),S())}finally{k.close()}}catch{}})(),()=>{C=!0}},[e,S,m,E]),_.useEffect(()=>{if(m!=="video")return;if(!("VideoDecoder"in window)||!("EncodedVideoChunk"in window)){x("Video decoder unavailable"),f("fallback");return}const C=new AbortController,A=k=>{const O=s.current;try{if(O){const z=k.displayWidth||k.codedWidth,H=k.displayHeight||k.codedHeight;Rv(O,k,z,H),E(z,H),c.current=!0,S()}}finally{k.close()}};return(async()=>{for(;!C.signal.aborted;){let k=null,O=null,z=new Uint8Array,H=[],D=!1,G=0,Y="avc1.42E01F";const W=async()=>{if(k)return k;const j={codec:Y,optimizeForLatency:!0,avc:{format:"annexb"}};if(!(await VideoDecoder.isConfigSupported(j)).supported)throw new Error(`Unsupported Android video codec: ${Y}`);return k=new VideoDecoder({output:A,error:M=>{x(M.message)}}),k.configure(j),k},L=async()=>{if(!D){H=[];return}const j=await W(),U=L$(H),M=D$(H),P=G;G+=$C,H=[],D=!1,!(j.decodeQueueSize>2&&!U)&&j.decode(new EncodedVideoChunk({type:U?"key":"delta",timestamp:P,duration:$C,data:M}))},T=async j=>{const U=T$(j);U&&(Y=U),(um(j)===9||HC(j))&&D&&await L(),H.push(j),HC(j)&&(D=!0)};try{const j=await fetch(xe.emulatorVideoStreamUrl(e),{cache:"no-store",signal:C.signal});if(!j.ok||!j.body)throw new Error(`Android video stream failed: ${j.status}`);for(O=j.body.getReader();;){const{done:M,value:P}=await O.read();if(M)break;const I=UC(z,P);z=I.pending;for(const F of I.nals)await T(F)}const U=UC(z,qh);for(const M of U.nals)await T(M);await L(),(k==null?void 0:k.state)==="configured"&&await k.flush()}catch(j){if(C.signal.aborted||B$(j))break;if(x(FC(j)),!c.current){f("fallback");break}}finally{try{O==null||O.releaseLock()}catch{}(k==null?void 0:k.state)!=="closed"&&(k==null||k.close())}C.signal.aborted||await j$(A$,C.signal).catch(()=>{})}})(),()=>{C.abort()}},[e,S,m,E]),_.useEffect(()=>{if(m!=="fallback")return;let C=!1,A;const N=async()=>{try{const k=await xe.emulatorFrameBlob(e);if(C)return;const O=await createImageBitmap(k);try{const z=s.current;z&&(Rv(z,O,O.width,O.height),E(O.width,O.height),S())}finally{O.close()}}catch(k){C||x(FC(k))}finally{C||(A=window.setTimeout(N,N$))}};return N(),()=>{C=!0,A&&window.clearTimeout(A)}},[e,S,m,E]),u.jsxs("div",{className:"relative h-full w-full",children:[u.jsx("canvas",{ref:w,"aria-label":t,width:720,height:1520,className:"pointer-events-none h-full w-full select-none object-contain"}),!g&&u.jsx("div",{className:"pointer-events-none absolute inset-0 grid place-items-center px-5 text-center text-sm text-zinc-400",children:b})]})}const WC=8,P$=.012,z$=1500,I$=35,$$=260,U$=40,H$=3,F$=5e3,W$=750;function qC(e){return[e.backend,e.isDefault?"default":void 0,e.detail].filter(Boolean).join(" · ")}function VC(e,t,r){return Math.max(t,Math.min(r,e))}function GC(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function q$(e){const t=e.getBoundingClientRect();if(t.width<=0||t.height<=0)return null;const r="naturalWidth"in e?e.naturalWidth||t.width:e.width||t.width,i="naturalHeight"in e?e.naturalHeight||t.height:e.height||t.height;if(r<=0||i<=0)return t;const s=r/i;if(t.width/t.height>s){const d=t.height*s;return new DOMRect(t.left+(t.width-d)/2,t.top,d,t.height)}const c=t.width/s;return new DOMRect(t.left,t.top+(t.height-c)/2,t.width,c)}function kv(e,t,r){if(!e)return null;const i=q$(e);if(!i)return null;const s=(t.clientX-i.left)/i.width,o=(t.clientY-i.top)/i.height;return!r&&(s<0||s>1||o<0||o>1)?null:{x:VC(s,0,1),y:VC(o,0,1)}}function V$(e){return new Promise(t=>setTimeout(t,e))}function G$(e){const t=new TextEncoder().encode(JSON.stringify(e)),r=new Uint8Array(1+t.length);return r[0]=H$,r.set(t,1),r.buffer}function Y$(){const[e,t]=_.useState([]),[r,i]=_.useState(null),[s,o]=_.useState(!0),[c,d]=_.useState(null),[m,f]=_.useState(null),[g,p]=_.useState(!1),[b,x]=_.useState(null),[w,S]=_.useState(null),[E,C]=_.useState(!1),[A,N]=_.useState(0),k=_.useRef(null),O=_.useRef(null),z=_.useRef(null),H=_.useRef(null),D=_.useRef(null),G=_.useRef(null),Y=_.useCallback(async()=>{o(!0);try{const[Q,re]=await Promise.all([xe.emulatorDevices(),xe.activeEmulator()]);t(Q),i(re)}catch(Q){we.error(`Failed to load emulator: ${Q.message}`)}finally{o(!1)}},[]);_.useEffect(()=>{Y()},[Y]),_.useEffect(()=>()=>{z.current!==null&&window.clearTimeout(z.current),O.current!==null&&window.clearTimeout(O.current)},[]),_.useEffect(()=>()=>{var re;const Q=(re=H.current)==null?void 0:re.socket;H.current=null,Q&&Q.readyState!==WebSocket.CLOSED&&Q.close()},[r==null?void 0:r.wsUrl]),_.useEffect(()=>{var Q;if((r==null?void 0:r.backend)!=="android"){const re=(Q=D.current)==null?void 0:Q.socket;D.current=null,re&&re.readyState!==WebSocket.CLOSED&&re.close();return}return le(r.deviceUdid).catch(()=>{}),()=>{var be;const re=(be=D.current)==null?void 0:be.socket;D.current=null,re&&re.readyState!==WebSocket.CLOSED&&re.close()}},[r==null?void 0:r.backend,r==null?void 0:r.deviceUdid]);const W=(r==null?void 0:r.streamUrl)??null,L=W&&A>0?`${W}${W.includes("?")?"&":"?"}rynx_preview_retry=${A}`:W,T=(r==null?void 0:r.backend)==="android"&&!r.streamUrl,j=!!(W||T),U=w===null?void 0:{aspectRatio:w,width:`min(100%, calc(100cqh * ${w}))`},M=_.useCallback((Q,re)=>{if(!Number.isFinite(Q)||!Number.isFinite(re)||Q<=0||re<=0)return;const be=Q/re;S(pe=>pe!==null&&Math.abs(pe-be)<1e-4?pe:be)},[]),P=_.useCallback(()=>{O.current!==null&&(window.clearTimeout(O.current),O.current=null)},[]),I=_.useCallback((Q,re)=>{P(),M(Q,re),C(!0)},[P,M]),F=_.useCallback(()=>{C(!1),O.current===null&&(O.current=window.setTimeout(()=>{O.current=null,N(Q=>Q+1)},W$))},[]);_.useEffect(()=>{if(P(),S(null),C(!1),N(0),!W)return;const Q=()=>{const be=k.current;be instanceof HTMLImageElement&&be.naturalWidth>0&&be.naturalHeight>0&&I(be.naturalWidth,be.naturalHeight)};Q();const re=window.setInterval(Q,500);return()=>window.clearInterval(re)},[P,r==null?void 0:r.attachedAt,r==null?void 0:r.deviceUdid,I,W]),_.useEffect(()=>{if(!W||E)return;const Q=window.setTimeout(F,F$);return()=>window.clearTimeout(Q)},[A,E,W,F]);async function q(Q){if(r){x("home");try{await xe.buttonEmulator(Q,r.deviceUdid)}catch(re){we.error(`${Q==="appswitch"?"App switcher":"Home"} failed: ${re.message}`)}finally{x(null)}}}function $(){if(!(!r||b)){if(z.current!==null){window.clearTimeout(z.current),z.current=null,q("appswitch");return}z.current=window.setTimeout(()=>{z.current=null,q("home")},$$)}}async function X(Q,re){const be=(r==null?void 0:r.deviceUdid)===Q;z.current!==null&&(window.clearTimeout(z.current),z.current=null),f(Q),be&&x("shutdown");try{await xe.shutdownEmulator(Q),be&&i(null),we.success(`Shutdown ${re}`),Y()}catch(pe){we.error(`Shutdown failed: ${pe.message}`)}finally{f(null),be&&x(null)}}async function V(Q){d(Q.id);try{const re=await xe.attachEmulator(Q.id);i(re),we.success(`Attached ${re.deviceName??re.deviceUdid}`),Y()}catch(re){we.error(`Attach failed: ${re.message}`)}finally{d(null)}}function J(Q){var Ee;const re=H.current;if((re==null?void 0:re.url)===Q){if(((Ee=re.socket)==null?void 0:Ee.readyState)===WebSocket.OPEN)return Promise.resolve(re.socket);if(re.connecting)return re.connecting}else re!=null&&re.socket&&re.socket.readyState!==WebSocket.CLOSED&&re.socket.close();const be={url:Q,socket:null,connecting:null},pe=new Promise((Ie,Te)=>{const Ye=new WebSocket(Q),ft=window.setTimeout(()=>{Ye.close(),Te(new Error("Timed out connecting to emulator gesture stream."))},1500),Ge=()=>window.clearTimeout(ft);Ye.binaryType="arraybuffer",Ye.addEventListener("open",()=>{Ge(),be.socket=Ye,be.connecting=null,Ie(Ye)},{once:!0}),Ye.addEventListener("error",()=>{Ge(),be.connecting=null,Te(new Error("Failed to connect to emulator gesture stream."))},{once:!0}),Ye.addEventListener("close",()=>{var zt;((zt=H.current)==null?void 0:zt.socket)===Ye&&(H.current=null)})});return be.connecting=pe,H.current=be,pe}function le(Q){var Ee;const re=D.current;if((re==null?void 0:re.device)===Q){if(((Ee=re.socket)==null?void 0:Ee.readyState)===WebSocket.OPEN)return Promise.resolve(re.socket);if(re.connecting)return re.connecting}else re!=null&&re.socket&&re.socket.readyState!==WebSocket.CLOSED&&re.socket.close();const be={device:Q,socket:null,connecting:null},pe=new Promise((Ie,Te)=>{const Ye=new WebSocket(y7(Q));let ft=!1;const Ge=window.setTimeout(()=>{ft||(ft=!0,Ye.close(),Te(new Error("Timed out connecting to Android touch stream.")))},z$),zt=()=>window.clearTimeout(Ge);Ye.addEventListener("message",dt=>{if(!ft&&typeof dt.data=="string")try{const Vt=JSON.parse(dt.data);Vt.t==="opened"?(ft=!0,zt(),be.socket=Ye,be.connecting=null,Ie(Ye)):Vt.t==="error"&&(ft=!0,zt(),be.connecting=null,Te(new Error(Vt.message??"Android touch stream failed.")))}catch{}}),Ye.addEventListener("error",()=>{ft||(ft=!0,zt(),be.connecting=null,Te(new Error("Failed to connect to Android touch stream.")))},{once:!0}),Ye.addEventListener("close",()=>{var dt;zt(),be.connecting=null,ft||(ft=!0,Te(new Error("Android touch stream closed before it was ready."))),((dt=D.current)==null?void 0:dt.socket)===Ye&&(D.current=null)})});return be.connecting=pe,D.current=be,pe}async function ae(Q,re){if(Q.backend==="android"){if(Q.liveFailed)return!1;try{return(await le(Q.device)).send(JSON.stringify(re)),Q.sentLiveFrames+=1,!0}catch(be){return Q.liveFailed=!0,Q.sentLiveFrames>0&&we.error(`Android touch stream failed: ${be.message}`),!1}}if(!Q.wsUrl||Q.liveFailed)return!1;try{return(await J(Q.wsUrl)).send(G$(re)),Q.sentLiveFrames+=1,!0}catch(be){return Q.liveFailed=!0,Q.sentLiveFrames>0&&we.error(`Gesture stream failed: ${be.message}`),!1}}function ee(Q,re){xe.gestureEmulator([{type:"begin",x:Q.x,y:Q.y}],re).catch(be=>{we.error(`Tap failed: ${be.message}`)})}function se(Q,re){xe.gestureEmulator(Q,re).catch(be=>{we.error(`Gesture failed: ${be.message}`)})}function ce(Q){if(!r||!j||!Q.isPrimary||Q.pointerType==="mouse"&&Q.button!==0)return;const re=kv(k.current,Q,!1);re&&(Q.preventDefault(),Q.currentTarget.setPointerCapture(Q.pointerId),G.current={backend:r.backend,pointerId:Q.pointerId,device:r.deviceUdid,wsUrl:r.backend==="ios"?r.wsUrl:void 0,startClientX:Q.clientX,startClientY:Q.clientY,lastPoint:re,moved:!1,liveFailed:!1,sentLiveFrames:0,points:[{type:"begin",x:re.x,y:re.y}]},ae(G.current,{type:"begin",x:re.x,y:re.y}),p(!0))}function Se(Q){const re=G.current;if(!re||re.pointerId!==Q.pointerId)return;const be=kv(k.current,Q,!0);if(!be)return;Q.preventDefault();const pe=Math.hypot(Q.clientX-re.startClientX,Q.clientY-re.startClientY)>WC,Ee=GC(be,re.lastPoint)>P$;if(re.lastPoint=be,pe&&(Ee||!re.moved)){re.moved=!0;const Ie={type:"move",x:be.x,y:be.y};re.points.push(Ie),ae(re,Ie)}}async function Re(Q){const re=G.current;if(!re||re.pointerId!==Q.pointerId)return;Q.preventDefault();const be=kv(k.current,Q,!0)??re.lastPoint,pe=Math.hypot(Q.clientX-re.startClientX,Q.clientY-re.startClientY)>WC;G.current=null,p(!1);try{Q.currentTarget.releasePointerCapture(Q.pointerId)}catch{}const Ee={type:"end",x:be.x,y:be.y};if((re.backend==="android"||re.wsUrl)&&!re.liveFailed&&(!re.moved&&!pe&&await V$(re.backend==="android"?I$:U$),await ae(re,Ee)||re.sentLiveFrames>0))return;if(!re.moved&&!pe){ee(be,re.device);return}const Ie=[...re.points],Te=Ie[Ie.length-1];Te&&GC(Te,be)<=.001?Ie[Ie.length-1]=Ee:Ie.push(Ee),se(Ie,re.device)}function Ne(Q){const re=G.current;!re||re.pointerId!==Q.pointerId||(G.current=null,p(!1),(re.backend==="android"||re.wsUrl)&&!re.liveFailed&&ae(re,{type:"end",x:re.lastPoint.x,y:re.lastPoint.y}))}return u.jsxs("div",{className:"grid h-full min-h-0 gap-3 p-3 sm:p-4 lg:grid-cols-[minmax(0,360px)_minmax(360px,1fr)]",children:[u.jsxs(Yi,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[u.jsxs($n,{className:"px-4 py-3",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsxs(dn,{className:"flex items-center gap-2",children:[u.jsx(q4,{className:"size-4"}),"Preview"]}),u.jsx("div",{className:"label-caps mt-1 truncate text-[10px] text-[var(--muted-foreground)]",children:r?`This device · ${r.backend} · ${r.deviceName??r.deviceUdid}`:"This device · not attached"})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[u.jsx(ge,{variant:"outline",size:"icon",className:"size-8",onClick:$,disabled:!r||b!==null,"aria-label":"Home or app switcher",title:"Home · double-click for app switcher",children:u.jsx(jE,{className:qe(b==="home"&&"animate-pulse")})}),u.jsx(ge,{variant:"outline",size:"icon",className:"size-8",onClick:()=>{r&&X(r.deviceUdid,r.deviceName??r.deviceUdid)},disabled:!r||b!==null||m!==null,"aria-label":"Shutdown emulator",title:"Shutdown",children:u.jsx(g_,{className:qe(b==="shutdown"&&"animate-pulse")})}),u.jsx(ge,{variant:"outline",size:"icon",className:"size-8",onClick:()=>void Y(),disabled:s,"aria-label":"Refresh emulator",title:"Refresh",children:u.jsx(mr,{className:qe(s&&"animate-spin")})})]})]}),u.jsxs(hn,{className:"relative grid min-h-0 flex-1 place-items-center p-2 sm:p-3",style:{containerType:"size"},"aria-busy":j&&!E,children:[j?u.jsx("div",{className:qe("relative grid touch-none select-none place-items-center overflow-hidden bg-black",E?"max-h-full max-w-full rounded-md border border-[var(--border)] shadow-sm":"pointer-events-none absolute inset-0",E&&(g?"cursor-grabbing":"cursor-crosshair")),style:E?U:void 0,onPointerDown:ce,onPointerMove:Se,onPointerUp:Re,onPointerCancel:Ne,children:W?u.jsx("img",{ref:Q=>{k.current=Q},src:L??void 0,alt:(r==null?void 0:r.deviceName)??(r==null?void 0:r.deviceUdid),className:"pointer-events-none absolute inset-0 h-full w-full select-none object-contain",onLoad:Q=>{I(Q.currentTarget.naturalWidth,Q.currentTarget.naturalHeight)},onError:F,draggable:!1},`${r==null?void 0:r.deviceUdid}:${r==null?void 0:r.attachedAt}:${A}`):r&&T?u.jsx(O$,{device:r.deviceUdid,alt:r.deviceName??r.deviceUdid,mediaRef:Q=>{k.current=Q},onFrameSize:I},r.deviceUdid):null}):u.jsx("div",{className:"grid h-full w-full place-items-center px-6 text-center text-sm text-[var(--muted-foreground)]",children:r?`${r.backend} preview unavailable`:"No active emulator"}),j&&!E&&u.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 grid place-items-center bg-[var(--background)] text-[var(--muted-foreground)]",role:"status","aria-live":"polite",children:u.jsxs("div",{className:"grid place-items-center gap-2 text-xs",children:[u.jsx(mr,{className:"size-4 animate-spin text-[var(--primary)]"}),u.jsx("span",{children:"Loading preview…"})]})})]})]}),u.jsxs(Yi,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[u.jsxs($n,{children:[u.jsxs(dn,{className:"flex items-center gap-2",children:[u.jsx(zl,{className:"size-4"}),"Devices"]}),u.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e.length})]}),u.jsx(hn,{className:"min-h-0 flex-1 p-0",children:e.length===0?u.jsx("div",{className:"px-5 py-8 text-sm text-[var(--muted-foreground)]",children:s?"Loading...":"No devices"}):u.jsx(un,{className:"h-full min-h-0",children:u.jsx("ul",{className:"grid grid-cols-1 content-start gap-2 p-3 sm:grid-cols-2 2xl:grid-cols-3",children:e.map(Q=>{const re=(r==null?void 0:r.deviceUdid)===Q.id,be=c===Q.id,pe=m===Q.id;return u.jsxs("li",{className:"flex min-w-0 items-center gap-2 rounded-md border border-[var(--border)] bg-[var(--background)] px-3 py-2.5",children:[u.jsx(zl,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx("div",{className:"truncate text-sm font-medium",children:Q.name}),u.jsxs(fr,{variant:Q.state==="booted"?"success":Q.state==="shutdown"?"outline":"warning",className:"h-5 shrink-0 gap-1 px-2 py-0 font-mono text-[9px] uppercase",children:[u.jsx("span",{className:"size-1.5 rounded-full bg-current","aria-hidden":"true"}),Q.state]})]}),u.jsx("div",{className:"mt-1 truncate font-mono text-[10px] uppercase text-[var(--muted-foreground)]",title:qC(Q),children:qC(Q)})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.jsx(ge,{size:"xs",variant:re?"outline":"default",onClick:()=>void V(Q),disabled:be||m!==null,children:be?"Attaching…":re?"Reattach":"Attach"}),Q.state==="booted"&&u.jsx(ge,{size:"icon-xs",variant:"destructive",onClick:()=>void X(Q.id,Q.name),disabled:c!==null||m!==null,"aria-label":`Shutdown ${Q.name}`,title:`Shutdown ${Q.name}`,children:u.jsx(g_,{className:qe(pe&&"animate-pulse")})})]})]},`${Q.backend}:${Q.id}`)})})})})]})]})}function CA({inst:e}){return e.running?e.connected===!1||e.lastError?u.jsx(fr,{variant:"destructive",children:"● error"}):e.connected&&!e.lastEventAt?u.jsx(fr,{variant:"default",children:"● connected (idle)"}):e.connected?u.jsx(fr,{variant:"success",children:"● connected"}):u.jsx(fr,{variant:"default",children:"● running"}):u.jsx(fr,{variant:"outline",children:"● stopped"})}function K$({instances:e,channels:t,agents:r,onChange:i}){const[s,o]=_.useState(!1),c=_.useMemo(()=>new Set(e.map(f=>f.channelId)),[e]),d=t.filter(f=>!c.has(f.id));async function m(f,g){try{await g(),we.success(f),await i()}catch(p){we.error(`${f} failed: ${p.message}`)}}return u.jsxs(Yi,{children:[u.jsxs($n,{children:[u.jsxs(dn,{children:["Instances ",u.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:e.length})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsxs(ge,{variant:"outline",size:"sm",onClick:()=>void i(),children:[u.jsx(mr,{})," Refresh"]}),u.jsxs(ge,{size:"sm",onClick:()=>o(!0),disabled:d.length===0,children:[u.jsx(Gi,{})," Add instance"]})]})]}),u.jsx(hn,{className:"p-0",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"label-caps border-b border-[var(--border)] text-left text-xs text-[var(--muted-foreground)]",children:[u.jsx("th",{className:"px-5 py-2.5 font-medium",children:"Channel"}),u.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Type"}),u.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Status"}),u.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Agent"}),u.jsx("th",{className:"px-5 py-2.5 text-right font-medium",children:"Actions"})]})}),u.jsxs("tbody",{children:[e.length===0&&u.jsx("tr",{children:u.jsx("td",{colSpan:5,className:"px-5 py-8 text-center text-[var(--muted-foreground)]",children:t.length===0?"No channels yet. Configure one on the Channels tab first.":"No instances. Bind a channel to an agent to start it."})}),e.map(f=>u.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0 hover:bg-[var(--muted)]/40",children:[u.jsxs("td",{className:"px-5 py-3",children:[u.jsx("div",{className:"font-medium",children:f.channelName}),u.jsx("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:f.id})]}),u.jsx("td",{className:"px-3 py-3 text-[var(--muted-foreground)]",children:f.type}),u.jsxs("td",{className:"px-3 py-3",children:[u.jsx(CA,{inst:f}),f.lastError&&u.jsx("div",{className:"mt-0.5 max-w-[16rem] truncate text-xs text-[var(--destructive)]",children:f.lastError})]}),u.jsx("td",{className:"px-3 py-3",children:u.jsxs(fo,{value:f.agent??"",onChange:g=>void m("Agent updated",()=>xe.updateInstance(f.id,{agent:g.target.value||void 0})),children:[u.jsx("option",{value:"",children:"(none)"}),r.map(g=>u.jsx("option",{value:g.id,children:g.name??g.id},g.id))]})}),u.jsx("td",{className:"px-5 py-3",children:u.jsxs("div",{className:"flex justify-end gap-1.5",children:[f.enabled?u.jsxs(ge,{variant:"outline",size:"sm",onClick:()=>void m("Disabled",()=>xe.instanceAction(f.id,"disable")),children:[u.jsx(aB,{})," Disable"]}):u.jsxs(ge,{variant:"outline",size:"sm",onClick:()=>void m("Enabled",()=>xe.instanceAction(f.id,"enable")),children:[u.jsx(PE,{})," Enable"]}),u.jsxs(ge,{variant:"ghost",size:"sm",onClick:()=>void m("Restarted",()=>xe.instanceAction(f.id,"restart")),children:[u.jsx(zE,{})," Restart"]}),u.jsx(X$,{name:f.channelName,onDeleted:()=>m("Deleted",()=>xe.deleteInstance(f.id))})]})})]},f.id))]})]})}),s&&u.jsx(Z$,{freeChannels:d,agents:r,onClose:()=>o(!1),onAdded:async()=>{o(!1),await i()}})]})}function X$({name:e,onDeleted:t}){return u.jsxs(Ca,{children:[u.jsx(Ea,{asChild:!0,children:u.jsx(ge,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:u.jsx(ql,{})})}),u.jsxs(Ss,{children:[u.jsxs(Ra,{children:[u.jsxs(Cs,{children:['Delete instance for "',e,'"?']}),u.jsx(Es,{children:"This stops the binding. The channel + its credentials stay; you can re-bind it later."})]}),u.jsxs(ka,{children:[u.jsx(ks,{children:"Cancel"}),u.jsx(Rs,{variant:"destructive",onClick:t,children:"Delete"})]})]})]})}function Z$({freeChannels:e,agents:t,onClose:r,onAdded:i}){var f;const[s,o]=_.useState(((f=e[0])==null?void 0:f.id)??""),[c,d]=_.useState("");async function m(){if(!s)return we.error("Pick a channel");try{await xe.createInstance({channelId:s,agent:c||void 0}),we.success("Instance created"),await i()}catch(g){we.error(`Create failed: ${g.message}`)}}return u.jsx(wo,{open:!0,onOpenChange:g=>!g&&r(),children:u.jsxs(Na,{children:[u.jsx(So,{children:u.jsx(Aa,{children:"Add instance"})}),u.jsxs("div",{className:"grid gap-3",children:[u.jsx(YC,{label:"Channel",children:u.jsx(fo,{value:s,onChange:g=>o(g.target.value),className:"w-full",children:e.map(g=>u.jsxs("option",{value:g.id,children:[g.name," (",g.type,")"]},g.id))})}),u.jsx(YC,{label:"Agent",children:u.jsxs(fo,{value:c,onChange:g=>d(g.target.value),className:"w-full",children:[u.jsx("option",{value:"",children:"(none)"}),t.map(g=>u.jsx("option",{value:g.id,children:g.name??g.id},g.id))]})})]}),u.jsxs($u,{children:[u.jsx(Iu,{asChild:!0,children:u.jsx(ge,{variant:"outline",children:"Cancel"})}),u.jsx(ge,{onClick:m,children:"Create"})]})]})})}function YC({label:e,children:t}){return u.jsxs("div",{className:"grid gap-1.5",children:[u.jsx(Fr,{children:e}),t]})}function J$(){const[e,t]=_.useState(""),[r,i]=_.useState("");async function s(){try{i(await xe.logs(e.trim()||void 0)||"(empty)")}catch(o){we.error(`Failed to read logs: ${o.message}`)}}return u.jsxs(Yi,{children:[u.jsxs($n,{children:[u.jsx(dn,{children:"Logs"}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(xt,{value:e,onChange:o=>t(o.target.value),placeholder:"filter by instance (optional)",className:"h-8 w-56"}),u.jsxs(ge,{size:"sm",onClick:()=>void s(),children:[u.jsx(IE,{})," Tail"]})]})]}),u.jsx(hn,{children:u.jsx("pre",{className:"max-h-[28rem] overflow-auto rounded-lg bg-[var(--muted)] p-4 font-mono text-xs leading-relaxed text-[var(--foreground)]",children:r||"Press Tail to load the latest daemon logs."})})]})}function Q$(e){return!!(e.options&&Object.keys(e.options).length>0)}function e9({instances:e,channels:t,agents:r}){const i=wa(),s=m=>i(Et[m]),o=e.filter(m=>m.running).length,c=e.filter(m=>m.connected).length,d=t.filter(Q$).length;return u.jsxs("div",{className:"grid gap-5",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Overview"}),u.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Channels, agents, and the instances binding them together."})]}),u.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[u.jsx(Nv,{icon:TE,label:"Instances",value:e.length,sub:`${o} running · ${c} connected`,onClick:()=>s("instances")}),u.jsx(Nv,{icon:Q0,label:"Channels",value:t.length,sub:`${d} configured`,onClick:()=>s("channels")}),u.jsx(Nv,{icon:J0,label:"Agents",value:r.length,sub:r.length===1?"1 defined":`${r.length} defined`,onClick:()=>s("agents")})]}),u.jsxs(Yi,{children:[u.jsxs($n,{children:[u.jsx(dn,{children:"Instances"}),u.jsx(ge,{variant:"outline",size:"sm",onClick:()=>s("instances"),children:"Manage"})]}),u.jsx(hn,{className:"p-0",children:e.length===0?u.jsxs("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:[t.length===0?"No channels yet — add one to get started.":"No instances yet — bind a channel to an agent.",u.jsx("div",{className:"mt-3",children:u.jsx(ge,{size:"sm",onClick:()=>s(t.length===0?"channels":"instances"),children:t.length===0?"Add channel":"Add instance"})})]}):u.jsx("ul",{className:"divide-y divide-[var(--border)]",children:e.map(m=>u.jsxs("li",{className:"flex items-center justify-between gap-3 px-5 py-3",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"truncate text-sm font-medium",children:m.channelName}),u.jsxs("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:[m.type,m.agent?` · ${m.agent}`:""]})]}),u.jsx(CA,{inst:m})]},m.id))})})]})]})}function Nv({icon:e,label:t,value:r,sub:i,onClick:s}){return u.jsx(Yi,{children:u.jsxs("button",{onClick:s,className:"flex w-full items-start gap-4 rounded-xl p-5 text-left transition-colors hover:bg-[var(--muted)]/40",children:[u.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:u.jsx(e,{className:"size-5"})}),u.jsxs("div",{children:[u.jsx("div",{className:"text-3xl font-semibold leading-none tabular-nums",children:r}),u.jsx("div",{className:"label-caps mt-1.5 text-[11px] text-[var(--muted-foreground)]",children:t}),u.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:i})]})]})})}const Av="local",t9={starting:"Starting…",installing:"Installing…",updating:"Updating…",verifying:"Verifying installation…",complete:"Complete"};function r9(){const[e,t]=_.useState(null),[r,i]=_.useState(null),[s,o]=_.useState(!1),[c,d]=_.useState({}),m=_.useRef(0),f=_.useCallback(async(p=!1)=>{const b=++m.current;p&&o(!0),i(null);try{const x=await xe.listProviderClis(Av);b===m.current&&t(x)}catch(x){b===m.current&&(t(null),i(x instanceof Error?x.message:String(x)))}finally{b===m.current&&o(!1)}},[]);_.useEffect(()=>{f()},[f]);const g=async(p,b)=>{try{let x=(await xe.startProviderCliOperation(Av,p,b)).job;for(d(w=>({...w,[p]:x}));x.state==="running";)await c9(750),x=await xe.getProviderCliJob(Av,x.id),d(w=>({...w,[p]:x}));x.state==="succeeded"?(we.success(`${KC(p)} ${b} completed`),await f(),d(w=>{const S={...w};return delete S[p],S})):we.error(x.error??`${KC(p)} ${b} failed`)}catch(x){we.error(x.message),d(w=>{const S={...w};return delete S[p],S})}};return u.jsxs("div",{className:"grid gap-4",children:[u.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Providers"}),u.jsx("p",{className:"mt-1 max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Inspect and manage the coding-agent providers installed on this device."})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs(fr,{variant:"outline",className:"gap-1.5",children:[u.jsx(ty,{className:"size-3"}),"This device"]}),u.jsxs(ge,{variant:"outline",size:"sm",disabled:s,onClick:()=>void f(!0),children:[u.jsx(mr,{className:s?"animate-spin":""}),"Refresh"]})]})]}),r&&u.jsxs("div",{className:"rounded-lg border border-[var(--destructive)]/35 bg-[var(--destructive)]/8 px-4 py-3 text-sm",children:[u.jsxs("div",{className:"flex items-center gap-2 font-medium text-[var(--destructive)]",children:[u.jsx(ny,{className:"size-4"})," Could not inspect Providers"]}),u.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:r}),u.jsxs(ge,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>void f(!0),children:[u.jsx(mr,{})," Retry"]})]}),e===null&&!r?u.jsx("div",{className:"grid gap-3","aria-label":"Loading Providers",children:[0,1,2].map(p=>u.jsx(n9,{},p))}):u.jsx("div",{className:"grid gap-3",children:e==null?void 0:e.providerClis.map(p=>u.jsx(i9,{provider:p,job:c[p.id],readOnly:e.management==="read_only",onOperation:g},p.id))})]})}function i9({provider:e,job:t,readOnly:r,onOperation:i}){const s=e.availability!=="installed"?e.canInstall?"install":void 0:e.updateState==="available"&&e.canUpdate?"update":void 0,o=(t==null?void 0:t.state)==="running";return u.jsx(Yi,{className:"min-w-0",children:u.jsxs(hn,{className:"grid gap-3 p-4 text-xs",children:[u.jsxs("div",{className:"grid gap-4 xl:grid-cols-[12rem_minmax(0,1fr)_auto] xl:items-center",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[u.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:u.jsx(iy,{className:"size-4"})}),u.jsxs("div",{className:"min-w-0",children:[u.jsx(dn,{children:e.name}),u.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--muted-foreground)]",children:e.binary})]})]}),u.jsxs("div",{className:"grid min-w-0 gap-3 sm:grid-cols-2 lg:grid-cols-[minmax(14rem,1.5fr)_minmax(8rem,0.65fr)_minmax(10rem,0.8fr)]",children:[u.jsx(Mv,{icon:$4,label:"Executable",value:e.executablePath??"Not found on Runtime PATH",mono:!0}),u.jsx(Mv,{icon:mr,label:"Version",value:o9(e),mono:!0,noWrap:!0}),u.jsx(Mv,{icon:BE,label:"Authentication",value:l9(e)})]}),u.jsxs("div",{className:"flex flex-wrap items-center gap-2 xl:max-w-56 xl:justify-end",children:[u.jsx(s9,{provider:e}),!r&&s&&u.jsx(a9,{provider:e,operation:s,disabled:o,onConfirm:()=>i(e.id,s)})]})]}),e.error&&u.jsx("p",{className:"rounded-md bg-[var(--destructive)]/8 px-2.5 py-2 text-[11px] text-[var(--destructive)]",children:e.error}),t&&u.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-[var(--muted)]/45 px-2.5 py-2 text-[11px]",children:[o?u.jsx(mr,{className:"size-3.5 animate-spin text-[var(--primary)]"}):t.state==="succeeded"?u.jsx(LE,{className:"size-3.5 text-[var(--success)]"}):u.jsx(ny,{className:"size-3.5 text-[var(--destructive)]"}),u.jsx("span",{children:t.error??t9[t.stage]})]})]})})}function n9(){return u.jsxs("div",{"aria-hidden":"true",className:"grid animate-pulse gap-4 rounded-xl border border-[var(--border)] p-4 xl:grid-cols-[12rem_minmax(0,1fr)_auto] xl:items-center",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"size-9 rounded-lg bg-[var(--muted)]"}),u.jsxs("div",{className:"grid gap-2",children:[u.jsx("div",{className:"h-3.5 w-20 rounded bg-[var(--muted)]"}),u.jsx("div",{className:"h-2.5 w-12 rounded bg-[var(--muted)]"})]})]}),u.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:["w-full","w-24","w-32"].map((e,t)=>u.jsxs("div",{className:"grid gap-2",children:[u.jsx("div",{className:"h-2.5 w-16 rounded bg-[var(--muted)]"}),u.jsx("div",{className:`h-3 rounded bg-[var(--muted)] ${e}`})]},t))}),u.jsxs("div",{className:"flex items-center gap-2 xl:justify-end",children:[u.jsx("div",{className:"h-5 w-24 rounded-full bg-[var(--muted)]"}),u.jsx("div",{className:"h-8 w-24 rounded-md bg-[var(--muted)]"})]})]})}function s9({provider:e}){return e.availability==="missing"?u.jsx(fr,{variant:"warning",children:"Not installed"}):e.availability==="broken"?u.jsx(fr,{variant:"destructive",children:"Unavailable"}):e.updateState==="available"?u.jsx(fr,{variant:"warning",children:"New version"}):u.jsx(fr,{variant:"success",children:"Installed"})}function Mv({icon:e,label:t,value:r,mono:i=!1,noWrap:s=!1}){return u.jsxs("div",{className:"grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] gap-x-2",children:[u.jsx(e,{className:"mt-0.5 size-3.5 text-[var(--muted-foreground)]"}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-[var(--muted-foreground)]",children:t}),u.jsx("div",{className:qe("mt-0.5",i&&"font-mono text-[11px]",i&&!s&&"break-all",s&&"whitespace-nowrap"),children:r})]})]})}function a9({provider:e,operation:t,disabled:r,onConfirm:i}){const s=t==="install"?"Install":"Update";return u.jsxs(Ca,{children:[u.jsx(Ea,{asChild:!0,children:u.jsxs(ge,{size:"sm",className:"w-full sm:w-auto",disabled:r,children:[r?u.jsx(mr,{className:"animate-spin"}):u.jsx(p4,{}),r?"Working…":s]})}),u.jsxs(Ss,{children:[u.jsxs(Ra,{children:[u.jsxs(Cs,{children:[s," ",e.name,"?"]}),u.jsxs(Es,{children:["Rynx will run ",e.name,"'s official ",t," mechanism on this Runtime. The daemon will verify the executable and version when it finishes."]})]}),u.jsxs(ka,{children:[u.jsx(ks,{children:"Cancel"}),u.jsx(Rs,{onClick:()=>void i(),children:s})]})]})]})}function o9(e){return e.currentVersion?e.latestVersion?e.updateState==="available"?`${e.currentVersion} → ${e.latestVersion}`:`${e.currentVersion} · latest`:`${e.currentVersion} · latest unknown`:e.availability==="missing"?"—":"Unknown"}function l9(e){const t=e.authMode?` · ${e.authMode}`:"";return e.authState==="ready"?`Authenticated${t}`:e.authState==="required"?`Sign-in required${t}`:`Unknown${t}`}function KC(e){return e==="codex"?"Codex":e==="claude"?"Claude Code":"Traex"}function c9(e){return new Promise(t=>window.setTimeout(t,e))}function u9(){const{runtimeSelector:e,selectRuntime:t,updateRuntimes:r}=Kl(),[i,s]=_.useState(null),[o,c]=_.useState(!1),[d,m]=_.useState(null),[f,g]=_.useState({});async function p(){try{const w=await xe.listRuntimes();s(w),r(w)}catch(w){s([]),we.error(`Failed to load Runtimes: ${w.message}`)}}_.useEffect(()=>{p()},[]);async function b(w){m(w.selector);try{const S=await xe.testRuntime(w.selector);g(E=>({...E,[w.selector]:S})),we.success(`${w.displayName} is reachable`)}catch(S){we.error(`Connection test failed: ${S.message}`)}finally{m(null)}}async function x(w){try{await xe.forgetRuntime(w.daemonId),g(S=>{const E={...S};return delete E[w.selector],E}),we.success(`Forgot ${w.displayName}`),e===w.selector&&t("local"),await p()}catch(S){we.error(`Forget failed: ${S.message}`)}}return u.jsxs("div",{className:"grid gap-4",children:[u.jsx(d9,{}),u.jsxs(Yi,{children:[u.jsxs($n,{className:"items-start",children:[u.jsxs("div",{className:"grid gap-1",children:[u.jsxs(dn,{children:["Runtimes"," ",u.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:(i==null?void 0:i.length)??0})]}),u.jsx("p",{className:"max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Pair this Control Plane with remote Rynx daemons. Client keys stay in the local backend and never enter the browser."})]}),u.jsxs(ge,{size:"sm",onClick:()=>c(!0),children:[u.jsx(Gi,{})," Add Runtime"]})]}),u.jsx(hn,{className:"p-0",children:u.jsxs("div",{className:"divide-y divide-[var(--border)]",children:[i===null&&u.jsx("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:"Loading Runtimes…"}),i==null?void 0:i.map(w=>{const S=f[w.selector];return u.jsxs("article",{className:"grid gap-3 px-5 py-4 transition-colors hover:bg-[var(--muted)]/35 md:grid-cols-[minmax(0,1fr)_auto] md:items-center",children:[u.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[u.jsx("div",{className:"mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:w.binding==="local"?u.jsx(ty,{className:"size-4"}):u.jsx(jf,{className:"size-4"})}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx("h2",{className:"font-medium",children:w.displayName}),u.jsx(fr,{variant:w.binding==="local"?"default":"outline",children:w.binding}),S&&u.jsxs(fr,{variant:"success",children:[u.jsx(LE,{className:"mr-1 size-3"})," reachable"]})]}),u.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-[var(--muted-foreground)]",children:w.daemonId}),w.endpoint&&u.jsx("div",{className:"mt-1 truncate text-xs text-[var(--muted-foreground)]",children:w.endpoint}),w.identityKeyFingerprint&&u.jsxs("div",{className:"mt-1 flex items-center gap-1.5 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:[u.jsx(ry,{className:"size-3 shrink-0"}),w.identityKeyFingerprint]}),S&&u.jsxs("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:["Instance ",S.status.daemonInstanceId]})]})]}),u.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[u.jsxs(ge,{variant:"outline",size:"sm",disabled:d===w.selector,onClick:()=>void b(w),children:[u.jsx(mr,{className:d===w.selector?"animate-spin":""}),"Test"]}),w.binding==="direct"&&u.jsx(g9,{target:w,onForget:()=>x(w)})]})]},w.selector)})]})})]}),u.jsx("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 px-4 py-3 text-xs text-[var(--muted-foreground)]",children:"Sessions, terminals, and Session-scoped resources follow the selected Runtime. The standalone Emulator manager in Settings controls This device only. A remote failure never falls back to this device."}),u.jsx(p9,{open:o,onOpenChange:c,onAdded:async w=>{g(S=>({...S,[w.target.selector]:w})),await p()}})]})}const XC="__rynx_custom_share_address__";function d9(){const[e,t]=_.useState(null),[r,i]=_.useState(null),[s,o]=_.useState(null),[c,d]=_.useState(!1),[m,f]=_.useState(!1),[g,p]=_.useState(""),[b,x]=_.useState(!1),[w,S]=_.useState(""),[E,C]=_.useState(!1),[A,N]=_.useState(null),[k,O]=_.useState(null),[z,H]=_.useState(null),[D,G]=_.useState(!1),[Y,W]=_.useState(null),L=_.useCallback(async(V=!1)=>{G(!0);try{O(await xe.listRuntimeAccess()),H(null),V&&we.success("Shared access refreshed")}catch(J){const le=J.message;H(le),V&&we.error(`Failed to refresh shared access: ${le}`)}finally{G(!1)}},[]),T=_.useCallback(async(V=!1)=>{d(!0);try{const J=await xe.listRuntimeShareAddresses();t(J),o(null),i(le=>(le==null?void 0:le.kind)==="custom"||le&&J.some(ae=>ae.address===le.address)?le:J[0]?{kind:"detected",address:J[0].address}:null),V&&we.success("Network addresses refreshed")}catch(J){const le=J.message;t(ae=>ae??[]),o(le),V&&we.error(`Failed to refresh network addresses: ${le}`)}finally{d(!1)}},[]);_.useEffect(()=>{L(),T()},[L,T]);const j=(r==null?void 0:r.address)??"",U=w.trim(),M=A&&A.address===j.trim()&&A.clientLabel===U?A.code:"";function P(V){if(V===XC){p((r==null?void 0:r.kind)==="custom"?r.address:""),x(!1),f(!0);return}V!==Tv(r)&&e!=null&&e.some(J=>J.address===V)&&i({kind:"detected",address:V})}function I(){const V=g.trim();if(!f9(V)){x(!0);return}i({kind:"custom",address:V}),f(!1),x(!1)}async function F(){const V=j.trim();if(!V){we.error("Choose an address that the other device can reach");return}C(!0);try{const J=await xe.shareRuntime({address:V,...U?{clientLabel:U}:{}});N({code:J.pairingCode,address:V,clientLabel:U}),we.success("Pairing link generated"),await L()}catch(J){we.error(`Failed to generate pairing link: ${J.message}`)}finally{C(!1)}}async function q(){if(M)try{if(!navigator.clipboard)throw new Error("Clipboard access is unavailable");await navigator.clipboard.writeText(M),we.success("Pairing link copied")}catch(V){we.error(`Copy failed: ${V.message}`)}}async function $(V){W(V.grantId);try{const J=await xe.revokeRuntimeAccess(V.grantId);we.success(`Revoked ${q_(V)}${J.closedConnections>0?` and closed ${J.closedConnections} active connection${J.closedConnections===1?"":"s"}`:""}`),await L()}catch(J){we.error(`Revoke failed: ${J.message}`)}finally{W(null)}}const X=(k==null?void 0:k.filter(V=>V.revokedAt===null).length)??0;return u.jsxs(Yi,{children:[u.jsx($n,{className:"items-start",children:u.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[u.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:u.jsx(wB,{className:"size-4"})}),u.jsxs("div",{className:"grid gap-1",children:[u.jsx(dn,{children:"Share this device"}),u.jsx("p",{className:"max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Generate a revocable pairing link so another Rynx Control Plane can connect to this Runtime. Use a LAN, Tailscale, or tunnel address reachable from that device."})]})]})}),u.jsxs(hn,{className:"grid gap-6",children:[u.jsxs("form",{className:"grid gap-3",onSubmit:V=>{V.preventDefault(),F()},children:[u.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] md:items-end",children:[u.jsxs("div",{className:"grid gap-1.5",children:[u.jsx(Fr,{htmlFor:"runtime-share-address",children:"Connection address"}),u.jsxs("div",{className:"flex min-w-0 gap-1.5",children:[u.jsxs(lm,{value:(r==null?void 0:r.kind)==="custom"?Tv(r):r==null?void 0:r.address,onValueChange:P,disabled:e===null,children:[u.jsx(Ku,{id:"runtime-share-address",className:"min-w-0 flex-1","aria-describedby":"runtime-share-address-help",children:u.jsx(Yu,{placeholder:e===null?"Detecting addresses…":"No address detected",children:(r==null?void 0:r.kind)==="custom"?r.address:r?h9(e??[],r.address):void 0})}),u.jsxs(Xu,{align:"start",children:[(r==null?void 0:r.kind)==="custom"&&u.jsxs(zn,{value:Tv(r),children:["Custom (",r.address,")"]}),e==null?void 0:e.map(V=>u.jsx(zn,{value:V.address,children:EA(V)},V.address)),((r==null?void 0:r.kind)==="custom"||!!(e!=null&&e.length))&&u.jsx(Vy,{}),u.jsx(zn,{value:XC,children:"Enter custom address…"})]})]}),u.jsx(ge,{type:"button",variant:"outline",size:"icon",disabled:c,"aria-label":"Refresh network addresses",title:"Refresh network addresses",onClick:()=>void T(!0),children:u.jsx(mr,{className:c?"animate-spin":""})})]})]}),u.jsxs("div",{className:"grid gap-1.5",children:[u.jsx(Fr,{htmlFor:"runtime-share-label",children:"Client label"}),u.jsx(xt,{id:"runtime-share-label",value:w,onChange:V=>S(V.target.value),placeholder:"Alice’s laptop (optional)",maxLength:128})]}),u.jsxs(ge,{type:"submit",disabled:E||!r,children:[E?u.jsx(mr,{className:"animate-spin"}):u.jsx(B4,{}),"Generate Link"]})]}),u.jsx("p",{id:"runtime-share-address-help",className:s?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",role:s?"alert":void 0,children:s?`Could not refresh network addresses: ${s}`:(r==null?void 0:r.kind)==="custom"?"Using a custom host or ws(s) endpoint. Make sure the other device can reach it.":e!=null&&e.length?"Detected from this device. Tailnet addresses are listed first.":e===null?"Looking for reachable IPv4 interfaces on this device…":"No reachable IPv4 interface was found. Check the Runtime listener or enter a custom address."}),M&&u.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 p-3",children:[u.jsx(Fr,{htmlFor:"runtime-pairing-code",children:"Pairing link"}),u.jsxs("div",{className:"flex min-w-0 gap-2",children:[u.jsx(xt,{id:"runtime-pairing-code",value:M,readOnly:!0,className:"font-mono text-xs",spellCheck:!1}),u.jsxs(ge,{type:"button",variant:"outline",onClick:()=>void q(),children:[u.jsx(f4,{})," Copy"]})]}),u.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Treat this link as a credential. After it is used, the client appears below and can be revoked."})]})]}),u.jsxs("section",{className:"grid gap-3 border-t border-[var(--border)] pt-4","aria-labelledby":"runtime-access-title",children:[u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsxs("div",{children:[u.jsxs("h2",{id:"runtime-access-title",className:"text-sm font-medium",children:["Shared access ",u.jsx("span",{className:"text-[var(--muted-foreground)]",children:X})]}),u.jsx("p",{className:"mt-0.5 text-xs text-[var(--muted-foreground)]",children:"Active clients can reconnect until their grant is revoked."})]}),u.jsx(ge,{type:"button",variant:"ghost",size:"icon-sm",disabled:D,"aria-label":"Refresh shared access",onClick:()=>void L(!0),children:u.jsx(mr,{className:D?"animate-spin":""})})]}),k===null&&!z&&u.jsx("div",{className:"py-4 text-center text-xs text-[var(--muted-foreground)]",role:"status",children:"Loading shared access…"}),z&&u.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2",children:[u.jsxs("p",{className:"text-xs text-[var(--destructive)]",role:"alert",children:["Could not load shared access: ",z]}),u.jsx(ge,{type:"button",variant:"outline",size:"sm",onClick:()=>void L(),children:"Retry"})]}),(k==null?void 0:k.length)===0&&!z&&u.jsx("div",{className:"rounded-lg border border-dashed border-[var(--border)] px-4 py-6 text-center text-xs text-[var(--muted-foreground)]",children:"No shared Runtime access yet."}),k&&k.length>0&&u.jsx("ul",{className:"divide-y divide-[var(--border)] overflow-hidden rounded-lg border border-[var(--border)]",children:k.map(V=>u.jsxs("li",{className:"grid gap-3 px-3 py-3 md:grid-cols-[minmax(0,1fr)_auto] md:items-center",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx("span",{className:"text-sm font-medium",children:q_(V)}),u.jsxs(fr,{variant:V.revokedAt?"destructive":"success",children:[V.revokedAt?u.jsx(UE,{className:"size-3"}):u.jsx(ry,{className:"size-3"}),V.revokedAt?"revoked":"active"]})]}),u.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:V.grantId}),u.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:V.lastUsedAt?`Last used ${ZC(V.lastUsedAt)}`:`Created ${ZC(V.createdAt)} · never connected`})]}),!V.revokedAt&&u.jsx(m9,{client:V,disabled:Y===V.grantId,onRevoke:()=>$(V)})]},V.grantId))})]})]}),u.jsx(wo,{open:m,onOpenChange:V=>{f(V),V||x(!1)},children:u.jsxs(Na,{className:"sm:max-w-md",children:[u.jsxs(So,{children:[u.jsx(Aa,{children:"Enter custom address"}),u.jsx(Vf,{children:"Use a DNS name, custom port, reverse proxy, or tunnel when the detected interfaces are not the route the other device should dial."})]}),u.jsxs("form",{className:"grid gap-4",onSubmit:V=>{V.preventDefault(),I()},children:[u.jsxs("div",{className:"grid gap-1.5",children:[u.jsx(Fr,{htmlFor:"runtime-custom-share-address",children:"Host or WebSocket URL"}),u.jsx(xt,{id:"runtime-custom-share-address",value:g,onChange:V=>{p(V.target.value),V.target.value.trim()&&x(!1)},placeholder:"runtime.example.com or wss://runtime.example.com",maxLength:2048,"aria-invalid":b,"aria-describedby":"runtime-custom-share-address-help",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,autoFocus:!0}),u.jsx("p",{id:"runtime-custom-share-address-help",className:b?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",children:b?"Enter a host or a complete ws:// or wss:// URL without spaces.":"Rynx adds the listener port for a host and supplies the Runtime path."})]}),u.jsxs($u,{children:[u.jsx(Iu,{asChild:!0,children:u.jsx(ge,{type:"button",variant:"outline",children:"Cancel"})}),u.jsx(ge,{type:"submit",disabled:!g.trim(),children:"Use Address"})]})]})]})})]})}function EA(e){return`${e.interfaceName} (${e.address})`}function h9(e,t){const r=e.find(i=>i.address===t);return r?EA(r):t}function Tv(e){return(e==null?void 0:e.kind)==="custom"?`__rynx_custom_share_address_current__:${e.address}`:void 0}function f9(e){return e.length>0&&e.length<=2048&&!/[\s\u0000-\u001f\u007f]/.test(e)}function m9({client:e,disabled:t,onRevoke:r}){return u.jsxs(Ca,{children:[u.jsx(Ea,{asChild:!0,children:u.jsxs(ge,{type:"button",variant:"destructive",size:"sm",disabled:t,children:[t?u.jsx(mr,{className:"animate-spin"}):u.jsx(UE,{}),"Revoke"]})}),u.jsxs(Ss,{children:[u.jsxs(Ra,{children:[u.jsxs(Cs,{children:["Revoke access for “",q_(e),"”?"]}),u.jsx(Es,{children:"This client will no longer be able to reconnect. Any active Runtime connections using this grant are closed immediately."})]}),u.jsxs(ka,{children:[u.jsx(ks,{children:"Cancel"}),u.jsx(Rs,{variant:"destructive",onClick:()=>void r(),children:"Revoke Access"})]})]})]})}function q_(e){return e.clientLabel??e.clientId}function ZC(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function p9({open:e,onOpenChange:t,onAdded:r}){const[i,s]=_.useState(""),[o,c]=_.useState(""),[d,m]=_.useState(!1);async function f(){const g=o.trim();if(g){m(!0);try{const p=await xe.pairRuntime({offer:g,...i.trim()?{displayName:i.trim()}:{}});we.success(`Paired ${p.target.displayName}`),await r(p),s(""),c(""),t(!1)}catch(p){we.error(`Pairing failed: ${p.message}`)}finally{m(!1)}}}return u.jsx(wo,{open:e,onOpenChange:t,children:u.jsxs(Na,{className:"sm:max-w-lg",children:[u.jsxs(So,{children:[u.jsx(Aa,{children:"Add Runtime"}),u.jsx(Vf,{children:"On the remote host, share the Runtime and paste its pairing link here. The local backend keeps the resulting client credential out of the browser."})]}),u.jsxs("form",{className:"grid gap-4",onSubmit:g=>{g.preventDefault(),f()},children:[u.jsxs("div",{className:"grid gap-3",children:[u.jsxs("div",{className:"grid gap-1.5",children:[u.jsx(Fr,{htmlFor:"runtime-name",children:"Display name"}),u.jsx(xt,{id:"runtime-name",value:i,onChange:g=>s(g.target.value),placeholder:"Remote lab",maxLength:128})]}),u.jsxs("div",{className:"grid gap-1.5",children:[u.jsx(Fr,{htmlFor:"runtime-offer",children:"Pairing link"}),u.jsx(xt,{id:"runtime-offer",value:o,onChange:g=>c(g.target.value),placeholder:"rynx://pair?code=...",className:"font-mono text-xs",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1}),u.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["Generate one from"," ",u.jsx("span",{className:"font-medium text-[var(--foreground)]",children:"Share this device"})," on the remote Control Plane."]})]})]}),u.jsxs($u,{children:[u.jsx(Iu,{asChild:!0,children:u.jsx(ge,{type:"button",variant:"outline",children:"Cancel"})}),u.jsxs(ge,{type:"submit",disabled:d||!o.trim(),children:[d?u.jsx(mr,{className:"animate-spin"}):u.jsx(ry,{}),"Add Runtime"]})]})]})]})})}function g9({target:e,onForget:t}){return u.jsxs(Ca,{children:[u.jsx(Ea,{asChild:!0,children:u.jsxs(ge,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:[u.jsx(ql,{}),u.jsxs("span",{className:"sr-only",children:["Forget ",e.displayName]})]})}),u.jsxs(Ss,{children:[u.jsxs(Ra,{children:[u.jsxs(Cs,{children:["Forget “",e.displayName,"”?"]}),u.jsxs(Es,{children:["Removes this route and its protected client credential from the local Control Plane. The remote grant remains until an operator runs ",u.jsx("code",{children:"rynx runtime clients revoke"}),"on that daemon."]})]}),u.jsxs(ka,{children:[u.jsx(ks,{children:"Cancel"}),u.jsx(Rs,{variant:"destructive",onClick:()=>void t(),children:"Forget Runtime"})]})]})]})}const v9="rynx.control.session-launch-selection.v2";function RA(e){return`${e.kind}:${e.id}`}function kA(e){return e==="provider:claude"?{kind:"provider",id:"claude"}:e==="provider:codex"?{kind:"provider",id:"codex"}:e.startsWith("agent:")&&e.length>6?{kind:"agent",id:e.slice(6)}:null}function _9(e,t){return e.kind==="provider"?t.providers.some(r=>r.id===e.id):t.agents.some(r=>r.id===e.id)}function y9(e,t){const r=t?kA(t):null;if(r&&_9(r,e)&&(r.kind==="agent"&&e.agents.some(o=>o.id===r.id&&o.ready)||r.kind==="provider"&&e.providers.some(o=>o.id===r.id&&o.ready)))return r;for(const o of["claude","codex"])if(e.providers.some(c=>c.id===o&&c.ready))return{kind:"provider",id:o};const i=e.providers.find(o=>o.ready);if(i)return{kind:"provider",id:i.id};const s=e.agents.find(o=>o.ready);return s?{kind:"agent",id:s.id}:e.providers[0]?{kind:"provider",id:e.providers[0].id}:e.agents[0]?{kind:"agent",id:e.agents[0].id}:null}function b9(e,t){if(!t)return null;try{return t.getItem(NA(e))}catch{return null}}function x9(e,t,r){if(t)try{t.setItem(NA(e),RA(r))}catch{}}function NA(e){return`${v9}:${encodeURIComponent(e)}`}function w9(e,t){return e.kind==="provider"?{provider:e.id,title:t}:{agent:e.id,title:t}}function S9(e){const t=e.replace(/\s+/g," ").trim(),r=Array.from(t);return r.length<=64?t:`${r.slice(0,61).join("").trimEnd()}…`}function C9(e){return{providers:[],agents:e.map(t=>({...t,ready:!0,readiness:"unverified"}))}}function Dv(e){return e.readiness==="unverified"?"unverified":e.ready?"ready":"needs_setup"}function Ky(e){return e==="claude"?"Claude Code":"Codex"}function AA(e,t){if(!e)return null;if(e.kind==="provider")return t.providers.find(i=>i.id===e.id)??null;const r=t.agents.find(i=>i.id===e.id);return r?{name:r.name??r.id,ready:r.ready,...r.reason?{reason:r.reason}:{},...r.readiness?{readiness:r.readiness}:{}}:null}const MA=o7,TA=_.forwardRef(({className:e,...t},r)=>u.jsx(l7,{ref:r,className:qe("inline-flex h-9 items-center gap-1 rounded-lg bg-[var(--muted)] p-1 text-[var(--muted-foreground)]",e),...t}));TA.displayName="TabsList";const V_=_.forwardRef(({className:e,...t},r)=>u.jsx(c7,{ref:r,className:qe("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all focus-visible:outline-none data-[state=active]:bg-[var(--background)] data-[state=active]:text-[var(--foreground)] data-[state=active]:shadow-sm",e),...t}));V_.displayName="TabsTrigger";const Du=_.forwardRef(({className:e,...t},r)=>u.jsx(u7,{ref:r,className:qe("mt-4 focus-visible:outline-none",e),...t}));Du.displayName="TabsContent";function xu(){return{items:[],byId:{},callIndex:{},interactionIndex:{},pendingOutputs:{},pendingInteractionResolutions:{},childStates:{},turns:{},runStatus:"idle",waitingForInteraction:!1,todos:[],historyLoaded:!1}}function E9(e){return e.map(t=>t.text).join("")}function pa(e){return{...e,items:e.items.slice(),byId:{...e.byId},callIndex:{...e.callIndex},interactionIndex:{...e.interactionIndex},pendingOutputs:{...e.pendingOutputs},pendingInteractionResolutions:{...e.pendingInteractionResolutions},childStates:{...e.childStates},turns:{...e.turns}}}function wi(e,t,r){e.items[t]=r}function sn(e,t){const r=e.items.length;return e.items.push(t),r}function JC(e,t,r){if(!r)return;const i=e.turns[t];e.turns[t]=i?{...i,model:i.model??r}:{status:"completed",model:r}}function DA(e){let t=0;for(const r of e)r.kind==="interaction"&&r.status==="pending"&&(t+=1),r.kind==="tool"&&r.children&&(t+=DA(r.children));return t}function Bl(e){e.waitingForInteraction=DA(e.items)>0||Object.values(e.childStates).some(t=>t.waitingForInteraction)}function LA(e){const t={...e,status:"pending"};return delete t.resolution,delete t.reason,delete t.resolvedAt,t}function G_(e,t){return e.map(r=>r.kind==="interaction"?t.has(r.id)?LA(r):r.status==="pending"?{...r,status:"inactive"}:r:r.kind==="tool"&&r.children?{...r,children:G_(r.children,t)}:r)}function Y_(e,t=new Set){for(const r of e)r.kind==="interaction"&&t.add(r.id),r.kind==="tool"&&r.children&&Y_(r.children,t);return t}function QC(e,t){const r=new Set(t.pendingInteractions.map(({interaction:o})=>o.interactionId));for(const[o,c]of Object.entries(e.childStates)){const d=pa(c);d.items=G_(d.items,r),Bl(d),e.childStates[o]=d;const m=e.callIndex[o];if(m!==void 0){const f=e.items[m];wi(e,m,{...f,children:d.items})}}e.items=G_(e.items,r);const i=Y_(e.items);for(const o of Object.values(e.childStates))Y_(o.items,i);for(const{responseId:o,interaction:c}of t.pendingInteractions){if(i.has(c.interactionId))continue;const d={kind:"interaction",id:c.interactionId,responseId:o,request:c,status:"pending"};e.interactionIndex[c.interactionId]=sn(e,d),i.add(c.interactionId)}const s=new Set(t.activeResponseIds);for(const[o,c]of Object.entries(e.turns))c.status==="running"&&!s.has(o)&&(e.turns[o]={...c,status:"completed"});for(const o of s)e.turns[o]={...e.turns[o],status:"running"};e.runStatus=t.status,e.waitingForInteraction=r.size>0}function e2(e,t){return{...e,status:t.status,...t.resolution?{resolution:t.resolution}:{},...t.reason?{reason:t.reason}:{},resolvedAt:t.resolvedAt}}function t2(e,t,r,i){const s=e.byId[t];if(s!==void 0)return s;const o=sn(e,i());return e.byId[t]=o,o}function R9(e,t,r){const i=pa(e.childStates[t]??xu());ps(i,{...r,parentToolCallId:void 0}),Bl(i),e.childStates[t]=i;const s=e.callIndex[t];if(s!==void 0){const o=e.items[s];wi(e,s,{...o,children:i.items})}}function ps(e,t){var r;if(t.parentToolCallId){R9(e,t.parentToolCallId,t);return}switch(t.type){case"message":{JC(e,t.responseId,t.data.model);const i={kind:"message",id:t.id,responseId:t.responseId,role:t.data.role,text:E9(t.data.content),model:t.data.model,isMeta:t.data.isMeta,interrupted:t.data.interrupted,streaming:!1},s=e.byId[t.id];if(s!==void 0){wi(e,s,i);return}if(t.data.role==="user"){const o=e.items.findIndex(c=>c.kind==="message"&&c.optimistic&&c.role==="user"&&c.text===i.text);if(o!==-1){const c=e.items[o];delete e.byId[c.id],wi(e,o,i),e.byId[t.id]=o;return}}e.byId[t.id]=sn(e,i);return}case"reasoning":{JC(e,t.responseId,t.data.model);const i={kind:"reasoning",id:t.id,responseId:t.responseId,summary:t.data.summary.map(o=>o.text),model:t.data.model,streaming:!1},s=e.byId[t.id];s!==void 0?wi(e,s,i):e.byId[t.id]=sn(e,i);return}case"function_call":{const i=t.data.callId,s=e.pendingOutputs[i],o=(r=e.childStates[i])==null?void 0:r.items,c={kind:"tool",id:i,responseId:t.responseId,name:t.data.name,arguments:t.data.arguments,status:s?s.status??"completed":t.status,output:s==null?void 0:s.output,exitCode:s==null?void 0:s.exitCode,...o&&o.length?{children:o}:{}};s&&delete e.pendingOutputs[i];const d=e.callIndex[i];d!==void 0?wi(e,d,c):e.callIndex[i]=sn(e,c);return}case"function_call_output":{const i=t.data.callId,s=e.callIndex[i];if(s===void 0){e.pendingOutputs[i]={output:t.data.output,status:t.data.status,exitCode:t.data.exitCode};return}const o=e.items[s];wi(e,s,{...o,output:t.data.output,status:t.data.status??"completed",exitCode:t.data.exitCode});return}case"terminal_command":{const i={kind:"terminal_command",id:t.id,responseId:t.responseId,command:t.data.command,...t.data.stdout?{stdout:t.data.stdout}:{},...t.data.stderr?{stderr:t.data.stderr}:{}},s=e.byId[t.id];s!==void 0?wi(e,s,i):e.byId[t.id]=sn(e,i);return}case"interaction_request":{const i=t.data.interaction,s=i.interactionId,o=e.interactionIndex[s],c=e.pendingInteractionResolutions[s],d=o===void 0?void 0:e.items[o];let m={kind:"interaction",id:s,responseId:t.responseId,request:i,status:(d==null?void 0:d.status)??"pending",...d!=null&&d.resolution?{resolution:d.resolution}:{},...d!=null&&d.reason?{reason:d.reason}:{},...(d==null?void 0:d.resolvedAt)!==void 0?{resolvedAt:d.resolvedAt}:{}};c&&(m=e2(m,c),delete e.pendingInteractionResolutions[s]),o===void 0?e.interactionIndex[s]=sn(e,m):wi(e,o,m),e.byId[t.id]=e.interactionIndex[s];return}case"interaction_resolution":{const i=t.data,s=e.interactionIndex[i.interactionId];if(s===void 0){e.pendingInteractionResolutions[i.interactionId]={...i,responseId:t.responseId,itemId:t.id};return}const o=e.items[s];wi(e,s,e2(o,i)),e.byId[t.id]=s;return}case"error":{const i={kind:"error",id:t.id,responseId:t.responseId,source:t.data.source,code:t.data.code,message:t.data.message},s=e.byId[t.id];s!==void 0?wi(e,s,i):e.byId[t.id]=sn(e,i);return}}}function r2(e,t){e.items=K_(e.items,t);for(const[r,i]of Object.entries(e.childStates)){const s=pa(i);s.items=K_(s.items,t),Bl(s),e.childStates[r]=s;const o=e.callIndex[r];if(o!==void 0){const c=e.items[o];wi(e,o,{...c,children:s.items})}}}function K_(e,t){return e.map(r=>{const i=r.kind==="tool"&&r.children?{...r,children:K_(r.children,t)}:r;return i.responseId!==t?i:i.kind==="tool"&&i.status==="in_progress"?{...i,status:"incomplete"}:(i.kind==="message"||i.kind==="reasoning")&&i.streaming?{...i,streaming:!1}:i.kind==="interaction"&&i.status==="pending"?{...i,status:"inactive",reason:"Turn ended before this interaction was resolved"}:i})}function i2(e){return Object.values(e.turns).some(t=>t.status==="running")}function k9(e,t){switch(t.type){case"session.status":{e.runStatus=t.status,t.runtimeSessionId&&(e.runtimeSessionId=t.runtimeSessionId),e.note=t.note;return}case"response.created":{e.turns[t.responseId]={status:"running",model:t.model},e.runStatus="running",e.note=void 0;return}case"response.output_text.delta":{e.note=void 0;const r=t2(e,t.itemId,t.responseId,()=>({kind:"message",id:t.itemId,responseId:t.responseId,role:"assistant",text:"",streaming:!0})),i=e.items[r];e.items[r]={...i,text:i.text+t.delta,streaming:!0};return}case"response.reasoning_summary_text.delta":{e.note=void 0;const r=t2(e,t.itemId,t.responseId,()=>({kind:"reasoning",id:t.itemId,responseId:t.responseId,summary:[],streaming:!0})),i=e.items[r],s=i.summary.slice();s[t.summaryIndex]=(s[t.summaryIndex]??"")+t.delta,e.items[r]={...i,summary:s,streaming:!0};return}case"response.function_call_output.delta":{e.note=void 0;const r=e.callIndex[t.callId];if(r===void 0){const s=e.pendingOutputs[t.callId]??{output:""};e.pendingOutputs[t.callId]={...s,output:(s.output??"")+t.delta};return}const i=e.items[r];e.items[r]={...i,output:(i.output??"")+t.delta};return}case"session.interaction.requested":{e.note=void 0,ps(e,t.item);const r=e.interactionIndex[t.interaction.interactionId];if(r!==void 0){const i=e.items[r];(i.status==="pending"||i.status==="inactive")&&wi(e,r,LA(i))}return}case"session.interaction.resolved":case"session.interaction.cancelled":{e.note=void 0,ps(e,t.item);return}case"response.output_item.done":{e.note=void 0,ps(e,t.item);return}case"response.completed":{const r=e.turns[t.responseId];e.turns[t.responseId]={...r,status:"completed",usage:t.usage},r2(e,t.responseId),!i2(e)&&e.runStatus!=="failed"&&(e.runStatus="idle");return}case"response.failed":{const r=e.turns[t.responseId];e.turns[t.responseId]={...r,status:"failed"},e.items.some(s=>s.kind==="error"&&s.responseId===t.responseId&&s.code===t.error.code)||sn(e,{kind:"error",id:`failed_${t.responseId}_${t.error.code}`,responseId:t.responseId,source:t.error.source,code:t.error.code,message:t.error.message}),r2(e,t.responseId),e.runStatus=i2(e)?"running":"idle";return}case"session.input.consumed":{ps(e,t.item);return}case"session.todos":{e.todos=t.todos;return}case"session.rotated":{sn(e,{kind:"divider",id:`rotate_${t.newSessionId}`,responseId:`rotate_${t.newSessionId}`,label:t.kind==="fork"?"forked to a new session":"context cleared — new session",newSessionId:t.newSessionId,rotateKind:t.kind}),e.runStatus="idle";return}}}function N9(e,t){switch(t.kind){case"reset":return xu();case"snapshot":{const r=xu();for(const i of t.items)ps(r,i);return QC(r,t.runtime),r.historyLoaded=!0,r}case"reconcile_snapshot":{const r=pa(e);for(const i of t.items)ps(r,i);return QC(r,t.runtime),r.historyLoaded=!0,r.error=void 0,r}case"history":{const r=xu();for(const i of t.items)ps(r,i);return Bl(r),r.historyLoaded=!0,r}case"reconcile_history":{const r=pa(e);for(const i of t.items)ps(r,i);return Bl(r),r.historyLoaded=!0,r.error=void 0,r}case"event":{const r=pa(e);return k9(r,t.event),Bl(r),r}case"optimistic_user":{const r=pa(e),i={kind:"message",id:t.id,responseId:t.id,role:"user",text:t.text,streaming:!1,optimistic:!0};return r.byId[t.id]=sn(r,i),r}case"stream_error":{const r=pa(e);return r.error=t.message,r}case"stream_done":return e}}function A9(e){let t;for(const r of e.items){const i=e.turns[r.responseId];i&&(t=i)}return t}const X_="browser:",Z_="emulator:",n2=.44,hu=360,M9=420;function T9(e){return e?e==="browser"?{type:"browser",pageId:null}:e.startsWith(X_)?{type:"browser",pageId:e.slice(X_.length).trim()||null}:e==="emulator"?{type:"emulator",bindingId:null}:e.startsWith(Z_)?{type:"emulator",bindingId:e.slice(Z_.length).trim()||null}:null:null}function Tn(e){return e?`${X_}${e}`:"browser"}function Dn(e){return e?`${Z_}${e}`:"emulator"}function s2(e,t){const r=new Set(t),i=new Set,s=[];for(const o of e)!r.has(o)||i.has(o)||(i.add(o),s.push(o));for(const o of t)i.has(o)||(i.add(o),s.push(o));return s}function Eh(e,t){const r=Math.max(0,e),i=Math.max(0,r-M9),s=Math.min(hu,i);return Math.min(i,Math.max(s,t))}function D9(e,t,r){var i;return!e||e.pages.length===0?null:t&&e.pages.some(s=>s.pageId===t)?t:r&&e.pages.some(s=>s.pageId===r)?r:e.activePageId&&e.pages.some(s=>s.pageId===e.activePageId)?e.activePageId:((i=e.pages[0])==null?void 0:i.pageId)??null}function L9(e,t){return!e||!(t!=null&&t.activePageId)||e.includes(t.activePageId)?null:t.pages.some(r=>r.pageId===t.activePageId)?t.activePageId:null}const j9=256,B9=4*1024*1024;function O9(e,{runtimeSelector:t,allowSend:r=!0}={}){const[i,s]=_.useReducer(N9,void 0,xu),[o,c]=_.useState(!1),d=_.useRef(null),m=_.useRef(0);_.useEffect(()=>{if(s({kind:"reset"}),c(!1),!e)return;const b=new AbortController;let x=!1,w=!0,S;return(async()=>{let C=500;for(;!b.signal.aborted;){const A=new AbortController,N=()=>A.abort();b.signal.addEventListener("abort",N,{once:!0});let k=!1,O=!1;const z={events:[],utf8Bytes:0};let H,D;const G=new Promise((L,T)=>{H=L,D=T}),Y=xe.streamSession(e,L=>{if(!(x||A.signal.aborted))if(L.event==="ready"){const T=z9(S,L.data);S=T.daemonInstanceId,T.changed&&(w=!0,s({kind:"reset"})),H()}else if(L.event==="event"){const T=L.data;k?s({kind:"event",event:T}):P9(z,T)||(O=!0,A.abort())}else L.event==="error"&&s({kind:"stream_error",message:String(L.data.message??"stream error")})},A.signal,t).then(()=>(D(new Error("session stream closed before ready")),{error:void 0})).catch(L=>(D(L),{error:L}));try{await G,C=500;let L=500;for(;;){const T=new AbortController,j=()=>T.abort();A.signal.addEventListener("abort",j,{once:!0}),A.signal.aborted&&T.abort();const U=xe.getSessionSnapshot(e,T.signal,t).then(F=>({kind:"snapshot",snapshot:F})).catch(F=>({kind:"snapshot_error",error:F})),M=await Promise.race([U,Y.then(()=>({kind:"stream_ended"}))]);if(A.signal.removeEventListener("abort",j),M.kind==="stream_ended"){T.abort();break}if(x||b.signal.aborted)return;if(O)break;if(M.kind==="snapshot"){const{snapshot:F}=M;s({kind:w?"snapshot":"reconcile_snapshot",items:F.items,runtime:F.runtime}),w=!1;break}const{error:P}=M;s({kind:"stream_error",message:P instanceof Error?P.message:String(P)});const I=await Promise.race([Y.then(()=>"stream_ended"),a2(L,b.signal).then(()=>"retry")]);if(b.signal.aborted)return;if(I==="stream_ended")break;L=Math.min(L*2,8e3)}}catch(L){!x&&!b.signal.aborted&&!O&&s({kind:"stream_error",message:L instanceof Error?L.message:String(L)})}finally{if(O||(k=!0),!x&&!b.signal.aborted&&!O){for(const L of z.events.splice(0))s({kind:"event",event:L});z.utf8Bytes=0}}const W=await Y;if(b.signal.removeEventListener("abort",N),A.abort(),b.signal.aborted)return;W.error,await a2(C,b.signal),C=Math.min(C*2,8e3)}})(),()=>{var C;x=!0,b.abort(),(C=d.current)==null||C.abort()}},[t,e]);const f=_.useCallback(async b=>{if(!e||!r)return;const x=new AbortController;d.current=x,c(!0),s({kind:"optimistic_user",id:`optimistic_${m.current++}`,text:b});try{await xe.sendSessionMessage(e,b,()=>{},x.signal,t)}catch(w){x.signal.aborted||s({kind:"stream_error",message:w.message}),c(!1)}finally{d.current===x&&(d.current=null)}},[r,t,e]),g=_.useCallback(async()=>{var b;if((b=d.current)==null||b.abort(),c(!1),!!e)try{await xe.interruptSession(e,t)}catch{}},[t,e]);_.useEffect(()=>{if(!o)return;if(i.runStatus==="running"||i.waitingForInteraction){c(!1);return}const b=window.setTimeout(()=>c(!1),15e3);return()=>window.clearTimeout(b)},[o,i.runStatus,i.waitingForInteraction]);const p=o||i.runStatus==="running"||i.waitingForInteraction;return{state:i,running:p,send:f,stop:g}}function P9(e,t,r={}){const i=r.events??j9,s=r.utf8Bytes??B9;let o;try{o=new TextEncoder().encode(JSON.stringify(t)).byteLength}catch{return!1}return e.events.length>=i||o>s||e.utf8Bytes+o>s?!1:(e.events.push(t),e.utf8Bytes+=o,!0)}function z9(e,t){const r=t&&typeof t=="object"&&!Array.isArray(t)?t.daemonInstanceId:void 0;return typeof r!="string"||r.length===0?{daemonInstanceId:e,changed:!1}:{daemonInstanceId:r,changed:e!==void 0&&e!==r}}function a2(e,t){return t.aborted?Promise.resolve():new Promise(r=>{const i=window.setTimeout(s,e);t.addEventListener("abort",s,{once:!0});function s(){window.clearTimeout(i),t.removeEventListener("abort",s),r()}})}const I9=1,o2=32*1024,l2=4*1024*1024,$9=4096,U9=4096,H9=8847360,F9=4*1024,J_=512,W9=1024,c2=new Uint8Array([82,66,83,70]),bl=38,q9=1,V9=2,_f=new TextEncoder,G9=new TextDecoder("utf-8",{fatal:!0});function Y9(e){const t=X9(e);switch(t.type){case"browser.surface.ready":{Lv(t,["type","subscriptionId","browserGeneration","viewportRevision","sourceWidth","sourceHeight","deviceScaleFactor","format","grantedRole"],"Browser Surface ready frame");const r=yf(t.sourceWidth,"sourceWidth"),i=yf(t.sourceHeight,"sourceHeight");return jA(r,i),{type:"browser.surface.ready",subscriptionId:fu(t.subscriptionId,"subscriptionId"),browserGeneration:u2(t.browserGeneration,"browserGeneration"),viewportRevision:Q9(t.viewportRevision,"viewportRevision"),sourceWidth:r,sourceHeight:i,deviceScaleFactor:tU(t.deviceScaleFactor,.25,8,"deviceScaleFactor"),format:rU(t.format),grantedRole:Vh(t.grantedRole,["view","control"],"grantedRole")}}case"browser.surface.driver.changed":{Lv(t,["type","subscriptionId","browserGeneration","driver","driverSubscriptionId"],"driver changed frame",!0);const r=Vh(t.driver,["none","desktop","stream"],"driver"),i=t.driverSubscriptionId===void 0?void 0:fu(t.driverSubscriptionId,"driverSubscriptionId");if(r==="stream"!=(i!==void 0))throw Pt("driverSubscriptionId is required only when driver is stream");return{type:"browser.surface.driver.changed",subscriptionId:fu(t.subscriptionId,"subscriptionId"),browserGeneration:u2(t.browserGeneration,"browserGeneration"),driver:r,...i===void 0?{}:{driverSubscriptionId:i}}}case"browser.surface.closed":{Lv(t,["type","subscriptionId","reason","message"],"Browser Surface closed frame",!0);const r=t.message===void 0?void 0:J9(t.message,"message",W9);return{type:"browser.surface.closed",subscriptionId:fu(t.subscriptionId,"subscriptionId"),reason:Vh(t.reason,["browser_closed","page_closed","generation_changed","replaced","cancelled","unauthorized","unsupported","capacity","idle_timeout","protocol_error","internal_error"],"reason"),...r===void 0?{}:{message:r}}}default:throw Pt("unknown Browser Surface server frame type")}}function K9(e){if(!(e instanceof Uint8Array)||e.byteLength<bl+1||e.byteLength>bl+J_+l2)throw Pt("Browser Surface image frame has an invalid byte length");for(let b=0;b<c2.length;b+=1)if(e[b]!==c2[b])throw Pt("Browser Surface image frame has invalid magic");const t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint8(4)!==I9||t.getUint16(6,!1)!==0)throw Pt("Browser Surface image frame header is unsupported");const r=t.getUint8(5),i=r===q9?"jpeg":r===V9?"png":void 0;if(i===void 0)throw Pt("Browser Surface image frame format is unsupported");const s=t.getUint16(32,!1),o=t.getUint32(34,!1);if(s===0||s>J_||o===0||o>l2||bl+s+o!==e.byteLength)throw Pt("Browser Surface image frame lengths are invalid");let c;try{c=G9.decode(e.subarray(bl,bl+s))}catch{throw Pt("subscriptionId must be valid UTF-8")}c=fu(c,"subscriptionId");const d=d2(t.getBigUint64(8,!1),"frameSequence"),m=t.getUint32(16,!1),f=d2(t.getBigUint64(20,!1),"timestampMilliseconds"),g=yf(t.getUint16(28,!1),"width"),p=yf(t.getUint16(30,!1),"height");return jA(g,p),{subscriptionId:c,frameSequence:d,viewportRevision:m,timestampMilliseconds:f,width:g,height:p,format:i,encodedBytes:new Uint8Array(e.subarray(bl+s))}}function X9(e){let t=e;if(typeof e=="string"){if(_f.encode(e).byteLength>o2)throw Pt("Browser Surface control frame exceeds its byte limit");try{t=JSON.parse(e)}catch{throw Pt("Browser Surface control frame must be valid JSON")}}const r=Z9(t,"Browser Surface control frame");let i;try{i=JSON.stringify(r)}catch{throw Pt("Browser Surface control frame must be serializable")}if(_f.encode(i).byteLength>o2)throw Pt("Browser Surface control frame exceeds its byte limit");return r}function Z9(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw Pt(`${t} must be an object`);return e}function Lv(e,t,r,i=!1){const s=Object.keys(e),o=i?t.length-1:t.length;if(s.length<o||s.length>t.length||s.some(c=>!t.includes(c))||t.slice(0,o).some(c=>!Object.hasOwn(e,c)))throw Pt(`${r} contains unknown or missing fields`)}function fu(e,t){if(typeof e!="string"||e.length===0||_f.encode(e).byteLength>J_||!/^[\x21-\x7e]+$/.test(e))throw Pt(`${t} must be a bounded opaque identifier`);return e}function J9(e,t,r){if(typeof e!="string"||e.includes("\0")||_f.encode(e).byteLength>r)throw Pt(`${t} exceeds its text byte limit`);return e}function u2(e,t){if(!Number.isSafeInteger(e)||e<1)throw Pt(`${t} must be a positive safe integer`);return e}function Q9(e,t){if(!Number.isSafeInteger(e)||e<0)throw Pt(`${t} must be a nonnegative safe integer`);return e}function eU(e,t,r,i){if(!Number.isInteger(e)||e<t||e>r)throw Pt(`${i} must be an integer from ${t} to ${r}`);return e}function tU(e,t,r,i){if(typeof e!="number"||!Number.isFinite(e)||e<t||e>r)throw Pt(`${i} must be a finite number from ${t} to ${r}`);return e}function yf(e,t){const r=t.toLowerCase().includes("height")?U9:$9;return eU(e,1,r,t)}function jA(e,t){if(e*t>H9)throw Pt("Browser Surface viewport exceeds its maximum pixels")}function rU(e){return Vh(e,["jpeg","png"],"format")}function Vh(e,t,r){if(typeof e!="string"||!t.includes(e))throw Pt(`${r} is unsupported`);return e}function d2(e,t){if(e>BigInt(Number.MAX_SAFE_INTEGER))throw Pt(`${t} exceeds a safe integer`);return Number(e)}function Pt(e){return new TypeError(`Invalid Runtime Browser Surface: ${e}`)}const h2=1e4,iU=16,jv=1,f2=[500,1e3,2e3,4e3,8e3,15e3];function nU(e){const t=Math.max(0,Math.min(Math.trunc(e),f2.length-1));return f2[t]}function sU(e){return e===1e3||e===1001||e===1006||e===1012||e===4408}function aU(e){return e==="browser_closed"||e==="generation_changed"||e==="cancelled"||e==="capacity"||e==="idle_timeout"||e==="internal_error"}function BA(e){const t=e.trim();if(t)return/^[A-Za-z][A-Za-z\d+.-]*:/.test(t)?t:`https://${t}`}function Rh(e){return!(e instanceof Error)||!e.message?"Browser operation failed":e.message.replaceAll("_"," ")}function oU(e,t,r){return r&&e==="local"&&t.executionBackend==="embedded-electron"}function lU(e,t,r){return r&&e==="local"&&t.executionBackend==="headless-chromium"}async function cU(e,t){var o,c,d,m;const r=e.pages.findIndex(f=>f.pageId===e.activePageId);await t.close(e.browserGeneration);let i=await t.open((o=e.pages[0])==null?void 0:o.url);(c=t.onProgress)==null||c.call(t,i);for(const f of e.pages.slice(1))i=await t.createPage(i.browserGeneration,f.url),(d=t.onProgress)==null||d.call(t,i);const s=r>=0?i.pages[r]:void 0;return s&&i.activePageId!==s.pageId&&(i=await t.activatePage(i.browserGeneration,s.pageId),(m=t.onProgress)==null||m.call(t,i)),i}function uU({scrollLeft:e,viewportWidth:t,contentWidth:r,availableWidth:i=t}){const s=Math.max(0,r-t),o=r-i>jv;return{hasOverflow:o,canScrollLeft:o&&e>jv,canScrollRight:o&&e<s-jv}}function dU(e){return Math.max(120,e*.75)}function hU({scrollLeft:e,viewportWidth:t,tabLeft:r,tabWidth:i,inset:s=4}){const o=e,c=e+t,d=Math.max(0,r-s),m=r+i+s;return d<o?d-o:m>c?m-c:0}function fU(e,t,r,i){return{deltaX:m2(e+r),deltaY:m2(t+i)}}function m2(e){return Number.isFinite(e)?Math.max(-h2,Math.min(h2,e)):0}function mU(e){if(!e)return[];const t=new TextEncoder,r=[];let i="",s=0;for(const o of e){const c=t.encode(o).byteLength;if(s+c>F9){if(r.push(i),r.length>=iU)throw new RangeError("Browser text input is too large");i="",s=0}i+=o,s+=c}return i&&r.push(i),r}function pU(e,t){if(t.type==="pointerdown"){const i=p2(t.button);return i&&e.set(t.pointerId,i),i}const r=e.get(t.pointerId);return e.delete(t.pointerId),r??p2(t.button)}function p2(e){if(e===0)return"left";if(e===1)return"middle";if(e===2)return"right";if(e===3)return"back";if(e===4)return"forward"}const gU=1,vU=2;function _U({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i,toolbarHost:s}){const o=_.useRef(null),c=_.useRef(null),d=_.useRef(void 0),m=_.useRef(void 0),f=_.useRef(0),g=_.useRef(0),p=_.useRef(0),b=_.useRef(0),x=_.useRef(void 0),w=_.useRef(!1),S=_.useRef(!1),E=_.useRef(!1),C=_.useRef(void 0),A=_.useRef(void 0),N=_.useRef(void 0),k=_.useRef(new Map),[O,z]=_.useState("connecting"),[H,D]=_.useState(),[G,Y]=_.useState(),[W,L]=_.useState("none"),[T,j]=_.useState(),[U,M]=_.useState(!1),[P,I]=_.useState(!1),F=W==="stream"&&T===(G==null?void 0:G.subscriptionId),q=_.useCallback(()=>{N.current!==void 0&&(window.cancelAnimationFrame(N.current),N.current=void 0),C.current=void 0,A.current=void 0,k.current.clear()},[]),$=_.useCallback(()=>{x.current!==void 0&&(window.clearTimeout(x.current),x.current=void 0)},[]),X=_.useCallback(async({refreshCapability:pe=!1,preserveFrame:Ee=!1}={})=>{var Ye;$();const Ie=++p.current;(Ye=d.current)==null||Ye.close(1e3,"Browser Surface reconnecting"),d.current=void 0,m.current=void 0,f.current=0,g.current=0,E.current=!1,S.current=!1,q(),z("connecting"),D(void 0),Y(void 0),L("none"),j(void 0),I(!1),Ee||(w.current=!1,M(!1));const Te=ft=>{if(p.current!==Ie)return;D(ft),z("connecting");const Ge=nU(b.current++);x.current=window.setTimeout(()=>{x.current=void 0,X({preserveFrame:!0})},Ge)};try{const ft=await Tu(pe);if(p.current!==Ie)return;const Ge=new WebSocket(xU({runtimeSelector:e,sessionId:t,pageId:i,browserGeneration:r,capability:ft}));Ge.binaryType="arraybuffer",d.current=Ge;let zt=pe,dt=!1;Ge.onmessage=Vt=>{var _n;if(p.current!==Ie||d.current!==Ge)return;if(typeof Vt.data=="string"){try{const Gt=JSON.parse(Vt.data);if(Gt&&typeof Gt=="object"&&"type"in Gt&&Gt.type==="error"){const Xi="message"in Gt&&typeof Gt.message=="string"?Gt.message:"Browser Surface failed";D(Xi);return}const Jt=Y9(Gt);if(Jt.type==="browser.surface.ready"){m.current=Jt,f.current=Jt.viewportRevision,$(),Y(Jt),z("ready");return}if(Jt.type==="browser.surface.driver.changed"){const Xi=Jt.driver==="stream"&&Jt.driverSubscriptionId===((_n=m.current)==null?void 0:_n.subscriptionId);E.current=Xi,Xi||q(),L(Jt.driver),j(Jt.driverSubscriptionId);return}E.current=!1,q();const Jr=Jt.message??wU(Jt.reason);dt=!0,aU(Jt.reason)?(Te(Jr),Ge.close(1e3,"recovering Browser Surface")):(D(Jr),z("closed"))}catch{dt=!0,D("Browser Surface sent an invalid control frame"),z("closed"),Ge.close(4400,"invalid Browser Surface control")}return}if(!(Vt.data instanceof ArrayBuffer)){D("Browser Surface sent an invalid image frame"),Ge.close(4400,"invalid Browser Surface image");return}const Wr=()=>p.current===Ie&&d.current===Ge;yU(Vt.data,Ge,o.current,m.current,Wr).then(Gt=>{Gt===void 0||!Wr()||(f.current=Gt,w.current=!0,S.current=!0,b.current=0,M(!0),I(!0))}).catch(()=>{Wr()&&(dt=!0,D("Browser preview could not be decoded"),z("closed"),Ge.close(4400,"Browser Surface image decode failed"))})},Ge.onclose=Vt=>{if(!(p.current!==Ie||d.current!==Ge)&&(d.current=void 0,E.current=!1,q(),!dt)){if((Vt.code===4403||Vt.code===1006)&&!zt){zt=!0,X({refreshCapability:!0,preserveFrame:!0});return}if(sU(Vt.code)){Te(_2(Vt.code));return}z("closed"),D(Wr=>Wr??_2(Vt.code))}},Ge.onerror=()=>{d.current===Ge&&D("Browser preview transport failed")}}catch(ft){if(p.current!==Ie)return;Te(ft instanceof Error?ft.message:"Browser preview could not connect")}},[e,t,i,r,q,$]);_.useEffect(()=>(X(),()=>{var pe;p.current+=1,$(),q(),(pe=d.current)==null||pe.close(1e3,"Browser Surface view unmounted"),d.current=void 0}),[X,q,$]);const V=_.useCallback(()=>{b.current=0,X({preserveFrame:!0})},[X]),J=_.useCallback(pe=>{const Ee=d.current;return!Ee||Ee.readyState!==WebSocket.OPEN?!1:(Ee.send(JSON.stringify(pe)),!0)},[]),le=_.useCallback(()=>{var Ee;const pe=m.current;!pe||!S.current||(J({type:"browser.surface.driver.take",subscriptionId:pe.subscriptionId,browserGeneration:pe.browserGeneration,viewportRevision:f.current}),(Ee=c.current)==null||Ee.focus())},[J]),ae=_.useCallback(()=>{const pe=m.current;pe&&(q(),c.current&&(c.current.value=""),J({type:"browser.surface.driver.release",subscriptionId:pe.subscriptionId,browserGeneration:pe.browserGeneration}))},[J,q]),ee=_.useCallback(pe=>{const Ee=m.current;return!Ee||!S.current||!E.current?!1:J({type:"browser.surface.input",subscriptionId:Ee.subscriptionId,browserGeneration:Ee.browserGeneration,viewportRevision:f.current,inputSequence:g.current++,event:pe})},[J]),se=_.useCallback(pe=>{let Ee;try{Ee=mU(pe)}catch{return D("Text input is limited to 64 KiB at a time."),!1}let Ie=!1;for(const Te of Ee){if(!ee({type:"text.insert",text:Te}))return Ie;Ie=!0}return Ie},[ee]),ce=_.useCallback(()=>{N.current!==void 0&&(window.cancelAnimationFrame(N.current),N.current=void 0);const pe=C.current,Ee=A.current;C.current=void 0,A.current=void 0,E.current&&(pe&&ee({...pe}),Ee&&ee({...Ee}))},[ee]),Se=_.useCallback(()=>{N.current===void 0&&(N.current=window.requestAnimationFrame(ce))},[ce]);_.useEffect(()=>{E.current=F,F||(q(),c.current&&(c.current.value="",c.current.blur()))},[F,q]);const Re=_.useCallback(pe=>{var ft;if(!F)return;const Ee=g2(pe.currentTarget,pe.clientX,pe.clientY);if(!Ee)return;if(pe.type==="pointermove"){C.current={type:"pointer.move",...Ee,modifiers:kh(pe)},Se(),pe.preventDefault();return}ce(),pe.type==="pointerdown"&&((ft=c.current)==null||ft.focus(),pe.currentTarget.setPointerCapture(pe.pointerId));const Ie=pe.type==="pointerdown"?"pointer.down":"pointer.up",Te=pU(k.current,pe);if(!Te)return;const Ye={type:Ie,...Ee,button:Te,modifiers:kh(pe)};ee(Ye)&&pe.preventDefault()},[F,ee,ce,Se]),Ne=_.useCallback(pe=>{if(!F)return;const Ee=g2(pe.currentTarget,pe.clientX,pe.clientY);if(!Ee)return;const Ie=pe.deltaMode===gU?16:pe.deltaMode===vU?Math.max(1,pe.currentTarget.clientHeight):1,Te=A.current,Ye=fU((Te==null?void 0:Te.deltaX)??0,(Te==null?void 0:Te.deltaY)??0,pe.deltaX*Ie,pe.deltaY*Ie);A.current={type:"wheel",...Ee,...Ye,modifiers:kh(pe)},Se(),pe.preventDefault()},[F,Se]),Q=_.useCallback(pe=>{if(pe.nativeEvent.isComposing||pe.key==="Process"||pe.key==="Dead")return;ce();const Ee=ee({type:pe.type==="keydown"?"key.down":"key.up",key:pe.key,code:pe.code,repeat:pe.repeat,modifiers:kh(pe)}),Ie=bU({type:pe.type,key:pe.key,altKey:pe.altKey,ctrlKey:pe.ctrlKey,metaKey:pe.metaKey,isComposing:pe.nativeEvent.isComposing}),Te=Ie===void 0?!1:se(Ie);(Ee||Te)&&pe.preventDefault()},[ee,se,ce]),re=_.useCallback(pe=>{ce();const Ee=pe.clipboardData.getData("text/plain");Ee&&se(Ee)&&pe.preventDefault()},[se,ce]),be=_.useCallback(pe=>{const Ee=pe.data||pe.currentTarget.value;pe.currentTarget.value="",Ee&&se(Ee)},[se]);return u.jsxs("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-[#111318]",children:[u.jsx("canvas",{ref:o,className:"max-h-full max-w-full outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]","aria-label":F?"Interactive browser preview":"Browser preview",tabIndex:-1,onPointerMove:Re,onPointerDown:Re,onPointerUp:Re,onPointerCancel:Re,onWheel:Ne}),u.jsx("textarea",{ref:c,"aria-label":"Browser keyboard input",className:"pointer-events-none absolute left-0 top-0 size-px resize-none opacity-0",tabIndex:F?0:-1,autoComplete:"off",spellCheck:!1,onKeyDown:Q,onKeyUp:Q,onPaste:re,onCompositionEnd:be}),O==="connecting"&&u.jsx(v2,{preserveFrame:U,icon:u.jsx(ht,{className:"size-5 animate-spin"}),label:U?"Reconnecting preview…":"Connecting preview…"}),O==="ready"&&!P&&u.jsx(v2,{icon:u.jsx(ht,{className:"size-5 animate-spin"}),label:"Waiting for first frame…"}),O==="closed"&&u.jsx("div",{className:"absolute inset-0 grid place-items-center bg-[#111318]/90 px-6 text-center",children:u.jsxs("div",{className:"max-w-sm",children:[u.jsx("p",{className:"text-sm font-medium text-white",children:"Preview disconnected"}),u.jsx("p",{role:"alert",className:"mt-1 text-xs leading-5 text-white/60",children:H??"The Browser Surface ended."})]})}),s&&_o.createPortal(u.jsx("div",{className:"flex items-center",children:O==="closed"?u.jsx(ge,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Reconnect browser preview",title:"Reconnect browser preview",onClick:V,children:u.jsx(mr,{className:"size-4"})}):O!=="ready"||!P?u.jsx(ge,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":w.current?"Reconnecting browser preview":"Connecting browser preview",title:w.current?"Reconnecting browser preview":"Connecting browser preview",disabled:!0,children:u.jsx(ht,{className:"size-4 animate-spin"})}):F?u.jsx(ge,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Release browser control",title:"Release browser control",onClick:ae,children:u.jsx(K4,{className:"size-4"})}):u.jsx(ge,{size:"icon-sm",className:"size-8","aria-label":"Take browser control",title:"Take browser control",onClick:le,children:u.jsx(Z4,{className:"size-4"})})}),s),u.jsx("p",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:H??(F?"Browser control active":`Browser preview ${O}`)})]})}async function yU(e,t,r,i,s){const o=K9(new Uint8Array(e));if(!i||o.subscriptionId!==i.subscriptionId||o.format!==i.format)throw new Error("Browser Surface image does not match the active subscription");const c=await createImageBitmap(new Blob([o.encodedBytes],{type:o.format==="jpeg"?"image/jpeg":"image/png"}));try{if(!s()||!r||t.readyState!==WebSocket.OPEN)return;r.width=o.width,r.height=o.height;const d=r.getContext("2d",{alpha:!1});if(!d)throw new Error("Browser preview canvas is unavailable");return d.drawImage(c,0,0,o.width,o.height),t.send(JSON.stringify({type:"browser.surface.frame.ack",subscriptionId:i.subscriptionId,frameSequence:o.frameSequence})),o.viewportRevision}finally{c.close()}}function bU(e){if(!(e.type!=="keydown"||e.isComposing||e.key==="Process"||e.key==="Dead"||e.altKey||e.ctrlKey||e.metaKey||Array.from(e.key).length!==1))return e.key}function xU(e){const t=location.protocol==="https:"?"wss":"ws",r=new URLSearchParams({generation:String(e.browserGeneration),role:"control",format:"jpeg",quality:"75",maximumFrameRate:"15",capability:e.capability});return`${t}://${location.host}/api/runtimes/${encodeURIComponent(e.runtimeSelector)}/sessions/${encodeURIComponent(e.sessionId)}/browser/pages/${encodeURIComponent(e.pageId)}/surface?${r.toString()}`}function g2(e,t,r){const i=e.getBoundingClientRect();if(!(i.width<=0||i.height<=0||e.width<=0||e.height<=0))return{x:Math.max(0,Math.min(e.width,(t-i.left)*e.width/i.width)),y:Math.max(0,Math.min(e.height,(r-i.top)*e.height/i.height))}}function kh(e){const t=[];return e.altKey&&t.push("alt"),e.ctrlKey&&t.push("control"),e.metaKey&&t.push("meta"),e.shiftKey&&t.push("shift"),t}function v2({icon:e,label:t,preserveFrame:r=!1}){return u.jsx("div",{className:r?"absolute inset-0 grid place-items-center bg-[#111318]/55 text-white":"absolute inset-0 grid place-items-center bg-[#111318] text-white/70",children:u.jsxs("div",{role:"status",className:"flex flex-col items-center gap-3 text-sm",children:[e,t]})})}function wU(e){return e==="replaced"?"This preview was opened somewhere else.":e==="generation_changed"?"The Browser was restarted.":e==="page_closed"?"This Browser page was closed.":e==="idle_timeout"?"The Browser preview timed out.":e==="unauthorized"?"Browser preview authorization expired.":"The Browser preview ended."}function _2(e){return e===4403?"Browser preview authorization failed.":e===4406?"The selected Runtime cannot provide this Browser preview.":e===4408?"The Browser preview client was too slow.":e===1012?"The selected Runtime disconnected.":"The Browser preview connection closed."}const SU=400;function CU({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i}){const s=_.useRef(null),[o,c]=_.useState(0),[d,m]=_.useState("mounting"),[f,g]=_.useState("unavailable"),[p,b]=_.useState(!1),[x,w]=_.useState(),S=_.useMemo(()=>({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i}),[e,t,r,i]);_.useEffect(()=>{const C=window.rynxDesktopBrowser,A=s.current;if(!C||!A){m("unavailable");return}let N=!1,k=0,O;const z=Bv(S),H=async()=>{if(N)return;const L=EU(A.getBoundingClientRect());if(!L){C.park(S);return}try{const T=await C.mount(S,L);if(N)return;if(T==="mounted"){m("mounted"),O!==void 0&&window.clearTimeout(O),O=void 0;return}}catch{}N||(m("mounting"),O=window.setTimeout(()=>void H(),SU))},D=()=>{window.cancelAnimationFrame(k),k=window.requestAnimationFrame(()=>void H())},G=new ResizeObserver(D);G.observe(A),window.addEventListener("resize",D),window.addEventListener("scroll",D,!0);const Y=C.onState(L=>{if(Bv(L.resource)===z){if(L.state==="closed"){m("unavailable");return}D()}}),W=C.onDriver(L=>{Bv(L.resource)===z&&(g(L.driver),L.driver==="desktop"&&(b(!1),w(void 0)))});return g(C.getDriver(S)),m("mounting"),D(),()=>{N=!0,G.disconnect(),Y(),W(),window.removeEventListener("resize",D),window.removeEventListener("scroll",D,!0),window.cancelAnimationFrame(k),O!==void 0&&window.clearTimeout(O),C.park(S)}},[S,o]);const E=async()=>{const C=window.rynxDesktopBrowser;if(!(!C||p)){b(!0),w(void 0);try{if(await C.takeBack(S)!=="taken")throw new Error("The remote controller is no longer available.")}catch(A){b(!1),w(A instanceof Error?A.message:"Could not take back browser control.")}}};return u.jsxs("div",{ref:s,className:"relative flex min-h-0 flex-1 overflow-hidden bg-white","aria-label":"Embedded session browser page",children:[d!=="mounted"&&u.jsx("div",{className:"absolute inset-0 z-0 grid place-items-center bg-[var(--muted)]/20 p-4 text-center",children:d==="mounting"?u.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--muted-foreground)]",children:[u.jsx(ht,{className:"size-4 animate-spin"}),"Attaching the local browser…"]}):u.jsxs("div",{className:"space-y-3",children:[u.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"The local desktop browser is unavailable."}),u.jsxs(ge,{size:"sm",variant:"outline",onClick:()=>c(C=>C+1),children:[u.jsx(mr,{}),"Retry"]})]})}),d==="mounted"&&f==="stream"&&u.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center bg-black/45 p-4 text-center backdrop-blur-[1px]",children:u.jsxs("div",{className:"max-w-sm rounded-lg border border-white/20 bg-[var(--card)] p-4 shadow-lg",children:[u.jsx("p",{className:"text-sm font-medium text-[var(--foreground)]",children:"Controlled from a remote viewer"}),u.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Local mouse and keyboard input are paused to prevent two controllers from acting at once."}),u.jsxs(ge,{className:"mt-3",size:"sm",disabled:p,onClick:()=>void E(),children:[p?u.jsx(ht,{className:"animate-spin"}):null,"Take back control"]}),x?u.jsx("p",{role:"alert",className:"mt-2 text-xs text-[var(--destructive)]",children:x}):null]})})]})}function EU(e){const t=Math.max(0,Math.ceil(e.left)),r=Math.max(0,Math.ceil(e.top)),i=Math.min(window.innerWidth,Math.floor(e.right)),s=Math.min(window.innerHeight,Math.floor(e.bottom));return i<=t||s<=r?null:{x:t,y:r,width:i-t,height:s-r}}function Bv(e){return JSON.stringify([e.runtimeSelector,e.sessionId,e.browserGeneration,e.pageId])}const RU="size-11 sm:size-8";function kU({sessionId:e,runtimeSelector:t,pageId:r,browserResource:i}){const{browser:s,loading:o,pendingAction:c,error:d,disabled:m,load:f,openBrowser:g,closeBrowser:p,recreateForDesktop:b,navigatePage:x,backPage:w,forwardPage:S,reloadPage:E}=i,C=_.useMemo(()=>s==null?void 0:s.pages.find(H=>H.pageId===r),[s,r]),A=s!==null&&oU(t,s,typeof window.rynxDesktopBrowser<"u"),N=s!==null&&s.sessionId===e&&lU(t,s,typeof window.rynxDesktopBrowser<"u"),k=_.useRef(null),[O,z]=_.useState(null);return _.useEffect(()=>{const H=`${t}
|
|
476
|
+
${e}`;!N||k.current===H||(k.current=H,b())},[N,b,t,e]),o&&s===null?u.jsx(Ov,{label:"Loading browser…"}):s===null?u.jsx(NU,{error:d,pending:c!==null,onOpen:H=>void g(H),onRetry:()=>void f(!0)}):u.jsxs("section",{className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--card)]","aria-label":"Session browser page",children:[u.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-[var(--border)] px-2 py-2 sm:flex-nowrap sm:px-3",children:[u.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[u.jsx(Nh,{label:"Go back",disabled:m||!(C!=null&&C.canGoBack),onClick:()=>C&&void w(C.pageId),children:u.jsx(Pl,{})}),u.jsx(Nh,{label:"Go forward",disabled:m||!(C!=null&&C.canGoForward),onClick:()=>C&&void S(C.pageId),children:u.jsx(Gj,{})}),u.jsx(Nh,{label:"Reload page",disabled:m||!C,onClick:()=>C&&void E(C.pageId),children:u.jsx(zE,{className:C!=null&&C.loading?"animate-spin":void 0})})]}),C?u.jsx(AU,{page:C,disabled:m,onNavigate:H=>void x(C.pageId,H)},`${C.pageId}
|
|
477
|
+
${C.url}`):u.jsx("div",{className:"h-11 min-w-0 flex-1 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 sm:h-8"}),!A&&u.jsx("div",{ref:z,className:"flex shrink-0 items-center"}),u.jsx(Nh,{label:"Stop browser",disabled:c!==null,onClick:()=>void p(),children:u.jsx(g_,{})})]}),u.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[N?u.jsx(Ov,{label:"Opening in Desktop…"}):s.status==="ready"&&C?A?u.jsx(CU,{runtimeSelector:t,sessionId:e,browserGeneration:s.browserGeneration,pageId:C.pageId}):u.jsx(_U,{runtimeSelector:t,sessionId:e,browserGeneration:s.browserGeneration,pageId:C.pageId,toolbarHost:O}):s.status==="ready"?u.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center text-sm text-[var(--muted-foreground)]",children:"No browser page is open."}):s.status==="unavailable"?u.jsx(MU,{error:d,pending:c!==null,onRestart:()=>void g()}):u.jsx(Ov,{label:s.status==="closing"?"Closing browser…":"Starting browser…"}),d&&s.status!=="unavailable"&&u.jsx("div",{role:"alert",className:"absolute bottom-3 left-1/2 max-w-[calc(100%-1.5rem)] -translate-x-1/2 rounded-md border border-[var(--destructive)]/30 bg-[var(--card)] px-3 py-2 text-xs text-[var(--destructive)] shadow-sm",children:d})]}),u.jsx("p",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:c??d??(s.status==="ready"?"Browser ready":`Browser ${s.status}`)})]})}function NU({error:e,pending:t,onOpen:r,onRetry:i}){const[s,o]=_.useState(""),c=d=>{d.preventDefault(),r(BA(s))};return u.jsx(un,{className:"min-h-0 flex-1 bg-[var(--muted)]/20",children:u.jsx("main",{className:"flex min-h-full items-center justify-center p-4 sm:p-6",children:u.jsxs("form",{onSubmit:c,className:"w-full max-w-xl rounded-lg border border-[var(--border)] bg-[var(--card)] p-4 shadow-sm sm:p-6",children:[u.jsxs("div",{className:"flex items-start gap-3",children:[u.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:u.jsx(Cu,{className:"size-5"})}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("h3",{className:"text-base font-semibold",children:"Open a browser for this session"}),u.jsx("p",{className:"mt-1 text-sm leading-5 text-[var(--muted-foreground)]",children:"The browser runs on the selected Runtime, beside the agent using it."})]})]}),u.jsxs("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row",children:[u.jsx(xt,{value:s,onChange:d=>o(d.target.value),"aria-label":"Initial browser address",placeholder:"https://example.com (optional)",className:"h-11 flex-1 sm:h-9",disabled:t,autoFocus:!0}),u.jsxs(ge,{type:"submit",className:"h-11 sm:h-9",disabled:t,children:[t?u.jsx(ht,{className:"animate-spin"}):u.jsx(Cu,{}),t?"Opening…":"Open browser"]})]}),e&&u.jsxs("div",{role:"alert",className:"mt-3 flex items-center justify-between gap-3 rounded-md bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",children:[u.jsx("span",{children:e}),u.jsx(ge,{type:"button",variant:"ghost",size:"sm",onClick:i,children:"Retry"})]}),u.jsx("p",{className:"sr-only","aria-live":"polite",children:t?"Starting browser":""})]})})})}function AU({page:e,disabled:t,onNavigate:r}){const[i,s]=_.useState(e.url),o=c=>{c.preventDefault();const d=BA(i);d&&r(d)};return u.jsx("form",{onSubmit:o,className:"order-last flex min-w-full flex-1 sm:order-none sm:min-w-0",children:u.jsx(xt,{value:i,onChange:c=>s(c.target.value),"aria-label":"Browser address",className:"h-11 rounded-lg bg-[var(--muted)]/35 font-mono text-xs sm:h-8",disabled:t,spellCheck:!1})})}function Nh({label:e,disabled:t,onClick:r,children:i}){return u.jsx(ge,{type:"button",variant:"ghost",size:"icon",className:RU,"aria-label":e,title:e,disabled:t,onClick:r,children:i})}function Ov({label:e}){return u.jsxs("div",{className:"flex min-h-0 flex-1 items-center justify-center gap-2 bg-[var(--muted)]/20 text-sm text-[var(--muted-foreground)]","aria-live":"polite",children:[u.jsx(ht,{className:"size-4 animate-spin"}),e]})}function MU({error:e,pending:t,onRestart:r}){return u.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-4 text-center",role:"status",children:[u.jsx(mr,{className:"size-5 text-[var(--muted-foreground)]"}),u.jsxs("div",{children:[u.jsx("p",{className:"text-sm font-medium",children:"Browser is unavailable"}),u.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:e??"The selected Runtime cannot provide this browser right now."})]}),u.jsxs(ge,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:r,children:[t&&u.jsx(ht,{className:"animate-spin"}),t?"Restarting…":"Restart browser"]})]})}const Pv=200;function TU({initialDraft:e,model:t,running:r,disabled:i,onSend:s,onStop:o}){const[c,d]=_.useState(e??""),m=_.useRef(null),f=_.useRef(!1);_.useLayoutEffect(()=>{const p=m.current;if(!p)return;p.style.height="auto";const b=p.scrollHeight;p.style.height=`${Math.min(b,Pv)}px`,p.style.overflowY=b>Pv?"auto":"hidden"},[c]);function g(){const p=c.trim();p&&(s(p),d(""))}return u.jsx("div",{className:"px-4 pb-3 pt-1",children:u.jsxs("div",{className:"mx-auto w-full max-w-3xl rounded-xl border border-[var(--border)] bg-[var(--card)] p-2 shadow-[var(--shadow-sm)] transition-[border-color,box-shadow] focus-within:border-[color-mix(in_srgb,var(--primary)_55%,var(--border))] focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--primary)_9%,transparent),var(--shadow-sm)]",children:[u.jsx("textarea",{ref:m,value:c,rows:1,placeholder:"Message… (Enter to send · Shift+Enter for newline)",disabled:i,onChange:p=>d(p.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:p=>{p.key==="Enter"&&!p.shiftKey&&!f.current&&!p.nativeEvent.isComposing&&p.keyCode!==229&&(p.preventDefault(),g())},className:qe("block min-h-[52px] w-full resize-none overflow-hidden border-0 bg-transparent px-2 py-1.5","text-sm leading-relaxed placeholder:text-[var(--muted-foreground)]","focus-visible:outline-none","disabled:cursor-not-allowed disabled:opacity-50"),style:{maxHeight:Pv}}),u.jsxs("div",{className:"flex min-h-8 items-center gap-2 pt-1",children:[t&&u.jsx("span",{className:"min-w-0 truncate px-2 font-mono text-[10px] text-[var(--muted-foreground)]",children:t}),r?u.jsxs(ge,{variant:"outline",className:"ml-auto h-8 shrink-0",onClick:o,title:"Stop the running turn",children:[u.jsx(TB,{})," Stop"]}):u.jsxs(ge,{className:"ml-auto h-8 shrink-0",onClick:g,disabled:i||!c.trim(),children:[u.jsx($E,{})," Send"]})]})]})})}const OA=24,DU={hasOverflow:!1,canScrollLeft:!1,canScrollRight:!1};function LU({pages:e,order:t,selectedPageId:r,selectionDisabled:i,mutationDisabled:s,createDisabled:o,createPending:c,emulatorAttached:d,emulator:m,onSelectPage:f,onClosePage:g,onCreatePage:p,onSelectEmulator:b,onCloseEmulator:x,onAddEmulator:w,trailingAction:S}){const E=_.useRef(null),C=_.useRef(null),A=_.useRef(null),N=_.useRef(null),k=_.useRef(null),O=_.useRef(null),[z,H]=_.useState(DU),D=t.flatMap(P=>{if(P===Dn())return m?[{type:"emulator",key:P,emulator:m}]:[];const I=e.find(F=>Tn(F.pageId)===P);return I?[{type:"browser",key:P,page:I}]:[]}),G=D.map(P=>P.key).join(`
|
|
478
|
+
`),Y=D.length,W=_.useCallback(()=>{const P=E.current,I=C.current,F=A.current;if(!(!P||!I||!F))return uU({scrollLeft:I.scrollLeft,viewportWidth:I.clientWidth,contentWidth:F.scrollWidth,availableWidth:P.clientWidth})},[]),L=_.useCallback(()=>{const P=W();P&&H(I=>jU(I,P)?I:P)},[W]),T=_.useCallback(()=>{k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null,L()}))},[L]),j=_.useCallback(P=>{const I=C.current,F=N.current;if(!I||!F)return;const q=I.getBoundingClientRect(),$=F.getBoundingClientRect(),X=hU({scrollLeft:I.scrollLeft,viewportWidth:I.clientWidth,tabLeft:I.scrollLeft+$.left-q.left,tabWidth:$.width,inset:OA});X!==0&&I.scrollBy({left:X,behavior:P})},[]),U=_.useCallback(P=>{const I=C.current;if(!I)return;const F=dU(I.clientWidth);I.scrollBy({left:P==="left"?-F:F,behavior:b2()})},[]);_.useEffect(()=>()=>{k.current!==null&&window.cancelAnimationFrame(k.current)},[]),_.useLayoutEffect(()=>{const P=E.current,I=C.current,F=A.current;if(!P||!I||!F)return;const q=()=>{const X=I.clientWidth,V=O.current===null||Math.abs(X-O.current)>1;O.current=X,T(),V&&j("auto")},$=typeof ResizeObserver>"u"?void 0:new ResizeObserver(q);return $==null||$.observe(P),$==null||$.observe(I),$==null||$.observe(F),window.addEventListener("resize",q),L(),()=>{$==null||$.disconnect(),window.removeEventListener("resize",q)}},[j,T,L]),_.useEffect(()=>{const P=C.current;if(!P)return;const I=F=>{if(F.ctrlKey||F.deltaY===0||Math.abs(F.deltaY)<=Math.abs(F.deltaX))return;const q=W();(F.deltaY<0?q!=null&&q.canScrollLeft:q!=null&&q.canScrollRight)&&(F.preventDefault(),P.scrollLeft+=F.deltaY,T())};return P.addEventListener("wheel",I,{passive:!1}),()=>P.removeEventListener("wheel",I)},[W,T]),_.useLayoutEffect(()=>{j(b2()),T()},[G,j,T,z.hasOverflow,r]);function M(P,I){var $;let F;if(P.key==="ArrowLeft"?F=(I-1+Y)%Y:P.key==="ArrowRight"?F=(I+1)%Y:P.key==="Home"?F=0:P.key==="End"&&(F=Y-1),F===void 0||F===I)return;P.preventDefault();const q=($=A.current)==null?void 0:$.querySelectorAll('[role="tab"]').item(F);q==null||q.focus(),q==null||q.click()}return u.jsxs("div",{className:"app-drag-region flex h-12 shrink-0 items-end gap-1 border-b border-[var(--border)] bg-[var(--muted)]/30 pl-2 pr-3 pt-1 sm:pr-4",children:[u.jsxs("div",{ref:E,className:"flex min-w-0 flex-1 items-end gap-1",children:[z.hasOverflow&&u.jsx(y2,{direction:"left",disabled:!z.canScrollLeft,onClick:()=>U("left")}),u.jsx("div",{ref:C,className:"min-w-0 flex-1 overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:BU(z),onScroll:T,children:u.jsx("div",{ref:A,className:"flex w-max items-end gap-1",role:"tablist","aria-label":"Session resources",children:D.map((P,I)=>{if(P.type==="emulator"){const X=P.emulator;return u.jsxs("div",{ref:X.selected?N:void 0,role:"presentation",className:X.selected?"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2":"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]",children:[u.jsxs("button",{type:"button",role:"tab","aria-selected":X.selected,"aria-label":X.label,title:X.label,tabIndex:X.selected?0:-1,onClick:b,onKeyDown:V=>M(V,I),className:"flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",children:[X.busy?u.jsx(ht,{className:"size-3 shrink-0 animate-spin"}):u.jsx(zl,{className:"size-3 shrink-0"}),u.jsx("span",{className:"truncate",children:X.label})]}),u.jsx(ge,{type:"button",variant:"ghost",size:"icon-xs","aria-label":"Close emulator tab",title:"Close emulator tab",onClick:x,className:"ml-1",children:u.jsx(Il,{className:"size-3"})})]},P.key)}const F=P.page,q=F.pageId===r,$=F.title||F.url||"New page";return u.jsxs("div",{ref:q?N:void 0,role:"presentation",className:q?"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2":"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]",children:[u.jsxs("button",{type:"button",role:"tab","aria-selected":q,"aria-label":$,title:$,tabIndex:q?0:-1,disabled:i,onClick:()=>f(F.pageId),onKeyDown:X=>M(X,I),className:"flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",children:[F.loading?u.jsx(ht,{className:"size-3 shrink-0 animate-spin"}):u.jsx(Cu,{className:"size-3 shrink-0"}),u.jsx("span",{className:"truncate",children:$})]}),u.jsx(ge,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Close ${$}`,title:`Close ${$}`,disabled:s,onClick:()=>g(F.pageId),className:"ml-1",children:u.jsx(Il,{className:"size-3"})})]},P.key)})})}),z.hasOverflow&&u.jsx(y2,{direction:"right",disabled:!z.canScrollRight,onClick:()=>U("right")})]}),u.jsxs(E_,{children:[u.jsx(mf,{asChild:!0,children:u.jsx(ge,{type:"button",variant:"ghost",size:"icon-sm",className:"mb-1 size-8","aria-label":"Add Session resource",title:"Add Session resource",children:u.jsx(Gi,{})})}),u.jsxs(pf,{align:"end",children:[u.jsxs(gf,{disabled:o,"aria-busy":c,onSelect:p,children:[c?u.jsx(ht,{className:"animate-spin"}):u.jsx(Cu,{}),c?"Creating browser tab…":"New browser tab"]}),u.jsxs(gf,{onSelect:w,children:[u.jsx(zl,{}),m||d?"Show emulator":"Attach emulator"]})]})]}),S&&u.jsx("div",{className:"mb-1 ml-0.5 shrink-0",children:S})]})}function y2({direction:e,disabled:t,onClick:r}){const i=e==="left"?DE:yo;return u.jsx(ge,{type:"button",variant:"ghost",size:"icon-sm",className:"mb-1 size-7","aria-label":`Scroll resource tabs ${e}`,title:`Scroll resource tabs ${e}`,disabled:t,onClick:r,children:u.jsx(i,{})})}function b2(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}function jU(e,t){return e.hasOverflow===t.hasOverflow&&e.canScrollLeft===t.canScrollLeft&&e.canScrollRight===t.canScrollRight}function BU(e){const t=`${OA}px`;let r;return e.canScrollLeft&&e.canScrollRight?r=`linear-gradient(to right, transparent, #000 ${t}, #000 calc(100% - ${t}), transparent)`:e.canScrollLeft?r=`linear-gradient(to right, transparent, #000 ${t}, #000 100%)`:e.canScrollRight&&(r=`linear-gradient(to right, #000 0, #000 calc(100% - ${t}), transparent)`),r?{WebkitMaskImage:r,maskImage:r}:void 0}const OU=8,PU=256,zU=4e3;function IU({sessionId:e,runtimeSelector:t,controller:r}){return r.binding?u.jsx(UU,{sessionId:e,runtimeSelector:t,binding:r.binding,controller:r}):u.jsx($U,{controller:r})}function $U({controller:e}){const[t,r]=_.useState(null),i=async s=>{r(s);try{await e.attach(s)}catch(o){we.error(`Could not attach Emulator: ${o.message}`)}finally{r(null)}};return u.jsx(un,{className:"min-h-0 flex-1",children:u.jsx("div",{className:"p-4 sm:p-5",children:u.jsxs("div",{className:"mx-auto max-w-2xl",children:[u.jsxs("div",{className:"mb-4 flex items-start justify-between gap-4",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"text-sm font-semibold",children:"Attach an Emulator"}),u.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:"Only devices available to this Session are shown. Attaching does not affect another Session."})]}),u.jsx(ge,{variant:"ghost",size:"icon-sm",onClick:()=>void e.reloadDevices(),title:"Refresh devices","aria-label":"Refresh devices",children:u.jsx(mr,{className:qe("size-4",e.devicesLoading&&"animate-spin")})})]}),e.error&&u.jsx("div",{className:"mb-3 rounded-md border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2 text-xs text-[var(--destructive)]",children:e.error.message}),e.devicesLoading&&e.devices.length===0?u.jsx("div",{className:"grid min-h-40 place-items-center","aria-live":"polite",children:u.jsx(zA,{icon:u.jsx(ht,{className:"size-5 animate-spin"}),label:"Loading devices…"})}):e.devices.length===0?u.jsxs("div",{className:"rounded-md border border-dashed border-[var(--border)] px-5 py-10 text-center",children:[u.jsx(p_,{className:"mx-auto mb-3 size-6 text-[var(--muted-foreground)]"}),u.jsx("p",{className:"text-sm font-medium",children:"No Emulator is available"}),u.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Boot a simulator on this Runtime, or release one from another Session."})]}):u.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:e.devices.map(s=>u.jsxs("button",{type:"button",disabled:e.mutating,onClick:()=>void i(s.id),className:"group flex min-h-20 items-center gap-3 rounded-md border border-[var(--border)] bg-[var(--card)] p-3 text-left transition-colors hover:border-[var(--primary)]/50 hover:bg-[var(--primary)]/[0.03] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:opacity-60",children:[u.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-md bg-[var(--primary)]/10 text-[var(--primary)]",children:t===s.id?u.jsx(ht,{className:"size-4 animate-spin"}):u.jsx(p_,{className:"size-4"})}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate text-sm font-medium",children:s.name}),u.jsxs("span",{className:"mt-1 flex items-center gap-2",children:[u.jsx(PA,{state:s.state}),u.jsx("span",{className:"font-mono text-[9px] uppercase text-[var(--muted-foreground)]",children:s.backend})]})]})]},`${s.backend}:${s.id}`))})]})})})}function UU({sessionId:e,runtimeSelector:t,binding:r,controller:i}){const[s,o]=_.useState(null),[c,d]=_.useState(!1),[m,f]=_.useState(null),[g,p]=_.useState(null),b=_.useRef(null),x=_.useRef(null),w=_.useRef(null),S=_.useRef(null),E=_.useRef(null);_.useEffect(()=>{o(null),d(!1),p(null),f(null);let D=!1,G,Y,W=0,L=0,T=!1,j=null,U,M="png";const P=()=>{Y!==void 0&&window.clearTimeout(Y),Y=void 0,f(null)},I=(X,V=!1)=>{if(Y!==void 0&&window.clearTimeout(Y),V||j===null){f(X);return}Y=window.setTimeout(()=>{Y=void 0,D||f(X)},zU)},F=X=>{if(D)return;const V=URL.createObjectURL(X),J=j;j=V,o(V),P(),W=0,T=!1,J&&window.setTimeout(()=>URL.revokeObjectURL(J),1e3)},q=(X,V=!1)=>{if(D)return;G!==void 0&&window.clearTimeout(G);const J=V?0:Math.min(8e3,500*2**W++);G=window.setTimeout(()=>void X(V),J)},$=async(X=!1)=>{const V=++L;try{const J=await Tu(X);if(D||V!==L)return;const le=new WebSocket(HU({runtimeSelector:t,sessionId:e,bindingId:r.bindingId,maximumFrameRate:r.backend==="ios"?30:5,capability:J}));U=le,le.binaryType="arraybuffer",le.onmessage=ae=>{if(D||V!==L||U!==le)return;if(typeof ae.data=="string"){try{const ce=JSON.parse(ae.data);if(ce.type!=="emulator.surface.ready"||typeof ce.surfaceId!="string"||ce.format!=="png"&&ce.format!=="jpeg")throw new Error("invalid Emulator Surface ready frame");M=ce.format,x.current={socket:le,surfaceId:ce.surfaceId,inputSequence:0}}catch{le.close(4400,"invalid Emulator Surface ready frame")}return}const ee=ae.data instanceof ArrayBuffer||ae.data instanceof Blob?ae.data:null,se=M==="jpeg"?"image/jpeg":"image/png";ee instanceof Blob?F(new Blob([ee],{type:se})):ee&&F(new Blob([ee],{type:se}))},le.onclose=ae=>{var se;if(D||V!==L||U!==le)return;((se=x.current)==null?void 0:se.socket)===le&&(x.current=null);const ee=new Error(ae.code===4406?"emulator_surface_upgrade_required":ae.reason||"Remote Emulator Surface disconnected");I(ee,ae.code===4406),ae.code!==4406&&((ae.code===4403||ae.code===1006)&&!T?(T=!0,q($,!0)):q($))},le.onerror=()=>{}}catch(J){if(D||V!==L)return;I(J instanceof Error?J:new Error(String(J))),q($)}};return $(),()=>{D=!0,L+=1,x.current=null,U==null||U.close(1e3,"Session Emulator pane closed"),G!==void 0&&window.clearTimeout(G),Y!==void 0&&window.clearTimeout(Y),j&&URL.revokeObjectURL(j)}},[r.backend,r.bindingId,t,e]);const C=_.useCallback((D,G,Y)=>{const W=x.current;if(!W||W.socket.readyState!==WebSocket.OPEN||Y!==void 0&&W.surfaceId!==Y)return!1;try{return W.socket.send(JSON.stringify({type:"emulator.surface.touch",surfaceId:W.surfaceId,inputSequence:W.inputSequence++,phase:D,...G})),!0}catch{return!1}},[]),A=_.useCallback(()=>{S.current!==null&&window.cancelAnimationFrame(S.current),S.current=null;const D=w.current;w.current=null,D&&C("move",D,D.surfaceId)},[C]),N=_.useCallback(D=>{const G=b.current;if(!G)return null;const Y=G.getBoundingClientRect();return Y.width<=0||Y.height<=0?null:{x:Math.max(0,Math.min(1,(D.clientX-Y.left)/Y.width)),y:Math.max(0,Math.min(1,(D.clientY-Y.top)/Y.height))}},[]),k=D=>{var L;if(i.mutating)return;const G=N(D.nativeEvent);if(!G)return;D.currentTarget.setPointerCapture(D.pointerId);const Y=((L=x.current)==null?void 0:L.surfaceId)??null,W=Y!==null&&C("begin",G,Y);E.current={pointerId:D.pointerId,startX:D.clientX,startY:D.clientY,lastPoint:G,points:[{type:"begin",...G}],live:W,surfaceId:W?Y:null}},O=D=>{const G=E.current;if(!G||G.pointerId!==D.pointerId)return;const Y=N(D.nativeEvent);Y&&G.live?(G.lastPoint=Y,w.current=G.surfaceId?{...Y,surfaceId:G.surfaceId}:null,S.current===null&&(S.current=window.requestAnimationFrame(()=>A()))):Y&&G.points.length<PU-1&&(G.lastPoint=Y,G.points.push({type:"move",...Y}))},z=D=>{const G=E.current;if(E.current=null,!G||G.pointerId!==D.pointerId)return;const Y=N(D.nativeEvent);if(!Y)return;if(G.live){A(),G.surfaceId&&C("end",Y,G.surfaceId);return}(Math.hypot(D.clientX-G.startX,D.clientY-G.startY)>OU?i.gesture([...G.points,{type:"end",...Y}]):i.tap(Y.x,Y.y)).catch(T=>we.error(`Emulator input failed: ${T.message}`))},H=async()=>{try{await i.detach()}catch(D){we.error(`Could not detach Emulator: ${D.message}`)}};return u.jsxs("div",{className:"flex min-h-0 flex-1 flex-col bg-[var(--background)]",children:[u.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between gap-3 border-b border-[var(--border)] px-3",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx("span",{className:"truncate text-xs font-medium",children:r.deviceName??r.deviceId}),u.jsx(PA,{state:r.deviceState}),!r.available&&u.jsx(fr,{variant:"outline",children:"Unavailable"}),m&&s&&u.jsxs(fr,{variant:"outline",className:"gap-1 border-[var(--warning)]/30 font-mono text-[8px] uppercase text-[var(--warning)]",children:[u.jsx(ht,{className:"size-2.5 animate-spin"}),"Reconnecting"]})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.jsx(ge,{variant:"ghost",size:"icon-sm",disabled:!r.available||i.mutating,title:"Home","aria-label":"Home",onClick:()=>void i.button("home").catch(D=>we.error(`Home failed: ${D.message}`)),children:u.jsx(jE,{})}),u.jsxs(ge,{variant:"ghost",size:"sm",disabled:i.mutating,title:"Detach from this session",onClick:()=>void H(),children:[i.mutating?u.jsx(ht,{className:"animate-spin"}):u.jsx(IB,{}),"Detach"]})]})]}),u.jsxs("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden p-3",children:[!c&&!m&&u.jsx("div",{className:"absolute inset-0 z-10 grid place-items-center bg-[var(--background)]",children:u.jsx(zA,{icon:u.jsx(ht,{className:"size-5 animate-spin"}),label:"Connecting to Emulator…"})}),m&&!s&&u.jsxs("div",{className:"max-w-sm text-center",children:[u.jsx(p_,{className:"mx-auto mb-3 size-7 text-[var(--muted-foreground)]"}),u.jsx("p",{className:"text-sm font-medium",children:t==="local"?"Preview is unavailable":"Remote Emulator Surface is unavailable"}),u.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:m.message==="emulator_surface_upgrade_required"?"Upgrade the selected Runtime daemon to a version with Emulator Surface support.":m.message})]}),s&&u.jsx("img",{ref:b,src:s,alt:r.deviceName??r.deviceId,draggable:!1,onLoad:D=>{p({width:D.currentTarget.naturalWidth,height:D.currentTarget.naturalHeight}),d(!0)},onPointerDown:k,onPointerMove:O,onPointerUp:z,onPointerCancel:()=>{const D=E.current;E.current=null,D!=null&&D.live&&(A(),D.surfaceId&&C("end",D.lastPoint,D.surfaceId))},className:"max-h-full max-w-full touch-none select-none rounded-md bg-black object-contain shadow-[var(--shadow-md)]",style:g?{aspectRatio:`${g.width} / ${g.height}`}:void 0})]})]})}function HU(e){const t=location.protocol==="https:"?"wss":"ws",r=new URLSearchParams({bindingId:e.bindingId,maximumFrameRate:String(e.maximumFrameRate),capability:e.capability});return`${t}://${location.host}/api/runtimes/${encodeURIComponent(e.runtimeSelector)}/sessions/${encodeURIComponent(e.sessionId)}/emulator/surface?${r.toString()}`}function PA({state:e}){return u.jsxs(fr,{variant:"outline",className:qe("gap-1 px-1.5 py-0 font-mono text-[8px] uppercase",e==="booted"&&"border-[var(--success)]/30 text-[var(--success)]",e==="shutdown"&&"text-[var(--muted-foreground)]"),children:[u.jsx("span",{className:qe("size-1 rounded-full bg-current",e==="booted"&&"animate-pulse")}),e]})}function zA({icon:e,label:t}){return u.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 text-[var(--muted-foreground)]",children:[e,u.jsx("span",{className:"text-xs",children:t})]})}const IA="rynx.control.theme";function FU(){const e=localStorage.getItem(IA);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Xy(){const[e,t]=_.useState(FU);return _.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),localStorage.setItem(IA,e)},[e]),{theme:e,toggle:()=>t(r=>r==="dark"?"light":"dark")}}/**
|
|
479
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
480
|
+
* @license MIT
|
|
481
|
+
*
|
|
482
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
483
|
+
* @license MIT
|
|
484
|
+
*
|
|
485
|
+
* Originally forked from (with the author's permission):
|
|
486
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
487
|
+
* http://bellard.org/jslinux/
|
|
488
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
489
|
+
*/var WU=2,qU=1,VU=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var p;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((p=this._terminal.options.overviewRuler)==null?void 0:p.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue("height")),s=Math.max(0,parseInt(r.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),c={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},d=c.top+c.bottom,m=c.right+c.left,f=i-d,g=s-m-t;return{cols:Math.max(WU,Math.floor(g/e.css.cell.width)),rows:Math.max(qU,Math.floor(f/e.css.cell.height))}}};/**
|
|
490
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
491
|
+
* @license MIT
|
|
492
|
+
*
|
|
493
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
494
|
+
* @license MIT
|
|
495
|
+
*
|
|
496
|
+
* Originally forked from (with the author's permission):
|
|
497
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
498
|
+
* http://bellard.org/jslinux/
|
|
499
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
500
|
+
*/var GU=class{constructor(t,r,i,s={}){this._terminal=t,this._regex=r,this._handler=i,this._options=s}provideLinks(t,r){let i=KU.computeLink(t,this._regex,this._terminal,this._handler);r(this._addCallbacks(i))}_addCallbacks(t){return t.map(r=>(r.leave=this._options.leave,r.hover=(i,s)=>{if(this._options.hover){let{range:o}=r;this._options.hover(i,s,o)}},r))}};function YU(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var KU=class Gh{static computeLink(t,r,i,s){let o=new RegExp(r.source,(r.flags||"")+"g"),[c,d]=Gh._getWindowedLineStrings(t-1,i),m=c.join(""),f,g=[];for(;f=o.exec(m);){let p=f[0];if(!YU(p))continue;let[b,x]=Gh._mapStrIdx(i,d,0,f.index),[w,S]=Gh._mapStrIdx(i,b,x,p.length);if(b===-1||x===-1||w===-1||S===-1)continue;let E={start:{x:x+1,y:b+1},end:{x:S,y:w+1}};g.push({range:E,text:p,activate:s})}return g}static _getWindowedLineStrings(t,r){let i,s=t,o=t,c=0,d="",m=[];if(i=r.buffer.active.getLine(t)){let f=i.translateToString(!0);if(i.isWrapped&&f[0]!==" "){for(c=0;(i=r.buffer.active.getLine(--s))&&c<2048&&(d=i.translateToString(!0),c+=d.length,m.push(d),!(!i.isWrapped||d.indexOf(" ")!==-1)););m.reverse()}for(m.push(f),c=0;(i=r.buffer.active.getLine(++o))&&i.isWrapped&&c<2048&&(d=i.translateToString(!0),c+=d.length,m.push(d),d.indexOf(" ")===-1););}return[m,s]}static _mapStrIdx(t,r,i,s){let o=t.buffer.active,c=o.getNullCell(),d=i;for(;s;){let m=o.getLine(r);if(!m)return[-1,-1];for(let f=d;f<m.length;++f){m.getCell(f,c);let g=c.getChars();if(c.getWidth()&&(s-=g.length||1,f===m.length-1&&g==="")){let p=o.getLine(r+1);p&&p.isWrapped&&(p.getCell(0,c),c.getWidth()===2&&(s+=1))}if(s<0)return[r,f]}r++,d=0}return[r,d]}},XU=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function ZU(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var JU=class{constructor(t=ZU,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,i=r.urlRegex||XU;this._linkProvider=this._terminal.registerLinkProvider(new GU(this._terminal,i,this._handler,r))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
|
|
501
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
502
|
+
* @license MIT
|
|
503
|
+
*
|
|
504
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
505
|
+
* @license MIT
|
|
506
|
+
*
|
|
507
|
+
* Originally forked from (with the author's permission):
|
|
508
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
509
|
+
* http://bellard.org/jslinux/
|
|
510
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
511
|
+
*/var QU=(e,t,r,i)=>{for(var s=t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(s=c(s)||s);return s},eH=(e,t)=>(r,i)=>t(r,i,e),tH=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?x2.isErrorNoTelemetry(e)?new x2(e.message+`
|
|
512
|
+
|
|
513
|
+
`+e.stack):new Error(e.message+`
|
|
514
|
+
|
|
515
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},rH=new tH;function zv(e){iH(e)||rH.onUnexpectedError(e)}var Q_="Canceled";function iH(e){return e instanceof nH?!0:e instanceof Error&&e.name===Q_&&e.message===Q_}var nH=class extends Error{constructor(){super(Q_),this.name=this.message}},x2=class e0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e0)return t;let r=new e0;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},sH;(e=>{function t(o){return o<0}e.isLessThan=t;function r(o){return o<=0}e.isLessThanOrEqual=r;function i(o){return o>0}e.isGreaterThan=i;function s(o){return o===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(sH||(sH={}));function aH(e,t){let r=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(r,arguments))),s}}var $A;(e=>{function t(k){return k&&typeof k=="object"&&typeof k[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*s(k){yield k}e.single=s;function o(k){return t(k)?k:s(k)}e.wrap=o;function c(k){return k||r}e.from=c;function*d(k){for(let O=k.length-1;O>=0;O--)yield k[O]}e.reverse=d;function m(k){return!k||k[Symbol.iterator]().next().done===!0}e.isEmpty=m;function f(k){return k[Symbol.iterator]().next().value}e.first=f;function g(k,O){let z=0;for(let H of k)if(O(H,z++))return!0;return!1}e.some=g;function p(k,O){for(let z of k)if(O(z))return z}e.find=p;function*b(k,O){for(let z of k)O(z)&&(yield z)}e.filter=b;function*x(k,O){let z=0;for(let H of k)yield O(H,z++)}e.map=x;function*w(k,O){let z=0;for(let H of k)yield*O(H,z++)}e.flatMap=w;function*S(...k){for(let O of k)yield*O}e.concat=S;function E(k,O,z){let H=z;for(let D of k)H=O(H,D);return H}e.reduce=E;function*C(k,O,z=k.length){for(O<0&&(O+=k.length),z<0?z+=k.length:z>k.length&&(z=k.length);O<z;O++)yield k[O]}e.slice=C;function A(k,O=Number.POSITIVE_INFINITY){let z=[];if(O===0)return[z,k];let H=k[Symbol.iterator]();for(let D=0;D<O;D++){let G=H.next();if(G.done)return[z,e.empty()];z.push(G.value)}return[z,{[Symbol.iterator](){return H}}]}e.consume=A;async function N(k){let O=[];for await(let z of k)O.push(z);return Promise.resolve(O)}e.asyncToArray=N})($A||($A={}));function UA(e){if($A.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function HA(...e){return Hr(()=>UA(e))}function Hr(e){return{dispose:aH(()=>{e()})}}var FA=class WA{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{UA(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?WA.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};FA.DISABLE_DISPOSED_WARNING=!1;var Ol=FA,fn=class{constructor(){this._store=new Ol,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};fn.None=Object.freeze({dispose(){}});var Zc=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var r;this._isDisposed||t===this._value||((r=this._value)==null||r.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Zy=typeof process<"u"&&"title"in process,dm=Zy?"node":navigator.userAgent,oH=Zy?"node":navigator.platform,lH=dm.includes("Firefox"),cH=dm.includes("Edge"),qA=/^((?!chrome|android).)*safari/i.test(dm);function uH(){if(!qA)return 0;let e=dm.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}oH.indexOf("Linux")>=0;var dH="",xr=0,wr=0,Sr=0,Ht=0,zi={css:"#00000000",rgba:0},Yr;(e=>{function t(s,o,c,d){return d!==void 0?`#${Qa(s)}${Qa(o)}${Qa(c)}${Qa(d)}`:`#${Qa(s)}${Qa(o)}${Qa(c)}`}e.toCss=t;function r(s,o,c,d=255){return(s<<24|o<<16|c<<8|d)>>>0}e.toRgba=r;function i(s,o,c,d){return{css:e.toCss(s,o,c,d),rgba:e.toRgba(s,o,c,d)}}e.toColor=i})(Yr||(Yr={}));var mu;(e=>{function t(m,f){if(Ht=(f.rgba&255)/255,Ht===1)return{css:f.css,rgba:f.rgba};let g=f.rgba>>24&255,p=f.rgba>>16&255,b=f.rgba>>8&255,x=m.rgba>>24&255,w=m.rgba>>16&255,S=m.rgba>>8&255;xr=x+Math.round((g-x)*Ht),wr=w+Math.round((p-w)*Ht),Sr=S+Math.round((b-S)*Ht);let E=Yr.toCss(xr,wr,Sr),C=Yr.toRgba(xr,wr,Sr);return{css:E,rgba:C}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function i(m,f,g){let p=ao.ensureContrastRatio(m.rgba,f.rgba,g);if(p)return Yr.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=i;function s(m){let f=(m.rgba|255)>>>0;return[xr,wr,Sr]=ao.toChannels(f),{css:Yr.toCss(xr,wr,Sr),rgba:f}}e.opaque=s;function o(m,f){return Ht=Math.round(f*255),[xr,wr,Sr]=ao.toChannels(m.rgba),{css:Yr.toCss(xr,wr,Sr,Ht),rgba:Yr.toRgba(xr,wr,Sr,Ht)}}e.opacity=o;function c(m,f){return Ht=m.rgba&255,o(m,Ht*f/255)}e.multiplyOpacity=c;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(mu||(mu={}));var hH;(e=>{let t,r;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return xr=parseInt(s.slice(1,2).repeat(2),16),wr=parseInt(s.slice(2,3).repeat(2),16),Sr=parseInt(s.slice(3,4).repeat(2),16),Yr.toColor(xr,wr,Sr);case 5:return xr=parseInt(s.slice(1,2).repeat(2),16),wr=parseInt(s.slice(2,3).repeat(2),16),Sr=parseInt(s.slice(3,4).repeat(2),16),Ht=parseInt(s.slice(4,5).repeat(2),16),Yr.toColor(xr,wr,Sr,Ht);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return xr=parseInt(o[1]),wr=parseInt(o[2]),Sr=parseInt(o[3]),Ht=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Yr.toColor(xr,wr,Sr,Ht);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[xr,wr,Sr,Ht]=t.getImageData(0,0,1,1).data,Ht!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Yr.toRgba(xr,wr,Sr,Ht),css:s}}e.toColor=i})(hH||(hH={}));var Vr;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,s,o){let c=i/255,d=s/255,m=o/255,f=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),p=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return f*.2126+g*.7152+p*.0722}e.relativeLuminance2=r})(Vr||(Vr={}));var ao;(e=>{function t(c,d){if(Ht=(d&255)/255,Ht===1)return d;let m=d>>24&255,f=d>>16&255,g=d>>8&255,p=c>>24&255,b=c>>16&255,x=c>>8&255;return xr=p+Math.round((m-p)*Ht),wr=b+Math.round((f-b)*Ht),Sr=x+Math.round((g-x)*Ht),Yr.toRgba(xr,wr,Sr)}e.blend=t;function r(c,d,m){let f=Vr.relativeLuminance(c>>8),g=Vr.relativeLuminance(d>>8);if(us(f,g)<m){if(g<f){let x=i(c,d,m),w=us(f,Vr.relativeLuminance(x>>8));if(w<m){let S=s(c,d,m),E=us(f,Vr.relativeLuminance(S>>8));return w>E?x:S}return x}let p=s(c,d,m),b=us(f,Vr.relativeLuminance(p>>8));if(b<m){let x=i(c,d,m),w=us(f,Vr.relativeLuminance(x>>8));return b>w?p:x}return p}}e.ensureContrastRatio=r;function i(c,d,m){let f=c>>24&255,g=c>>16&255,p=c>>8&255,b=d>>24&255,x=d>>16&255,w=d>>8&255,S=us(Vr.relativeLuminance2(b,x,w),Vr.relativeLuminance2(f,g,p));for(;S<m&&(b>0||x>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),x-=Math.max(0,Math.ceil(x*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=us(Vr.relativeLuminance2(b,x,w),Vr.relativeLuminance2(f,g,p));return(b<<24|x<<16|w<<8|255)>>>0}e.reduceLuminance=i;function s(c,d,m){let f=c>>24&255,g=c>>16&255,p=c>>8&255,b=d>>24&255,x=d>>16&255,w=d>>8&255,S=us(Vr.relativeLuminance2(b,x,w),Vr.relativeLuminance2(f,g,p));for(;S<m&&(b<255||x<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=us(Vr.relativeLuminance2(b,x,w),Vr.relativeLuminance2(f,g,p));return(b<<24|x<<16|w<<8|255)>>>0}e.increaseLuminance=s;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(ao||(ao={}));function Qa(e){let t=e.toString(16);return t.length<2?"0"+t:t}function us(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function nr(e){if(!e)throw new Error("value must not be falsy");return e}function Jy(e){return 57508<=e&&e<=57558}function fH(e){return 57520<=e&&e<=57527}function mH(e){return 57344<=e&&e<=63743}function pH(e){return 9472<=e&&e<=9631}function gH(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function vH(e,t,r,i){return t===1&&r>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!gH(e)&&!Jy(e)&&!mH(e)}function VA(e){return Jy(e)||pH(e)}function _H(){return{css:{canvas:Ah(),cell:Ah()},device:{canvas:Ah(),cell:Ah(),char:{width:0,height:0,left:0,top:0}}}}function Ah(){return{width:0,height:0}}function yH(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var Lr=0,yr=0,Nn=!1,ds=!1,Mh=!1,ui,Iv=0,bH=class{constructor(e,t,r,i,s,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=i,this._coreBrowserService=s,this._themeService=o,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,i){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,yr=0,Lr=0,ds=!1,Nn=!1,Mh=!1,ui=this._themeService.colors,Iv=0,e.getCode()!==0&&e.extended.underlineStyle===4){let s=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Iv=t*i%(Math.round(s)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",s=>{s.backgroundColorRGB&&(yr=s.backgroundColorRGB.rgba>>8&16777215,ds=!0),s.foregroundColorRGB&&(Lr=s.foregroundColorRGB.rgba>>8&16777215,Nn=!0)}),Mh=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Mh){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:yr=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:yr=(this.result.fg&16777215)<<8|255;break;case 0:default:yr=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:yr=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:yr=(this.result.bg&16777215)<<8|255;break}yr=ao.blend(yr,(this._coreBrowserService.isFocused?ui.selectionBackgroundOpaque:ui.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else yr=(this._coreBrowserService.isFocused?ui.selectionBackgroundOpaque:ui.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(ds=!0,ui.selectionForeground&&(Lr=ui.selectionForeground.rgba>>8&16777215,Nn=!0),VA(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Lr=(this._coreBrowserService.isFocused?ui.selectionBackgroundOpaque:ui.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Lr=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Lr=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Lr=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Lr=(this.result.fg&16777215)<<8|255;break;case 0:default:Lr=this._themeService.colors.foreground.rgba}Lr=ao.blend(Lr,(this._coreBrowserService.isFocused?ui.selectionBackgroundOpaque:ui.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Nn=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",s=>{s.backgroundColorRGB&&(yr=s.backgroundColorRGB.rgba>>8&16777215,ds=!0),s.foregroundColorRGB&&(Lr=s.foregroundColorRGB.rgba>>8&16777215,Nn=!0)}),ds&&(Mh?yr=e.bg&-16777216&-134217729|yr|50331648:yr=e.bg&-16777216|yr|50331648),Nn&&(Lr=e.fg&-16777216&-67108865|Lr|50331648),this.result.fg&67108864&&(ds&&!Nn&&((this.result.bg&50331648)===0?Lr=this.result.fg&-134217728|ui.background.rgba>>8&16777215&16777215|50331648:Lr=this.result.fg&-134217728|this.result.bg&67108863,Nn=!0),!ds&&Nn&&((this.result.fg&50331648)===0?yr=this.result.bg&-67108864|ui.foreground.rgba>>8&16777215&16777215|50331648:yr=this.result.bg&-67108864|this.result.fg&67108863,ds=!0)),ui=void 0,this.result.bg=ds?yr:this.result.bg,this.result.fg=Nn?Lr:this.result.fg,this.result.ext&=536870911,this.result.ext|=Iv<<29&3758096384}},xH=.5,GA=lH||cH?"bottom":"ideographic",wH={"▀":[{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}]},SH={"░":[[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]]},CH={"─":{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:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},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:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},Lu={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{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}};Lu[""]=Lu[""];Lu[""]=Lu[""];function EH(e,t,r,i,s,o,c,d){let m=wH[t];if(m)return RH(e,m,r,i,s,o),!0;let f=SH[t];if(f)return kH(e,f,r,i,s,o),!0;let g=CH[t];if(g)return NH(e,g,r,i,s,o,d),!0;let p=Lu[t];return p?(AH(e,p,r,i,s,o,c,d),!0):!1}function RH(e,t,r,i,s,o){for(let c=0;c<t.length;c++){let d=t[c],m=s/8,f=o/8;e.fillRect(r+d.x*m,i+d.y*f,d.w*m,d.h*f)}}var w2=new Map;function kH(e,t,r,i,s,o){let c=w2.get(t);c||(c=new Map,w2.set(t,c));let d=e.fillStyle;if(typeof d!="string")throw new Error(`Unexpected fillStyle type "${d}"`);let m=c.get(d);if(!m){let f=t[0].length,g=t.length,p=e.canvas.ownerDocument.createElement("canvas");p.width=f,p.height=g;let b=nr(p.getContext("2d")),x=new ImageData(f,g),w,S,E,C;if(d.startsWith("#"))w=parseInt(d.slice(1,3),16),S=parseInt(d.slice(3,5),16),E=parseInt(d.slice(5,7),16),C=d.length>7&&parseInt(d.slice(7,9),16)||1;else if(d.startsWith("rgba"))[w,S,E,C]=d.substring(5,d.length-1).split(",").map(A=>parseFloat(A));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let A=0;A<g;A++)for(let N=0;N<f;N++)x.data[(A*f+N)*4]=w,x.data[(A*f+N)*4+1]=S,x.data[(A*f+N)*4+2]=E,x.data[(A*f+N)*4+3]=t[A][N]*(C*255);b.putImageData(x,0,0),m=nr(e.createPattern(p,null)),c.set(d,m)}e.fillStyle=m,e.fillRect(r,i,s,o)}function NH(e,t,r,i,s,o,c){e.strokeStyle=e.fillStyle;for(let[d,m]of Object.entries(t)){e.beginPath(),e.lineWidth=c*Number.parseInt(d);let f;if(typeof m=="function"){let g=.15/o*s;f=m(.15,g)}else f=m;for(let g of f.split(" ")){let p=g[0],b=YA[p];if(!b){console.error(`Could not find drawing instructions for "${p}"`);continue}let x=g.substring(1).split(",");!x[0]||!x[1]||b(e,KA(x,s,o,r,i,!0,c))}e.stroke(),e.closePath()}}function AH(e,t,r,i,s,o,c,d){let m=new Path2D;m.rect(r,i,s,o),e.clip(m),e.beginPath();let f=c/12;e.lineWidth=d*f;for(let g of t.d.split(" ")){let p=g[0],b=YA[p];if(!b){console.error(`Could not find drawing instructions for "${p}"`);continue}let x=g.substring(1).split(",");!x[0]||!x[1]||b(e,KA(x,s,o,r,i,!1,d,(t.leftPadding??0)*(f/2),(t.rightPadding??0)*(f/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function S2(e,t,r=0){return Math.max(Math.min(e,t),r)}var YA={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function KA(e,t,r,i,s,o,c,d=0,m=0){let f=e.map(g=>parseFloat(g)||parseInt(g));if(f.length<2)throw new Error("Too few arguments for instruction");for(let g=0;g<f.length;g+=2)f[g]*=t-d*c-m*c,o&&f[g]!==0&&(f[g]=S2(Math.round(f[g]+.5)-.5,t,0)),f[g]+=i+d*c;for(let g=1;g<f.length;g+=2)f[g]*=r,o&&f[g]!==0&&(f[g]=S2(Math.round(f[g]+.5)-.5,r,0)),f[g]+=s;return f}var C2=class{constructor(){this._data={}}set(t,r,i){this._data[t]||(this._data[t]={}),this._data[t][r]=i}get(t,r){return this._data[t]?this._data[t][r]:void 0}clear(){this._data={}}},E2=class{constructor(){this._data=new C2}set(e,t,r,i,s){this._data.get(e,t)||this._data.set(e,t,new C2),this._data.get(e,t).set(r,i,s)}get(e,t,r,i){var s;return(s=this._data.get(e,t))==null?void 0:s.get(r,i)}clear(){this._data.clear()}},XA=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,r=0,i=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),s=e.timeRemaining(),r*1.5>s){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=s}this.clear()}},MH=class extends XA{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let r=performance.now()+t;return{timeRemaining:()=>Math.max(0,r-performance.now())}}},TH=class extends XA{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},DH=!Zy&&"requestIdleCallback"in window?TH:MH,Ml=class ZA{constructor(){this.fg=0,this.bg=0,this.extended=new JA}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new ZA;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},JA=class QA{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new QA(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},LH=globalThis.performance&&typeof globalThis.performance.now=="function",jH=class eM{static create(t){return new eM(t)}constructor(t){this._now=LH&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},gs;(e=>{e.None=()=>fn.None;function t(L,T){return p(L,()=>{},0,void 0,!0,void 0,T)}e.defer=t;function r(L){return(T,j=null,U)=>{let M=!1,P;return P=L(I=>{if(!M)return P?P.dispose():M=!0,T.call(j,I)},null,U),M&&P.dispose(),P}}e.once=r;function i(L,T,j){return f((U,M=null,P)=>L(I=>U.call(M,T(I)),null,P),j)}e.map=i;function s(L,T,j){return f((U,M=null,P)=>L(I=>{T(I),U.call(M,I)},null,P),j)}e.forEach=s;function o(L,T,j){return f((U,M=null,P)=>L(I=>T(I)&&U.call(M,I),null,P),j)}e.filter=o;function c(L){return L}e.signal=c;function d(...L){return(T,j=null,U)=>{let M=HA(...L.map(P=>P(I=>T.call(j,I))));return g(M,U)}}e.any=d;function m(L,T,j,U){let M=j;return i(L,P=>(M=T(M,P),M),U)}e.reduce=m;function f(L,T){let j,U={onWillAddFirstListener(){j=L(M.fire,M)},onDidRemoveLastListener(){j==null||j.dispose()}},M=new Mt(U);return T==null||T.add(M),M.event}function g(L,T){return T instanceof Array?T.push(L):T&&T.add(L),L}function p(L,T,j=100,U=!1,M=!1,P,I){let F,q,$,X=0,V,J={leakWarningThreshold:P,onWillAddFirstListener(){F=L(ae=>{X++,q=T(q,ae),U&&!$&&(le.fire(q),q=void 0),V=()=>{let ee=q;q=void 0,$=void 0,(!U||X>1)&&le.fire(ee),X=0},typeof j=="number"?(clearTimeout($),$=setTimeout(V,j)):$===void 0&&($=0,queueMicrotask(V))})},onWillRemoveListener(){M&&X>0&&(V==null||V())},onDidRemoveLastListener(){V=void 0,F.dispose()}},le=new Mt(J);return I==null||I.add(le),le.event}e.debounce=p;function b(L,T=0,j){return e.debounce(L,(U,M)=>U?(U.push(M),U):[M],T,void 0,!0,void 0,j)}e.accumulate=b;function x(L,T=(U,M)=>U===M,j){let U=!0,M;return o(L,P=>{let I=U||!T(P,M);return U=!1,M=P,I},j)}e.latch=x;function w(L,T,j){return[e.filter(L,T,j),e.filter(L,U=>!T(U),j)]}e.split=w;function S(L,T=!1,j=[],U){let M=j.slice(),P=L(q=>{M?M.push(q):F.fire(q)});U&&U.add(P);let I=()=>{M==null||M.forEach(q=>F.fire(q)),M=null},F=new Mt({onWillAddFirstListener(){P||(P=L(q=>F.fire(q)),U&&U.add(P))},onDidAddFirstListener(){M&&(T?setTimeout(I):I())},onDidRemoveLastListener(){P&&P.dispose(),P=null}});return U&&U.add(F),F.event}e.buffer=S;function E(L,T){return(j,U,M)=>{let P=T(new A);return L(function(I){let F=P.evaluate(I);F!==C&&j.call(U,F)},void 0,M)}}e.chain=E;let C=Symbol("HaltChainable");class A{constructor(){this.steps=[]}map(T){return this.steps.push(T),this}forEach(T){return this.steps.push(j=>(T(j),j)),this}filter(T){return this.steps.push(j=>T(j)?j:C),this}reduce(T,j){let U=j;return this.steps.push(M=>(U=T(U,M),U)),this}latch(T=(j,U)=>j===U){let j=!0,U;return this.steps.push(M=>{let P=j||!T(M,U);return j=!1,U=M,P?M:C}),this}evaluate(T){for(let j of this.steps)if(T=j(T),T===C)break;return T}}function N(L,T,j=U=>U){let U=(...F)=>I.fire(j(...F)),M=()=>L.on(T,U),P=()=>L.removeListener(T,U),I=new Mt({onWillAddFirstListener:M,onDidRemoveLastListener:P});return I.event}e.fromNodeEventEmitter=N;function k(L,T,j=U=>U){let U=(...F)=>I.fire(j(...F)),M=()=>L.addEventListener(T,U),P=()=>L.removeEventListener(T,U),I=new Mt({onWillAddFirstListener:M,onDidRemoveLastListener:P});return I.event}e.fromDOMEventEmitter=k;function O(L){return new Promise(T=>r(L)(T))}e.toPromise=O;function z(L){let T=new Mt;return L.then(j=>{T.fire(j)},()=>{T.fire(void 0)}).finally(()=>{T.dispose()}),T.event}e.fromPromise=z;function H(L,T){return L(j=>T.fire(j))}e.forward=H;function D(L,T,j){return T(j),L(U=>T(U))}e.runAndSubscribe=D;class G{constructor(T,j){this._observable=T,this._counter=0,this._hasChanged=!1;let U={onWillAddFirstListener:()=>{T.addObserver(this)},onDidRemoveLastListener:()=>{T.removeObserver(this)}};this.emitter=new Mt(U),j&&j.add(this.emitter)}beginUpdate(T){this._counter++}handlePossibleChange(T){}handleChange(T,j){this._hasChanged=!0}endUpdate(T){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Y(L,T){return new G(L,T).emitter.event}e.fromObservable=Y;function W(L){return(T,j,U)=>{let M=0,P=!1,I={beginUpdate(){M++},endUpdate(){M--,M===0&&(L.reportChanges(),P&&(P=!1,T.call(j)))},handlePossibleChange(){},handleChange(){P=!0}};L.addObserver(I),L.reportChanges();let F={dispose(){L.removeObserver(I)}};return U instanceof Ol?U.add(F):Array.isArray(U)&&U.push(F),F}}e.fromObservableLight=W})(gs||(gs={}));var t0=class r0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${r0._idPool++}`,r0.all.add(this)}start(t){this._stopWatch=new jH,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};t0.all=new Set,t0._idPool=0;var BH=t0,OH=-1,tM=class rM{constructor(t,r,i=(rM._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let m=new IH(d,o);this._errorHandler(m)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,s]of this._stacks)(!t||r<s)&&(t=[i,s],r=s);return t}};tM._idPool=1;var PH=tM,zH=class iM{constructor(t){this.value=t}static create(){let t=new Error;return new iM(t.stack??"")}print(){console.warn(this.value.split(`
|
|
516
|
+
`).slice(2).join(`
|
|
517
|
+
`))}},IH=class extends Error{constructor(t,r){super(t),this.name="ListenerLeakError",this.stack=r}},$H=class extends Error{constructor(t,r){super(t),this.name="ListenerRefusalError",this.stack=r}},UH=0,$v=class{constructor(e){this.value=e,this.id=UH++}},HH=2,FH,Mt=class{constructor(t){var r,i,s,o;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new PH((t==null?void 0:t.onListenerError)??zv,((i=this._options)==null?void 0:i.leakWarningThreshold)??OH):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new BH(this._options._profName):void 0,this._deliveryQueue=(o=this._options)==null?void 0:o.deliveryQueue}dispose(){var t,r,i,s;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||i.call(r),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(t,r,i)=>{var d,m,f,g,p;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let b=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(b);let x=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],w=new $H(`${b}. HINT: Stack shows most frequent listener (${x[1]}-times)`,x[0]);return(((d=this._options)==null?void 0:d.onListenerError)||zv)(w),fn.None}if(this._disposed)return fn.None;r&&(t=t.bind(r));let s=new $v(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=zH.create(),o=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof $v?(this._deliveryQueue??(this._deliveryQueue=new WH),this._listeners=[this._listeners,s]):this._listeners.push(s):((f=(m=this._options)==null?void 0:m.onWillAddFirstListener)==null||f.call(m,this),this._listeners=s,(p=(g=this._options)==null?void 0:g.onDidAddFirstListener)==null||p.call(g,this)),this._size++;let c=Hr(()=>{o==null||o(),this._removeListener(s)});return i instanceof Ol?i.add(c):Array.isArray(i)&&i.push(c),c}),this._event}_removeListener(t){var o,c,d,m;if((c=(o=this._options)==null?void 0:o.onWillRemoveListener)==null||c.call(o,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(m=(d=this._options)==null?void 0:d.onDidRemoveLastListener)==null||m.call(d,this),this._size=0;return}let r=this._listeners,i=r.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*HH<=r.length){let f=0;for(let g=0;g<r.length;g++)r[g]?r[f++]=r[g]:s&&(this._deliveryQueue.end--,f<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=f}}_deliver(t,r){var s;if(!t)return;let i=((s=this._options)==null?void 0:s.onListenerError)||zv;if(!i){t.value(r);return}try{t.value(r)}catch(o){i(o)}}_deliverQueue(t){let r=t.current._listeners;for(;t.i<t.end;)this._deliver(r[t.i++],t.value);t.reset()}fire(t){var r,i,s,o;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof $v)this._deliver(this._listeners,t);else{let c=this._deliveryQueue;c.enqueue(this,t,this._listeners.length),this._deliverQueue(c)}(o=this._perfMon)==null||o.stop()}hasListeners(){return this._size>0}},WH=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},R2={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},Jc=2,Qc,da=class Nl{constructor(t,r,i){this._document=t,this._config=r,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new E2,this._cacheMapCombined=new E2,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ml,this._textureSize=512,this._onAddTextureAtlasCanvas=new Mt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Mt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=nM(t,this._config.deviceCellWidth*4+Jc*2,this._config.deviceCellHeight+Jc*2),this._tmpCtx=nr(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new DH;for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let i=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,i)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Nl.maxAtlasPages&&this._pages.length>=Math.max(4,Nl.maxAtlasPages)){let r=this._pages.filter(f=>f.canvas.width*2<=(Nl.maxTextureSize||4096)).sort((f,g)=>g.canvas.width!==f.canvas.width?g.canvas.width-f.canvas.width:g.percentageUsed-f.percentageUsed),i=-1,s=0;for(let f=0;f<r.length;f++)if(r[f].canvas.width!==s)i=f,s=r[f].canvas.width;else if(f-i===3)break;let o=r.slice(i,i+4),c=o.map(f=>f.glyphs[0].texturePage).sort((f,g)=>f>g?1:-1),d=this.pages.length-o.length,m=this._mergePages(o,d);m.version++;for(let f=c.length-1;f>=0;f--)this._deletePage(c[f]);this.pages.push(m),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(m.canvas)}let t=new Uv(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let i=t[0].canvas.width*2,s=new Uv(this._document,i,t);for(let[o,c]of t.entries()){let d=o*c.canvas.width%i,m=Math.floor(o/2)*c.canvas.height;s.ctx.drawImage(c.canvas,d,m);for(let g of c.glyphs)g.texturePage=r,g.sizeClipSpace.x=g.size.x/i,g.sizeClipSpace.y=g.size.y/i,g.texturePosition.x+=d,g.texturePosition.y+=m,g.texturePositionClipSpace.x=g.texturePosition.x/i,g.texturePositionClipSpace.y=g.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(c.canvas);let f=this._activePages.indexOf(c);f!==-1&&this._activePages.splice(f,1)}return s}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let i=this._pages[r];for(let s of i.glyphs)s.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,r,i,s,o,c){return this._getFromCacheMap(this._cacheMapCombined,t,r,i,s,o,c)}getRasterizedGlyph(t,r,i,s,o,c){return this._getFromCacheMap(this._cacheMap,t,r,i,s,o,c)}_getFromCacheMap(t,r,i,s,o,c,d){return Qc=t.get(r,i,s,o),Qc||(Qc=this._drawToCache(r,i,s,o,c,d),t.set(r,i,s,o,Qc)),Qc}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,i,s){if(this._config.allowTransparency)return zi;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(r);break;case 50331648:let c=Ml.toColorRGB(r);o=Yr.toColor(c[0],c[1],c[2]);break;case 0:default:i?o=mu.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=mu.opaque(o)),o}_getForegroundColor(t,r,i,s,o,c,d,m,f,g){let p=this._getMinimumContrastColor(t,r,i,s,o,c,d,f,m,g);if(p)return p;let b;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&f&&c<8&&(c+=8),b=this._getColorFromAnsiIndex(c);break;case 50331648:let x=Ml.toColorRGB(c);b=Yr.toColor(x[0],x[1],x[2]);break;case 0:default:d?b=this._config.colors.background:b=this._config.colors.foreground}return this._config.allowTransparency&&(b=mu.opaque(b)),m&&(b=mu.multiplyOpacity(b,xH)),b}_resolveBackgroundRgba(t,r,i){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;case 0:default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,i,s){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;case 0:default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,i,s,o,c,d,m,f,g){if(this._config.minimumContrastRatio===1||g)return;let p=this._getContrastCache(f),b=p.getColor(t,s);if(b!==void 0)return b||void 0;let x=this._resolveBackgroundRgba(r,i,d),w=this._resolveForegroundRgba(o,c,d,m),S=ao.ensureContrastRatio(x,w,this._config.minimumContrastRatio/(f?2:1));if(!S){p.setColor(t,s,null);return}let E=Yr.toColor(S>>24&255,S>>16&255,S>>8&255);return p.setColor(t,s,E),E}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,i,s,o,c){let d=typeof t=="number"?String.fromCharCode(t):t;c&&this._tmpCanvas.parentElement!==c&&(this._tmpCanvas.style.display="none",c.append(this._tmpCanvas));let m=Math.min(this._config.deviceCellWidth*Math.max(d.length,2)+Jc*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<m&&(this._tmpCanvas.width=m);let f=Math.min(this._config.deviceCellHeight+Jc*4,this._textureSize);if(this._tmpCanvas.height<f&&(this._tmpCanvas.height=f),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=s,!!this._workAttributeData.isInvisible())return R2;let g=!!this._workAttributeData.isBold(),p=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),x=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),S=!!this._workAttributeData.isStrikethrough(),E=!!this._workAttributeData.isOverline(),C=this._workAttributeData.getFgColor(),A=this._workAttributeData.getFgColorMode(),N=this._workAttributeData.getBgColor(),k=this._workAttributeData.getBgColorMode();if(p){let q=C;C=N,N=q;let $=A;A=k,k=$}let O=this._getBackgroundColor(k,N,p,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=O.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let z=g?this._config.fontWeightBold:this._config.fontWeight,H=x?"italic":"";this._tmpCtx.font=`${H} ${z} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=GA;let D=d.length===1&&Jy(d.charCodeAt(0)),G=d.length===1&&fH(d.charCodeAt(0)),Y=this._getForegroundColor(r,k,N,i,A,C,p,b,g,VA(d.charCodeAt(0)));this._tmpCtx.fillStyle=Y.css;let W=G?0:Jc*2,L=!1;this._config.customGlyphs!==!1&&(L=EH(this._tmpCtx,d,W,W,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let T=!D,j;if(typeof t=="number"?j=this._unicodeService.wcwidth(t):j=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),$=q%2===1?.5:0;if(this._tmpCtx.lineWidth=q,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())T=!1,this._tmpCtx.strokeStyle=`rgb(${Ml.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{T=!1;let ee=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ee<8&&(ee+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ee).css}this._tmpCtx.beginPath();let X=W,V=Math.ceil(W+this._config.deviceCharHeight)-$-(o?q*2:0),J=V+q,le=V+q*2,ae=this._workAttributeData.getUnderlineVariantOffset();for(let ee=0;ee<j;ee++){this._tmpCtx.save();let se=X+ee*this._config.deviceCellWidth,ce=X+(ee+1)*this._config.deviceCellWidth,Se=se+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(se,V),this._tmpCtx.lineTo(ce,V),this._tmpCtx.moveTo(se,le),this._tmpCtx.lineTo(ce,le);break;case 3:let Re=q<=1?le:Math.ceil(W+this._config.deviceCharHeight-q/2)-$,Ne=q<=1?V:Math.ceil(W+this._config.deviceCharHeight+q/2)-$,Q=new Path2D;Q.rect(se,V,this._config.deviceCellWidth,le-V),this._tmpCtx.clip(Q),this._tmpCtx.moveTo(se-this._config.deviceCellWidth/2,J),this._tmpCtx.bezierCurveTo(se-this._config.deviceCellWidth/2,Ne,se,Ne,se,J),this._tmpCtx.bezierCurveTo(se,Re,Se,Re,Se,J),this._tmpCtx.bezierCurveTo(Se,Ne,ce,Ne,ce,J),this._tmpCtx.bezierCurveTo(ce,Re,ce+this._config.deviceCellWidth/2,Re,ce+this._config.deviceCellWidth/2,J);break;case 4:let re=ae===0?0:ae>=q?q*2-ae:q-ae;ae>=q||re===0?(this._tmpCtx.setLineDash([Math.round(q),Math.round(q)]),this._tmpCtx.moveTo(se+re,V),this._tmpCtx.lineTo(ce,V)):(this._tmpCtx.setLineDash([Math.round(q),Math.round(q)]),this._tmpCtx.moveTo(se,V),this._tmpCtx.lineTo(se+re,V),this._tmpCtx.moveTo(se+re+q,V),this._tmpCtx.lineTo(ce,V)),ae=yH(ce-se,q,ae);break;case 5:let be=.6,pe=.3,Ee=ce-se,Ie=Math.floor(be*Ee),Te=Math.floor(pe*Ee),Ye=Ee-Ie-Te;this._tmpCtx.setLineDash([Ie,Te,Ye]),this._tmpCtx.moveTo(se,V),this._tmpCtx.lineTo(ce,V);break;case 1:default:this._tmpCtx.moveTo(se,V),this._tmpCtx.lineTo(ce,V);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!L&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let ee=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ee&&ee.actualBoundingBoxDescent>0){this._tmpCtx.save();let se=new Path2D;se.rect(X,V-Math.ceil(q/2),this._config.deviceCellWidth*j,le-V+Math.ceil(q/2)),this._tmpCtx.clip(se),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=O.css,this._tmpCtx.strokeText(d,W,W+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(E){let q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),$=q%2===1?.5:0;this._tmpCtx.lineWidth=q,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(W,W+$),this._tmpCtx.lineTo(W+this._config.deviceCharWidth*j,W+$),this._tmpCtx.stroke()}if(L||this._tmpCtx.fillText(d,W,W+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let q=Hv(this._tmpCtx.getImageData(W,W,this._config.deviceCellWidth,this._config.deviceCellHeight),O,Y,T);if(q)for(let $=1;$<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=O.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,W,W+this._config.deviceCharHeight-$),q=Hv(this._tmpCtx.getImageData(W,W,this._config.deviceCellWidth,this._config.deviceCellHeight),O,Y,T),!!q);$++);}if(S){let q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),$=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=q,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(W,W+Math.floor(this._config.deviceCharHeight/2)-$),this._tmpCtx.lineTo(W+this._config.deviceCharWidth*j,W+Math.floor(this._config.deviceCharHeight/2)-$),this._tmpCtx.stroke()}this._tmpCtx.restore();let U=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),M;if(this._config.allowTransparency?M=qH(U):M=Hv(U,O,Y,T),M)return R2;let P=this._findGlyphBoundingBox(U,this._workBoundingBox,m,G,L,W),I,F;for(;;){if(this._activePages.length===0){let q=this._createNewPage();I=q,F=q.currentRow,F.height=P.size.y;break}I=this._activePages[this._activePages.length-1],F=I.currentRow;for(let q of this._activePages)P.size.y<=q.currentRow.height&&(I=q,F=q.currentRow);for(let q=this._activePages.length-1;q>=0;q--)for(let $ of this._activePages[q].fixedRows)$.height<=F.height&&P.size.y<=$.height&&(I=this._activePages[q],F=$);if(P.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Uv(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),I=this._overflowSizePage,F=this._overflowSizePage.currentRow,F.x+P.size.x>=I.canvas.width&&(F.x=0,F.y+=F.height,F.height=0);break}if(F.y+P.size.y>=I.canvas.height||F.height>P.size.y+2){let q=!1;if(I.currentRow.y+I.currentRow.height+P.size.y>=I.canvas.height){let $;for(let X of this._activePages)if(X.currentRow.y+X.currentRow.height+P.size.y<X.canvas.height){$=X;break}if($)I=$;else if(Nl.maxAtlasPages&&this._pages.length>=Nl.maxAtlasPages&&F.y+P.size.y<=I.canvas.height&&F.height>=P.size.y&&F.x+P.size.x<=I.canvas.width)q=!0;else{let X=this._createNewPage();I=X,F=X.currentRow,F.height=P.size.y,q=!0}}q||(I.currentRow.height>0&&I.fixedRows.push(I.currentRow),F={x:0,y:I.currentRow.y+I.currentRow.height,height:P.size.y},I.fixedRows.push(F),I.currentRow={x:0,y:F.y+F.height,height:0})}if(F.x+P.size.x<=I.canvas.width)break;F===I.currentRow?(F.x=0,F.y+=F.height,F.height=0):I.fixedRows.splice(I.fixedRows.indexOf(F),1)}return P.texturePage=this._pages.indexOf(I),P.texturePosition.x=F.x,P.texturePosition.y=F.y,P.texturePositionClipSpace.x=F.x/I.canvas.width,P.texturePositionClipSpace.y=F.y/I.canvas.height,P.sizeClipSpace.x/=I.canvas.width,P.sizeClipSpace.y/=I.canvas.height,F.height=Math.max(F.height,P.size.y),F.x+=P.size.x,I.ctx.putImageData(U,P.texturePosition.x-this._workBoundingBox.left,P.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,P.size.x,P.size.y),I.addGlyph(P),I.version++,P}_findGlyphBoundingBox(t,r,i,s,o,c){r.top=0;let d=s?this._config.deviceCellHeight:this._tmpCanvas.height,m=s?this._config.deviceCellWidth:i,f=!1;for(let g=0;g<d;g++){for(let p=0;p<m;p++){let b=g*this._tmpCanvas.width*4+p*4+3;if(t.data[b]!==0){r.top=g,f=!0;break}}if(f)break}r.left=0,f=!1;for(let g=0;g<c+m;g++){for(let p=0;p<d;p++){let b=p*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){r.left=g,f=!0;break}}if(f)break}r.right=m,f=!1;for(let g=c+m-1;g>=c;g--){for(let p=0;p<d;p++){let b=p*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){r.right=g,f=!0;break}}if(f)break}r.bottom=d,f=!1;for(let g=d-1;g>=0;g--){for(let p=0;p<m;p++){let b=g*this._tmpCanvas.width*4+p*4+3;if(t.data[b]!==0){r.bottom=g,f=!0;break}}if(f)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+c+(s||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+c+(s||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Uv=class{constructor(t,r,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let s of i)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=nM(t,r,r),this.ctx=nr(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function Hv(e,t,r,i){let s=t.rgba>>>24,o=t.rgba>>>16&255,c=t.rgba>>>8&255,d=r.rgba>>>24,m=r.rgba>>>16&255,f=r.rgba>>>8&255,g=Math.floor((Math.abs(s-d)+Math.abs(o-m)+Math.abs(c-f))/12),p=!0;for(let b=0;b<e.data.length;b+=4)e.data[b]===s&&e.data[b+1]===o&&e.data[b+2]===c||i&&Math.abs(e.data[b]-s)+Math.abs(e.data[b+1]-o)+Math.abs(e.data[b+2]-c)<g?e.data[b+3]=0:p=!1;return p}function qH(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function nM(e,t,r){let i=e.createElement("canvas");return i.width=t,i.height=r,i}function VH(e,t,r,i,s,o,c,d){let m={foreground:o.foreground,background:o.background,cursor:zi,cursorAccent:zi,selectionForeground:zi,selectionBackgroundTransparent:zi,selectionBackgroundOpaque:zi,selectionInactiveBackgroundTransparent:zi,selectionInactiveBackgroundOpaque:zi,overviewRulerBorder:zi,scrollbarSliderBackground:zi,scrollbarSliderHoverBackground:zi,scrollbarSliderActiveBackground:zi,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:c,deviceMaxTextureSize:d,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:i,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:m}}function k2(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function GH(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Fi=[];function sM(e,t,r,i,s,o,c,d,m){let f=VH(i,s,o,c,t,r,d,m);for(let b=0;b<Fi.length;b++){let x=Fi[b],w=x.ownedBy.indexOf(e);if(w>=0){if(k2(x.config,f))return x.atlas;x.ownedBy.length===1?(x.atlas.dispose(),Fi.splice(b,1)):x.ownedBy.splice(w,1);break}}for(let b=0;b<Fi.length;b++){let x=Fi[b];if(k2(x.config,f))return x.ownedBy.push(e),x.atlas}let g=e._core,p={atlas:new da(document,f,g.unicodeService),config:f,ownedBy:[e]};return Fi.push(p),p.atlas}function N2(e){for(let t=0;t<Fi.length;t++){let r=Fi[t].ownedBy.indexOf(e);if(r!==-1){Fi[t].ownedBy.length===1?(Fi[t].atlas.dispose(),Fi.splice(t,1)):Fi[t].ownedBy.splice(r,1);break}}}var Th=600,YH=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=Th){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Th-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=Th-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Th)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function A2(e,t,r){let i=new t.ResizeObserver(s=>{let o=s.find(m=>m.target===e);if(!o)return;if(!("devicePixelContentBoxSize"in o)){i==null||i.disconnect(),i=void 0;return}let c=o.devicePixelContentBoxSize[0].inlineSize,d=o.devicePixelContentBoxSize[0].blockSize;c>0&&d>0&&r(c,d)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return Hr(()=>i==null?void 0:i.disconnect())}function KH(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var M2=class aM extends Ml{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new JA,this.combinedData=""}static fromCharData(t){let r=new aM;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?KH(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},oM=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function lM(e,t,r){let i=nr(e.createProgram());if(e.attachShader(i,nr(T2(e,e.VERTEX_SHADER,t))),e.attachShader(i,nr(T2(e,e.FRAGMENT_SHADER,r))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;console.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function T2(e,t,r){let i=nr(e.createShader(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function XH(e,t){let r=Math.min(e.length*2,t),i=new Float32Array(r);for(let s=0;s<e.length;s++)i[s]=e[s];return i}var ZH=class{constructor(t){this.texture=t,this.version=-1}},JH=`#version 300 es
|
|
518
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
519
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
520
|
+
layout (location = 2) in vec2 a_offset;
|
|
521
|
+
layout (location = 3) in vec2 a_size;
|
|
522
|
+
layout (location = 4) in float a_texpage;
|
|
523
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
524
|
+
layout (location = 6) in vec2 a_texsize;
|
|
525
|
+
|
|
526
|
+
uniform mat4 u_projection;
|
|
527
|
+
uniform vec2 u_resolution;
|
|
528
|
+
|
|
529
|
+
out vec2 v_texcoord;
|
|
530
|
+
flat out int v_texpage;
|
|
531
|
+
|
|
532
|
+
void main() {
|
|
533
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
534
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
535
|
+
v_texpage = int(a_texpage);
|
|
536
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
537
|
+
}`;function QH(e){let t="";for(let r=1;r<e;r++)t+=` else if (v_texpage == ${r}) { outColor = texture(u_texture[${r}], v_texcoord); }`;return`#version 300 es
|
|
538
|
+
precision lowp float;
|
|
539
|
+
|
|
540
|
+
in vec2 v_texcoord;
|
|
541
|
+
flat in int v_texpage;
|
|
542
|
+
|
|
543
|
+
uniform sampler2D u_texture[${e}];
|
|
544
|
+
|
|
545
|
+
out vec4 outColor;
|
|
546
|
+
|
|
547
|
+
void main() {
|
|
548
|
+
if (v_texpage == 0) {
|
|
549
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
550
|
+
} ${t}
|
|
551
|
+
}`}var ha=11,xl=ha*Float32Array.BYTES_PER_ELEMENT,eF=2,Ut=0,Nt,Fv=0,eu=0,tF=class extends fn{constructor(t,r,i,s){super(),this._terminal=t,this._gl=r,this._dimensions=i,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;da.maxAtlasPages===void 0&&(da.maxAtlasPages=Math.min(32,nr(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),da.maxTextureSize=nr(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=nr(lM(o,JH,QH(da.maxAtlasPages))),this._register(Hr(()=>o.deleteProgram(this._program))),this._projectionLocation=nr(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=nr(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=nr(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let c=new Float32Array([0,0,1,0,0,1,1,1]),d=o.createBuffer();this._register(Hr(()=>o.deleteBuffer(d))),o.bindBuffer(o.ARRAY_BUFFER,d),o.bufferData(o.ARRAY_BUFFER,c,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let m=new Uint8Array([0,1,2,3]),f=o.createBuffer();this._register(Hr(()=>o.deleteBuffer(f))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f),o.bufferData(o.ELEMENT_ARRAY_BUFFER,m,o.STATIC_DRAW),this._attributesBuffer=nr(o.createBuffer()),this._register(Hr(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,xl,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,xl,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,xl,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,xl,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,xl,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,xl,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let g=new Int32Array(da.maxAtlasPages);for(let p=0;p<da.maxAtlasPages;p++)g[p]=p;o.uniform1iv(this._textureLocation,g),o.uniformMatrix4fv(this._projectionLocation,!1,oM),this._atlasTextures=[];for(let p=0;p<da.maxAtlasPages;p++){let b=new ZH(nr(o.createTexture()));this._register(Hr(()=>o.deleteTexture(b.texture))),o.activeTexture(o.TEXTURE0+p),o.bindTexture(o.TEXTURE_2D,b.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[p]=b}o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,i,s,o,c,d,m,f){this._updateCell(this._vertices.attributes,t,r,i,s,o,c,d,m,f)}_updateCell(t,r,i,s,o,c,d,m,f,g){if(Ut=(i*this._terminal.cols+r)*ha,s===0||s===void 0){t.fill(0,Ut,Ut+ha-1-eF);return}this._atlas&&(m&&m.length>1?Nt=this._atlas.getRasterizedGlyphCombinedChar(m,o,c,d,!1,this._terminal.element):Nt=this._atlas.getRasterizedGlyph(s,o,c,d,!1,this._terminal.element),Fv=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==g&&Nt.offset.x>Fv?(eu=Nt.offset.x-Fv,t[Ut]=-(Nt.offset.x-eu)+this._dimensions.device.char.left,t[Ut+1]=-Nt.offset.y+this._dimensions.device.char.top,t[Ut+2]=(Nt.size.x-eu)/this._dimensions.device.canvas.width,t[Ut+3]=Nt.size.y/this._dimensions.device.canvas.height,t[Ut+4]=Nt.texturePage,t[Ut+5]=Nt.texturePositionClipSpace.x+eu/this._atlas.pages[Nt.texturePage].canvas.width,t[Ut+6]=Nt.texturePositionClipSpace.y,t[Ut+7]=Nt.sizeClipSpace.x-eu/this._atlas.pages[Nt.texturePage].canvas.width,t[Ut+8]=Nt.sizeClipSpace.y):(t[Ut]=-Nt.offset.x+this._dimensions.device.char.left,t[Ut+1]=-Nt.offset.y+this._dimensions.device.char.top,t[Ut+2]=Nt.size.x/this._dimensions.device.canvas.width,t[Ut+3]=Nt.size.y/this._dimensions.device.canvas.height,t[Ut+4]=Nt.texturePage,t[Ut+5]=Nt.texturePositionClipSpace.x,t[Ut+6]=Nt.texturePositionClipSpace.y,t[Ut+7]=Nt.sizeClipSpace.x,t[Ut+8]=Nt.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&vH(s,f,Nt.size.x,this._dimensions.device.cell.width)&&(t[Ut+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*ha;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==r?this._vertices.attributesBuffers[i]=new Float32Array(r):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=r,i=0;for(let s=0;s<t.rows;s++)for(let o=0;o<t.cols;o++)this._vertices.attributes[i+9]=o/t.cols,this._vertices.attributes[i+10]=s/t.rows,i+=ha}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],s=0;for(let o=0;o<t.lineLengths.length;o++){let c=o*this._terminal.cols*ha,d=this._vertices.attributes.subarray(c,c+t.lineLengths[o]*ha);i.set(d,s),s+=d.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,i.subarray(0,s),r.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(r,this._atlas,o);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,s/ha)}setAtlas(t){this._atlas=t;for(let r of this._atlasTextures)r.version=-1}_bindAtlasPageTexture(t,r,i){t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[i].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[i].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[i].version=r.pages[i].version}setDimensions(t){this._dimensions=t}},rF=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,r,i,s=!1){if(this.selectionStart=r,this.selectionEnd=i,!r||!i||r[0]===i[0]&&r[1]===i[1]){this.clear();return}let o=t.buffers.active.ydisp,c=r[1]-o,d=i[1]-o,m=Math.max(c,0),f=Math.min(d,t.rows-1);if(m>=t.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=c,this.viewportEndRow=d,this.viewportCappedStartRow=m,this.viewportCappedEndRow=f,this.startCol=r[0],this.endCol=i[0]}isCellSelected(t,r,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&i>=this.viewportCappedStartRow&&r<this.endCol&&i<=this.viewportCappedEndRow:r<this.startCol&&i>=this.viewportCappedStartRow&&r>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&r>=this.startCol):!1}};function iF(){return new rF}var bf=4,Yh=1,Kh=2,Wv=3,nF=2147483648,sF=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=iF()}resize(t,r){let i=t*r*bf;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(r))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},aF=`#version 300 es
|
|
552
|
+
layout (location = 0) in vec2 a_position;
|
|
553
|
+
layout (location = 1) in vec2 a_size;
|
|
554
|
+
layout (location = 2) in vec4 a_color;
|
|
555
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
556
|
+
|
|
557
|
+
uniform mat4 u_projection;
|
|
558
|
+
|
|
559
|
+
out vec4 v_color;
|
|
560
|
+
|
|
561
|
+
void main() {
|
|
562
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
563
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
564
|
+
v_color = a_color;
|
|
565
|
+
}`,oF=`#version 300 es
|
|
566
|
+
precision lowp float;
|
|
567
|
+
|
|
568
|
+
in vec4 v_color;
|
|
569
|
+
|
|
570
|
+
out vec4 outColor;
|
|
571
|
+
|
|
572
|
+
void main() {
|
|
573
|
+
outColor = v_color;
|
|
574
|
+
}`,ms=8,qv=ms*Float32Array.BYTES_PER_ELEMENT,lF=20*ms,D2=class{constructor(){this.attributes=new Float32Array(lF),this.count=0}},hs=0,L2=0,j2=0,B2=0,O2=0,P2=0,z2=0,cF=class extends fn{constructor(e,t,r,i){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=i,this._vertices=new D2,this._verticesCursor=new D2;let s=this._gl;this._program=nr(lM(s,aF,oF)),this._register(Hr(()=>s.deleteProgram(this._program))),this._projectionLocation=nr(s.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),c=s.createBuffer();this._register(Hr(()=>s.deleteBuffer(c))),s.bindBuffer(s.ARRAY_BUFFER,c),s.bufferData(s.ARRAY_BUFFER,o,s.STATIC_DRAW),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let d=new Uint8Array([0,1,2,3]),m=s.createBuffer();this._register(Hr(()=>s.deleteBuffer(m))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,m),s.bufferData(s.ELEMENT_ARRAY_BUFFER,d,s.STATIC_DRAW),this._attributesBuffer=nr(s.createBuffer()),this._register(Hr(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,qv,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,qv,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,qv,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(f=>{this._updateCachedColors(f),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,oM),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,r=this._vertices,i=1,s,o,c,d,m,f,g,p,b,x,w;for(s=0;s<t.rows;s++){for(c=-1,d=0,m=0,f=!1,o=0;o<t.cols;o++)g=(s*t.cols+o)*bf,p=e.cells[g+Yh],b=e.cells[g+Kh],x=!!(b&67108864),(p!==d||b!==m&&(f||x))&&((d!==0||f&&m!==0)&&(w=i++*ms,this._updateRectangle(r,w,m,d,c,o,s)),c=o,d=p,m=b,f=x);(d!==0||f&&m!==0)&&(w=i++*ms,this._updateRectangle(r,w,m,d,c,t.cols,s))}r.count=i}updateCursor(e){let t=this._verticesCursor,r=e.cursor;if(!r||r.style==="block"){t.count=0;return}let i,s=0;(r.style==="bar"||r.style==="outline")&&(i=s++*ms,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.style==="bar"?r.dpr*r.cursorWidth:r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(r.style==="underline"||r.style==="outline")&&(i=s++*ms,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,(r.y+1)*this._dimensions.device.cell.height-r.dpr,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat)),r.style==="outline"&&(i=s++*ms,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat),i=s++*ms,this._addRectangleFloat(t.attributes,i,(r.x+r.width)*this._dimensions.device.cell.width-r.dpr,r.y*this._dimensions.device.cell.height,r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=s}_updateRectangle(e,t,r,i,s,o,c){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:hs=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:hs=(r&16777215)<<8;break;case 0:default:hs=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:hs=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:hs=(i&16777215)<<8;break;case 0:default:hs=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=XH(e.attributes,this._terminal.rows*this._terminal.cols*ms)),L2=s*this._dimensions.device.cell.width,j2=c*this._dimensions.device.cell.height,B2=(hs>>24&255)/255,O2=(hs>>16&255)/255,P2=(hs>>8&255)/255,z2=1,this._addRectangle(e.attributes,t,L2,j2,(o-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,B2,O2,P2,z2)}_addRectangle(e,t,r,i,s,o,c,d,m,f){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=c,e[t+5]=d,e[t+6]=m,e[t+7]=f}_addRectangleFloat(e,t,r,i,s,o,c){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=c[0],e[t+5]=c[1],e[t+6]=c[2],e[t+7]=c[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},uF=class extends fn{constructor(t,r,i,s,o,c,d,m){super(),this._container=r,this._alpha=o,this._coreBrowserService=c,this._optionsService=d,this._themeService=m,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(t,f),this.reset(t)})),this._register(Hr(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=nr(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,r,i){}handleSelectionChanged(t,r,i,s=!1){}_setTransparency(t,r){if(r===this._alpha)return;let i=this._canvas;this._alpha=r,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,r){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=sM(t,this._optionsService.rawOptions,r,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,r){this._deviceCellWidth=r.device.cell.width,this._deviceCellHeight=r.device.cell.height,this._deviceCharWidth=r.device.char.width,this._deviceCharHeight=r.device.char.height,this._deviceCharLeft=r.device.char.left,this._deviceCharTop=r.device.char.top,this._canvas.width=r.device.canvas.width,this._canvas.height=r.device.canvas.height,this._canvas.style.width=`${r.css.canvas.width}px`,this._canvas.style.height=`${r.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,r,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(r+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,r,i,s){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,r*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,r*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(t,r,i,s){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=GA,this._clipCell(i,s,r.getWidth()),this._ctx.fillText(r.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,r,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,r*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,r,i){let s=r?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${s} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},dF=class extends uF{constructor(t,r,i,s,o,c,d){super(i,t,"link",r,!0,o,c,d),this._register(s.onShowLinkUnderline(m=>this._handleShowLinkUnderline(m))),this._register(s.onHideLinkUnderline(m=>this._handleHideLinkUnderline(m)))}resize(t,r){super.resize(t,r),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&GH(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let r=t.y1+1;r<t.y2;r++)this._fillBottomLineAtCells(0,r,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},io=typeof window=="object"?window:globalThis,i0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Mt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Mt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};i0.INSTANCE=new i0;var cM=i0;function hF(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}cM.INSTANCE.onDidChangeZoomLevel;cM.INSTANCE.onDidChangeFullscreen;var Xl=typeof navigator=="object"?navigator.userAgent:"";Xl.indexOf("Firefox")>=0;Xl.indexOf("AppleWebKit")>=0;var fF=Xl.indexOf("Chrome")>=0;!fF&&Xl.indexOf("Safari")>=0;Xl.indexOf("Electron/")>=0;Xl.indexOf("Android")>=0;var Vv=!1;if(typeof io.matchMedia=="function"){let e=io.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=io.matchMedia("(display-mode: fullscreen)");Vv=e.matches,hF(io,e,({matches:r})=>{Vv&&t.matches||(Vv=r)})}var Tl="en",Gv=!1,uM=!1,Dh,Xh=Tl,I2=Tl,mF,tn,oo=globalThis,jr,tE;typeof oo.vscode<"u"&&typeof oo.vscode.process<"u"?jr=oo.vscode.process:typeof process<"u"&&typeof((tE=process==null?void 0:process.versions)==null?void 0:tE.node)=="string"&&(jr=process);var rE,pF=typeof((rE=jr==null?void 0:jr.versions)==null?void 0:rE.electron)=="string",gF=pF&&(jr==null?void 0:jr.type)==="renderer",iE;if(typeof jr=="object"){jr.platform,jr.platform,Gv=jr.platform==="linux",Gv&&jr.env.SNAP&&jr.env.SNAP_REVISION,jr.env.CI||jr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Dh=Tl,Xh=Tl;let e=jr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Dh=t.userLocale,I2=t.osLocale,Xh=t.resolvedLanguage||Tl,mF=(iE=t.languagePack)==null?void 0:iE.translationsConfigFile}catch{}uM=!0}else typeof navigator=="object"&&!gF?(tn=navigator.userAgent,tn.indexOf("Windows")>=0,tn.indexOf("Macintosh")>=0,(tn.indexOf("Macintosh")>=0||tn.indexOf("iPad")>=0||tn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Gv=tn.indexOf("Linux")>=0,(tn==null?void 0:tn.indexOf("Mobi"))>=0,Xh=globalThis._VSCODE_NLS_LANGUAGE||Tl,Dh=navigator.language.toLowerCase(),I2=Dh):console.error("Unable to resolve platform.");var $2=uM,Un=tn,aa=Xh,vF;(e=>{function t(){return aa}e.value=t;function r(){return aa.length===2?aa==="en":aa.length>=3?aa[0]==="e"&&aa[1]==="n"&&aa[2]==="-":!1}e.isDefaultVariant=r;function i(){return aa==="en"}e.isDefault=i})(vF||(vF={}));var _F=typeof oo.postMessage=="function"&&!oo.importScripts;(()=>{if(_F){let e=[];oo.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;i++){let o=e[i];if(o.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),oo.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var yF=!!(Un&&Un.indexOf("Chrome")>=0);Un&&Un.indexOf("Firefox")>=0;!yF&&Un&&Un.indexOf("Safari")>=0;Un&&Un.indexOf("Edg/")>=0;Un&&Un.indexOf("Android")>=0;var wl=typeof navigator=="object"?navigator:{};$2||document.queryCommandSupported&&document.queryCommandSupported("copy")||wl&&wl.clipboard&&wl.clipboard.writeText,$2||wl&&wl.clipboard&&wl.clipboard.readText;var Qy=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Yv=new Qy,U2=new Qy,H2=new Qy;new Array(230);var bF;(e=>{function t(d){return Yv.keyCodeToStr(d)}e.toString=t;function r(d){return Yv.strToKeyCode(d)}e.fromString=r;function i(d){return U2.keyCodeToStr(d)}e.toUserSettingsUS=i;function s(d){return H2.keyCodeToStr(d)}e.toUserSettingsGeneral=s;function o(d){return U2.strToKeyCode(d)||H2.strToKeyCode(d)}e.fromUserSettings=o;function c(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Yv.keyCodeToStr(d)}e.toElectronAccelerator=c})(bF||(bF={}));var dM=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),xF;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof wF?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:gs.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:dM})})(xF||(xF={}));var wF=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?dM:(this._emitter||(this._emitter=new Mt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},SF;(e=>{async function t(i){let s,o=await Promise.all(i.map(c=>c.then(d=>d,d=>{s||(s=d)})));if(typeof s<"u")throw s;return o}e.settled=t;function r(i){return new Promise(async(s,o)=>{try{await i(s,o)}catch(c){o(c)}})}e.withAsyncBody=r})(SF||(SF={}));var F2=class Ii{static fromArray(t){return new Ii(r=>{r.emitMany(t)})}static fromPromise(t){return new Ii(async r=>{r.emitMany(await t)})}static fromPromises(t){return new Ii(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new Ii(async r=>{await Promise.all(t.map(async i=>{for await(let s of i)r.emitOne(s)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Mt,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(i)),this.resolve()}catch(s){this.reject(s)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await gs.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new Ii(async i=>{for await(let s of t)i.emitOne(r(s))})}map(t){return Ii.map(this,t)}static filter(t,r){return new Ii(async i=>{for await(let s of t)r(s)&&i.emitOne(s)})}filter(t){return Ii.filter(this,t)}static coalesce(t){return Ii.filter(t,r=>!!r)}coalesce(){return Ii.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return Ii.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};F2.EMPTY=F2.fromArray([]);var{getWindow:CF}=(function(){let e=new Map,t={window:io,disposables:new Ol};e.set(io.vscodeWindowId,t);let r=new Mt,i=new Mt,s=new Mt;function o(c,d){return(typeof c=="number"?e.get(c):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(c){if(e.has(c.vscodeWindowId))return fn.None;let d=new Ol,m={window:c,disposables:d.add(new Ol)};return e.set(c.vscodeWindowId,m),d.add(Hr(()=>{e.delete(c.vscodeWindowId),i.fire(c)})),d.add(n0(c,RF.BEFORE_UNLOAD,()=>{s.fire(c)})),r.fire(m),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){var f;let d=c;if((f=d==null?void 0:d.ownerDocument)!=null&&f.defaultView)return d.ownerDocument.defaultView.window;let m=c;return m!=null&&m.view?m.view.window:io},getDocument(c){return CF(c).document}}})(),EF=class{constructor(t,r,i,s){this._node=t,this._type=r,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function n0(e,t,r,i){return new EF(e,t,r,i)}var RF={BEFORE_UNLOAD:"beforeunload"},kF=class extends fn{constructor(t,r,i,s,o,c,d,m,f){super(),this._terminal=t,this._characterJoinerService=r,this._charSizeService=i,this._coreBrowserService=s,this._coreService=o,this._decorationService=c,this._optionsService=d,this._themeService=m,this._cursorBlinkStateManager=new Zc,this._charAtlasDisposable=this._register(new Zc),this._observerDisposable=this._register(new Zc),this._model=new sF,this._workCell=new M2,this._workCell2=new M2,this._rectangleRenderer=this._register(new Zc),this._glyphRenderer=this._register(new Zc),this._onChangeTextureAtlas=this._register(new Mt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Mt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Mt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Mt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Mt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let g={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",g),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new bH(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new dF(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=_H(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(d.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(n0(this._canvas,"webglcontextlost",p=>{console.log("webglcontextlost event received"),p.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(p)},3e3)})),this._register(n0(this._canvas,"webglcontextrestored",p=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,N2(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=A2(this._canvas,this._coreBrowserService.window,(p,b)=>this._setCanvasDevicePixelDimensions(p,b)),this._register(this._coreBrowserService.onWindowChange(p=>{this._observerDisposable.value=A2(this._canvas,p,(b,x)=>this._setCanvasDevicePixelDimensions(b,x))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Hr(()=>{var p;for(let b of this._renderLayers)b.dispose();(p=this._canvas.parentElement)==null||p.removeChild(this._canvas),N2(this._terminal)}))}get textureAtlas(){var t;return(t=this._charAtlas)==null?void 0:t.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,r){var i,s,o,c;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let d of this._renderLayers)d.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(i=this._rectangleRenderer.value)==null||i.setDimensions(this.dimensions),(s=this._rectangleRenderer.value)==null||s.handleResize(),(o=this._glyphRenderer.value)==null||o.setDimensions(this.dimensions),(c=this._glyphRenderer.value)==null||c.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var t;for(let r of this._renderLayers)r.handleBlur(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.pause(),this._requestRedrawViewport()}handleFocus(){var t;for(let r of this._renderLayers)r.handleFocus(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,r,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,t,r,i);this._model.selection.update(this._core,t,r,i),this._requestRedrawViewport()}handleCursorMove(){var t;for(let r of this._renderLayers)r.handleCursorMove(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new cF(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new tF(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var r;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=sM(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=HA(gs.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),gs.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),(r=this._glyphRenderer.value)==null||r.setAtlas(this._charAtlas)}_clearModel(t){var r;this._model.clear(),t&&((r=this._glyphRenderer.value)==null||r.clear())}clearTextureAtlas(){var t;(t=this._charAtlas)==null||t.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var t;this._clearModel(!0);for(let r of this._renderLayers)r.reset(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,r){var i;if(!this._isAttached)if((i=this._core.screenElement)!=null&&i.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,t,r);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,r),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new YH(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,r){let i=this._core,s=this._workCell,o,c,d,m,f,g,p=0,b=!0,x,w,S,E,C,A,N,k,O;t=W2(t,i.rows-1,0),r=W2(r,i.rows-1,0);let z=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",H=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,D=H-i.buffer.ydisp,G=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),Y=-1,W=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let L=!1;for(c=t;c<=r;c++)for(d=c+i.buffer.ydisp,m=i.buffer.lines.get(d),this._model.lineLengths[c]=0,S=H===d,p=0,f=this._characterJoinerService.getJoinedCharacters(d),k=0;k<i.cols;k++){if(o=this._cellColorResolver.result.bg,m.loadCell(k,s),k===0&&(o=this._cellColorResolver.result.bg),g=!1,b=k>=p,x=k,f.length>0&&k===f[0][0]&&b){w=f.shift();let T=this._model.selection.isCellSelected(this._terminal,w[0],d);for(N=w[0]+1;N<w[1];N++)b&&(b=T===this._model.selection.isCellSelected(this._terminal,N,d));b&&(b=!S||G<w[0]||G>=w[1]),b?(g=!0,s=new NF(s,m.translateToString(!0,w[0],w[1]),w[1]-w[0]),x=w[1]-1):p=w[1]}if(E=s.getChars(),C=s.getCode(),N=(c*i.cols+k)*bf,this._cellColorResolver.resolve(s,k,d,this.dimensions.device.cell.width),W&&d===H&&(k===G&&(this._model.cursor={x:G,y:D,width:s.getWidth(),style:this._coreBrowserService.isFocused?z:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},Y=G+s.getWidth()-1),k>=G&&k<=Y&&(this._coreBrowserService.isFocused&&z==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),C!==0&&(this._model.lineLengths[c]=k+1),!(this._model.cells[N]===C&&this._model.cells[N+Yh]===this._cellColorResolver.result.bg&&this._model.cells[N+Kh]===this._cellColorResolver.result.fg&&this._model.cells[N+Wv]===this._cellColorResolver.result.ext)&&(L=!0,E.length>1&&(C|=nF),this._model.cells[N]=C,this._model.cells[N+Yh]=this._cellColorResolver.result.bg,this._model.cells[N+Kh]=this._cellColorResolver.result.fg,this._model.cells[N+Wv]=this._cellColorResolver.result.ext,A=s.getWidth(),this._glyphRenderer.value.updateCell(k,c,C,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,E,A,o),g)){for(s=this._workCell,k++;k<=x;k++)O=(c*i.cols+k)*bf,this._glyphRenderer.value.updateCell(k,c,0,0,0,0,dH,0,0),this._model.cells[O]=0,this._model.cells[O+Yh]=this._cellColorResolver.result.bg,this._model.cells[O+Kh]=this._cellColorResolver.result.fg,this._model.cells[O+Wv]=this._cellColorResolver.result.ext;k--}}L&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,r){this._canvas.width===t&&this._canvas.height===r||(this._canvas.width=t,this._canvas.height=r,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},NF=class extends Ml{constructor(t,r,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function W2(e,t,r=0){return Math.max(Math.min(e,t),r)}var q2="di$target",V2="di$dependencies",Kv=new Map;function Wn(e){if(Kv.has(e))return Kv.get(e);let t=function(r,i,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");AF(t,r,s)};return t._id=e,Kv.set(e,t),t}function AF(e,t,r){t[q2]===t?t[V2].push({id:e,index:r}):(t[V2]=[{id:e,index:r}],t[q2]=t)}Wn("BufferService");Wn("CoreMouseService");Wn("CoreService");Wn("CharsetService");Wn("InstantiationService");Wn("LogService");var MF=Wn("OptionsService");Wn("OscLinkService");Wn("UnicodeService");Wn("DecorationService");var TF={trace:0,debug:1,info:2,warn:3,error:4,off:5},DF="xterm.js: ",G2=class extends fn{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=TF[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let r=0;r<t.length;r++)typeof t[r]=="function"&&(t[r]=t[r]())}_log(t,r,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":DF)+r,...i)}trace(t,...r){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,t,r)}debug(t,...r){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,t,r)}info(t,...r){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,t,r)}warn(t,...r){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,t,r)}error(t,...r){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,t,r)}};G2=QU([eH(0,MF)],G2);var LF=class extends fn{constructor(t){if(qA&&uH()<16){let r={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",r))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new Mt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Mt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Mt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Mt),this.onContextLoss=this._onContextLoss.event}activate(t){let r=t._core;if(!t.element){this._register(r.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=r.coreService,s=r.optionsService,o=r,c=o._renderService,d=o._characterJoinerService,m=o._charSizeService,f=o._coreBrowserService,g=o._decorationService;o._logService;let p=o._themeService;this._renderer=this._register(new kF(t,d,m,f,i,g,s,p,this._preserveDrawingBuffer)),this._register(gs.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(gs.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(gs.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(gs.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),c.setRenderer(this._renderer),this._register(Hr(()=>{if(this._terminal._core._store._isDisposed)return;let b=this._terminal._core._renderService;b.setRenderer(this._terminal._core._createRenderer()),b.handleResize(t.cols,t.rows)}))}get textureAtlas(){var t;return(t=this._renderer)==null?void 0:t.textureAtlas}clearTextureAtlas(){var t;(t=this._renderer)==null||t.clearTextureAtlas()}};/**
|
|
575
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
576
|
+
* @license MIT
|
|
577
|
+
*
|
|
578
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
579
|
+
* @license MIT
|
|
580
|
+
*
|
|
581
|
+
* Originally forked from (with the author's permission):
|
|
582
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
583
|
+
* http://bellard.org/jslinux/
|
|
584
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
585
|
+
*/var hM=Object.defineProperty,jF=Object.getOwnPropertyDescriptor,BF=(e,t)=>{for(var r in t)hM(e,r,{get:t[r],enumerable:!0})},qt=(e,t,r,i)=>{for(var s=i>1?void 0:i?jF(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(s=(i?c(t,r,s):c(s))||s);return i&&s&&hM(t,r,s),s},Ce=(e,t)=>(r,i)=>t(r,i,e),Y2="Terminal input",s0={get:()=>Y2,set:e=>Y2=e},K2="Too much output to announce, navigate to rows manually to read",a0={get:()=>K2,set:e=>K2=e};function OF(e){return e.replace(/\r?\n/g,"\r")}function PF(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function zF(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function IF(e,t,r,i){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");fM(s,t,r,i)}}function fM(e,t,r,i){e=OF(e),e=PF(e,r.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function mM(e,t,r){let i=r.getBoundingClientRect(),s=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function X2(e,t,r,i,s){mM(e,t,r),s&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function fa(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function hm(e,t=0,r=e.length){let i="";for(let s=t;s<r;++s){let o=e[s];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var $F=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let i=0,s=0;if(this._interim){let o=e.charCodeAt(s++);56320<=o&&o<=57343?t[i++]=(this._interim-55296)*1024+o-56320+65536:(t[i++]=this._interim,t[i++]=o),this._interim=0}for(let o=s;o<r;++o){let c=e.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=r)return this._interim=c,i;let d=e.charCodeAt(o);56320<=d&&d<=57343?t[i++]=(c-55296)*1024+d-56320+65536:(t[i++]=c,t[i++]=d);continue}c!==65279&&(t[i++]=c)}return i}},UF=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let i=0,s,o,c,d,m=0,f=0;if(this.interim[0]){let b=!1,x=this.interim[0];x&=(x&224)===192?31:(x&240)===224?15:7;let w=0,S;for(;(S=this.interim[++w]&63)&&w<4;)x<<=6,x|=S;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,C=E-w;for(;f<C;){if(f>=r)return 0;if(S=e[f++],(S&192)!==128){f--,b=!0;break}else this.interim[w++]=S,x<<=6,x|=S&63}b||(E===2?x<128?f--:t[i++]=x:E===3?x<2048||x>=55296&&x<=57343||x===65279||(t[i++]=x):x<65536||x>1114111||(t[i++]=x)),this.interim.fill(0)}let g=r-4,p=f;for(;p<r;){for(;p<g&&!((s=e[p])&128)&&!((o=e[p+1])&128)&&!((c=e[p+2])&128)&&!((d=e[p+3])&128);)t[i++]=s,t[i++]=o,t[i++]=c,t[i++]=d,p+=4;if(s=e[p++],s<128)t[i++]=s;else if((s&224)===192){if(p>=r)return this.interim[0]=s,i;if(o=e[p++],(o&192)!==128){p--;continue}if(m=(s&31)<<6|o&63,m<128){p--;continue}t[i++]=m}else if((s&240)===224){if(p>=r)return this.interim[0]=s,i;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=r)return this.interim[0]=s,this.interim[1]=o,i;if(c=e[p++],(c&192)!==128){p--;continue}if(m=(s&15)<<12|(o&63)<<6|c&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[i++]=m}else if((s&248)===240){if(p>=r)return this.interim[0]=s,i;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=r)return this.interim[0]=s,this.interim[1]=o,i;if(c=e[p++],(c&192)!==128){p--;continue}if(p>=r)return this.interim[0]=s,this.interim[1]=o,this.interim[2]=c,i;if(d=e[p++],(d&192)!==128){p--;continue}if(m=(s&7)<<18|(o&63)<<12|(c&63)<<6|d&63,m<65536||m>1114111)continue;t[i++]=m}}return i}},pM="",ga=" ",Zu=class gM{constructor(){this.fg=0,this.bg=0,this.extended=new xf}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new gM;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},xf=class vM{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new vM(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},qi=class _M extends Zu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new xf,this.combinedData=""}static fromCharData(t){let r=new _M;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?fa(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Z2="di$target",o0="di$dependencies",Xv=new Map;function HF(e){return e[o0]||[]}function kr(e){if(Xv.has(e))return Xv.get(e);let t=function(r,i,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");FF(t,r,s)};return t._id=e,Xv.set(e,t),t}function FF(e,t,r){t[Z2]===t?t[o0].push({id:e,index:r}):(t[o0]=[{id:e,index:r}],t[Z2]=t)}var Xr=kr("BufferService"),yM=kr("CoreMouseService"),Ao=kr("CoreService"),WF=kr("CharsetService"),eb=kr("InstantiationService"),bM=kr("LogService"),Zr=kr("OptionsService"),xM=kr("OscLinkService"),qF=kr("UnicodeService"),Ju=kr("DecorationService"),l0=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var g;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let i=[],s=this._optionsService.rawOptions.linkHandler,o=new qi,c=r.getTrimmedLength(),d=-1,m=-1,f=!1;for(let p=0;p<c;p++)if(!(m===-1&&!r.hasContent(p))){if(r.loadCell(p,o),o.hasExtendedAttrs()&&o.extended.urlId)if(m===-1){m=p,d=o.extended.urlId;continue}else f=o.extended.urlId!==d;else m!==-1&&(f=!0);if(f||m!==-1&&p===c-1){let b=(g=this._oscLinkService.getLinkData(d))==null?void 0:g.uri;if(b){let x={start:{x:m+1,y:e},end:{x:p+(!f&&p===c-1?1:0),y:e}},w=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let S=new URL(b);["http:","https:"].includes(S.protocol)||(w=!0)}catch{w=!0}w||i.push({text:b,range:x,activate:(S,E)=>s?s.activate(S,E,x):VF(S,E),hover:(S,E)=>{var C;return(C=s==null?void 0:s.hover)==null?void 0:C.call(s,S,E,x)},leave:(S,E)=>{var C;return(C=s==null?void 0:s.leave)==null?void 0:C.call(s,S,E,x)}})}f=!1,o.hasExtendedAttrs()&&o.extended.urlId?(m=p,d=o.extended.urlId):(m=-1,d=-1)}}t(i)}};l0=qt([Ce(0,Xr),Ce(1,Zr),Ce(2,xM)],l0);function VF(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
586
|
+
|
|
587
|
+
WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var fm=kr("CharSizeService"),Ms=kr("CoreBrowserService"),tb=kr("MouseService"),Ts=kr("RenderService"),GF=kr("SelectionService"),wM=kr("CharacterJoinerService"),Zl=kr("ThemeService"),SM=kr("LinkProviderService"),YF=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?J2.isErrorNoTelemetry(e)?new J2(e.message+`
|
|
588
|
+
|
|
589
|
+
`+e.stack):new Error(e.message+`
|
|
590
|
+
|
|
591
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},KF=new YF;function Zh(e){XF(e)||KF.onUnexpectedError(e)}var c0="Canceled";function XF(e){return e instanceof ZF?!0:e instanceof Error&&e.name===c0&&e.message===c0}var ZF=class extends Error{constructor(){super(c0),this.name=this.message}};function JF(e){return new Error(`Illegal argument: ${e}`)}var J2=class u0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof u0)return t;let r=new u0;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},d0=class CM extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,CM.prototype)}};function bi(e,t=0){return e[e.length-(1+t)]}var QF;(e=>{function t(o){return o<0}e.isLessThan=t;function r(o){return o<=0}e.isLessThanOrEqual=r;function i(o){return o>0}e.isGreaterThan=i;function s(o){return o===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(QF||(QF={}));function eW(e,t){let r=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(r,arguments))),s}}var EM;(e=>{function t(k){return k&&typeof k=="object"&&typeof k[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*s(k){yield k}e.single=s;function o(k){return t(k)?k:s(k)}e.wrap=o;function c(k){return k||r}e.from=c;function*d(k){for(let O=k.length-1;O>=0;O--)yield k[O]}e.reverse=d;function m(k){return!k||k[Symbol.iterator]().next().done===!0}e.isEmpty=m;function f(k){return k[Symbol.iterator]().next().value}e.first=f;function g(k,O){let z=0;for(let H of k)if(O(H,z++))return!0;return!1}e.some=g;function p(k,O){for(let z of k)if(O(z))return z}e.find=p;function*b(k,O){for(let z of k)O(z)&&(yield z)}e.filter=b;function*x(k,O){let z=0;for(let H of k)yield O(H,z++)}e.map=x;function*w(k,O){let z=0;for(let H of k)yield*O(H,z++)}e.flatMap=w;function*S(...k){for(let O of k)yield*O}e.concat=S;function E(k,O,z){let H=z;for(let D of k)H=O(H,D);return H}e.reduce=E;function*C(k,O,z=k.length){for(O<0&&(O+=k.length),z<0?z+=k.length:z>k.length&&(z=k.length);O<z;O++)yield k[O]}e.slice=C;function A(k,O=Number.POSITIVE_INFINITY){let z=[];if(O===0)return[z,k];let H=k[Symbol.iterator]();for(let D=0;D<O;D++){let G=H.next();if(G.done)return[z,e.empty()];z.push(G.value)}return[z,{[Symbol.iterator](){return H}}]}e.consume=A;async function N(k){let O=[];for await(let z of k)O.push(z);return Promise.resolve(O)}e.asyncToArray=N})(EM||(EM={}));function go(e){if(EM.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function tW(...e){return Dt(()=>go(e))}function Dt(e){return{dispose:eW(()=>{e()})}}var RM=class kM{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{go(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?kM.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};RM.DISABLE_DISPOSED_WARNING=!1;var _a=RM,Ze=class{constructor(){this._store=new _a,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ze.None=Object.freeze({dispose(){}});var Hl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},vs=typeof window=="object"?window:globalThis,h0=class f0{constructor(t){this.element=t,this.next=f0.Undefined,this.prev=f0.Undefined}};h0.Undefined=new h0(void 0);var jt=h0,Q2=class{constructor(){this._first=jt.Undefined,this._last=jt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===jt.Undefined}clear(){let e=this._first;for(;e!==jt.Undefined;){let t=e.next;e.prev=jt.Undefined,e.next=jt.Undefined,e=t}this._first=jt.Undefined,this._last=jt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new jt(e);if(this._first===jt.Undefined)this._first=r,this._last=r;else if(t){let s=this._last;this._last=r,r.prev=s,s.next=r}else{let s=this._first;this._first=r,r.next=s,s.prev=r}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(r))}}shift(){if(this._first!==jt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==jt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==jt.Undefined&&e.next!==jt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===jt.Undefined&&e.next===jt.Undefined?(this._first=jt.Undefined,this._last=jt.Undefined):e.next===jt.Undefined?(this._last=this._last.prev,this._last.next=jt.Undefined):e.prev===jt.Undefined&&(this._first=this._first.next,this._first.prev=jt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==jt.Undefined;)yield e.element,e=e.next}},rW=globalThis.performance&&typeof globalThis.performance.now=="function",iW=class NM{static create(t){return new NM(t)}constructor(t){this._now=rW&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Or;(e=>{e.None=()=>Ze.None;function t(L,T){return p(L,()=>{},0,void 0,!0,void 0,T)}e.defer=t;function r(L){return(T,j=null,U)=>{let M=!1,P;return P=L(I=>{if(!M)return P?P.dispose():M=!0,T.call(j,I)},null,U),M&&P.dispose(),P}}e.once=r;function i(L,T,j){return f((U,M=null,P)=>L(I=>U.call(M,T(I)),null,P),j)}e.map=i;function s(L,T,j){return f((U,M=null,P)=>L(I=>{T(I),U.call(M,I)},null,P),j)}e.forEach=s;function o(L,T,j){return f((U,M=null,P)=>L(I=>T(I)&&U.call(M,I),null,P),j)}e.filter=o;function c(L){return L}e.signal=c;function d(...L){return(T,j=null,U)=>{let M=tW(...L.map(P=>P(I=>T.call(j,I))));return g(M,U)}}e.any=d;function m(L,T,j,U){let M=j;return i(L,P=>(M=T(M,P),M),U)}e.reduce=m;function f(L,T){let j,U={onWillAddFirstListener(){j=L(M.fire,M)},onDidRemoveLastListener(){j==null||j.dispose()}},M=new _e(U);return T==null||T.add(M),M.event}function g(L,T){return T instanceof Array?T.push(L):T&&T.add(L),L}function p(L,T,j=100,U=!1,M=!1,P,I){let F,q,$,X=0,V,J={leakWarningThreshold:P,onWillAddFirstListener(){F=L(ae=>{X++,q=T(q,ae),U&&!$&&(le.fire(q),q=void 0),V=()=>{let ee=q;q=void 0,$=void 0,(!U||X>1)&&le.fire(ee),X=0},typeof j=="number"?(clearTimeout($),$=setTimeout(V,j)):$===void 0&&($=0,queueMicrotask(V))})},onWillRemoveListener(){M&&X>0&&(V==null||V())},onDidRemoveLastListener(){V=void 0,F.dispose()}},le=new _e(J);return I==null||I.add(le),le.event}e.debounce=p;function b(L,T=0,j){return e.debounce(L,(U,M)=>U?(U.push(M),U):[M],T,void 0,!0,void 0,j)}e.accumulate=b;function x(L,T=(U,M)=>U===M,j){let U=!0,M;return o(L,P=>{let I=U||!T(P,M);return U=!1,M=P,I},j)}e.latch=x;function w(L,T,j){return[e.filter(L,T,j),e.filter(L,U=>!T(U),j)]}e.split=w;function S(L,T=!1,j=[],U){let M=j.slice(),P=L(q=>{M?M.push(q):F.fire(q)});U&&U.add(P);let I=()=>{M==null||M.forEach(q=>F.fire(q)),M=null},F=new _e({onWillAddFirstListener(){P||(P=L(q=>F.fire(q)),U&&U.add(P))},onDidAddFirstListener(){M&&(T?setTimeout(I):I())},onDidRemoveLastListener(){P&&P.dispose(),P=null}});return U&&U.add(F),F.event}e.buffer=S;function E(L,T){return(j,U,M)=>{let P=T(new A);return L(function(I){let F=P.evaluate(I);F!==C&&j.call(U,F)},void 0,M)}}e.chain=E;let C=Symbol("HaltChainable");class A{constructor(){this.steps=[]}map(T){return this.steps.push(T),this}forEach(T){return this.steps.push(j=>(T(j),j)),this}filter(T){return this.steps.push(j=>T(j)?j:C),this}reduce(T,j){let U=j;return this.steps.push(M=>(U=T(U,M),U)),this}latch(T=(j,U)=>j===U){let j=!0,U;return this.steps.push(M=>{let P=j||!T(M,U);return j=!1,U=M,P?M:C}),this}evaluate(T){for(let j of this.steps)if(T=j(T),T===C)break;return T}}function N(L,T,j=U=>U){let U=(...F)=>I.fire(j(...F)),M=()=>L.on(T,U),P=()=>L.removeListener(T,U),I=new _e({onWillAddFirstListener:M,onDidRemoveLastListener:P});return I.event}e.fromNodeEventEmitter=N;function k(L,T,j=U=>U){let U=(...F)=>I.fire(j(...F)),M=()=>L.addEventListener(T,U),P=()=>L.removeEventListener(T,U),I=new _e({onWillAddFirstListener:M,onDidRemoveLastListener:P});return I.event}e.fromDOMEventEmitter=k;function O(L){return new Promise(T=>r(L)(T))}e.toPromise=O;function z(L){let T=new _e;return L.then(j=>{T.fire(j)},()=>{T.fire(void 0)}).finally(()=>{T.dispose()}),T.event}e.fromPromise=z;function H(L,T){return L(j=>T.fire(j))}e.forward=H;function D(L,T,j){return T(j),L(U=>T(U))}e.runAndSubscribe=D;class G{constructor(T,j){this._observable=T,this._counter=0,this._hasChanged=!1;let U={onWillAddFirstListener:()=>{T.addObserver(this)},onDidRemoveLastListener:()=>{T.removeObserver(this)}};this.emitter=new _e(U),j&&j.add(this.emitter)}beginUpdate(T){this._counter++}handlePossibleChange(T){}handleChange(T,j){this._hasChanged=!0}endUpdate(T){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Y(L,T){return new G(L,T).emitter.event}e.fromObservable=Y;function W(L){return(T,j,U)=>{let M=0,P=!1,I={beginUpdate(){M++},endUpdate(){M--,M===0&&(L.reportChanges(),P&&(P=!1,T.call(j)))},handlePossibleChange(){},handleChange(){P=!0}};L.addObserver(I),L.reportChanges();let F={dispose(){L.removeObserver(I)}};return U instanceof _a?U.add(F):Array.isArray(U)&&U.push(F),F}}e.fromObservableLight=W})(Or||(Or={}));var m0=class p0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${p0._idPool++}`,p0.all.add(this)}start(t){this._stopWatch=new iW,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};m0.all=new Set,m0._idPool=0;var nW=m0,sW=-1,AM=class MM{constructor(t,r,i=(MM._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let m=new lW(d,o);this._errorHandler(m)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,s]of this._stacks)(!t||r<s)&&(t=[i,s],r=s);return t}};AM._idPool=1;var aW=AM,oW=class TM{constructor(t){this.value=t}static create(){let t=new Error;return new TM(t.stack??"")}print(){console.warn(this.value.split(`
|
|
592
|
+
`).slice(2).join(`
|
|
593
|
+
`))}},lW=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},cW=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},uW=0,Zv=class{constructor(e){this.value=e,this.id=uW++}},dW=2,hW,_e=class{constructor(e){var t,r,i,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new aW((e==null?void 0:e.onListenerError)??Zh,((r=this._options)==null?void 0:r.leakWarningThreshold)??sW):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new nW(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,r,i;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(e,t,r)=>{var c,d,m,f,g;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let p=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(p);let b=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],x=new cW(`${p}. HINT: Stack shows most frequent listener (${b[1]}-times)`,b[0]);return(((c=this._options)==null?void 0:c.onListenerError)||Zh)(x),Ze.None}if(this._disposed)return Ze.None;t&&(e=e.bind(t));let i=new Zv(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=oW.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof Zv?(this._deliveryQueue??(this._deliveryQueue=new fW),this._listeners=[this._listeners,i]):this._listeners.push(i):((m=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||m.call(d,this),this._listeners=i,(g=(f=this._options)==null?void 0:f.onDidAddFirstListener)==null||g.call(f,this)),this._size++;let o=Dt(()=>{s==null||s(),this._removeListener(i)});return r instanceof _a?r.add(o):Array.isArray(r)&&r.push(o),o}),this._event}_removeListener(e){var s,o,c,d;if((o=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||o.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(d=(c=this._options)==null?void 0:c.onDidRemoveLastListener)==null||d.call(c,this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*dW<=t.length){let m=0;for(let f=0;f<t.length;f++)t[f]?t[m++]=t[f]:i&&(this._deliveryQueue.end--,m<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=m}}_deliver(e,t){var i;if(!e)return;let r=((i=this._options)==null?void 0:i.onListenerError)||Zh;if(!r){e.value(t);return}try{e.value(t)}catch(s){r(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,r,i,s;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof Zv)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},fW=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},g0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new _e,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new _e,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};g0.INSTANCE=new g0;var rb=g0;function mW(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}rb.INSTANCE.onDidChangeZoomLevel;function pW(e){return rb.INSTANCE.getZoomFactor(e)}rb.INSTANCE.onDidChangeFullscreen;var Jl=typeof navigator=="object"?navigator.userAgent:"",v0=Jl.indexOf("Firefox")>=0,gW=Jl.indexOf("AppleWebKit")>=0,ib=Jl.indexOf("Chrome")>=0,vW=!ib&&Jl.indexOf("Safari")>=0;Jl.indexOf("Electron/")>=0;Jl.indexOf("Android")>=0;var Jv=!1;if(typeof vs.matchMedia=="function"){let e=vs.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=vs.matchMedia("(display-mode: fullscreen)");Jv=e.matches,mW(vs,e,({matches:r})=>{Jv&&t.matches||(Jv=r)})}var Dl="en",_0=!1,y0=!1,Jh=!1,DM=!1,Lh,Qh=Dl,e5=Dl,_W,rn,lo=globalThis,Br,nE;typeof lo.vscode<"u"&&typeof lo.vscode.process<"u"?Br=lo.vscode.process:typeof process<"u"&&typeof((nE=process==null?void 0:process.versions)==null?void 0:nE.node)=="string"&&(Br=process);var sE,yW=typeof((sE=Br==null?void 0:Br.versions)==null?void 0:sE.electron)=="string",bW=yW&&(Br==null?void 0:Br.type)==="renderer",aE;if(typeof Br=="object"){_0=Br.platform==="win32",y0=Br.platform==="darwin",Jh=Br.platform==="linux",Jh&&Br.env.SNAP&&Br.env.SNAP_REVISION,Br.env.CI||Br.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Lh=Dl,Qh=Dl;let e=Br.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Lh=t.userLocale,e5=t.osLocale,Qh=t.resolvedLanguage||Dl,_W=(aE=t.languagePack)==null?void 0:aE.translationsConfigFile}catch{}DM=!0}else typeof navigator=="object"&&!bW?(rn=navigator.userAgent,_0=rn.indexOf("Windows")>=0,y0=rn.indexOf("Macintosh")>=0,(rn.indexOf("Macintosh")>=0||rn.indexOf("iPad")>=0||rn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Jh=rn.indexOf("Linux")>=0,(rn==null?void 0:rn.indexOf("Mobi"))>=0,Qh=globalThis._VSCODE_NLS_LANGUAGE||Dl,Lh=navigator.language.toLowerCase(),e5=Lh):console.error("Unable to resolve platform.");var LM=_0,In=y0,xW=Jh,t5=DM,Hn=rn,oa=Qh,wW;(e=>{function t(){return oa}e.value=t;function r(){return oa.length===2?oa==="en":oa.length>=3?oa[0]==="e"&&oa[1]==="n"&&oa[2]==="-":!1}e.isDefaultVariant=r;function i(){return oa==="en"}e.isDefault=i})(wW||(wW={}));var SW=typeof lo.postMessage=="function"&&!lo.importScripts;(()=>{if(SW){let e=[];lo.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;i++){let o=e[i];if(o.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),lo.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var CW=!!(Hn&&Hn.indexOf("Chrome")>=0);Hn&&Hn.indexOf("Firefox")>=0;!CW&&Hn&&Hn.indexOf("Safari")>=0;Hn&&Hn.indexOf("Edg/")>=0;Hn&&Hn.indexOf("Android")>=0;var Sl=typeof navigator=="object"?navigator:{};t5||document.queryCommandSupported&&document.queryCommandSupported("copy")||Sl&&Sl.clipboard&&Sl.clipboard.writeText,t5||Sl&&Sl.clipboard&&Sl.clipboard.readText;var nb=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Qv=new nb,r5=new nb,i5=new nb,EW=new Array(230),jM;(e=>{function t(d){return Qv.keyCodeToStr(d)}e.toString=t;function r(d){return Qv.strToKeyCode(d)}e.fromString=r;function i(d){return r5.keyCodeToStr(d)}e.toUserSettingsUS=i;function s(d){return i5.keyCodeToStr(d)}e.toUserSettingsGeneral=s;function o(d){return r5.strToKeyCode(d)||i5.strToKeyCode(d)}e.fromUserSettings=o;function c(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Qv.keyCodeToStr(d)}e.toElectronAccelerator=c})(jM||(jM={}));var RW=class BM{constructor(t,r,i,s,o){this.ctrlKey=t,this.shiftKey=r,this.altKey=i,this.metaKey=s,this.keyCode=o}equals(t){return t instanceof BM&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",i=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${r}${i}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new kW([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},kW=class{constructor(e){if(e.length===0)throw JF("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function NW(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return jM.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(v0)switch(t){case 59:return 85;case 60:if(xW)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(In)return 57;break}else if(gW&&(In&&t===93||!In&&t===92))return 57;return EW[t]||0}var AW=In?256:2048,MW=512,TW=1024,DW=In?2048:256,n5=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=NW(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=AW),this.altKey&&(t|=MW),this.shiftKey&&(t|=TW),this.metaKey&&(t|=DW),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new RW(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},s5=new WeakMap;function LW(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var jW=class{static getSameOriginWindowChain(e){let t=s5.get(e);if(!t){t=[],s5.set(e,t);let r=e,i;do i=LW(r),i?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=i;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,i=0,s=this.getSameOriginWindowChain(e);for(let o of s){let c=o.window.deref();if(r+=(c==null?void 0:c.scrollY)??0,i+=(c==null?void 0:c.scrollX)??0,c===t||!o.iframeElement)break;let d=o.iframeElement.getBoundingClientRect();r+=d.top,i+=d.left}return{top:r,left:i}}},jh=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=jW.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},a5=class{constructor(e,t=0,r=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let i=!1;if(ib){let o=navigator.userAgent.match(/Chrome\/(\d+)/);i=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,d=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")i?this.deltaY=o.wheelDeltaY/(120*d):this.deltaY=o.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?v0&&!In?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")vW&&LM?this.deltaX=-(o.wheelDeltaX/120):i?this.deltaX=o.wheelDeltaX/(120*d):this.deltaX=o.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?v0&&!In?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},OM=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),BW;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof OW?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Or.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:OM})})(BW||(BW={}));var OW=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?OM:(this._emitter||(this._emitter=new _e),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},sb=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new d0("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new d0("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},PW=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new d0("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=r.setInterval(()=>{e()},t);this.disposable=Dt(()=>{r.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},zW;(e=>{async function t(i){let s,o=await Promise.all(i.map(c=>c.then(d=>d,d=>{s||(s=d)})));if(typeof s<"u")throw s;return o}e.settled=t;function r(i){return new Promise(async(s,o)=>{try{await i(s,o)}catch(c){o(c)}})}e.withAsyncBody=r})(zW||(zW={}));var o5=class $i{static fromArray(t){return new $i(r=>{r.emitMany(t)})}static fromPromise(t){return new $i(async r=>{r.emitMany(await t)})}static fromPromises(t){return new $i(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new $i(async r=>{await Promise.all(t.map(async i=>{for await(let s of i)r.emitOne(s)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new _e,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(i)),this.resolve()}catch(s){this.reject(s)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Or.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new $i(async i=>{for await(let s of t)i.emitOne(r(s))})}map(t){return $i.map(this,t)}static filter(t,r){return new $i(async i=>{for await(let s of t)r(s)&&i.emitOne(s)})}filter(t){return $i.filter(this,t)}static coalesce(t){return $i.filter(t,r=>!!r)}coalesce(){return $i.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return $i.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};o5.EMPTY=o5.fromArray([]);var{getWindow:On,getWindowId:IW,onDidRegisterWindow:$W}=(function(){let e=new Map,t={window:vs,disposables:new _a};e.set(vs.vscodeWindowId,t);let r=new _e,i=new _e,s=new _e;function o(c,d){return(typeof c=="number"?e.get(c):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(c){if(e.has(c.vscodeWindowId))return Ze.None;let d=new _a,m={window:c,disposables:d.add(new _a)};return e.set(c.vscodeWindowId,m),d.add(Dt(()=>{e.delete(c.vscodeWindowId),i.fire(c)})),d.add($e(c,br.BEFORE_UNLOAD,()=>{s.fire(c)})),r.fire(m),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){var f;let d=c;if((f=d==null?void 0:d.ownerDocument)!=null&&f.defaultView)return d.ownerDocument.defaultView.window;let m=c;return m!=null&&m.view?m.view.window:vs},getDocument(c){return On(c).document}}})(),UW=class{constructor(e,t,r,i){this._node=e,this._type=t,this._handler=r,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function $e(e,t,r,i){return new UW(e,t,r,i)}var l5=function(e,t,r,i){return $e(e,t,r,i)},ab,HW=class extends PW{constructor(e){super(),this.defaultTarget=e&&On(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},c5=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Zh(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,i=new Map,s=o=>{r.set(o,!1);let c=e.get(o)??[];for(t.set(o,c),e.set(o,[]),i.set(o,!0);c.length>0;)c.sort(c5.sort),c.shift().execute();i.set(o,!1)};ab=(o,c,d=0)=>{let m=IW(o),f=new c5(c,d),g=e.get(m);return g||(g=[],e.set(m,g)),g.push(f),r.get(m)||(r.set(m,!0),o.requestAnimationFrame(()=>s(m))),f}})();function FW(e){let t=e.getBoundingClientRect(),r=On(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var br={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},WW=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=di(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=di(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=di(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=di(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=di(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=di(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=di(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=di(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=di(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=di(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=di(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=di(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=di(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=di(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function di(e){return typeof e=="number"?`${e}px`:e}function wu(e){return new WW(e)}var PM=class{constructor(){this._hooks=new _a,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,i,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=s;let o=e;try{e.setPointerCapture(t),this._hooks.add(Dt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=On(e)}this._hooks.add($e(o,br.POINTER_MOVE,c=>{if(c.buttons!==r){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add($e(o,br.POINTER_UP,c=>this.stopMonitoring(!0)))}};function qW(e,t,r){let i=null,s=null;if(typeof r.value=="function"?(i="value",s=r.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(i="get",s=r.get),!s)throw new Error("not supported");let o=`$memoize$${t}`;r[i]=function(...c){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,c)}),this[o]}}var Ln;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ln||(Ln={}));var pu=class Ur extends Ze{constructor(){super(),this.dispatched=!1,this.targets=new Q2,this.ignoreTargets=new Q2,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Or.runAndSubscribe($W,({window:t,disposables:r})=>{r.add($e(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),r.add($e(t.document,"touchend",i=>this.onTouchEnd(t,i))),r.add($e(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:vs,disposables:this._store}))}static addTarget(t){if(!Ur.isTouchDevice())return Ze.None;Ur.INSTANCE||(Ur.INSTANCE=new Ur);let r=Ur.INSTANCE.targets.push(t);return Dt(r)}static ignoreTarget(t){if(!Ur.isTouchDevice())return Ze.None;Ur.INSTANCE||(Ur.INSTANCE=new Ur);let r=Ur.INSTANCE.ignoreTargets.push(t);return Dt(r)}static isTouchDevice(){return"ontouchstart"in vs||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,s=t.targetTouches.length;i<s;i++){let o=t.targetTouches.item(i);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:r,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[r],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let c=this.newGestureEvent(Ln.Start,o.target);c.pageX=o.pageX,c.pageY=o.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let i=Date.now(),s=Object.keys(this.activeTouches).length;for(let o=0,c=r.changedTouches.length;o<c;o++){let d=r.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let m=this.activeTouches[d.identifier],f=Date.now()-m.initialTimeStamp;if(f<Ur.HOLD_DELAY&&Math.abs(m.initialPageX-bi(m.rollingPageX))<30&&Math.abs(m.initialPageY-bi(m.rollingPageY))<30){let g=this.newGestureEvent(Ln.Tap,m.initialTarget);g.pageX=bi(m.rollingPageX),g.pageY=bi(m.rollingPageY),this.dispatchEvent(g)}else if(f>=Ur.HOLD_DELAY&&Math.abs(m.initialPageX-bi(m.rollingPageX))<30&&Math.abs(m.initialPageY-bi(m.rollingPageY))<30){let g=this.newGestureEvent(Ln.Contextmenu,m.initialTarget);g.pageX=bi(m.rollingPageX),g.pageY=bi(m.rollingPageY),this.dispatchEvent(g)}else if(s===1){let g=bi(m.rollingPageX),p=bi(m.rollingPageY),b=bi(m.rollingTimestamps)-m.rollingTimestamps[0],x=g-m.rollingPageX[0],w=p-m.rollingPageY[0],S=[...this.targets].filter(E=>m.initialTarget instanceof Node&&E.contains(m.initialTarget));this.inertia(t,S,i,Math.abs(x)/b,x>0?1:-1,g,Math.abs(w)/b,w>0?1:-1,p)}this.dispatchEvent(this.newGestureEvent(Ln.End,m.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=r,i.tapCount=0,i}dispatchEvent(t){if(t.type===Ln.Tap){let r=new Date().getTime(),i=0;r-this._lastSetTapCountTime>Ur.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=r,t.tapCount=i}else(t.type===Ln.Change||t.type===Ln.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let r=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let s=0,o=t.initialTarget;for(;o&&o!==i;)s++,o=o.parentElement;r.push([s,i])}r.sort((i,s)=>i[0]-s[0]);for(let[i,s]of r)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,i,s,o,c,d,m,f){this.handle=ab(t,()=>{let g=Date.now(),p=g-i,b=0,x=0,w=!0;s+=Ur.SCROLL_FRICTION*p,d+=Ur.SCROLL_FRICTION*p,s>0&&(w=!1,b=o*s*p),d>0&&(w=!1,x=m*d*p);let S=this.newGestureEvent(Ln.Change);S.translationX=b,S.translationY=x,r.forEach(E=>E.dispatchEvent(S)),w||this.inertia(t,r,g,s,o,c+b,d,m,f+x)})}onTouchMove(t){let r=Date.now();for(let i=0,s=t.changedTouches.length;i<s;i++){let o=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let c=this.activeTouches[o.identifier],d=this.newGestureEvent(Ln.Change,c.initialTarget);d.translationX=o.pageX-bi(c.rollingPageX),d.translationY=o.pageY-bi(c.rollingPageY),d.pageX=o.pageX,d.pageY=o.pageY,this.dispatchEvent(d),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(o.pageX),c.rollingPageY.push(o.pageY),c.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};pu.SCROLL_FRICTION=-.005,pu.HOLD_DELAY=700,pu.CLEAR_TAP_COUNT_TIME=400,qt([qW],pu,"isTouchDevice",1);var VW=pu,ob=class extends Ze{onclick(e,t){this._register($e(e,br.CLICK,r=>t(new jh(On(e),r))))}onmousedown(e,t){this._register($e(e,br.MOUSE_DOWN,r=>t(new jh(On(e),r))))}onmouseover(e,t){this._register($e(e,br.MOUSE_OVER,r=>t(new jh(On(e),r))))}onmouseleave(e,t){this._register($e(e,br.MOUSE_LEAVE,r=>t(new jh(On(e),r))))}onkeydown(e,t){this._register($e(e,br.KEY_DOWN,r=>t(new n5(r))))}onkeyup(e,t){this._register($e(e,br.KEY_UP,r=>t(new n5(r))))}oninput(e,t){this._register($e(e,br.INPUT,t))}onblur(e,t){this._register($e(e,br.BLUR,t))}onfocus(e,t){this._register($e(e,br.FOCUS,t))}onchange(e,t){this._register($e(e,br.CHANGE,t))}ignoreGesture(e){return VW.ignoreTarget(e)}},u5=11,GW=class extends ob{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=u5+"px",this.domNode.style.height=u5+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new PM),this._register(l5(this.bgDomNode,br.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(l5(this.domNode,br.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new HW),this._pointerdownScheduleRepeatTimer=this._register(new sb)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,On(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},YW=class b0{constructor(t,r,i,s,o,c,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,i=i|0,s=s|0,o=o|0,c=c|0,d=d|0),this.rawScrollLeft=s,this.rawScrollTop=d,r<0&&(r=0),s+r>i&&(s=i-r),s<0&&(s=0),o<0&&(o=0),d+o>c&&(d=c-o),d<0&&(d=0),this.width=r,this.scrollWidth=i,this.scrollLeft=s,this.height=o,this.scrollHeight=c,this.scrollTop=d}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new b0(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new b0(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,r){let i=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,m=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:s,scrollLeftChanged:o,heightChanged:c,scrollHeightChanged:d,scrollTopChanged:m}}},KW=class extends Ze{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new YW(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var i;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(i=this._smoothScrolling)==null||i.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let i;t?i=new h5(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=h5.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},d5=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function e_(e,t){let r=t-e;return function(i){return e+r*JW(i)}}function XW(e,t,r){return function(i){return i<r?e(i/r):t((i-r)/(1-r))}}var h5=class x0{constructor(t,r,i,s){this.from=t,this.to=r,this.duration=s,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,r,i){if(Math.abs(t-r)>2.5*i){let s,o;return t<r?(s=t+.75*i,o=r-.75*i):(s=t-.75*i,o=r+.75*i),XW(e_(t,s),e_(o,r),.33)}return e_(t,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let r=(t-this.startTime)/this.duration;if(r<1){let i=this.scrollLeft(r),s=this.scrollTop(r);return new d5(i,s,!1)}return new d5(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,i){return x0.start(t,r,i)}static start(t,r,i){i=i+10;let s=Date.now()-10;return new x0(t,r,s,i)}};function ZW(e){return Math.pow(e,3)}function JW(e){return 1-ZW(1-e)}var QW=class extends Ze{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new sb)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},eq=140,zM=class extends ob{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new QW(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new PM),this._shouldRender=!0,this.domNode=wu(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register($e(this.domNode.domNode,br.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new GW(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,i){this.slider=wu(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register($e(this.slider.domNode,br.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);r<=s&&s<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let s=FW(this.domNode.domNode);t=e.pageX-s.left,r=e.pageY-s.top}let i=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let o=this._sliderOrthogonalPointerPosition(s),c=Math.abs(o-r);if(LM&&c>eq){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let d=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(d))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},IM=class w0{constructor(t,r,i,s,o,c){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=o,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new w0(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,i,s,o){let c=Math.max(0,i-t),d=Math.max(0,c-2*r),m=s>0&&s>i;if(!m)return{computedAvailableSize:Math.round(c),computedIsNeeded:m,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(i*d/s))),g=(d-f)/(s-i),p=o*g;return{computedAvailableSize:Math.round(c),computedIsNeeded:m,computedSliderSize:Math.round(f),computedSliderRatio:g,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let t=w0._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,i=this._scrollPosition;return r<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},tq=class extends zM{constructor(e,t,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new IM(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},rq=class extends zM{constructor(e,t,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new IM(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},iq=500,f5=50,nq=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},S0=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,r=0,i=1,s=this._rear;do{let o=s===this._front?t:Math.pow(2,-i);if(t-=o,r+=this._memory[s].score*o,s===this._front)break;s=(this._capacity+s-1)%this._capacity,i++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(ib){let r=On(t.browserEvent),i=pW(r);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,i){let s=null,o=new nq(t,r,i);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,s)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),r){let s=Math.abs(t.deltaX),o=Math.abs(t.deltaY),c=Math.abs(r.deltaX),d=Math.abs(r.deltaY),m=Math.max(Math.min(s,c),1),f=Math.max(Math.min(o,d),1),g=Math.max(s,c),p=Math.max(o,d);g%m===0&&p%f===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};S0.INSTANCE=new S0;var sq=S0,aq=class extends ob{constructor(e,t,r){super(),this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new _e),this.onWillScroll=this._onWillScroll.event,this._options=lq(t),this._scrollable=r,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let i={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new rq(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new tq(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=wu(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=wu(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=wu(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new sb),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=go(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,In&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new a5(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=go(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new a5(r))};this._mouseWheelToDispose.push($e(this._listenOnDomNode,br.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=sq.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+o===0?c=o=0:Math.abs(o)>=Math.abs(c)?c=0:o=0),this._options.flipAxes&&([o,c]=[c,o]);let d=!In&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let m=this._scrollable.getFutureScrollPosition(),f={};if(o){let g=f5*o,p=m.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(f,p)}if(c){let g=f5*c,p=m.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(f,p)}f=this._scrollable.validateScrollPosition(f),(m.scrollLeft!==f.scrollLeft||m.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),r=!0)}let i=r;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,r=e.scrollLeft>0,i=r?" left":"",s=t?" top":"",o=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${s}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),iq)}},oq=class extends aq{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function lq(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,In&&(t.className+=" mac"),t}var C0=class extends Ze{constructor(e,t,r,i,s,o,c,d){super(),this._bufferService=r,this._optionsService=c,this._renderService=d,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new KW({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>ab(i.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new oq(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Or.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Dt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Dt(()=>this._styleElement.remove())),this._register(Or.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
594
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(f=>this._handleScroll(f)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};C0=qt([Ce(2,Xr),Ce(3,Ms),Ce(4,yM),Ce(5,Zl),Ce(6,Zr),Ce(7,Ts)],C0);var E0=class extends Ze{constructor(e,t,r,i,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=i,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(Dt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var i;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((i=e==null?void 0:e.options)==null?void 0:i.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};E0=qt([Ce(1,Xr),Ce(2,Ms),Ce(3,Ju),Ce(4,Ts)],E0);var cq=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},An={full:0,left:0,center:0,right:0},la={full:0,left:0,center:0,right:0},tu={full:0,left:0,center:0,right:0},wf=class extends Ze{constructor(e,t,r,i,s,o,c,d){var f;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=i,this._renderService=s,this._optionsService=o,this._themeService=c,this._coreBrowserService=d,this._colorZoneStore=new cq,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(f=this._viewportElement.parentElement)==null||f.insertBefore(this._canvas,this._viewportElement),this._register(Dt(()=>{var g;return(g=this._canvas)==null?void 0:g.remove()}));let m=this._canvas.getContext("2d");if(m)this._ctx=m;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);la.full=this._canvas.width,la.left=e,la.center=t,la.right=e,this._refreshDrawHeightConstants(),tu.full=1,tu.left=1,tu.center=1+la.left,tu.right=1+la.left+la.center}_refreshDrawHeightConstants(){An.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);An.left=t,An.center=t,An.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*An.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*An.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*An.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*An.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(tu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-An[e.position||"full"]/2),la[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+An[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};wf=qt([Ce(2,Xr),Ce(3,Ju),Ce(4,Ts),Ce(5,Zr),Ce(6,Zl),Ce(7,Ms)],wf);var me;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
595
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(me||(me={}));var ef;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(ef||(ef={}));var $M;(e=>e.ST=`${me.ESC}\\`)($M||($M={}));var R0=class{constructor(e,t,r,i,s,o){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=i,this._coreService=s,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${me.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};R0=qt([Ce(2,Xr),Ce(3,Zr),Ce(4,Ao),Ce(5,Ts)],R0);var Cr=0,Er=0,Rr=0,Ft=0,m5={css:"#00000000",rgba:0},sr;(e=>{function t(s,o,c,d){return d!==void 0?`#${eo(s)}${eo(o)}${eo(c)}${eo(d)}`:`#${eo(s)}${eo(o)}${eo(c)}`}e.toCss=t;function r(s,o,c,d=255){return(s<<24|o<<16|c<<8|d)>>>0}e.toRgba=r;function i(s,o,c,d){return{css:e.toCss(s,o,c,d),rgba:e.toRgba(s,o,c,d)}}e.toColor=i})(sr||(sr={}));var At;(e=>{function t(m,f){if(Ft=(f.rgba&255)/255,Ft===1)return{css:f.css,rgba:f.rgba};let g=f.rgba>>24&255,p=f.rgba>>16&255,b=f.rgba>>8&255,x=m.rgba>>24&255,w=m.rgba>>16&255,S=m.rgba>>8&255;Cr=x+Math.round((g-x)*Ft),Er=w+Math.round((p-w)*Ft),Rr=S+Math.round((b-S)*Ft);let E=sr.toCss(Cr,Er,Rr),C=sr.toRgba(Cr,Er,Rr);return{css:E,rgba:C}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function i(m,f,g){let p=tf.ensureContrastRatio(m.rgba,f.rgba,g);if(p)return sr.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=i;function s(m){let f=(m.rgba|255)>>>0;return[Cr,Er,Rr]=tf.toChannels(f),{css:sr.toCss(Cr,Er,Rr),rgba:f}}e.opaque=s;function o(m,f){return Ft=Math.round(f*255),[Cr,Er,Rr]=tf.toChannels(m.rgba),{css:sr.toCss(Cr,Er,Rr,Ft),rgba:sr.toRgba(Cr,Er,Rr,Ft)}}e.opacity=o;function c(m,f){return Ft=m.rgba&255,o(m,Ft*f/255)}e.multiplyOpacity=c;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(At||(At={}));var Ot;(e=>{let t,r;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Cr=parseInt(s.slice(1,2).repeat(2),16),Er=parseInt(s.slice(2,3).repeat(2),16),Rr=parseInt(s.slice(3,4).repeat(2),16),sr.toColor(Cr,Er,Rr);case 5:return Cr=parseInt(s.slice(1,2).repeat(2),16),Er=parseInt(s.slice(2,3).repeat(2),16),Rr=parseInt(s.slice(3,4).repeat(2),16),Ft=parseInt(s.slice(4,5).repeat(2),16),sr.toColor(Cr,Er,Rr,Ft);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Cr=parseInt(o[1]),Er=parseInt(o[2]),Rr=parseInt(o[3]),Ft=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),sr.toColor(Cr,Er,Rr,Ft);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Cr,Er,Rr,Ft]=t.getImageData(0,0,1,1).data,Ft!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:sr.toRgba(Cr,Er,Rr,Ft),css:s}}e.toColor=i})(Ot||(Ot={}));var Gr;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,s,o){let c=i/255,d=s/255,m=o/255,f=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),p=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return f*.2126+g*.7152+p*.0722}e.relativeLuminance2=r})(Gr||(Gr={}));var tf;(e=>{function t(c,d){if(Ft=(d&255)/255,Ft===1)return d;let m=d>>24&255,f=d>>16&255,g=d>>8&255,p=c>>24&255,b=c>>16&255,x=c>>8&255;return Cr=p+Math.round((m-p)*Ft),Er=b+Math.round((f-b)*Ft),Rr=x+Math.round((g-x)*Ft),sr.toRgba(Cr,Er,Rr)}e.blend=t;function r(c,d,m){let f=Gr.relativeLuminance(c>>8),g=Gr.relativeLuminance(d>>8);if(fs(f,g)<m){if(g<f){let x=i(c,d,m),w=fs(f,Gr.relativeLuminance(x>>8));if(w<m){let S=s(c,d,m),E=fs(f,Gr.relativeLuminance(S>>8));return w>E?x:S}return x}let p=s(c,d,m),b=fs(f,Gr.relativeLuminance(p>>8));if(b<m){let x=i(c,d,m),w=fs(f,Gr.relativeLuminance(x>>8));return b>w?p:x}return p}}e.ensureContrastRatio=r;function i(c,d,m){let f=c>>24&255,g=c>>16&255,p=c>>8&255,b=d>>24&255,x=d>>16&255,w=d>>8&255,S=fs(Gr.relativeLuminance2(b,x,w),Gr.relativeLuminance2(f,g,p));for(;S<m&&(b>0||x>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),x-=Math.max(0,Math.ceil(x*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=fs(Gr.relativeLuminance2(b,x,w),Gr.relativeLuminance2(f,g,p));return(b<<24|x<<16|w<<8|255)>>>0}e.reduceLuminance=i;function s(c,d,m){let f=c>>24&255,g=c>>16&255,p=c>>8&255,b=d>>24&255,x=d>>16&255,w=d>>8&255,S=fs(Gr.relativeLuminance2(b,x,w),Gr.relativeLuminance2(f,g,p));for(;S<m&&(b<255||x<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=fs(Gr.relativeLuminance2(b,x,w),Gr.relativeLuminance2(f,g,p));return(b<<24|x<<16|w<<8|255)>>>0}e.increaseLuminance=s;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(tf||(tf={}));function eo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function fs(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var uq=class extends Zu{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Sf=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new qi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],i=t.translateToString(!0),s=0,o=0,c=0,d=t.getFg(0),m=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==m){if(f-s>1){let g=this._getJoinedRanges(i,c,o,t,s);for(let p=0;p<g.length;p++)r.push(g[p])}s=f,c=o,d=this._workCell.fg,m=this._workCell.bg}o+=this._workCell.getChars().length||ga.length}if(this._bufferService.cols-s>1){let f=this._getJoinedRanges(i,c,o,t,s);for(let g=0;g<f.length;g++)r.push(f[g])}return r}_getJoinedRanges(e,t,r,i,s){let o=e.substring(t,r),c=[];try{c=this._characterJoiners[0].handler(o)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let m=this._characterJoiners[d].handler(o);for(let f=0;f<m.length;f++)Sf._mergeRanges(c,m[f])}catch(m){console.error(m)}return this._stringRangesToCellRanges(c,i,s),c}_stringRangesToCellRanges(e,t,r){let i=0,s=!1,o=0,c=e[i];if(c){for(let d=r;d<this._bufferService.cols;d++){let m=t.getWidth(d),f=t.getString(d).length||ga.length;if(m!==0){if(!s&&c[0]<=o&&(c[0]=d,s=!0),c[1]<=o){if(c[1]=d,c=e[++i],!c)break;c[0]<=o?(c[0]=d,s=!0):s=!1}o+=f}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(r){if(t[1]<=s[0])return e[i-1][1]=t[1],e;if(t[1]<=s[1])return e[i-1][1]=Math.max(t[1],s[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=s[0])return e.splice(i,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};Sf=qt([Ce(0,Xr)],Sf);function dq(e){return 57508<=e&&e<=57558}function hq(e){return 9472<=e&&e<=9631}function fq(e){return dq(e)||hq(e)}function mq(){return{css:{canvas:Bh(),cell:Bh()},device:{canvas:Bh(),cell:Bh(),char:{width:0,height:0,left:0,top:0}}}}function Bh(){return{width:0,height:0}}var k0=class{constructor(e,t,r,i,s,o,c){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=i,this._coreService=s,this._decorationService=o,this._themeService=c,this._workCell=new qi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,i,s,o,c,d,m,f,g){let p=[],b=this._characterJoinerService.getJoinedCharacters(t),x=this._themeService.colors,w=e.getNoBgTrimmedLength();r&&w<o+1&&(w=o+1);let S,E=0,C="",A=0,N=0,k=0,O=0,z=!1,H=0,D=!1,G=0,Y=0,W=[],L=f!==-1&&g!==-1;for(let T=0;T<w;T++){e.loadCell(T,this._workCell);let j=this._workCell.getWidth();if(j===0)continue;let U=!1,M=T>=Y,P=T,I=this._workCell;if(b.length>0&&T===b[0][0]&&M){let Q=b.shift(),re=this._isCellInSelection(Q[0],t);for(A=Q[0]+1;A<Q[1];A++)M&&(M=re===this._isCellInSelection(A,t));M&&(M=!r||o<Q[0]||o>=Q[1]),M?(U=!0,I=new uq(this._workCell,e.translateToString(!0,Q[0],Q[1]),Q[1]-Q[0]),P=Q[1]-1,j=I.getWidth()):Y=Q[1]}let F=this._isCellInSelection(T,t),q=r&&T===o,$=L&&T>=f&&T<=g,X=!1;this._decorationService.forEachDecorationAtCell(T,t,void 0,Q=>{X=!0});let V=I.getChars()||ga;if(V===" "&&(I.isUnderline()||I.isOverline())&&(V=" "),G=j*d-m.get(V,I.isBold(),I.isItalic()),!S)S=this._document.createElement("span");else if(E&&(F&&D||!F&&!D&&I.bg===N)&&(F&&D&&x.selectionForeground||I.fg===k)&&I.extended.ext===O&&$===z&&G===H&&!q&&!U&&!X&&M){I.isInvisible()?C+=ga:C+=V,E++;continue}else E&&(S.textContent=C),S=this._document.createElement("span"),E=0,C="";if(N=I.bg,k=I.fg,O=I.extended.ext,z=$,H=G,D=F,U&&o>=T&&o<=P&&(o=T),!this._coreService.isCursorHidden&&q&&this._coreService.isCursorInitialized){if(W.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&W.push("xterm-cursor-blink"),W.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":W.push("xterm-cursor-outline");break;case"block":W.push("xterm-cursor-block");break;case"bar":W.push("xterm-cursor-bar");break;case"underline":W.push("xterm-cursor-underline");break}}if(I.isBold()&&W.push("xterm-bold"),I.isItalic()&&W.push("xterm-italic"),I.isDim()&&W.push("xterm-dim"),I.isInvisible()?C=ga:C=I.getChars()||ga,I.isUnderline()&&(W.push(`xterm-underline-${I.extended.underlineStyle}`),C===" "&&(C=" "),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${Zu.toColorRGB(I.getUnderlineColor()).join(",")})`;else{let Q=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&Q<8&&(Q+=8),S.style.textDecorationColor=x.ansi[Q].css}I.isOverline()&&(W.push("xterm-overline"),C===" "&&(C=" ")),I.isStrikethrough()&&W.push("xterm-strikethrough"),$&&(S.style.textDecoration="underline");let J=I.getFgColor(),le=I.getFgColorMode(),ae=I.getBgColor(),ee=I.getBgColorMode(),se=!!I.isInverse();if(se){let Q=J;J=ae,ae=Q;let re=le;le=ee,ee=re}let ce,Se,Re=!1;this._decorationService.forEachDecorationAtCell(T,t,void 0,Q=>{Q.options.layer!=="top"&&Re||(Q.backgroundColorRGB&&(ee=50331648,ae=Q.backgroundColorRGB.rgba>>8&16777215,ce=Q.backgroundColorRGB),Q.foregroundColorRGB&&(le=50331648,J=Q.foregroundColorRGB.rgba>>8&16777215,Se=Q.foregroundColorRGB),Re=Q.options.layer==="top")}),!Re&&F&&(ce=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,ae=ce.rgba>>8&16777215,ee=50331648,Re=!0,x.selectionForeground&&(le=50331648,J=x.selectionForeground.rgba>>8&16777215,Se=x.selectionForeground)),Re&&W.push("xterm-decoration-top");let Ne;switch(ee){case 16777216:case 33554432:Ne=x.ansi[ae],W.push(`xterm-bg-${ae}`);break;case 50331648:Ne=sr.toColor(ae>>16,ae>>8&255,ae&255),this._addStyle(S,`background-color:#${p5((ae>>>0).toString(16),"0",6)}`);break;case 0:default:se?(Ne=x.foreground,W.push("xterm-bg-257")):Ne=x.background}switch(ce||I.isDim()&&(ce=At.multiplyOpacity(Ne,.5)),le){case 16777216:case 33554432:I.isBold()&&J<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(J+=8),this._applyMinimumContrast(S,Ne,x.ansi[J],I,ce,void 0)||W.push(`xterm-fg-${J}`);break;case 50331648:let Q=sr.toColor(J>>16&255,J>>8&255,J&255);this._applyMinimumContrast(S,Ne,Q,I,ce,Se)||this._addStyle(S,`color:#${p5(J.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(S,Ne,x.foreground,I,ce,Se)||se&&W.push("xterm-fg-257")}W.length&&(S.className=W.join(" "),W.length=0),!q&&!U&&!X&&M?E++:S.textContent=C,G!==this.defaultSpacing&&(S.style.letterSpacing=`${G}px`),p.push(S),T=P}return S&&E&&(S.textContent=C),p}_applyMinimumContrast(e,t,r,i,s,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||fq(i.getCode()))return!1;let c=this._getContrastCache(i),d;if(!s&&!o&&(d=c.getColor(t.rgba,r.rgba)),d===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);d=At.ensureContrastRatio(s||t,o||r,m),c.setColor((s||t).rgba,(o||r).rgba,d??null)}return d?(this._addStyle(e,`color:${d.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,i=this._selectionEnd;return!r||!i?!1:this._columnSelectMode?r[0]<=i[0]?e>=r[0]&&t>=r[1]&&e<i[0]&&t<=i[1]:e<r[0]&&t>=r[1]&&e>=i[0]&&t<=i[1]:t>r[1]&&t<i[1]||r[1]===i[1]&&t===r[1]&&e>=r[0]&&e<i[0]||r[1]<i[1]&&t===i[1]&&e<i[0]||r[1]<i[1]&&t===r[1]&&e>=r[0]}};k0=qt([Ce(1,wM),Ce(2,Zr),Ce(3,Ms),Ce(4,Ao),Ce(5,Ju),Ce(6,Zl)],k0);function p5(e,t,r){for(;e.length<r;)e=t+e;return e}var pq=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[r,i,s,o],this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,r,i){e===this._font&&t===this._fontSize&&r===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,r){let i=0;if(!t&&!r&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let c=this._measure(e,0);return c>0&&(this._flat[i]=c),c}let s=e;t&&(s+="B"),r&&(s+="I");let o=this._holey.get(s);if(o===void 0){let c=0;t&&(c|=1),r&&(c|=2),o=this._measure(e,c),o>0&&this._holey.set(s,o)}return o}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},gq=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,r,i=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let s=e.buffers.active.ydisp,o=t[1]-s,c=r[1]-s,d=Math.max(o,0),m=Math.min(c,e.rows-1);if(d>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=o,this.viewportEndRow=c,this.viewportCappedStartRow=d,this.viewportCappedEndRow=m,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function vq(){return new gq}var t_="xterm-dom-renderer-owner-",Pi="xterm-rows",Oh="xterm-fg-",g5="xterm-bg-",ru="xterm-focus",Ph="xterm-selection",_q=1,N0=class extends Ze{constructor(e,t,r,i,s,o,c,d,m,f,g,p,b,x){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=i,this._viewportElement=s,this._helperContainer=o,this._linkifier2=c,this._charSizeService=m,this._optionsService=f,this._bufferService=g,this._coreService=p,this._coreBrowserService=b,this._themeService=x,this._terminalClass=_q++,this._rowElements=[],this._selectionRenderModel=vq(),this.onRequestRedraw=this._register(new _e).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Pi),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Ph),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=mq(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(k0,document),this._element.classList.add(t_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(Dt(()=>{this._element.classList.remove(t_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new pq(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Pi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Pi} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Pi} .xterm-dim { color: ${At.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Pi}.${ru} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Pi}.${ru} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Pi}.${ru} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Pi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Pi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Pi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Pi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Pi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Ph} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ph} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ph} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${Oh}${o} { color: ${c.css}; }${this._terminalSelector} .${Oh}${o}.xterm-dim { color: ${At.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${g5}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${Oh}257 { color: ${At.opaque(e.background).css}; }${this._terminalSelector} .${Oh}257.xterm-dim { color: ${At.multiplyOpacity(At.opaque(e.background),.5).css}; }${this._terminalSelector} .${g5}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let r=this._rowElements.length;r<=t;r++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(ru),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ru),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(r){let m=e[0]>t[0];d.appendChild(this._createSelectionElement(o,m?t[0]:e[0],m?e[0]:t[0],c-o+1))}else{let m=i===o?e[0]:0,f=o===s?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(o,m,f));let g=c-o-1;if(d.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),o!==c){let p=s===c?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(c,0,p))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,r,i=1){let s=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(r-t);return o+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-o),s.style.height=`${i*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${o}px`,s.style.width=`${c}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let r=this._bufferService.buffer,i=r.ybase+r.y,s=Math.min(r.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let f=m+r.ydisp,g=this._rowElements[m],p=r.lines.get(f);if(!g||!p)break;g.replaceChildren(...this._rowFactory.createRow(p,f,f===i,c,d,s,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${t_}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,r,i,s,o){r<0&&(e=0),i<0&&(t=0);let c=this._bufferService.rows-1;r=Math.max(Math.min(r,c),0),i=Math.max(Math.min(i,c),0),s=Math.min(s,this._bufferService.cols);let d=this._bufferService.buffer,m=d.ybase+d.y,f=Math.min(d.x,s-1),g=this._optionsService.rawOptions.cursorBlink,p=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let x=r;x<=i;++x){let w=x+d.ydisp,S=this._rowElements[x],E=d.lines.get(w);if(!S||!E)break;S.replaceChildren(...this._rowFactory.createRow(E,w,w===m,p,b,f,g,this.dimensions.css.cell.width,this._widthCache,o?x===r?e:0:-1,o?(x===i?t:s)-1:-1))}}};N0=qt([Ce(7,eb),Ce(8,fm),Ce(9,Zr),Ce(10,Xr),Ce(11,Ao),Ce(12,Ms),Ce(13,Zl)],N0);var A0=class extends Ze{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new _e),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new bq(this._optionsService))}catch{this._measureStrategy=this._register(new yq(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};A0=qt([Ce(2,Zr)],A0);var UM=class extends Ze{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},yq=class extends UM{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},bq=class extends UM{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},xq=class extends Ze{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new wq(this._window)),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new _e),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(Or.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register($e(this._textarea,"focus",()=>this._isFocused=!0)),this._register($e(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},wq=class extends Ze{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Hl),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Dt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=$e(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},Sq=class extends Ze{constructor(){super(),this.linkProviders=[],this._register(Dt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function lb(e,t,r){let i=r.getBoundingClientRect(),s=e.getComputedStyle(r),o=parseInt(s.getPropertyValue("padding-left")),c=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-c]}function Cq(e,t,r,i,s,o,c,d,m){if(!o)return;let f=lb(e,t,r);if(f)return f[0]=Math.ceil((f[0]+(m?c/2:0))/c),f[1]=Math.ceil(f[1]/d),f[0]=Math.min(Math.max(f[0],1),i+(m?1:0)),f[1]=Math.min(Math.max(f[1],1),s),f}var M0=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,i,s){return Cq(window,e,t,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let r=lb(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};M0=qt([Ce(0,Ts),Ce(1,fm)],M0);var Eq=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},HM={};BF(HM,{getSafariVersion:()=>kq,isChromeOS:()=>VM,isFirefox:()=>FM,isIpad:()=>Nq,isIphone:()=>Aq,isLegacyEdge:()=>Rq,isLinux:()=>cb,isMac:()=>Cf,isNode:()=>mm,isSafari:()=>WM,isWindows:()=>qM});var mm=typeof process<"u"&&"title"in process,Qu=mm?"node":navigator.userAgent,ed=mm?"node":navigator.platform,FM=Qu.includes("Firefox"),Rq=Qu.includes("Edge"),WM=/^((?!chrome|android).)*safari/i.test(Qu);function kq(){if(!WM)return 0;let e=Qu.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Cf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(ed),Nq=ed==="iPad",Aq=ed==="iPhone",qM=["Windows","Win16","Win32","WinCE"].includes(ed),cb=ed.indexOf("Linux")>=0,VM=/\bCrOS\b/.test(Qu),GM=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,r=0,i=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),s=e.timeRemaining(),r*1.5>s){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=s}this.clear()}},Mq=class extends GM{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Tq=class extends GM{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Ef=!mm&&"requestIdleCallback"in window?Tq:Mq,Dq=class{constructor(){this._queue=new Ef}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},T0=class extends Ze{constructor(e,t,r,i,s,o,c,d,m){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=i,this._coreService=s,this._coreBrowserService=d,this._renderer=this._register(new Hl),this._pausedResizeTask=new Dq,this._observerDisposable=this._register(new Hl),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new _e),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new _e),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new _e),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Eq((f,g)=>this._renderRows(f,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Lq(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Dt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>{var f;return(f=this._renderer.value)==null?void 0:f.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=Dt(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var i;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(i=this._renderer.value)==null||i.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};T0=qt([Ce(2,Zr),Ce(3,fm),Ce(4,Ao),Ce(5,Ju),Ce(6,Xr),Ce(7,Ms),Ce(8,Zl)],T0);var Lq=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function jq(e,t,r,i){let s=r.buffer.x,o=r.buffer.y;if(!r.buffer.hasScrollback)return Pq(s,o,e,t,r,i)+pm(o,t,r,i)+zq(s,o,e,t,r,i);let c;if(o===t)return c=s>e?"D":"C",Bu(Math.abs(s-e),ju(c,i));c=o>t?"D":"C";let d=Math.abs(o-t),m=Oq(o>t?e:s,r)+(d-1)*r.cols+1+Bq(o>t?s:e);return Bu(m,ju(c,i))}function Bq(e,t){return e-1}function Oq(e,t){return t.cols-e}function Pq(e,t,r,i,s,o){return pm(t,i,s,o).length===0?"":Bu(KM(e,t,e,t-vo(t,s),!1,s).length,ju("D",o))}function pm(e,t,r,i){let s=e-vo(e,r),o=t-vo(t,r),c=Math.abs(s-o)-Iq(e,t,r);return Bu(c,ju(YM(e,t),i))}function zq(e,t,r,i,s,o){let c;pm(t,i,s,o).length>0?c=i-vo(i,s):c=t;let d=i,m=$q(e,t,r,i,s,o);return Bu(KM(e,c,r,d,m==="C",s).length,ju(m,o))}function Iq(e,t,r){var c;let i=0,s=e-vo(e,r),o=t-vo(t,r);for(let d=0;d<Math.abs(s-o);d++){let m=YM(e,t)==="A"?-1:1;(c=r.buffer.lines.get(s+m*d))!=null&&c.isWrapped&&i++}return i}function vo(e,t){let r=0,i=t.buffer.lines.get(e),s=i==null?void 0:i.isWrapped;for(;s&&e>=0&&e<t.rows;)r++,i=t.buffer.lines.get(--e),s=i==null?void 0:i.isWrapped;return r}function $q(e,t,r,i,s,o){let c;return pm(r,i,s,o).length>0?c=i-vo(i,s):c=t,e<r&&c<=i||e>=r&&c<i?"C":"D"}function YM(e,t){return e>t?"A":"B"}function KM(e,t,r,i,s,o){let c=e,d=t,m="";for(;(c!==r||d!==i)&&d>=0&&d<o.buffer.lines.length;)c+=s?1:-1,s&&c>o.cols-1?(m+=o.buffer.translateBufferLineToString(d,!1,e,c),c=0,e=0,d++):!s&&c<0&&(m+=o.buffer.translateBufferLineToString(d,!1,0,e+1),c=o.cols-1,e=c,d--);return m+o.buffer.translateBufferLineToString(d,!1,e,c)}function ju(e,t){let r=t?"O":"[";return me.ESC+r+e}function Bu(e,t){e=Math.floor(e);let r="";for(let i=0;i<e;i++)r+=t;return r}var Uq=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function v5(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var r_=50,Hq=15,Fq=50,Wq=500,qq=" ",Vq=new RegExp(qq,"g"),D0=class extends Ze{constructor(e,t,r,i,s,o,c,d,m){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=i,this._coreService=s,this._mouseService=o,this._optionsService=c,this._renderService=d,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new qi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new _e),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new _e),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new Uq(this._bufferService),this._activeSelectionMode=0,this._register(Dt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let d=r.translateBufferLineToString(c,!0,s,o);i.push(d)}}else{let s=e[1]===t[1]?t[0]:void 0;i.push(r.translateBufferLineToString(e[1],!0,e[0],s));for(let o=e[1]+1;o<=t[1]-1;o++){let c=r.lines.get(o),d=r.translateBufferLineToString(o,!0);c!=null&&c.isWrapped?i[i.length-1]+=d:i.push(d)}if(e[1]!==t[1]){let o=r.lines.get(t[1]),c=r.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=c:i.push(c)}}return i.map(s=>s.replace(Vq," ")).join(qM?`\r
|
|
596
|
+
`:`
|
|
597
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),cb&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i||!t?!1:this._areCoordsInSelection(t,r,i)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i?!1:this._areCoordsInSelection([e,t],r,i)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var s,o;let r=(o=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:o.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=v5(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=lb(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-r_),r_),t/=r_,t/Math.abs(t)+Math.round(t*(Hq-1)))}shouldForceSelection(e){return Cf?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),Fq)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Cf&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let i=r.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<Wq&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let i=jq(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let i=0;t>=i;i++){let s=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:s>1&&t!==i&&(r+=s-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,o=s.lines.get(e[1]);if(!o)return;let c=s.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(o,e[0]),m=d,f=e[0]-d,g=0,p=0,b=0,x=0;if(c.charAt(d)===" "){for(;d>0&&c.charAt(d-1)===" ";)d--;for(;m<c.length&&c.charAt(m+1)===" ";)m++}else{let E=e[0],C=e[0];o.getWidth(E)===0&&(g++,E--),o.getWidth(C)===2&&(p++,C++);let A=o.getString(C).length;for(A>1&&(x+=A-1,m+=A-1);E>0&&d>0&&!this._isCharWordSeparator(o.loadCell(E-1,this._workCell));){o.loadCell(E-1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,E--):N>1&&(b+=N-1,d-=N-1),d--,E--}for(;C<o.length&&m+1<c.length&&!this._isCharWordSeparator(o.loadCell(C+1,this._workCell));){o.loadCell(C+1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===2?(p++,C++):N>1&&(x+=N-1,m+=N-1),m++,C++}}m++;let w=d+f-g+b,S=Math.min(this._bufferService.cols,m-d+g+p-b-x);if(!(!t&&c.slice(d,m).trim()==="")){if(r&&w===0&&o.getCodePoint(0)!==32){let E=s.lines.get(e[1]-1);if(E&&o.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){let A=this._bufferService.cols-C.start;w-=A,S+=A}}}if(i&&w+S===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let E=s.lines.get(e[1]+1);if(E!=null&&E.isWrapped&&E.getCodePoint(0)!==32){let C=this._getWordAt([0,e[1]+1],!1,!1,!0);C&&(S+=C.length)}}return{start:w,length:S}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=v5(r,this._bufferService.cols)}};D0=qt([Ce(3,Xr),Ce(4,Ao),Ce(5,tb),Ce(6,Zr),Ce(7,Ts),Ce(8,Ms)],D0);var _5=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},y5=class{constructor(){this._color=new _5,this._css=new _5}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ur=Object.freeze((()=>{let e=[Ot.toColor("#2e3436"),Ot.toColor("#cc0000"),Ot.toColor("#4e9a06"),Ot.toColor("#c4a000"),Ot.toColor("#3465a4"),Ot.toColor("#75507b"),Ot.toColor("#06989a"),Ot.toColor("#d3d7cf"),Ot.toColor("#555753"),Ot.toColor("#ef2929"),Ot.toColor("#8ae234"),Ot.toColor("#fce94f"),Ot.toColor("#729fcf"),Ot.toColor("#ad7fa8"),Ot.toColor("#34e2e2"),Ot.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let i=t[r/36%6|0],s=t[r/6%6|0],o=t[r%6];e.push({css:sr.toCss(i,s,o),rgba:sr.toRgba(i,s,o)})}for(let r=0;r<24;r++){let i=8+r*10;e.push({css:sr.toCss(i,i,i),rgba:sr.toRgba(i,i,i)})}return e})()),to=Ot.toColor("#ffffff"),gu=Ot.toColor("#000000"),b5=Ot.toColor("#ffffff"),x5=gu,iu={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Gq=to,L0=class extends Ze{constructor(e){super(),this._optionsService=e,this._contrastCache=new y5,this._halfContrastCache=new y5,this._onChangeColors=this._register(new _e),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:to,background:gu,cursor:b5,cursorAccent:x5,selectionForeground:void 0,selectionBackgroundTransparent:iu,selectionBackgroundOpaque:At.blend(gu,iu),selectionInactiveBackgroundTransparent:iu,selectionInactiveBackgroundOpaque:At.blend(gu,iu),scrollbarSliderBackground:At.opacity(to,.2),scrollbarSliderHoverBackground:At.opacity(to,.4),scrollbarSliderActiveBackground:At.opacity(to,.5),overviewRulerBorder:to,ansi:ur.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=bt(e.foreground,to),t.background=bt(e.background,gu),t.cursor=At.blend(t.background,bt(e.cursor,b5)),t.cursorAccent=At.blend(t.background,bt(e.cursorAccent,x5)),t.selectionBackgroundTransparent=bt(e.selectionBackground,iu),t.selectionBackgroundOpaque=At.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=bt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=At.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?bt(e.selectionForeground,m5):void 0,t.selectionForeground===m5&&(t.selectionForeground=void 0),At.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=At.opacity(t.selectionBackgroundTransparent,.3)),At.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=At.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=bt(e.scrollbarSliderBackground,At.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=bt(e.scrollbarSliderHoverBackground,At.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=bt(e.scrollbarSliderActiveBackground,At.opacity(t.foreground,.5)),t.overviewRulerBorder=bt(e.overviewRulerBorder,Gq),t.ansi=ur.slice(),t.ansi[0]=bt(e.black,ur[0]),t.ansi[1]=bt(e.red,ur[1]),t.ansi[2]=bt(e.green,ur[2]),t.ansi[3]=bt(e.yellow,ur[3]),t.ansi[4]=bt(e.blue,ur[4]),t.ansi[5]=bt(e.magenta,ur[5]),t.ansi[6]=bt(e.cyan,ur[6]),t.ansi[7]=bt(e.white,ur[7]),t.ansi[8]=bt(e.brightBlack,ur[8]),t.ansi[9]=bt(e.brightRed,ur[9]),t.ansi[10]=bt(e.brightGreen,ur[10]),t.ansi[11]=bt(e.brightYellow,ur[11]),t.ansi[12]=bt(e.brightBlue,ur[12]),t.ansi[13]=bt(e.brightMagenta,ur[13]),t.ansi[14]=bt(e.brightCyan,ur[14]),t.ansi[15]=bt(e.brightWhite,ur[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)t.ansi[i+16]=bt(e.extendedAnsi[i],ur[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};L0=qt([Ce(0,Zr)],L0);function bt(e,t){if(e!==void 0)try{return Ot.toColor(e)}catch{}return t}var Yq=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Kq=class{constructor(){this._services=new Yq,this._services.set(eb,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=HF(e).sort((o,c)=>o.index-c.index),i=[];for(let o of r){let c=this._services.get(o.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(c)}let s=r.length>0?r[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},Xq={trace:0,debug:1,info:2,warn:3,error:4,off:5},Zq="xterm.js: ",j0=class extends Ze{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Xq[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":Zq)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};j0=qt([Ce(0,Zr)],j0);var w5=class extends Ze{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new _e),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new _e),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new _e),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...r){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let i=this._length+r.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let s=t-1;s>=0;s--)this.set(e+s+r,this.get(e+s));let i=e+t+r-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+r,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ke=3,ir=Object.freeze(new Zu),zh=0,i_=2,vu=class XM{constructor(t,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ke);let s=r||qi.fromCharData([0,pM,1,0]);for(let o=0;o<t;++o)this.setCell(o,s);this.length=t}get(t){let r=this._data[t*Ke+0],i=r&2097151;return[this._data[t*Ke+1],r&2097152?this._combined[t]:i?fa(i):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,r){this._data[t*Ke+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Ke+0]=t|2097152|r[2]<<22):this._data[t*Ke+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Ke+0]>>22}hasWidth(t){return this._data[t*Ke+0]&12582912}getFg(t){return this._data[t*Ke+1]}getBg(t){return this._data[t*Ke+2]}hasContent(t){return this._data[t*Ke+0]&4194303}getCodePoint(t){let r=this._data[t*Ke+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Ke+0]&2097152}getString(t){let r=this._data[t*Ke+0];return r&2097152?this._combined[t]:r&2097151?fa(r&2097151):""}isProtected(t){return this._data[t*Ke+2]&536870912}loadCell(t,r){return zh=t*Ke,r.content=this._data[zh+0],r.fg=this._data[zh+1],r.bg=this._data[zh+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Ke+0]=r.content,this._data[t*Ke+1]=r.fg,this._data[t*Ke+2]=r.bg}setCellFromCodepoint(t,r,i,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*Ke+0]=r|i<<22,this._data[t*Ke+1]=s.fg,this._data[t*Ke+2]=s.bg}addCodepointToCell(t,r,i){let s=this._data[t*Ke+0];s&2097152?this._combined[t]+=fa(r):s&2097151?(this._combined[t]=fa(s&2097151)+fa(r),s&=-2097152,s|=2097152):s=r|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[t*Ke+0]=s}insertCells(t,r,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length-t){let s=new qi;for(let o=this.length-t-r-1;o>=0;--o)this.setCell(t+r+o,this.loadCell(t+o,s));for(let o=0;o<r;++o)this.setCell(t+o,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,r,i){if(t%=this.length,r<this.length-t){let s=new qi;for(let o=0;o<this.length-t-r;++o)this.setCell(t+o,this.loadCell(t+r+o,s));for(let o=this.length-r;o<this.length;++o)this.setCell(o,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,r,i,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.setCell(t++,i)}resize(t,r){if(t===this.length)return this._data.length*4*i_<this._data.buffer.byteLength;let i=t*Ke;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let s=new Uint32Array(i);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,r)}else{this._data=this._data.subarray(0,i);let s=Object.keys(this._combined);for(let c=0;c<s.length;c++){let d=parseInt(s[c],10);d>=t&&delete this._combined[d]}let o=Object.keys(this._extendedAttrs);for(let c=0;c<o.length;c++){let d=parseInt(o[c],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,i*4*i_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*i_<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,r=!1){if(r){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new XM(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ke+0]&4194303)return t+(this._data[t*Ke+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ke+0]&4194303||this._data[t*Ke+2]&50331648)return t+(this._data[t*Ke+0]>>22);return 0}copyCellsFrom(t,r,i,s,o){let c=t._data;if(o)for(let m=s-1;m>=0;m--){for(let f=0;f<Ke;f++)this._data[(i+m)*Ke+f]=c[(r+m)*Ke+f];c[(r+m)*Ke+2]&268435456&&(this._extendedAttrs[i+m]=t._extendedAttrs[r+m])}else for(let m=0;m<s;m++){for(let f=0;f<Ke;f++)this._data[(i+m)*Ke+f]=c[(r+m)*Ke+f];c[(r+m)*Ke+2]&268435456&&(this._extendedAttrs[i+m]=t._extendedAttrs[r+m])}let d=Object.keys(t._combined);for(let m=0;m<d.length;m++){let f=parseInt(d[m],10);f>=r&&(this._combined[f-r+i]=t._combined[f])}}translateToString(t,r,i,s){r=r??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let o="";for(;r<i;){let c=this._data[r*Ke+0],d=c&2097151,m=c&2097152?this._combined[r]:d?fa(d):ga;if(o+=m,s)for(let f=0;f<m.length;++f)s.push(r);r+=c>>22||1}return s&&s.push(r),o}};function Jq(e,t,r,i,s,o){let c=[];for(let d=0;d<e.length-1;d++){let m=d,f=e.get(++m);if(!f.isWrapped)continue;let g=[e.get(d)];for(;m<e.length&&f.isWrapped;)g.push(f),f=e.get(++m);if(!o&&i>=d&&i<m){d+=g.length-1;continue}let p=0,b=Ou(g,p,t),x=1,w=0;for(;x<g.length;){let E=Ou(g,x,t),C=E-w,A=r-b,N=Math.min(C,A);g[p].copyCellsFrom(g[x],w,b,N,!1),b+=N,b===r&&(p++,b=0),w+=N,w===E&&(x++,w=0),b===0&&p!==0&&g[p-1].getWidth(r-1)===2&&(g[p].copyCellsFrom(g[p-1],r-1,b++,1,!1),g[p-1].setCell(r-1,s))}g[p].replaceCells(b,r,s);let S=0;for(let E=g.length-1;E>0&&(E>p||g[E].getTrimmedLength()===0);E--)S++;S>0&&(c.push(d+g.length-S),c.push(S)),d+=g.length-1}return c}function Qq(e,t){let r=[],i=0,s=t[i],o=0;for(let c=0;c<e.length;c++)if(s===c){let d=t[++i];e.onDeleteEmitter.fire({index:c-o,amount:d}),c+=d-1,o+=d,s=t[++i]}else r.push(c);return{layout:r,countRemoved:o}}function eV(e,t){let r=[];for(let i=0;i<t.length;i++)r.push(e.get(t[i]));for(let i=0;i<r.length;i++)e.set(i,r[i]);e.length=t.length}function tV(e,t,r){let i=[],s=e.map((m,f)=>Ou(e,f,t)).reduce((m,f)=>m+f),o=0,c=0,d=0;for(;d<s;){if(s-d<r){i.push(s-d);break}o+=r;let m=Ou(e,c,t);o>m&&(o-=m,c++);let f=e[c].getWidth(o-1)===2;f&&o--;let g=f?r-1:r;i.push(g),d+=g}return i}function Ou(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,s=e[t+1].getWidth(0)===2;return i&&s?r-1:r}var ZM=class JM{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=JM._nextId++,this._onDispose=this.register(new _e),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),go(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};ZM._nextId=1;var rV=ZM,pr={},ro=pr.B;pr[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};pr.A={"#":"£"};pr.B=void 0;pr[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};pr.C=pr[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};pr.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};pr.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};pr.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};pr.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};pr.E=pr[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};pr.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};pr.H=pr[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};pr["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var S5=4294967295,C5=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=ir.clone(),this.savedCharset=ro,this.markers=[],this._nullCell=qi.fromCharData([0,pM,1,0]),this._whitespaceCell=qi.fromCharData([0,ga,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Ef,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new w5(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new xf),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new xf),this._whitespaceCell}getBlankLine(e,t){return new vu(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>S5?S5:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ir);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new w5(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(ir),i=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)i+=+this.lines.get(c).resize(e,r);let o=0;if(this._rows<t)for(let c=this._rows;c<t;c++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new vu(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new vu(e,r)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let c=this.lines.length-s;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=Jq(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ir),r);if(i.length>0){let s=Qq(this.lines,i);eV(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let i=this.getNullCell(ir),s=r;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new vu(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(ir),s=[],o=0;for(let c=this.lines.length-1;c>=0;c--){let d=this.lines.get(c);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let m=[d];for(;d.isWrapped&&c>0;)d=this.lines.get(--c),m.unshift(d);if(!r){let N=this.ybase+this.y;if(N>=c&&N<c+m.length)continue}let f=m[m.length-1].getTrimmedLength(),g=tV(m,this._cols,e),p=g.length-m.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+p):b=Math.max(0,this.lines.length-this.lines.maxLength+p);let x=[];for(let N=0;N<p;N++){let k=this.getBlankLine(ir,!0);x.push(k)}x.length>0&&(s.push({start:c+m.length+o,newLines:x}),o+=x.length),m.push(...x);let w=g.length-1,S=g[w];S===0&&(w--,S=g[w]);let E=m.length-p-1,C=f;for(;E>=0;){let N=Math.min(C,S);if(m[w]===void 0)break;if(m[w].copyCellsFrom(m[E],C-N,S-N,N,!0),S-=N,S===0&&(w--,S=g[w]),C-=N,C===0){E--;let k=Math.max(E,0);C=Ou(m,k,this._cols)}}for(let N=0;N<m.length;N++)g[N]<e&&m[N].setCell(g[N],i);let A=p-b;for(;A-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+p,this.ybase+t-1)}if(s.length>0){let c=[],d=[];for(let S=0;S<this.lines.length;S++)d.push(this.lines.get(S));let m=this.lines.length,f=m-1,g=0,p=s[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let b=0;for(let S=Math.min(this.lines.maxLength-1,m+o-1);S>=0;S--)if(p&&p.start>f+b){for(let E=p.newLines.length-1;E>=0;E--)this.lines.set(S--,p.newLines[E]);S++,c.push({index:f+1,amount:p.newLines.length}),b+=p.newLines.length,p=s[++g]}else this.lines.set(S,d[f--]);let x=0;for(let S=c.length-1;S>=0;S--)c[S].index+=x,this.lines.onInsertEmitter.fire(c[S]),x+=c[S].amount;let w=Math.max(0,m+o-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,r=0,i){let s=this.lines.get(e);return s?s.translateToString(t,r,i):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new rV(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},iV=class extends Ze{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new _e),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new C5(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new C5(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},QM=2,eT=1,B0=class extends Ze{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,QM),this.rows=Math.max(e.rawOptions.rows||0,eT),this.buffers=this._register(new iV(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=r.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let s=r.ybase+r.scrollTop,o=r.ybase+r.scrollBottom;if(r.scrollTop===0){let c=r.lines.isFull;o===r.lines.length-1?c?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(o+1,0,i.clone()),c?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let c=o-s+1;r.lines.shiftElements(s+1,c-1,-1),r.lines.set(o,i.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};B0=qt([Ce(0,Zr)],B0);var Cl={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Cf,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},nV=["normal","bold","100","200","300","400","500","600","700","800","900"],sV=class extends Ze{constructor(e){super(),this._onOptionChange=this._register(new _e),this.onOptionChange=this._onOptionChange.event;let t={...Cl};for(let r in e)if(r in t)try{let i=e[r];t[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Dt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in Cl))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,i)=>{if(!(r in Cl))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let i={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Cl[e]),!aV(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Cl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=nV.includes(t)?t:Cl[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function aV(e){return e==="block"||e==="underline"||e==="bar"}function _u(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let i in e)r[i]=t<=1?e[i]:e[i]&&_u(e[i],t-1);return r}var E5=Object.freeze({insertMode:!1}),R5=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),O0=class extends Ze{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new _e),this.onData=this._onData.event,this._onUserInput=this._register(new _e),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new _e),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=_u(E5),this.decPrivateModes=_u(R5)}reset(){this.modes=_u(E5),this.decPrivateModes=_u(R5)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};O0=qt([Ce(0,Xr),Ce(1,bM),Ce(2,Zr)],O0);var k5={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function n_(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var s_=String.fromCharCode,N5={DEFAULT:e=>{let t=[n_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${s_(t[0])}${s_(t[1])}${s_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${n_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${n_(e,!0)};${e.x};${e.y}${t}`}},P0=class extends Ze{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new _e),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(k5))this.addProtocol(i,k5[i]);for(let i of Object.keys(N5))this.addEncoding(i,N5[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let i=t/r,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=i+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,r){if(r){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};P0=qt([Ce(0,Xr),Ce(1,Ao),Ce(2,Zr)],P0);var a_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],oV=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],dr;function lV(e,t){let r=0,i=t.length-1,s;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(s=r+i>>1,e>t[s][1])r=s+1;else if(e<t[s][0])i=s-1;else return!0;return!1}var cV=class{constructor(){if(this.version="6",!dr){dr=new Uint8Array(65536),dr.fill(1),dr[0]=0,dr.fill(0,1,32),dr.fill(0,127,160),dr.fill(2,4352,4448),dr[9001]=2,dr[9002]=2,dr.fill(2,11904,42192),dr[12351]=1,dr.fill(2,44032,55204),dr.fill(2,63744,64256),dr.fill(2,65040,65050),dr.fill(2,65072,65136),dr.fill(2,65280,65377),dr.fill(2,65504,65511);for(let e=0;e<a_.length;++e)dr.fill(0,a_[e][0],a_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?dr[e]:lV(e,oV)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),i=r===0&&t!==0;if(i){let s=no.extractWidth(t);s===0?i=!1:s>r&&(r=s)}return no.createPropertyValue(0,r,i)}},no=class rf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new _e,this.onChange=this._onChange.event;let t=new cV;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,i=!1){return(t&16777215)<<3|(r&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,i=0,s=t.length;for(let o=0;o<s;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=s)return r+this.wcwidth(c);let f=t.charCodeAt(o);56320<=f&&f<=57343?c=(c-55296)*1024+f-56320+65536:r+=this.wcwidth(f)}let d=this.charProperties(c,i),m=rf.extractWidth(d);rf.extractShouldJoin(d)&&(m-=rf.extractWidth(i)),r+=m,i=d}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},uV=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function A5(e){var i;let t=(i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:i.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var nu=2147483647,dV=256,tT=class z0{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>dV)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new z0;if(!t.length)return r;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let s=t[i];if(Array.isArray(s))for(let o=0;o<s.length;++o)r.addSubParam(s[o]);else r.addParam(s)}return r}clone(){let t=new z0(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let r=0;r<this.length;++r){t.push(this.params[r]);let i=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,s))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>nu?nu:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>nu?nu:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-r>0?this._subParams.subarray(r,i):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let i=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-i>0&&(t[r]=this._subParams.slice(i,s))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,s=i[r-1];i[r-1]=~s?Math.min(s*10+t,nu):t}},su=[],hV=class{constructor(){this._state=0,this._active=su,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=su}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=su,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||su,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",hm(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&r===!1){for(;i>=0&&(r=this._active[i].end(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=su,this._id=-1,this._state=0}}},xi=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=hm(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},au=[],fV=class{constructor(){this._handlers=Object.create(null),this._active=au,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=au}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=au,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||au,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",hm(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&r===!1){for(;i>=0&&(r=this._active[i].unhook(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=au,this._ident=0}},yu=new tT;yu.addParam(0);var M5=class{constructor(e){this._handler=e,this._data="",this._params=yu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():yu,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=hm(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(r=>(this._params=yu,this._data="",this._hitLimit=!1,r));return this._params=yu,this._data="",this._hitLimit=!1,t}},mV=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,i){this.table[t<<8|e]=r<<4|i}addMany(e,t,r,i){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=r<<4|i}},Hi=160,pV=(function(){let e=new mV(4095),t=Array.apply(null,Array(256)).map((d,m)=>m),r=(d,m)=>t.slice(d,m),i=r(32,127),s=r(0,24);s.push(25),s.push.apply(s,r(28,32));let o=r(0,14),c;e.setDefault(1,0),e.addMany(i,0,2,0);for(c in o)e.addMany([24,26,153,154],c,3,0),e.addMany(r(128,144),c,3,0),e.addMany(r(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Hi,0,2,0),e.add(Hi,8,5,8),e.add(Hi,6,0,6),e.add(Hi,11,0,11),e.add(Hi,13,13,13),e})(),gV=class extends Ze{constructor(e=pV){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new tT,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Dt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new hV),this._dcsParser=this._register(new fV),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let o=e.intermediates.charCodeAt(s);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=i,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let i=this._escHandlers[r];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let i=this._csiHandlers[r];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,i,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=i,this._parseStack.chunkPos=s}parse(e,t,r){let i=0,s=0,o=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&m>-1){for(;m>=0&&(c=d[m](this._params),c!==!0);m--)if(c instanceof Promise)return this._parseStack.handlerPos=m,c}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(c=d[m](),c!==!0);m--)if(c instanceof Promise)return this._parseStack.handlerPos=m,c}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(i!==24&&i!==26,r),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],c=this._oscParser.end(i!==24&&i!==26,r),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=o;d<t;++d){switch(i=e[d],s=this._transitions.table[this.currentState<<8|(i<160?i:Hi)],s>>4){case 2:for(let b=d+1;;++b){if(b>=t||(i=e[b])<32||i>126&&i<Hi){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Hi){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Hi){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Hi){this._printHandler(e,d,b),d=b-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|i],f=m?m.length-1:-1;for(;f>=0&&(c=m[f](this._params),c!==!0);f--)if(c instanceof Promise)return this._preserveStack(3,m,f,s,d),c;f<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++d<t&&(i=e[d])>47&&i<60);d--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let g=this._escHandlers[this._collect<<8|i],p=g?g.length-1:-1;for(;p>=0&&(c=g[p](),c!==!0);p--)if(c instanceof Promise)return this._preserveStack(4,g,p,s,d),c;p<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let b=d+1;;++b)if(b>=t||(i=e[b])===24||i===26||i===27||i>127&&i<Hi){this._dcsParser.put(e,d,b),d=b-1;break}break;case 14:if(c=this._dcsParser.unhook(i!==24&&i!==26),c)return this._preserveStack(6,[],0,s,d),c;i===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let b=d+1;;b++)if(b>=t||(i=e[b])<32||i>127&&i<Hi){this._oscParser.put(e,d,b),d=b-1;break}break;case 6:if(c=this._oscParser.end(i!==24&&i!==26),c)return this._preserveStack(5,[],0,s,d),c;i===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},vV=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,_V=/^[\da-f]+$/;function T5(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=vV.exec(t);if(r){let i=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/i*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/i*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),_V.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){let o=parseInt(t.slice(r*s,r*s+r),16);i[s]=r===1?o<<4:r===2?o:r===3?o>>4:o>>8}return i}}function o_(e,t){let r=e.toString(16),i=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function yV(e,t=16){let[r,i,s]=e;return`rgb:${o_(r,t)}/${o_(i,t)}/${o_(s,t)}`}var bV={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ca=131072,D5=10;function L5(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var j5=5e3,B5=0,xV=class extends Ze{constructor(e,t,r,i,s,o,c,d,m=new gV){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=i,this._optionsService=s,this._oscLinkService=o,this._coreMouseService=c,this._unicodeService=d,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new $F,this._utf8Decoder=new UF,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ir.clone(),this._eraseAttrDataInternal=ir.clone(),this._onRequestBell=this._register(new _e),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new _e),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new _e),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new _e),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new _e),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new _e),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new _e),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new _e),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new _e),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new I0(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:g.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,g,p)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:g,data:p})}),this._parser.setDcsHandlerFallback((f,g,p)=>{g==="HOOK"&&(p=p.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:g,payload:p})}),this._parser.setPrintHandler((f,g,p)=>this.print(f,g,p)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(me.BEL,()=>this.bell()),this._parser.setExecuteHandler(me.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(me.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(me.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(me.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(me.BS,()=>this.backspace()),this._parser.setExecuteHandler(me.HT,()=>this.tab()),this._parser.setExecuteHandler(me.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(me.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(ef.IND,()=>this.index()),this._parser.setExecuteHandler(ef.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(ef.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new xi(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new xi(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new xi(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new xi(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new xi(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new xi(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new xi(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new xi(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new xi(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new xi(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new xi(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new xi(f=>this.restoreCursorColor(f))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let f in pr)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new M5((f,g)=>this.requestStatusString(f,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),j5))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${j5} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,i=this._activeBuffer.x,s=this._activeBuffer.y,o=0,c=this._parseStack.paused;if(c){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;i=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ca&&(o=this._parseStack.position+ca)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<ca&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ca))),c||this._dirtyRowTracker.clearRange(),e.length>ca)for(let f=o;f<e.length;f+=ca){let g=f+ca<e.length?f+ca:e.length,p=typeof e=="string"?this._stringDecoder.decode(e.substring(f,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,g),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,p))return this._preserveStack(i,s,p,f),this._logSlowResolvingAsync(r),r}else if(!c){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,f))return this._preserveStack(i,s,f,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==i||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),m=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);m<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(m,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,r){let i,s,o=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,g=this._curAttrData,p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&p.getWidth(this._activeBuffer.x-1)===2&&p.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let b=this._parser.precedingJoinState;for(let x=t;x<r;++x){if(i=e[x],i<127&&o){let C=o[String.fromCharCode(i)];C&&(i=C.charCodeAt(0))}let w=this._unicodeService.charProperties(i,b);s=no.extractWidth(w);let S=no.extractShouldJoin(w),E=S?no.extractWidth(b):0;if(b=w,c&&this._onA11yChar.fire(fa(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-E>d){if(m){let C=p,A=this._activeBuffer.x-E;for(this._activeBuffer.x=E,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&p instanceof vu&&p.copyCellsFrom(C,A,0,E,!1);A<d;)C.setCellFromCodepoint(A++,0,1,g)}else if(this._activeBuffer.x=d-1,s===2)continue}if(S&&this._activeBuffer.x){let C=p.getWidth(this._activeBuffer.x-1)?1:2;p.addCodepointToCell(this._activeBuffer.x-C,i,s);for(let A=s-E;--A>=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(f&&(p.insertCells(this._activeBuffer.x,s-E,this._activeBuffer.getNullCell(g)),p.getWidth(d-1)===2&&p.setCellFromCodepoint(d-1,0,1,g)),p.setCellFromCodepoint(this._activeBuffer.x++,i,s,g),s>0)for(;--s;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=b,this._activeBuffer.x<d&&r-t>0&&p.getWidth(this._activeBuffer.x)===0&&!p.hasContent(this._activeBuffer.x)&&p.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>L5(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new M5(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new xi(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,i=!1,s=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),s),i&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var i;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&i.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(ir));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let r=e.params[0]||1,i=no.extractWidth(t),s=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),c=new Uint32Array(o.length*r),d=0;for(let f=0;f<o.length;){let g=o.codePointAt(f)||0;c[d++]=g,f+=g>65535?2:1}let m=d;for(let f=1;f<r;++f)c.copyWithin(m,0,d),m+=d;return this.print(c,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(me.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(me.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(me.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(me.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(me.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,ro),this._charsetService.setgCharset(1,ro),this._charsetService.setgCharset(2,ro),this._charsetService.setgCharset(3,ro);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(S=>(S[S.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",S[S.SET=1]="SET",S[S.RESET=2]="RESET",S[S.PERMANENTLY_SET=3]="PERMANENTLY_SET",S[S.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let i=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:o}=this._coreMouseService,c=this._coreService,{buffers:d,cols:m}=this._bufferService,{active:f,alt:g}=d,p=this._optionsService.rawOptions,b=(S,E)=>(c.triggerDataEvent(`${me.ESC}[${t?"":"?"}${S};${E}$y`),!0),x=S=>S?1:2,w=e.params[0];return t?w===2?b(w,4):w===4?b(w,x(c.modes.insertMode)):w===12?b(w,3):w===20?b(w,x(p.convertEol)):b(w,0):w===1?b(w,x(i.applicationCursorKeys)):w===3?b(w,p.windowOptions.setWinLines?m===80?2:m===132?1:0:0):w===6?b(w,x(i.origin)):w===7?b(w,x(i.wraparound)):w===8?b(w,3):w===9?b(w,x(s==="X10")):w===12?b(w,x(p.cursorBlink)):w===25?b(w,x(!c.isCursorHidden)):w===45?b(w,x(i.reverseWraparound)):w===66?b(w,x(i.applicationKeypad)):w===67?b(w,4):w===1e3?b(w,x(s==="VT200")):w===1002?b(w,x(s==="DRAG")):w===1003?b(w,x(s==="ANY")):w===1004?b(w,x(i.sendFocus)):w===1005?b(w,4):w===1006?b(w,x(o==="SGR")):w===1015?b(w,4):w===1016?b(w,x(o==="SGR_PIXELS")):w===1048?b(w,1):w===47||w===1047||w===1049?b(w,x(f===g)):w===2004?b(w,x(i.bracketedPasteMode)):w===2026?b(w,x(i.synchronizedOutput)):b(w,0)}_updateAttrColor(e,t,r,i,s){return t===2?(e|=50331648,e&=-16777216,e|=Zu.fromColorRGB([r,i,s])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let i=[0,0,-1,0,0,0],s=0,o=0;do{if(i[o+s]=e.params[t+o],e.hasSubParams(t+o)){let c=e.getSubParams(t+o),d=0;do i[1]===5&&(s=1),i[o+d+1+s]=c[d];while(++d<c.length&&d+o+1+s<i.length);break}if(i[1]===5&&o+s>=2||i[1]===2&&o+s>=5)break;i[1]&&(s=1)}while(++o+t<e.length&&o+s<i.length);for(let c=2;c<i.length;++c)i[c]===-1&&(i[c]=0);switch(i[0]){case 38:r.fg=this._updateAttrColor(r.fg,i[1],i[3],i[4],i[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,i[1],i[3],i[4],i[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,i[1],i[3],i[4],i[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=ir.fg,e.bg=ir.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,i=this._curAttrData;for(let s=0;s<t;s++)r=e.params[s],r>=30&&r<=37?(i.fg&=-50331904,i.fg|=16777216|r-30):r>=40&&r<=47?(i.bg&=-50331904,i.bg|=16777216|r-40):r>=90&&r<=97?(i.fg&=-50331904,i.fg|=16777216|r-90|8):r>=100&&r<=107?(i.bg&=-50331904,i.bg|=16777216|r-100|8):r===0?this._processSGR0(i):r===1?i.fg|=134217728:r===3?i.bg|=67108864:r===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,i)):r===5?i.fg|=536870912:r===7?i.fg|=67108864:r===8?i.fg|=1073741824:r===9?i.fg|=2147483648:r===2?i.bg|=134217728:r===21?this._processUnderline(2,i):r===22?(i.fg&=-134217729,i.bg&=-134217729):r===23?i.bg&=-67108865:r===24?(i.fg&=-268435457,this._processUnderline(0,i)):r===25?i.fg&=-536870913:r===27?i.fg&=-67108865:r===28?i.fg&=-1073741825:r===29?i.fg&=2147483647:r===39?(i.fg&=-67108864,i.fg|=ir.fg&16777215):r===49?(i.bg&=-67108864,i.bg|=ir.bg&16777215):r===38||r===48||r===58?s+=this._extractColor(e,s,i):r===53?i.bg|=1073741824:r===55?i.bg&=-1073741825:r===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):r===100?(i.fg&=-67108864,i.fg|=ir.fg&16777215,i.bg&=-67108864,i.bg|=ir.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${me.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${me.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${me.ESC}[?${t};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ir.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!L5(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${me.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>D5&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>D5&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let i=r.shift(),s=r.shift();if(/^\d+$/.exec(i)){let o=parseInt(i);if(O5(o))if(s==="?")t.push({type:0,index:o});else{let c=T5(s);c&&t.push({type:1,index:o,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(r,i):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),i,s=r.findIndex(o=>o.startsWith("id="));return s!==-1&&(i=r[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let r=e.split(";");for(let i=0;i<r.length&&!(t>=this._specialColors.length);++i,++t)if(r[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=T5(r[i]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],r=e.split(";");for(let i=0;i<r.length;++i)if(/^\d+$/.exec(r[i])){let s=parseInt(r[i]);O5(s)&&t.push({type:2,index:s})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,ro),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(bV[e[0]],pr[e[1]]||ro),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=ir.clone(),this._eraseAttrDataInternal=ir.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new qi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(r);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=c=>(this._coreService.triggerDataEvent(`${me.ESC}${c}${me.ESC}\\`),!0),i=this._bufferService.buffer,s=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},I0=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(B5=e,e=t,t=B5),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};I0=qt([Ce(0,Xr)],I0);function O5(e){return 0<=e&&e<256}var wV=5e7,P5=12,SV=50,CV=class extends Ze{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new _e),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>wV)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,t);if(s){let c=d=>performance.now()-r>=P5?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(r,d);s.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(c);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-r>=P5)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>SV&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},$0=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let d=t.addMarker(t.ybase+t.y),m={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(m,d)),this._dataByLinkId.set(m.id,m),m.id}let r=e,i=this._getEntryIdKey(r),s=this._entriesWithId.get(i);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let o=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(c,o)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);r.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(r,i))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};$0=qt([Ce(0,Xr)],$0);var z5=!1,EV=class extends Ze{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Hl),this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onData=this._register(new _e),this.onData=this._onData.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new _e),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new _e),this._instantiationService=new Kq,this.optionsService=this._register(new sV(e)),this._instantiationService.setService(Zr,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(B0)),this._instantiationService.setService(Xr,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(j0)),this._instantiationService.setService(bM,this._logService),this.coreService=this._register(this._instantiationService.createInstance(O0)),this._instantiationService.setService(Ao,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(P0)),this._instantiationService.setService(yM,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(no)),this._instantiationService.setService(qF,this.unicodeService),this._charsetService=this._instantiationService.createInstance(uV),this._instantiationService.setService(WF,this._charsetService),this._oscLinkService=this._instantiationService.createInstance($0),this._instantiationService.setService(xM,this._oscLinkService),this._inputHandler=this._register(new xV(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Or.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Or.forward(this._bufferService.onResize,this._onResize)),this._register(Or.forward(this.coreService.onData,this._onData)),this._register(Or.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new CV((t,r)=>this._inputHandler.parse(t,r))),this._register(Or.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new _e),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!z5&&(this._logService.warn("writeSync is unreliable and will be removed soon."),z5=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,QM),t=Math.max(t,eT),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(A5.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(A5(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Dt(()=>{for(let t of e)t.dispose()})}}},RV={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function kV(e,t,r,i){var c;let s={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=me.ESC+"OA":s.key=me.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=me.ESC+"OD":s.key=me.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=me.ESC+"OC":s.key=me.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=me.ESC+"OB":s.key=me.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":me.DEL,e.altKey&&(s.key=me.ESC+s.key);break;case 9:if(e.shiftKey){s.key=me.ESC+"[Z";break}s.key=me.HT,s.cancel=!0;break;case 13:s.key=e.altKey?me.ESC+me.CR:me.CR,s.cancel=!0;break;case 27:s.key=me.ESC,e.altKey&&(s.key=me.ESC+me.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;o?s.key=me.ESC+"[1;"+(o+1)+"D":t?s.key=me.ESC+"OD":s.key=me.ESC+"[D";break;case 39:if(e.metaKey)break;o?s.key=me.ESC+"[1;"+(o+1)+"C":t?s.key=me.ESC+"OC":s.key=me.ESC+"[C";break;case 38:if(e.metaKey)break;o?s.key=me.ESC+"[1;"+(o+1)+"A":t?s.key=me.ESC+"OA":s.key=me.ESC+"[A";break;case 40:if(e.metaKey)break;o?s.key=me.ESC+"[1;"+(o+1)+"B":t?s.key=me.ESC+"OB":s.key=me.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=me.ESC+"[2~");break;case 46:o?s.key=me.ESC+"[3;"+(o+1)+"~":s.key=me.ESC+"[3~";break;case 36:o?s.key=me.ESC+"[1;"+(o+1)+"H":t?s.key=me.ESC+"OH":s.key=me.ESC+"[H";break;case 35:o?s.key=me.ESC+"[1;"+(o+1)+"F":t?s.key=me.ESC+"OF":s.key=me.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=me.ESC+"[5;"+(o+1)+"~":s.key=me.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=me.ESC+"[6;"+(o+1)+"~":s.key=me.ESC+"[6~";break;case 112:o?s.key=me.ESC+"[1;"+(o+1)+"P":s.key=me.ESC+"OP";break;case 113:o?s.key=me.ESC+"[1;"+(o+1)+"Q":s.key=me.ESC+"OQ";break;case 114:o?s.key=me.ESC+"[1;"+(o+1)+"R":s.key=me.ESC+"OR";break;case 115:o?s.key=me.ESC+"[1;"+(o+1)+"S":s.key=me.ESC+"OS";break;case 116:o?s.key=me.ESC+"[15;"+(o+1)+"~":s.key=me.ESC+"[15~";break;case 117:o?s.key=me.ESC+"[17;"+(o+1)+"~":s.key=me.ESC+"[17~";break;case 118:o?s.key=me.ESC+"[18;"+(o+1)+"~":s.key=me.ESC+"[18~";break;case 119:o?s.key=me.ESC+"[19;"+(o+1)+"~":s.key=me.ESC+"[19~";break;case 120:o?s.key=me.ESC+"[20;"+(o+1)+"~":s.key=me.ESC+"[20~";break;case 121:o?s.key=me.ESC+"[21;"+(o+1)+"~":s.key=me.ESC+"[21~";break;case 122:o?s.key=me.ESC+"[23;"+(o+1)+"~":s.key=me.ESC+"[23~";break;case 123:o?s.key=me.ESC+"[24;"+(o+1)+"~":s.key=me.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=me.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=me.DEL:e.keyCode===219?s.key=me.ESC:e.keyCode===220?s.key=me.FS:e.keyCode===221&&(s.key=me.GS);else if((!r||i)&&e.altKey&&!e.metaKey){let d=(c=RV[e.keyCode])==null?void 0:c[e.shiftKey?1:0];if(d)s.key=me.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let m=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(m);e.shiftKey&&(f=f.toUpperCase()),s.key=me.ESC+f}else if(e.keyCode===32)s.key=me.ESC+(e.ctrlKey?me.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let m=e.code.slice(3,4);e.shiftKey||(m=m.toLowerCase()),s.key=me.ESC+m,s.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=me.US),e.key==="@"&&(s.key=me.NUL));break}return s}var Xt=0,NV=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Ef,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Ef,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((s,o)=>this._getKey(s)-this._getKey(o)),t=0,r=0,i=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<i.length;s++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(i[s]=e[t],t++):i[s]=this._array[r++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Xt=this._search(t),Xt===-1)||this._getKey(this._array[Xt])!==t)return!1;do if(this._array[Xt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Xt),!0;while(++Xt<this._array.length&&this._getKey(this._array[Xt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,o)=>s-o),t=0,r=new Array(this._array.length-e.length),i=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:r[i++]=this._array[s];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Xt=this._search(e),!(Xt<0||Xt>=this._array.length)&&this._getKey(this._array[Xt])===e))do yield this._array[Xt];while(++Xt<this._array.length&&this._getKey(this._array[Xt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Xt=this._search(e),!(Xt<0||Xt>=this._array.length)&&this._getKey(this._array[Xt])===e))do t(this._array[Xt]);while(++Xt<this._array.length&&this._getKey(this._array[Xt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let i=t+r>>1,s=this._getKey(this._array[i]);if(s>e)r=i-1;else if(s<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},l_=0,I5=0,AV=class extends Ze{constructor(){super(),this._decorations=new NV(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new _e),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new _e),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Dt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new MV(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let i=0,s=0;for(let o of this._decorations.getKeyIterator(t))i=o.options.x??0,s=i+(o.options.width??1),e>=i&&e<s&&(!r||(o.options.layer??"bottom")===r)&&(yield o)}forEachDecorationAtCell(e,t,r,i){this._decorations.forEachByKey(t,s=>{l_=s.options.x??0,I5=l_+(s.options.width??1),e>=l_&&e<I5&&(!r||(s.options.layer??"bottom")===r)&&i(s)})}},MV=class extends _a{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new _e),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new _e),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ot.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ot.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},TV=1e3,DV=class{constructor(e,t=TV){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=i-this._lastRefreshMs,o=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},$5=20,Rf=class extends Ze{constructor(e,t,r,i){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new DV(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
598
|
+
`))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register($e(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Dt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<$5+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
599
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===$5+1&&(this._liveRegion.textContent+=a0.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,i=r.lines.length.toString();for(let s=e;s<=t;s++){let o=r.lines.get(r.ydisp+s),c=[],d=(o==null?void 0:o.translateToString(!0,void 0,void 0,c))||"",m=(r.ydisp+s+1).toString(),f=this._rowElements[s];f&&(d.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=d,this._rowColumns.set(f,c)),f.setAttribute("aria-posinset",m),f.setAttribute("aria-setsize",i),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],s=r.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===o||e.relatedTarget!==i)return;let c,d;if(t===0?(c=r,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(c=this._rowElements.shift(),d=r,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var d;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:i,offset:((d=i.textContent)==null?void 0:d.length)??0}),!this._rowContainer.contains(r.node))return;let s=({node:m,offset:f})=>{let g=m instanceof Text?m.parentNode:m,p=parseInt(g==null?void 0:g.getAttribute("aria-posinset"),10)-1;if(isNaN(p))return console.warn("row is invalid. Race condition?"),null;let b=this._rowColumns.get(g);if(!b)return console.warn("columns is null. Race condition?"),null;let x=f<b.length?b[f]:b.slice(-1)[0]+1;return x>=this._terminal.cols&&(++p,x=0),{row:p,column:x}},o=s(t),c=s(r);if(!(!o||!c)){if(o.row>c.row||o.row===c.row&&o.column>=c.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(c.row-o.row)*this._terminal.cols-o.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var s,o;e.style.transform="";let t=e.getBoundingClientRect().width,r=(o=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:o[0];if(!r)return;let i=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};Rf=qt([Ce(1,eb),Ce(2,Ms),Ce(3,Ts)],Rf);var U0=class extends Ze{constructor(e,t,r,i,s){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=i,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new _e),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new _e),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Dt(()=>{var o;go(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(o=this._activeProviderReplies)==null||o.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register($e(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register($e(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register($e(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register($e(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let r=e.composedPath();for(let i=0;i<r.length;i++){let s=r[i];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,s;(!this._activeProviderReplies||!t)&&((i=this._activeProviderReplies)==null||i.forEach(o=>{o==null||o.forEach(c=>{c.link.dispose&&c.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[o,c]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(o)&&(r=this._checkLinkProviderResult(o,e,r)):c.provideLinks(e.y,d=>{var f,g;if(this._isMouseOut)return;let m=d==null?void 0:d.map(p=>({link:p}));(f=this._activeProviderReplies)==null||f.set(o,m),r=this._checkLinkProviderResult(o,e,r),((g=this._activeProviderReplies)==null?void 0:g.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let i=0;i<t.size;i++){let s=t.get(i);if(s)for(let o=0;o<s.length;o++){let c=s[o],d=c.link.range.start.y<e?0:c.link.range.start.x,m=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let f=d;f<=m;f++){if(r.has(f)){s.splice(o--,1);break}r.add(f)}}}}_checkLinkProviderResult(e,t,r){var o;if(!this._activeProviderReplies)return r;let i=this._activeProviderReplies.get(e),s=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(s=!0);if(!s&&i){let c=i.find(d=>this._linkAtPosition(d.link,t));c&&(r=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let c=0;c<this._activeProviderReplies.size;c++){let d=(o=this._activeProviderReplies.get(c))==null?void 0:o.find(m=>this._linkAtPosition(m.link,t));if(d){r=!0,this._handleNewLink(d);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&LV(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,go(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.pointerCursor},set:r=>{var i;(i=this._currentLink)!=null&&i.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.underline},set:r=>{var i,s,o;(i=this._currentLink)!=null&&i.state&&((o=(s=this._currentLink)==null?void 0:s.state)==null?void 0:o.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let i=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(i,s),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,i=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-i-1,r.end.x,r.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return r<=s&&s<=i}_positionFromMouseEvent(e,t,r){let i=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,i,s){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:s}}};U0=qt([Ce(1,tb),Ce(2,Ts),Ce(3,Xr),Ce(4,SM)],U0);function LV(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var jV=class extends EV{constructor(e={}){super(e),this._linkifier=this._register(new Hl),this.browser=HM,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Hl),this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new _e),this.onKey=this._onKey.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new _e),this.onBell=this._onBell.event,this._onFocus=this._register(new _e),this._onBlur=this._register(new _e),this._onA11yCharEmitter=this._register(new _e),this._onA11yTabEmitter=this._register(new _e),this._onWillOpen=this._register(new _e),this._setup(),this._decorationService=this._instantiationService.createInstance(AV),this._instantiationService.setService(Ju,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Sq),this._instantiationService.setService(SM,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(l0)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Or.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Or.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Or.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Or.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Dt(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,i="";switch(t.index){case 256:r="foreground",i="10";break;case 257:r="background",i="11";break;case 258:r="cursor",i="12";break;default:r="ansi",i="4;"+t.index}switch(t.type){case 0:let s=At.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${me.ESC}]${i};${yV(s)}${$M.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=sr.toColor(...t.color));else{let o=r;this._themeService.modifyColors(c=>c[o]=sr.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Rf,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(me.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(me.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,s=t.getWidth(r),o=this._renderService.dimensions.css.cell.width*s,c=this.buffer.y*this._renderService.dimensions.css.cell.height,d=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=c+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register($e(this.element,"copy",t=>{this.hasSelection()&&zF(t,this._selectionService)}));let e=t=>IF(t,this.textarea,this.coreService,this.optionsService);this._register($e(this.textarea,"paste",e)),this._register($e(this.element,"paste",e)),FM?this._register($e(this.element,"mousedown",t=>{t.button===2&&X2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register($e(this.element,"contextmenu",t=>{X2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),cb&&this._register($e(this.element,"auxclick",t=>{t.button===1&&mM(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register($e(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register($e(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register($e(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register($e(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register($e(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register($e(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register($e(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register($e(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",s0.get()),VM||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(xq,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Ms,this._coreBrowserService),this._register($e(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register($e(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(A0,this._document,this._helperContainer),this._instantiationService.setService(fm,this._charSizeService),this._themeService=this._instantiationService.createInstance(L0),this._instantiationService.setService(Zl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Sf),this._instantiationService.setService(wM,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(T0,this.rows,this.screenElement)),this._instantiationService.setService(Ts,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(R0,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(M0),this._instantiationService.setService(tb,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(U0,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(C0,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(D0,this.element,this.screenElement,i)),this._instantiationService.setService(GF,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(Or.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(E0,this.screenElement)),this._register($e(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Rf,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(wf,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(wf,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(N0,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(o){var f,g,p,b,x;let c=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!c)return!1;let d,m;switch(o.overrideType||o.type){case"mousemove":m=32,o.buttons===void 0?(d=3,o.button!==void 0&&(d=o.button<3?o.button:3)):d=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":m=0,d=o.button<3?o.button:3;break;case"mousedown":m=1,d=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let w=o.deltaY;if(w===0||e.coreMouseService.consumeWheelEvent(o,(b=(p=(g=(f=e._renderService)==null?void 0:f.dimensions)==null?void 0:g.device)==null?void 0:p.cell)==null?void 0:b.height,(x=e._coreBrowserService)==null?void 0:x.dpr)===0)return!1;m=w<0?0:1,d=4;break;default:return!1}return m===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:d,action:m,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:o=>(r(o),o.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(o)),wheel:o=>(r(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&r(o)},mousemove:o=>{o.buttons||r(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?i.mousemove||(t.addEventListener("mousemove",s.mousemove),i.mousemove=s.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),i.wheel=s.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register($e(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return r(o),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(o)})),this._register($e(t,"wheel",o=>{var c,d,m,f,g;if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(f=(m=(d=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:d.device)==null?void 0:m.cell)==null?void 0:f.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(o,!0);let p=me.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(p,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){fM(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,r){this._selectionService.setSelection(e,t,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var r;(r=this._selectionService)==null||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=kV(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let i=this.rows-1;return this.scrollLines(r.type===2?-i:i),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===me.ETX||r.key===me.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(BV(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var r;(r=this._charSizeService)==null||r.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(ir));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(me.ESC+"[I"):this.coreService.triggerDataEvent(me.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${me.ESC}[4;${r};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${me.ESC}[6;${s};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function BV(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var OV=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},PV=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new qi)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},U5=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new PV(t)}getNullCell(){return new qi}},zV=class extends Ze{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new _e),this.onBufferChange=this._onBufferChange.event,this._normal=new U5(this._core.buffers.normal,"normal"),this._alternate=new U5(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},IV=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,i)=>t(r,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},$V=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},UV=["cols","rows"],Mn=0,HV=class extends Ze{constructor(e){super(),this._core=this._register(new jV(e)),this._addonManager=this._register(new OV),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],r=(i,s)=>{this._checkReadonlyOptions(i),this._core.options[i]=s};for(let i in this._core.options){let s={get:t.bind(this,i),set:r.bind(this,i)};Object.defineProperty(this._publicOptions,i,s)}}_checkReadonlyOptions(e){if(UV.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new IV(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new $V(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new zV(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
600
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return s0.get()},set promptLabel(e){s0.set(e)},get tooMuchOutput(){return a0.get()},set tooMuchOutput(e){a0.set(e)}}}_verifyIntegers(...e){for(Mn of e)if(Mn===1/0||isNaN(Mn)||Mn%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Mn of e)if(Mn&&(Mn===1/0||isNaN(Mn)||Mn%1!==0||Mn<0))throw new Error("This API only accepts positive integers")}};function H5(e,t){if(typeof document>"u")return t;try{const r=document.createElement("span");r.style.color=`var(${e})`,r.style.position="absolute",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r);const i=getComputedStyle(r).color;return r.remove(),i||t}catch{return t}}function F5(){const e=H5("--card","#0b0b12"),t=H5("--foreground","#e5e5ef"),r=typeof document<"u"&&document.documentElement.classList.contains("dark");return{background:e,foreground:t,cursor:"#a855f7",cursorAccent:e,selectionBackground:"#9333ea55",...r?{}:{black:t,white:"#3f3f46",brightWhite:t,brightBlack:"#a1a1aa"}}}function FV(e,t){e.preventDefault(),window.open(t,"_blank","noopener,noreferrer")}function WV(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const r=t;return r.t==="opened"?{kind:"opened"}:r.t==="error"?{kind:"error",message:typeof r.message=="string"&&r.message.trim()?r.message:"Terminal bridge error"}:null}function qV(e){return e===1001||e===1006||e===1012||e===1013}function VV(e){if(typeof e=="object"&&e!==null){const r=e.status;if(typeof r=="number"&&r>=500)return!0}const t=e instanceof Error?e.message:String(e);return/failed to fetch|fetch failed|load failed|network\s*error/i.test(t)}const GV="\x1B[13;2u";function YV(e){return e.key==="Enter"&&e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey?GV:null}const W5=new TextEncoder,KV=750,XV=2048;function ZV(e,t){return t<KV&&e<=XV}function JV(e){let t;try{t=new LF}catch{return null}t.onContextLoss(()=>t.dispose());try{e.loadAddon(t)}catch{return t.dispose(),null}return t}function QV(e,t){var r;return t?((r=e.clipboardData)==null||r.setData("text/plain",t),e.preventDefault(),!0):!1}class eG{constructor(t,r,i){Ir(this,"term");Ir(this,"fit");Ir(this,"webgl");Ir(this,"listenerCtl");Ir(this,"resizeObserver");Ir(this,"ws",null);Ir(this,"dataDispose",null);Ir(this,"lastUserInputAt",0);Ir(this,"disposed",!1);Ir(this,"connectedOnce",!1);Ir(this,"connectionGeneration",0);Ir(this,"layoutVisible",!1);this.url=r,this.onState=i,this.term=new HV({fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,scrollback:2e4,cursorBlink:!0,theme:F5(),minimumContrastRatio:4.5,macOptionClickForcesSelection:!0,allowProposedApi:!0}),this.fit=new VU,this.term.loadAddon(this.fit),this.term.loadAddon(new JU(FV)),this.term.open(t),this.webgl=JV(this.term),this.listenerCtl=new AbortController;const{signal:s}=this.listenerCtl;t.addEventListener("copy",o=>QV(o,this.term.getSelection()),{capture:!0,signal:s}),this.onState({kind:"connecting"}),this.resizeObserver=new ResizeObserver(o=>{var m;if(this.disposed)return;const c=(m=o[0])==null?void 0:m.contentRect,d=!!c&&c.width>0&&c.height>0;if(this.layoutVisible=d,!this.connectedOnce&&!this.ws){d&&this.connect();return}d&&this.sendResize()}),this.resizeObserver.observe(t)}async connect(){var o;if(this.disposed)return;const t=++this.connectionGeneration;this.connectedOnce=!0;try{this.fit.fit()}catch{this.term.resize(80,24)}let r;try{if(r=typeof this.url=="function"?await this.url({cols:this.term.cols,rows:this.term.rows}):this.url,this.disposed||t!==this.connectionGeneration)return;const c=new URL(r);c.searchParams.set("cols",String(this.term.cols)),c.searchParams.set("rows",String(this.term.rows)),r=c.toString()}catch(c){if(this.disposed||t!==this.connectionGeneration)return;VV(c)?this.onState({kind:"closed",code:1006,reason:"Terminal connection temporarily unavailable"}):this.onState({kind:"error",message:c instanceof Error?c.message:"Could not prepare terminal connection"});return}let i;try{i=new WebSocket(r)}catch(c){if(this.disposed||t!==this.connectionGeneration)return;this.onState({kind:"error",message:c instanceof Error?c.message:"Could not open terminal connection"});return}i.binaryType="arraybuffer",this.ws=i;let s=null;i.addEventListener("open",()=>{this.sendResize(),this.term.focus()},{signal:this.listenerCtl.signal}),i.addEventListener("message",c=>{if(c.data instanceof ArrayBuffer){this.writeOutput(new Uint8Array(c.data));return}if(typeof c.data!="string")return;const d=WV(c.data);(d==null?void 0:d.kind)==="opened"?this.onState({kind:"connected"}):(d==null?void 0:d.kind)==="error"&&(s=d.message,this.onState({kind:"error",message:d.message}))},{signal:this.listenerCtl.signal}),i.addEventListener("close",c=>{var d;this.ws===i&&(this.ws=null,(d=this.dataDispose)==null||d.dispose(),this.dataDispose=null,!(s!==null&&c.code===4500)&&this.onState({kind:"closed",reason:c.reason||`code ${c.code}`,code:c.code}))},{signal:this.listenerCtl.signal}),i.addEventListener("error",()=>{this.ws===i&&this.onState({kind:"error",message:"Terminal WebSocket error"})},{signal:this.listenerCtl.signal}),(o=this.dataDispose)==null||o.dispose(),this.dataDispose=this.term.onData(c=>{this.lastUserInputAt=performance.now(),i.readyState===WebSocket.OPEN&&i.send(W5.encode(c))}),this.term.attachCustomKeyEventHandler(c=>{const d=YV(c);return d===null?!0:(c.type==="keydown"&&(c.preventDefault(),this.lastUserInputAt=performance.now(),i.readyState===WebSocket.OPEN&&i.send(W5.encode(d))),!1)})}setTheme(){this.term.options.theme=F5()}reconnect({silent:t=!1}={}){var i;if(this.disposed)return;const r=this.ws;this.ws=null,(i=this.dataDispose)==null||i.dispose(),this.dataDispose=null;try{r==null||r.close()}catch{}this.onState({kind:t?"probing":"connecting"}),this.connect()}dispose(){var r,i;if(this.disposed)return;this.disposed=!0,this.connectionGeneration+=1,this.listenerCtl.abort(),this.resizeObserver.disconnect(),(r=this.dataDispose)==null||r.dispose();const t=this.ws;this.ws=null;try{t==null||t.close()}catch{}(i=this.webgl)==null||i.dispose(),this.term.dispose()}writeOutput(t){if(ZV(t.length,performance.now()-this.lastUserInputAt)){const r=this.term._core;if(typeof(r==null?void 0:r.writeSync)=="function")try{r.writeSync(t,1);return}catch{}}this.term.write(t)}sendResize(){if(!(!this.layoutVisible||!this.ws||this.ws.readyState!==WebSocket.OPEN)){try{this.fit.fit()}catch{return}this.ws.send(JSON.stringify({t:"resize",cols:this.term.cols,rows:this.term.rows}))}}}const q5=[500,1e3,2e3,4e3,8e3],tG=3e4;function rG({sessionId:e,runtimeSelector:t,active:r,role:i="owner"}){const[s,o]=_.useState({kind:"connecting"}),[c,d]=_.useState(0),[m,f]=_.useState(!1),[g,p]=_.useState(!1),[b,x]=_.useState(null),w=_.useRef(0),S=_.useRef(null),E=_.useRef(null),C=`${t}\0${e}`,A=_.useRef(C);A.current=C;const{theme:N}=Xy(),k=_.useCallback(D=>o(D),[]);_.useEffect(()=>{var D;(D=E.current)==null||D.setTheme()},[N]),_.useEffect(()=>{x(null),p(!1)},[C]);const O=_.useCallback(D=>{if(D===null)return;k({kind:"connecting"});let G=null,Y=!1;return queueMicrotask(()=>{Y||(G=new eG(D,({cols:W,rows:L})=>_7(t,e,{role:i,cols:W,rows:L,refreshCapability:!0}),k),E.current=G)}),()=>{Y=!0,G==null||G.dispose(),E.current=null}},[e,t,i,k]);_.useEffect(()=>{if(s.kind==="connected"){S.current=Date.now(),f(!1);return}if(s.kind!=="closed")return;if(!r){f(!1);return}if(!qV(s.code)){f(!1);return}if(S.current!==null&&Date.now()-S.current>=tG&&(w.current=0),S.current=null,w.current>=q5.length){f(!1);return}const D=q5[w.current];w.current+=1,f(!0);let G=!1;const Y=()=>{G||(G=!0,E.current?E.current.reconnect():d(T=>T+1))},W=window.setTimeout(Y,D),L=()=>{document.visibilityState==="visible"&&Y()};return document.addEventListener("visibilitychange",L),()=>{window.clearTimeout(W),document.removeEventListener("visibilitychange",L)}},[r,s]);const z=_.useCallback(()=>{w.current=0,S.current=null,f(!1),E.current?E.current.reconnect():d(D=>D+1)},[]),H=_.useCallback(async()=>{if(g)return;const D=C;p(!0),x(null);try{if(await xe.startSessionTerminal(t,e),A.current!==D)return;z()}catch(G){if(A.current!==D)return;x(G instanceof Error?G.message:"Could not start terminal")}finally{A.current===D&&p(!1)}},[z,t,e,g,C]);return u.jsxs("div",{"data-state":s.kind,className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--card)]",children:[u.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden p-1",children:[u.jsx("div",{ref:O,className:"h-full w-full overflow-hidden"},c),s.kind!=="connected"&&u.jsx(sG,{state:s,reconnectPending:m,startingTerminal:g,startError:b,onRetry:z,onStartTerminal:()=>void H()})]}),u.jsx("div",{className:"flex min-h-8 shrink-0 select-none items-center gap-2 px-2 font-mono text-[10px] text-[var(--muted-foreground)]/70",children:u.jsx("span",{className:"min-w-0 flex-1 truncate px-2",children:nG(iG())})})]})}function iG(){if(typeof navigator>"u")return!1;const e=navigator.userAgentData,t=(e==null?void 0:e.platform)??navigator.platform??"";return/mac/i.test(t)}function nG(e){return e?"Hold ⌥ and drag to select · ⌘C to copy":"Hold Shift and drag to select · right-click to copy"}function sG({state:e,reconnectPending:t,startingTerminal:r,startError:i,onRetry:s,onStartTerminal:o}){return u.jsxs("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-[var(--background)]/85 text-sm text-[var(--foreground)] backdrop-blur-[1px]",children:[e.kind==="connecting"&&u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx(ht,{className:"size-4 animate-spin"}),"Connecting…"]}),e.kind==="closed"&&t&&u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx(ht,{className:"size-4 animate-spin"}),"Reconnecting…"]}),e.kind==="closed"&&!t&&(e.code===4404?u.jsx(aG,{starting:r,error:i,onStart:o}):u.jsx(V5,{message:e.reason||"Terminal connection closed",onRetry:s})),e.kind==="probing"&&u.jsxs("span",{className:"flex items-center gap-2 text-[var(--muted-foreground)]",children:[u.jsx(ht,{className:"size-4 animate-spin"}),"Checking terminal…"]}),e.kind==="error"&&u.jsx(V5,{message:e.message,onRetry:s})]})}function aG({starting:e,error:t,onStart:r}){return u.jsxs("div",{className:"grid max-w-sm place-items-center gap-3 px-6 text-center",children:[u.jsxs("div",{className:"grid gap-1",children:[u.jsx("span",{className:"font-medium",children:"Terminal is not running"}),u.jsx("span",{className:"text-[var(--muted-foreground)]",children:"Start it when you need terminal access for this Session."})]}),t&&u.jsx("span",{className:"text-[var(--destructive)]",children:t}),u.jsxs(ge,{variant:"outline",size:"sm",disabled:e,onClick:r,children:[e?u.jsx(ht,{className:"animate-spin"}):u.jsx(PE,{}),e?"Starting…":"Start terminal"]})]})}function V5({message:e,onRetry:t}){return u.jsxs("div",{className:"grid max-w-sm place-items-center gap-3 px-6 text-center",children:[u.jsx("span",{className:"text-[var(--muted-foreground)]",children:e}),u.jsxs(ge,{variant:"outline",size:"sm",onClick:t,children:[u.jsx(mr,{})," Retry"]})]})}var gm="Collapsible",[oG]=pn(gm),[lG,ub]=oG(gm),rT=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:i,defaultOpen:s,disabled:o,onOpenChange:c,...d}=e,[m,f]=co({prop:i,defaultProp:s??!1,onChange:c,caller:gm});return u.jsx(lG,{scope:r,disabled:o,contentId:on(),open:m,onOpenToggle:_.useCallback(()=>f(g=>!g),[f]),children:u.jsx(Ue.div,{"data-state":hb(m),"data-disabled":o?"":void 0,...d,ref:t})})});rT.displayName=gm;var iT="CollapsibleTrigger",nT=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,...i}=e,s=ub(iT,r);return u.jsx(Ue.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":hb(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...i,ref:t,onClick:Be(e.onClick,s.onOpenToggle)})});nT.displayName=iT;var db="CollapsibleContent",sT=_.forwardRef((e,t)=>{const{forceMount:r,...i}=e,s=ub(db,e.__scopeCollapsible);return u.jsx(gn,{present:r||s.open,children:({present:o})=>u.jsx(cG,{...i,ref:t,present:o})})});sT.displayName=db;var cG=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:i,children:s,...o}=e,c=ub(db,r),[d,m]=_.useState(i),f=_.useRef(null),g=Qe(t,f),p=_.useRef(0),b=p.current,x=_.useRef(0),w=x.current,S=c.open||d,E=_.useRef(S),C=_.useRef(void 0);return _.useEffect(()=>{const A=requestAnimationFrame(()=>E.current=!1);return()=>cancelAnimationFrame(A)},[]),Wt(()=>{const A=f.current;if(A){C.current=C.current||{transitionDuration:A.style.transitionDuration,animationName:A.style.animationName},A.style.transitionDuration="0s",A.style.animationName="none";const N=A.getBoundingClientRect();p.current=N.height,x.current=N.width,E.current||(A.style.transitionDuration=C.current.transitionDuration,A.style.animationName=C.current.animationName),m(i)}},[c.open,i]),u.jsx(Ue.div,{"data-state":hb(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!S,...o,ref:g,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":w?`${w}px`:void 0,...e.style},children:S&&s})});function hb(e){return e?"open":"closed"}var uG=rT,dG=nT,hG=sT;const vm=uG,_m=dG,ym=hG;function fG({status:e}){return e==="completed"?u.jsx(Lf,{className:"size-3 shrink-0 text-[var(--success)]"}):e==="in_progress"?u.jsx(ht,{className:"size-3 shrink-0 animate-spin text-[var(--primary)]"}):u.jsx(d4,{className:"size-3 shrink-0 text-[var(--muted-foreground)]"})}function mG({todos:e}){const[t,r]=_.useState(!0);if(e.length===0)return null;const i=e.filter(s=>s.status==="completed").length;return u.jsxs(vm,{open:t,onOpenChange:r,className:"mx-auto mt-2 w-[calc(100%-2rem)] max-w-3xl rounded-md border border-[var(--border)] bg-[var(--muted)]/30",children:[u.jsxs(_m,{className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs",children:[u.jsx(yo,{className:qe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",t&&"rotate-90")}),u.jsx("span",{className:"label-caps text-[var(--muted-foreground)]",children:"Tasks"}),u.jsxs("span",{className:"font-mono text-[var(--muted-foreground)]",children:[i,"/",e.length]})]}),u.jsx(ym,{className:"overflow-hidden px-3 pb-2",children:u.jsx("ul",{className:"space-y-1",children:e.map(s=>u.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[u.jsx(fG,{status:s.status}),u.jsx("span",{className:qe("truncate",s.status==="completed"&&"text-[var(--muted-foreground)] line-through"),children:s.subject})]},s.id))})})]})}function G5(e,t,r={},i={},s=!0){const o={},c={};for(const d of e){if(d.type==="text"){const x=typeof t[d.id]=="string"?t[d.id]:"";s&&d.required&&!x.trim()?c[d.id]=`${d.label} is required`:x.length>0&&(o[d.id]=x);continue}const m=new Set(d.options.map(x=>x.value)),f=d.allowOther===!0&&i[d.id]===!0,g=f?(r[d.id]??"").trim():"";if(d.multiple){const x=Array.isArray(t[d.id])?t[d.id]:[],w=d.options.map(S=>S.value).filter(S=>x.includes(S));g&&!w.includes(g)&&w.push(g),s&&f&&!g?c[d.id]=`${d.label}: enter a value for Other`:s&&d.required&&w.length===0?c[d.id]=`${d.label} is required`:w.length>0&&(o[d.id]=w);continue}const p=typeof t[d.id]=="string"?t[d.id]:"",b=f?g:m.has(p)?p:"";s&&f&&!g?c[d.id]=`${d.label}: enter a value for Other`:s&&d.required&&!b?c[d.id]=`${d.label} is required`:b&&(o[d.id]=b)}return Object.keys(c).length>0?{ok:!1,errors:c}:{ok:!0,answers:o}}function pG({sessionId:e,item:t,canResolve:r=!0}){var T;const{runtimeSelector:i}=Kl(),s=_.useId().replaceAll(":",""),[o,c]=_.useState({}),[d,m]=_.useState({}),[f,g]=_.useState({}),[p,b]=_.useState({}),[x,w]=_.useState(()=>{var j;return(j=t.request.fields[0])==null?void 0:j.id}),[S,E]=_.useState(),[C,A]=_.useState(),N=t.status==="pending";function k(j){b(U=>{if(!U[j])return U;const M={...U};return delete M[j],M})}function O(j,U){c(M=>({...M,[j]:U})),k(j)}function z(j,U){g(M=>({...M,[j]:U})),k(j)}function H(j){const U=t.request.fields,M=Math.max(U.findIndex(I=>I.id===x),0),P=U.findIndex(I=>I.id===j);if(!(P<0)){if(P>M){const I=U[M];if(I){const F=G5([I],o,d,f);if(!F.ok){b(q=>({...q,...F.errors}));return}k(I.id)}}w(j)}}async function D(j){if(!r)return;const U=G5(t.request.fields,o,d,f,j.requiresAnswers);if(!U.ok){b(U.errors);const M=t.request.fields.find(P=>U.errors[P.id]);M&&w(M.id);return}b({}),E(void 0),A(j.id);try{await b7(e,t.id,{actionId:j.id,...Object.keys(U.answers).length>0?{answers:U.answers}:{}},i)}catch(M){A(void 0),E(M instanceof Error?M.message:String(M))}}const G=t.request.kind==="permission"?CB:t.request.kind==="form"?P4:s4,Y=Math.max(t.request.fields.findIndex(j=>j.id===x),0),W=t.request.fields.length===0||Y===t.request.fields.length-1,L=t.request.actions.filter(j=>!j.requiresAnswers||W);return u.jsxs("section",{"aria-labelledby":`${s}-title`,"aria-busy":C!==void 0,className:qe("min-w-0 max-w-full overflow-hidden rounded-lg border p-3 text-xs shadow-sm",t.request.kind==="permission"?"border-[var(--warning)]/40 bg-[var(--warning)]/5":"border-[var(--primary)]/30 bg-[var(--primary)]/5"),children:[u.jsxs("div",{className:"flex items-start gap-2",children:[u.jsx(G,{"aria-hidden":"true",className:qe("mt-0.5 size-4 shrink-0",t.request.kind==="permission"?"text-[var(--warning)]":"text-[var(--primary)]")}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("div",{id:`${s}-title`,className:"font-medium text-[var(--foreground)]",children:t.request.title}),t.request.description&&u.jsx("p",{className:"mt-1 leading-relaxed text-[var(--muted-foreground)]",children:t.request.description})]})]}),u.jsx(gG,{item:t}),N&&!r?u.jsx("div",{role:"status",className:"mt-3 text-[var(--muted-foreground)]",children:"Pending interaction · resolve it on the owning Runtime."}):N?u.jsxs("div",{className:"mt-3 grid min-w-0 gap-3",children:[u.jsx(hI,{idPrefix:s,fields:t.request.fields,activeFieldId:x,answers:o,otherValues:d,otherSelections:f,errors:p,disabled:C!==void 0,onNavigate:H,onAnswerChange:O,onOtherSelectionChange:z,onOtherValueChange:(j,U)=>{m(M=>({...M,[j]:U})),k(j)}}),S&&u.jsxs("p",{role:"alert",className:"text-[var(--destructive)]",children:["Could not submit: ",S]}),u.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[L.map(j=>u.jsxs(ge,{type:"button",size:"sm",variant:_G(j),className:"h-auto max-w-full whitespace-normal break-words py-1.5 text-left",disabled:C!==void 0,title:j.description,"aria-label":j.description?`${j.label}. ${j.description}`:void 0,onClick:()=>void D(j),children:[C===j.id&&u.jsx(ht,{"aria-hidden":"true",className:"animate-spin"}),j.label]},j.id)),C&&u.jsxs("span",{role:"status",className:"text-[var(--muted-foreground)]",children:["Submitting ",(T=t.request.actions.find(j=>j.id===C))==null?void 0:T.label,"…"]})]})]}):u.jsx(vG,{item:t})]})}function gG({item:e}){const t=e.request.context;return t?u.jsxs("div",{className:"mt-3 grid min-w-0 gap-1.5",children:[t.summary&&u.jsx("p",{className:"break-words leading-relaxed text-[var(--muted-foreground)]",children:t.summary}),t.toolName&&u.jsxs("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:["tool · ",t.toolName]}),t.command&&u.jsx(Y5,{value:t.command}),t.cwd&&u.jsx("div",{className:"min-w-0 whitespace-pre-wrap break-all font-mono text-[10px] text-[var(--muted-foreground)]",children:t.cwd}),t.diff&&u.jsx(Y5,{value:t.diff,tall:!0})]}):null}function Y5({value:e,tall:t=!1}){return u.jsx("pre",{className:qe("min-w-0 max-w-full overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] rounded-md bg-[var(--muted)] p-2 font-mono text-[11px] leading-relaxed",t?"max-h-56":"max-h-32"),children:u.jsx("code",{className:"block min-w-0",children:e})})}function vG({item:e}){var i;if(e.status!=="resolved"){const s=e.status==="expired"?"Expired":e.status==="inactive"?"No longer active":"Cancelled";return u.jsxs("div",{role:"status",className:"mt-3 text-[var(--muted-foreground)]",children:[s,e.reason?` · ${e.reason}`:""]})}const t=e.request.actions.find(s=>{var o;return s.id===((o=e.resolution)==null?void 0:o.actionId)}),r=e.request.fields.flatMap(s=>{var d,m;const o=(m=(d=e.resolution)==null?void 0:d.answers)==null?void 0:m[s.id];if(o===void 0)return[];const c=s.type==="text"&&s.secret?"••••••••":Array.isArray(o)?o.join(", "):o;return[{id:s.id,label:s.label,value:c}]});return u.jsxs("div",{"aria-live":"polite",className:"mt-3 grid gap-1.5 text-[var(--muted-foreground)]",children:[u.jsxs("div",{children:["Resolved · ",(t==null?void 0:t.label)??((i=e.resolution)==null?void 0:i.actionId)??"answered"]}),r.map(s=>u.jsxs("div",{className:"grid grid-cols-[minmax(0,auto)_minmax(0,1fr)] gap-2 text-[11px]",children:[u.jsx("span",{children:s.label}),u.jsx("span",{className:"break-words text-[var(--foreground)]",children:s.value})]},s.id))]})}function _G(e){return e.style==="primary"?"default":e.style==="danger"?"destructive":"outline"}function yG({item:e}){const t=e.rotateKind==="fork"?N4:b4;return u.jsxs("div",{className:"my-2 flex items-center gap-2 text-[10px] text-[var(--muted-foreground)]",children:[u.jsx("div",{className:"h-px flex-1 bg-[var(--border)]"}),u.jsx(t,{className:"size-3 shrink-0 text-[var(--primary)]"}),u.jsx("span",{className:"label-caps",children:e.label}),u.jsx("span",{className:"font-mono opacity-70",children:e.newSessionId.slice(0,12)}),u.jsx("div",{className:"h-px flex-1 bg-[var(--border)]"})]})}function bG({item:e}){return u.jsxs("div",{className:"my-1 flex gap-2 rounded-md border border-[var(--destructive)]/40 bg-[var(--destructive)]/5 px-3 py-2 text-sm",children:[u.jsx(ny,{className:"size-4 shrink-0 text-[var(--destructive)]"}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"label-caps text-[10px] text-[var(--destructive)]",children:[e.source," error · ",e.code]}),u.jsx("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[var(--foreground)]/80",children:e.message})]})]})}const xG="modulepreload",wG=function(e){return"/"+e},K5={},SG=function(t,r,i){let s=Promise.resolve();if(r&&r.length>0){let c=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));s=c(r.map(f=>{if(f=wG(f),f in K5)return;K5[f]=!0;const g=f.endsWith(".css"),p=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${p}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":xG,g||(b.as="script"),b.crossOrigin="",b.href=f,m&&b.setAttribute("nonce",m),document.head.appendChild(b),g)return new Promise((x,w)=>{b.addEventListener("load",x),b.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return s.then(c=>{for(const d of c||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})},CG=_.lazy(()=>SG(()=>import("./mermaid-GHXKKRXX-DZn7Hbr2.js").then(e=>e.i),[]).then(e=>({default:e.Streamdown}))),EG=qe("min-w-0 text-sm leading-relaxed break-words","[&_p]:my-1.5 [&_ul]:my-1.5 [&_ol]:my-1.5 [&_li]:my-0.5","[&_pre]:my-2 [&_pre]:rounded-md [&_pre]:text-xs","[&_code]:font-mono [&_h1]:mt-3 [&_h2]:mt-3 [&_h3]:mt-2","[&_a]:text-[var(--primary)] [&_a]:underline [&_a]:underline-offset-2");function aT({children:e,className:t}){return u.jsx(_.Suspense,{fallback:u.jsx("div",{className:qe("whitespace-pre-wrap break-words text-sm",t),children:e}),children:u.jsx(CG,{shikiTheme:["github-light","github-dark"],className:qe(EG,t),children:e})})}function RG({item:e}){return e.role==="user"?u.jsx("div",{className:"flex justify-end",children:u.jsx("div",{className:"max-w-[85%] whitespace-pre-wrap break-words rounded-md rounded-br-sm bg-[var(--primary)]/10 px-3 py-2 text-sm dark:bg-[var(--primary)]/25 dark:ring-1 dark:ring-inset dark:ring-[var(--primary)]/35",children:e.text})}):u.jsx("div",{className:"flex justify-start",children:u.jsxs("div",{className:"min-w-0 max-w-[90%] rounded-md rounded-bl-sm bg-[var(--muted)] px-3.5 py-2.5",children:[e.text&&u.jsx(aT,{className:"[&>:first-child]:mt-0 [&>:last-child]:mb-0",children:e.text}),e.streaming&&u.jsx("span",{className:"ml-0.5 inline-block h-4 w-[3px] translate-y-0.5 animate-pulse rounded-full bg-[var(--primary)] align-middle"}),e.interrupted&&u.jsx("span",{className:"label-caps ml-2 align-middle text-[10px] text-[var(--warning)]",children:"interrupted"})]})})}function kG({item:e}){const t=e.summary.filter(Boolean).join(`
|
|
601
|
+
|
|
602
|
+
`).trim(),[r,i]=_.useState(e.streaming??!1);return _.useEffect(()=>{i(e.streaming??!1)},[e.streaming]),!t&&!e.streaming?null:u.jsxs(vm,{open:r,onOpenChange:i,className:"my-0.5",children:[u.jsxs(_m,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50",children:[u.jsx(yo,{className:qe("size-3 shrink-0 transition-transform",r&&"rotate-90")}),u.jsx(HE,{className:"size-3.5 shrink-0"}),u.jsx("span",{className:qe("label-caps text-[10px]",e.streaming&&"animate-pulse"),children:e.streaming?"Thinking…":"Thought"})]}),u.jsx(ym,{className:"overflow-hidden pl-7",children:u.jsx("div",{className:"mt-1 border-l-2 border-[var(--border)] pl-3 text-[var(--muted-foreground)]",children:t?u.jsx(aT,{children:t}):u.jsx("span",{className:"animate-pulse text-xs",children:"…"})})})]})}const X5=12e3;function Z5(e){return e.length<=X5?{text:e,truncated:!1}:{text:e.slice(0,X5),truncated:!0}}function NG({item:e}){const[t,r]=_.useState(!1),i=e.stdout?Z5(e.stdout):null,s=e.stderr?Z5(e.stderr):null,o=!!(i||s);return u.jsxs(vm,{open:t,onOpenChange:r,className:"my-0.5",children:[u.jsxs(_m,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-[var(--muted)]/50",children:[u.jsx(yo,{className:qe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",t&&"rotate-90")}),u.jsx(iy,{className:"size-3.5 shrink-0 text-[var(--primary)]"}),u.jsxs("span",{className:"truncate font-mono",children:[u.jsx("span",{className:"text-[var(--muted-foreground)]",children:"$ "}),e.command]})]}),u.jsxs(ym,{className:"overflow-hidden pl-7",children:[i&&u.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--border)] p-2 text-[11px] leading-relaxed",children:[u.jsx("code",{children:i.text}),i.truncated&&u.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),s&&u.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--destructive)]/40 p-2 text-[11px] leading-relaxed text-[var(--destructive)]",children:[u.jsx("code",{children:s.text}),s.truncated&&u.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),!o&&u.jsx("div",{className:"mt-1 text-[11px] text-[var(--muted-foreground)]",children:"(no output)"})]})]})}const J5=80,Q5=12e3;function AG(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function MG(e){try{const t=JSON.parse(e);for(const i of["command","cmd","path","file","file_path","query","url","pattern","description"]){const s=t[i];if(typeof s=="string"&&s)return s}const r=JSON.stringify(t);return r==="{}"?"":r}catch{return e}}function TG(e){let t=e,r=!1;const i=t.split(`
|
|
603
|
+
`);return i.length>J5&&(t=i.slice(0,J5).join(`
|
|
604
|
+
`),r=!0),t.length>Q5&&(t=t.slice(0,Q5),r=!0),{text:t,truncated:r}}function DG({status:e}){return e==="in_progress"?u.jsx(ht,{className:"size-3.5 shrink-0 animate-spin text-[var(--primary)]"}):e==="failed"?u.jsx(c4,{className:"size-3.5 shrink-0 text-[var(--destructive)]"}):e==="incomplete"?u.jsx(o4,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}):u.jsx(Lf,{className:"size-3.5 shrink-0 text-[var(--success)]"})}function LG({item:e,sessionId:t,canResolveInteractions:r=!0}){const[i,s]=_.useState(!1),o=MG(e.arguments),c=e.output!=null?TG(e.output):null,d=!!e.arguments&&e.arguments!=="{}",m=e.children??[];return u.jsxs(vm,{open:i,onOpenChange:s,className:"my-0.5",children:[u.jsxs(_m,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-[var(--muted)]/50",children:[u.jsx(yo,{className:qe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",i&&"rotate-90")}),u.jsx(DG,{status:e.status}),u.jsx("span",{className:"shrink-0 font-mono font-medium",children:e.name}),o&&u.jsx("span",{className:"truncate text-[var(--muted-foreground)]",children:o})]}),u.jsxs(ym,{className:"overflow-hidden pl-7",children:[d&&u.jsx("pre",{className:"mt-1 overflow-auto rounded-md bg-[var(--muted)] p-2 text-[11px] leading-relaxed",children:u.jsx("code",{children:AG(e.arguments)})}),c&&u.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--border)] p-2 text-[11px] leading-relaxed",children:[u.jsx("code",{children:c.text}),c.truncated&&u.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),e.exitCode!=null&&e.exitCode!==0&&u.jsxs("div",{className:"mt-1 text-[11px] text-[var(--destructive)]",children:["exit code ",e.exitCode]}),m.length>0&&u.jsxs("div",{className:"mt-1 border-l border-[var(--primary)]/30 pl-2",children:[u.jsxs("div",{className:"mb-0.5 flex items-center gap-1.5 text-[11px] text-[var(--muted-foreground)]",children:[u.jsx(UB,{className:"size-3 shrink-0 text-[var(--primary)]"}),u.jsxs("span",{className:"font-mono",children:[m.length," sub-agent step",m.length===1?"":"s"]})]}),m.map(f=>u.jsx(oT,{item:f,sessionId:t,canResolveInteractions:r},f.id))]})]})]})}function oT({item:e,sessionId:t,canResolveInteractions:r=!0}){switch(e.kind){case"message":return e.isMeta?null:u.jsx(RG,{item:e});case"tool":return u.jsx(LG,{item:e,sessionId:t,canResolveInteractions:r});case"reasoning":return u.jsx(kG,{item:e});case"terminal_command":return u.jsx(NG,{item:e});case"divider":return u.jsx(yG,{item:e});case"error":return u.jsx(bG,{item:e});case"interaction":return u.jsx(pG,{sessionId:t,item:e,canResolve:r})}}function jG(){return u.jsx("div",{className:"flex items-center gap-1.5 py-2 pl-1",children:[0,1,2].map(e=>u.jsx("span",{className:"size-1.5 rounded-full bg-[var(--primary)]",style:{animation:"typing-dot 1.3s ease-in-out infinite",animationDelay:`${e*.18}s`}},e))})}function BG({items:e,historyLoaded:t,running:r,waitingForInteraction:i,sessionId:s}){const o=_.useRef(null),[c,d]=_.useState(!0),m=e[e.length-1],f=(m==null?void 0:m.kind)==="message"&&m.role==="assistant"&&!!m.streaming,g=r&&!f&&!i;return _.useEffect(()=>{c&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},[e,r,c]),u.jsx(un,{className:"min-w-0 flex-1",viewportRef:o,viewportProps:{onScroll:p=>{const b=p.currentTarget;d(b.scrollHeight-b.scrollTop-b.clientHeight<40)},"aria-busy":!t},children:u.jsx("div",{className:"mx-auto w-full max-w-3xl space-y-3 px-4 py-3",children:!t&&e.length===0?u.jsxs("div",{role:"status","aria-live":"polite",className:"flex items-center justify-center gap-2 py-10 text-sm text-[var(--muted-foreground)]",children:[u.jsx(ht,{className:"size-4 animate-spin text-[var(--primary)]","aria-hidden":"true"}),u.jsx("span",{children:"Loading conversation…"})]}):e.length===0&&!r?u.jsx("p",{className:"py-10 text-center text-sm text-[var(--muted-foreground)]",children:"Send a message to start a turn."}):u.jsxs(u.Fragment,{children:[e.map(p=>u.jsx(oT,{item:p,sessionId:s,canResolveInteractions:!0},p.id)),g&&u.jsx(jG,{})]})})})}const OG=2500,ou=new Map;function PG({sessionId:e,runtimeSelector:t,active:r,polling:i=r}){const s=`${t}
|
|
605
|
+
${e}`,o=_.useRef(s);o.current=s;const c=_.useRef(r);c.current=r;const d=_.useRef(0),m=_.useRef(0),f=_.useRef(!1),g=_.useRef(null),p=_.useRef(null),[b,x]=_.useState(()=>ou.get(s)??null),[w,S]=_.useState(()=>!ou.has(s)),[E,C]=_.useState(null),[A,N]=_.useState(null),k=_.useCallback(L=>{p.current=L,N(L)},[]),O=_.useCallback(L=>{g.current=L,ou.set(s,L),x(L)},[s]),z=_.useCallback(async L=>{if(!c.current||f.current)return;const T=s,j=d.current,U=m.current;L&&S(!0);try{const M=await xe.getRuntimeBrowserState(t,e);return!c.current||d.current!==j||m.current!==U||o.current!==T||f.current?void 0:(O(M),L&&k(null),M)}catch(M){if(!c.current||d.current!==j||m.current!==U||o.current!==T)return;L&&k(Rh(M));return}finally{c.current&&d.current===j&&m.current===U&&o.current===T&&L&&S(!1)}},[s,t,e,O,k]);_.useEffect(()=>{const L=++d.current,T=ou.has(s);return O(ou.get(s)??null),k(null),S(!T),C(null),f.current=!1,z(!T),()=>{d.current===L&&(d.current+=1)}},[s,r,z,O,k]),_.useEffect(()=>{if(!i)return;const L=window.setInterval(()=>void z(!1),OG);return()=>window.clearInterval(L)},[r,z,i]);const H=_.useCallback(async(L,T)=>{if(!c.current||f.current)return;const j=s,U=d.current;m.current+=1,f.current=!0,C(L),k(null);try{const M=await T();return c.current&&d.current===U&&o.current===j?(O(M),M):void 0}catch(M){c.current&&d.current===U&&o.current===j&&k(Rh(M));return}finally{c.current&&d.current===U&&o.current===j&&(f.current=!1,C(null),S(!1))}},[s,O,k]),D=_.useCallback((L,T)=>{const j=g.current;return j?H(L,()=>T(j.browserGeneration)):Promise.resolve(void 0)},[H]),G=_.useCallback(L=>H("Starting browser",()=>xe.openRuntimeBrowser(t,e,L)),[t,e,H]),Y=_.useCallback(async()=>{const L=g.current;if(!c.current||!L||f.current)return;const T=s,j=d.current;m.current+=1,f.current=!0,C("Closing browser"),k(null);try{await xe.closeRuntimeBrowser(t,e,L.browserGeneration),c.current&&d.current===j&&o.current===T&&O(null)}catch(U){c.current&&d.current===j&&o.current===T&&k(Rh(U))}finally{c.current&&d.current===j&&o.current===T&&(f.current=!1,C(null))}},[s,t,e,O,k]),W=_.useCallback(async()=>{const L=g.current;if(!c.current||!L||f.current)return;const T=s,j=d.current;m.current+=1,f.current=!0,C("Opening in Desktop"),k(null);try{const U=await cU(L,{close:M=>xe.closeRuntimeBrowser(t,e,M).then(()=>{}),open:M=>xe.openRuntimeBrowser(t,e,M),createPage:(M,P)=>xe.createRuntimeBrowserPage(t,e,M,P),activatePage:(M,P)=>xe.activateRuntimeBrowserPage(t,e,M,P),onProgress:M=>{c.current&&d.current===j&&o.current===T&&(O(M),C("Restoring browser tabs"))}});return c.current&&d.current===j&&o.current===T?(O(U),U.executionBackend!=="embedded-electron"&&k("Desktop Browser Host is unavailable; using streamed browser"),U):void 0}catch(U){const M=await xe.getRuntimeBrowserState(t,e).catch(()=>{});c.current&&d.current===j&&o.current===T&&(M!==void 0&&O(M),k(Rh(U)));return}finally{c.current&&d.current===j&&o.current===T&&(f.current=!1,C(null),S(!1))}},[s,t,e,O,k]);return{browser:b,loading:w,pendingAction:E,error:A,currentError:()=>p.current,disabled:E!==null||(b==null?void 0:b.status)!=="ready",createDisabled:E!==null,load:z,openBrowser:G,closeBrowser:Y,recreateForDesktop:W,createPage:()=>D("Creating page",L=>xe.createRuntimeBrowserPage(t,e,L)),closePage:L=>D("Closing page",T=>xe.closeRuntimeBrowserPage(t,e,T,L)),activatePage:L=>D("Switching page",T=>xe.activateRuntimeBrowserPage(t,e,T,L)),navigatePage:(L,T)=>D("Navigating",j=>xe.navigateRuntimeBrowserPage(t,e,j,L,T)),backPage:L=>D("Going back",T=>xe.backRuntimeBrowserPage(t,e,T,L)),forwardPage:L=>D("Going forward",T=>xe.forwardRuntimeBrowserPage(t,e,T,L)),reloadPage:L=>D("Reloading page",T=>xe.reloadRuntimeBrowserPage(t,e,T,L))}}const zG=2500,lu=new Map;function IG({sessionId:e,runtimeSelector:t,active:r,polling:i=r,devicesActive:s=!1}){const o=`${t}
|
|
606
|
+
${e}`,[c,d]=_.useState(()=>lu.get(o)??null),[m,f]=_.useState([]),[g,p]=_.useState(()=>!lu.has(o)),[b,x]=_.useState(!1),[w,S]=_.useState(!1),[E,C]=_.useState(null),A=_.useRef(0),N=_.useRef(0),k=_.useRef(!1),O=_.useRef(!1),z=_.useRef(!1),H=_.useRef(null);H.current=c;const D=_.useCallback(U=>{H.current=U,lu.set(o,U),d(U)},[o]),G=_.useCallback(async()=>{if(k.current)return;const U=A.current,M=N.current;O.current||p(!0);try{const P=await xe.getSessionEmulator(t,e);if(A.current!==U||N.current!==M||k.current)return;D(P),C(null)}catch(P){if(A.current!==U||N.current!==M||k.current)return;C(c_(P))}finally{A.current===U&&N.current===M&&!k.current&&(O.current=!0,p(!1))}},[t,e,D]),Y=_.useCallback(async()=>{if(k.current)return;const U=A.current,M=N.current;x(!0);try{const P=await xe.listSessionEmulatorDevices(t,e);if(A.current!==U||N.current!==M||k.current)return;f(P),C(null)}catch(P){if(A.current!==U||N.current!==M||k.current)return;C(c_(P))}finally{A.current===U&&N.current===M&&!k.current&&(z.current=!0,x(!1))}},[t,e]);_.useEffect(()=>{A.current+=1;const U=lu.has(o);D(lu.get(o)??null),f([]),C(null),p(!U),x(!1),S(!1),k.current=!1,O.current=U,z.current=!1,G()},[r,G,o,D]),_.useEffect(()=>{if(!i)return;const U=window.setInterval(()=>void G(),zG);return()=>window.clearInterval(U)},[r,i,G]),_.useEffect(()=>{!s||g||w||c||z.current||Y()},[r,c,s,g,w,Y]);const W=_.useCallback(async(U,M)=>{const P=A.current,I=++N.current;k.current=!0,S(!0),C(null);try{const F=await U();return A.current!==P||N.current!==I?null:(M==null||M(F),F)}catch(F){throw A.current===P&&N.current===I&&C(c_(F)),F}finally{A.current===P&&N.current===I&&(k.current=!1,S(!1))}},[]),L=_.useCallback(U=>W(()=>xe.attachSessionEmulator(t,e,U),M=>D(M)),[W,t,e]),T=_.useCallback(async()=>{const U=H.current;return U?await W(()=>xe.detachSessionEmulator(t,e,U.bindingId),()=>D(null))!==null:!1},[W,t,e]),j=_.useCallback(async U=>{const M=H.current;if(!M)throw new Error("This Session has no Emulator attached");await W(()=>U(M))},[W]);return{binding:c,devices:m,loading:g,devicesLoading:b,mutating:w,error:E,reload:G,reloadDevices:Y,attach:L,detach:T,tap:(U,M)=>j(P=>xe.tapSessionEmulator(t,e,P.bindingId,U,M)),gesture:U=>j(M=>xe.gestureSessionEmulator(t,e,M.bindingId,U)),button:U=>j(M=>xe.buttonSessionEmulator(t,e,M.bindingId,U))}}function c_(e){return e instanceof Error?e:new Error(String(e))}const lT="rynx.session-resource-dock-width";function $G({session:e,runtimeSelector:t,leadingControls:r,initialDraft:i}){var yn,gr,Qr,or,Mo,Ds;const[s,o]=lj(),c=s.get("view"),d=c==="terminal"?"terminal":"chat",m=T9(s.get("surface")),f=s.get("panel")==="resources",g=c==="browser"||m!==null||f,p=(m==null?void 0:m.type)==="browser"?m.pageId:null,b=_.useRef(null),x=_.useRef(null),w=_.useRef("browser"),S=_.useRef(null),E=_.useRef(0),C=_.useRef(null),[A]=_.useState(UG),N=_.useRef(A),k=_.useRef(null),O=_.useRef(null),z=_.useRef(null),H=_.useRef(null),D=_.useRef(null),G=_.useRef(null),Y=_.useRef(!1),[W,L]=_.useState(!1),[T,j]=_.useState(!1),[U,M]=_.useState(null),[P,I]=_.useState(hu),[F,q]=_.useState(!1),[$,X]=_.useState([]),{state:V,running:J,send:le,stop:ae}=O9(e.id,{runtimeSelector:t,allowSend:!0}),ee=PG({sessionId:e.id,runtimeSelector:t,active:!0,polling:g}),se=IG({sessionId:e.id,runtimeSelector:t,active:!0,polling:g,devicesActive:(m==null?void 0:m.type)==="emulator"}),ce=_.useMemo(()=>D9(ee.browser,p,b.current),[ee.browser,p]),Se=J||e.status==="running",Re=e.agent??(e.provider?Ky(e.provider):void 0),Ne=(yn=A9(V))==null?void 0:yn.model,Q=((gr=ee.browser)==null?void 0:gr.pages)??[],re=(m==null?void 0:m.type)==="emulator"||W,be=ee.loading||se.loading,pe=Q.length>0||re,Ee=_.useMemo(()=>[...Q.map(ve=>Tn(ve.pageId)),...re?[Dn()]:[]],[Q,re]),Ie=_.useMemo(()=>s2($,Ee),[Ee,$]);_.useEffect(()=>{X(ve=>{const Le=s2(ve,Ee);return HG(ve,Le)?ve:Le})},[Ee]),_.useEffect(()=>{const ve=C.current;if(!ve)return;const Le=()=>{const wt=ve.getBoundingClientRect().width,gt=Eh(wt,Number.POSITIVE_INFINITY);I(gt);const Pe=N.current,ct=Eh(wt,Pe??wt*n2);Pe!==null&&ve.style.setProperty("--session-resource-dock-width",`${ct}px`),k.current=ct,M(ct)};Le();const Je=new ResizeObserver(Le);return Je.observe(ve),()=>Je.disconnect()},[]),_.useEffect(()=>()=>{var ve;z.current!==null&&window.cancelAnimationFrame(z.current),(ve=D.current)==null||ve.call(D),eE(G)},[]),_.useEffect(()=>{b.current=null,x.current=null,w.current="browser",S.current=null,L(!1),X([]),E.current+=1},[t,e.id]);const Te=(ve,Le=!0)=>{Le&&(E.current+=1);const Je=new URLSearchParams(s);ve?(Je.set("surface",ve),Je.delete("panel")):(Je.delete("surface"),Je.set("panel","resources")),Je.get("view")==="browser"&&Je.set("view","chat"),o(Je,{replace:!0})},Ye=()=>{E.current+=1;const ve=new URLSearchParams(s);ve.delete("surface"),ve.delete("panel"),ve.get("view")==="browser"&&ve.set("view","chat"),o(ve,{replace:!0})},ft=()=>{if(w.current==="emulator"&&W){Te(Dn(S.current));return}if(b.current){Te(Tn(b.current));return}if(W){Te(Dn(S.current));return}Te(null)};_.useEffect(()=>{m&&(w.current=m.type,m.type==="emulator"&&L(!0))},[m==null?void 0:m.type]),_.useEffect(()=>{var Le;const ve=((Le=se.binding)==null?void 0:Le.bindingId)??null;ve&&(S.current&&ve!==S.current?L(!0):S.current||L(!0),S.current=ve)},[(Qr=se.binding)==null?void 0:Qr.bindingId]),_.useEffect(()=>{if(c!=="browser")return;const ve=new URLSearchParams(s);ve.set("view","chat"),ve.set("surface",Tn(ce)),ve.delete("panel"),o(ve,{replace:!0})},[c,s,ce,o]),_.useEffect(()=>{if((m==null?void 0:m.type)!=="browser")return;ce&&(b.current=ce);const ve=Tn(ce);if(s.get("surface")===ve)return;const Le=new URLSearchParams(s);Le.set("surface",ve),o(Le,{replace:!0})},[m==null?void 0:m.type,s,ce,o]),_.useEffect(()=>{const ve=Q.map(Je=>Je.pageId),Le=L9(x.current,ee.browser);x.current=ve,!(!Le||(m==null?void 0:m.type)!=="browser")&&(b.current=Le,Te(Tn(Le),!1))},[Q,ee.browser,m==null?void 0:m.type]),_.useEffect(()=>{var Je;if((m==null?void 0:m.type)!=="emulator")return;const ve=Dn((Je=se.binding)==null?void 0:Je.bindingId);if(s.get("surface")===ve)return;const Le=new URLSearchParams(s);Le.set("surface",ve),o(Le,{replace:!0})},[(or=se.binding)==null?void 0:or.bindingId,m==null?void 0:m.type,s,o]),_.useEffect(()=>{var ve,Le;if(!(!g||be)){if(!pe){m&&Te(null,!1);return}(m==null?void 0:m.type)==="browser"&&ce||(m==null?void 0:m.type)==="emulator"&&re||(w.current==="emulator"&&re?Te(Dn((ve=se.binding)==null?void 0:ve.bindingId),!1):ce?Te(Tn(ce),!1):re&&Te(Dn((Le=se.binding)==null?void 0:Le.bindingId),!1))}},[(Mo=se.binding)==null?void 0:Mo.bindingId,re,pe,m==null?void 0:m.type,g,be,ce]);const Ge=async()=>{var Le,Je;if(Y.current)return;Y.current=!0,j(!0);const ve=E.current;try{const wt=((Le=ee.browser)==null?void 0:Le.status)==="ready"?await ee.createPage():await ee.openBrowser(),gt=(wt==null?void 0:wt.activePageId)??((Je=wt==null?void 0:wt.pages.at(-1))==null?void 0:Je.pageId);if(!wt){we.error(`Could not create Browser tab: ${ee.currentError()??"Browser is unavailable"}`);return}gt&&E.current===ve&&Te(Tn(gt),!1)}finally{Y.current=!1,j(!1)}},zt=ve=>{const Le=C.current;if(!Le)return null;const Je=Eh(Le.getBoundingClientRect().width,ve);return Le.style.setProperty("--session-resource-dock-width",`${Je}px`),k.current=Je,Je},dt=ve=>{const Le=C.current;return Le?zt(Le.getBoundingClientRect().right-ve):null},Vt=ve=>{if(ve!==null){N.current=ve,M(ve);try{window.localStorage.setItem(lT,String(Math.round(ve)))}catch{}}},Wr=ve=>{H.current=ve,z.current===null&&(z.current=window.requestAnimationFrame(()=>{z.current=null;const Le=H.current;H.current=null,Le!==null&&dt(Le)}))},_n=(ve,Le,Je)=>{var gt;if(O.current!==Le)return;z.current!==null&&(window.cancelAnimationFrame(z.current),z.current=null),H.current=null;const wt=Je===void 0?k.current:dt(Je);Vt(wt),O.current=null,(gt=D.current)==null||gt.call(D),D.current=null,ve.hasPointerCapture(Le)&&ve.releasePointerCapture(Le),eE(G),q(!1)},Gt=ve=>{var ct;if(ve.button!==0)return;ve.preventDefault(),(ct=D.current)==null||ct.call(D),O.current=ve.pointerId;const Le=ve.currentTarget;Le.setPointerCapture(ve.pointerId);const Je=Ct=>{O.current===Ct.pointerId&&Wr(Ct.clientX)},wt=Ct=>{_n(Le,Ct.pointerId,Ct.clientX)},gt=Ct=>{_n(Le,Ct.pointerId)};window.addEventListener("pointermove",Je,!0),window.addEventListener("pointerup",wt,!0),window.addEventListener("pointercancel",gt,!0),D.current=()=>{window.removeEventListener("pointermove",Je,!0),window.removeEventListener("pointerup",wt,!0),window.removeEventListener("pointercancel",gt,!0)};const Pe=document.documentElement.style;G.current={cursor:Pe.cursor,userSelect:Pe.userSelect},Pe.cursor="col-resize",Pe.userSelect="none",q(!0),dt(ve.clientX)},Jt=ve=>{const Le=C.current;if(!Le)return;const Je=k.current??Eh(Le.getBoundingClientRect().width,Le.getBoundingClientRect().width*n2),wt=ve.shiftKey?32:16;let gt=null;ve.key==="ArrowLeft"&&(gt=Je+wt),ve.key==="ArrowRight"&&(gt=Je-wt),ve.key==="Home"&&(gt=0),ve.key==="End"&&(gt=Number.POSITIVE_INFINITY),gt!==null&&(ve.preventDefault(),Vt(zt(gt)))},Jr=ve=>{E.current+=1;const Le=new URLSearchParams(s);Le.set("view",ve),o(Le,{replace:!0})},Xi=u.jsx(ge,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":d==="chat"?"Open terminal":"Open chat",title:d==="chat"?"Open terminal":"Open chat",onClick:()=>Jr(d==="chat"?"terminal":"chat"),children:d==="chat"?u.jsx(BB,{}):u.jsx(H4,{})}),Ri=u.jsx(ge,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":g?"Hide Session resources":"Show Session resources",title:g?"Hide Session resources":"Show Session resources",onClick:g?Ye:ft,children:g?u.jsx(rB,{}):u.jsx(nB,{})});return u.jsx("div",{className:"flex h-full min-h-0 min-w-0 flex-col overflow-hidden",children:u.jsxs("div",{ref:C,className:"relative flex min-h-0 min-w-0 flex-1 overflow-hidden [--session-resource-dock-width:44%]",children:[u.jsxs("section",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:[u.jsxs("header",{className:"app-drag-region flex h-12 shrink-0 items-center justify-between gap-3 border-b border-[var(--border)] px-3 sm:px-4",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r,u.jsx("h2",{className:"min-w-0 truncate text-sm font-medium",children:e.title??Re??"session"})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[Xi,!g&&Ri]})]}),u.jsxs(MA,{value:d,className:"flex min-h-0 min-w-0 flex-1 flex-col gap-0",children:[u.jsxs(Du,{value:"chat",forceMount:!0,className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden",children:[u.jsx(mG,{todos:V.todos}),u.jsx(BG,{items:V.items,historyLoaded:V.historyLoaded,running:J,waitingForInteraction:V.waitingForInteraction,sessionId:e.id}),u.jsx(TU,{initialDraft:i,model:Ne,running:Se,onSend:le,onStop:ae})]}),u.jsx(Du,{value:"terminal",forceMount:!0,className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden",children:u.jsx(rG,{sessionId:e.id,runtimeSelector:t,active:d==="terminal"})})]})]}),g&&u.jsxs(u.Fragment,{children:[u.jsx("div",{role:"separator","aria-label":"Resize Session resources","aria-orientation":"vertical","aria-valuemin":Math.min(hu,P),"aria-valuemax":P,"aria-valuenow":Math.round(U??hu),"aria-valuetext":`${Math.round(U??hu)} pixels wide`,tabIndex:0,title:"Drag to resize Session resources",className:"group relative z-30 -mx-1 hidden w-2 shrink-0 cursor-col-resize touch-none outline-none lg:block",onPointerDown:Gt,onKeyDown:Jt,children:u.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute inset-y-0 left-1/2 -translate-x-1/2 bg-[var(--border)] transition-[width,background-color] duration-150 group-hover:w-0.5 group-hover:bg-[var(--primary)] group-focus-visible:w-0.5 group-focus-visible:bg-[var(--primary)] ${F?"w-0.5 bg-[var(--primary)]":"w-px"}`})}),u.jsxs("aside",{className:"absolute inset-0 z-20 flex min-h-0 min-w-0 flex-col overflow-hidden bg-[var(--card)] lg:static lg:z-auto lg:w-[var(--session-resource-dock-width)] lg:min-w-[22.5rem] lg:max-w-[calc(100%_-_26.25rem)]","aria-label":"Session resources",children:[pe&&u.jsx(LU,{pages:Q,order:Ie,selectedPageId:(m==null?void 0:m.type)==="browser"?ce:null,selectionDisabled:ee.pendingAction!==null,mutationDisabled:ee.disabled,createDisabled:ee.createDisabled||T,createPending:T,emulatorAttached:!!se.binding,emulator:re?{selected:(m==null?void 0:m.type)==="emulator",label:((Ds=se.binding)==null?void 0:Ds.deviceName)??"Emulator",busy:se.loading||se.mutating}:null,onSelectPage:ve=>{var Le;b.current=ve,Te(Tn(ve)),((Le=ee.browser)==null?void 0:Le.status)==="ready"&&ee.activatePage(ve)},onClosePage:ve=>{E.current+=1,b.current===ve&&(b.current=null),ee.closePage(ve)},onCreatePage:()=>void Ge(),onSelectEmulator:()=>{var ve;L(!0),Te(Dn((ve=se.binding)==null?void 0:ve.bindingId))},onCloseEmulator:()=>{L(!1),w.current="browser",Te(ce?Tn(ce):null)},onAddEmulator:()=>{var ve;L(!0),Te(Dn((ve=se.binding)==null?void 0:ve.bindingId))},trailingAction:Ri}),!pe&&u.jsx("div",{className:"absolute right-3 top-1.5 z-10 sm:right-4",children:Ri}),pe?(m==null?void 0:m.type)==="emulator"?u.jsx(IU,{sessionId:e.id,runtimeSelector:t,controller:se}):(m==null?void 0:m.type)==="browser"?u.jsx(kU,{sessionId:e.id,runtimeSelector:t,pageId:ce,browserResource:ee}):u.jsxs("div",{className:"grid min-h-0 flex-1 place-items-center","aria-live":"polite",children:[u.jsx(ht,{className:"size-5 animate-spin text-[var(--muted-foreground)]"}),u.jsx("span",{className:"sr-only",children:"Selecting Session resource"})]}):u.jsx(FG,{browserBusy:ee.createDisabled||T,emulatorBusy:se.mutating,onOpenBrowser:()=>void Ge(),onOpenEmulator:()=>{var ve;L(!0),Te(Dn((ve=se.binding)==null?void 0:ve.bindingId))}})]})]})]})})}function UG(){if(typeof window>"u")return null;try{const e=Number(window.localStorage.getItem(lT));return Number.isFinite(e)&&e>0?e:null}catch{return null}}function eE(e){const t=e.current;!t||typeof document>"u"||(document.documentElement.style.cursor=t.cursor,document.documentElement.style.userSelect=t.userSelect,e.current=null)}function HG(e,t){return e.length===t.length&&e.every((r,i)=>r===t[i])}function FG({browserBusy:e,emulatorBusy:t,onOpenBrowser:r,onOpenEmulator:i}){return u.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6",children:u.jsxs("div",{className:"w-full max-w-64 space-y-1","aria-label":"Session resource choices",children:[u.jsxs("button",{type:"button",disabled:e,onClick:r,className:"flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm outline-none transition-colors hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:pointer-events-none disabled:opacity-50",children:[e?u.jsx(ht,{className:"size-4 shrink-0 animate-spin"}):u.jsx(Cu,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),u.jsx("span",{children:"Browser"})]}),u.jsxs("button",{type:"button",disabled:t,onClick:i,className:"flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm outline-none transition-colors hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:pointer-events-none disabled:opacity-50",children:[t?u.jsx(ht,{className:"size-4 shrink-0 animate-spin"}):u.jsx(zl,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),u.jsx("span",{children:"Emulator"})]})]})})}const WG=400,qG=160;function VG({sessions:e,runtimeSelector:t,runtimeLabel:r,listError:i,loading:s,selectedId:o,onCollapsedChange:c,onSelect:d,onNew:m,onRetry:f,onDeleted:g}){const[p,b]=_.useState(""),x=p.trim().toLocaleLowerCase(),w=_.useMemo(()=>x?e.filter(E=>[E.title,E.id,E.provider,E.provider?Ky(E.provider):void 0,E.agent,E.source].some(C=>C==null?void 0:C.toLocaleLowerCase().includes(x))):e,[x,e]);async function S(E){try{await xe.closeSession(E,t)}catch(C){we.error(`Delete session failed: ${C instanceof Error?C.message:String(C)}`);return}g(E)}return u.jsxs("aside",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--card)]/35","aria-label":"Sessions",children:[u.jsxs("div",{className:"app-drag-region desktop-macos-titlebar-inset shrink-0 border-b border-[var(--border)] p-2.5",children:[u.jsxs("div",{className:"mb-2 flex h-7 items-center gap-2 px-0.5",children:[u.jsxs(ma,{to:so(t),className:"app-no-drag flex items-center gap-2","aria-label":"Rynx Sessions",children:[u.jsx("img",{src:U_,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"}),u.jsx("span",{className:"label-caps text-[8px] text-[var(--muted-foreground)]",children:"control"})]}),u.jsx(ge,{variant:"ghost",size:"icon-sm",className:"app-no-drag ml-auto hidden md:inline-flex",onClick:()=>c(!0),title:"Collapse session list","aria-label":"Collapse session list","aria-expanded":"true",children:u.jsx(Q4,{className:"size-3.5"})})]}),u.jsxs("div",{className:"app-no-drag flex items-center gap-2",children:[u.jsxs("label",{className:"relative min-w-0 flex-1",children:[u.jsx("span",{className:"sr-only",children:"Search sessions"}),u.jsx(gB,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]"}),u.jsx(xt,{value:p,onChange:E=>b(E.target.value),placeholder:"Search sessions",className:"h-11 rounded-md pl-8 text-xs md:h-8"})]}),u.jsx(ge,{size:"icon",className:"size-11 shrink-0 md:size-8",onClick:m,title:"New session","aria-label":"New session",children:u.jsx(Gi,{})})]})]}),i&&u.jsxs("div",{role:"alert",className:"flex items-start gap-2 border-b border-[var(--border)] bg-[var(--warning)]/8 px-3 py-2 text-xs",children:[u.jsx("span",{className:"min-w-0 flex-1 text-[var(--warning)]",children:i}),u.jsx(ge,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-2 text-[10px]",onClick:f,children:"Retry"})]}),u.jsx(un,{className:"min-h-0 flex-1",children:s&&e.length===0?u.jsx(YG,{}):e.length===0?u.jsxs("div",{className:"grid place-items-center gap-3 px-5 py-10 text-center",children:[u.jsxs("div",{children:[u.jsxs("p",{className:"text-sm font-medium",children:["No sessions on ",r]}),u.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Create one to start a conversation and terminal."})]}),u.jsxs(ge,{size:"sm",className:"h-11 md:h-8",onClick:m,children:[u.jsx(Gi,{})," New session"]})]}):w.length===0?u.jsxs("div",{className:"px-5 py-10 text-center text-xs text-[var(--muted-foreground)]",children:["No sessions match “",p.trim(),"”."]}):u.jsx("ul",{className:"space-y-0.5 px-1.5 py-1.5",children:w.map(E=>u.jsx(GG,{session:E,runtimeLabel:r,selected:o===E.id,onSelect:()=>d(E.id),onDelete:()=>S(E.id)},E.id))})})]})}function GG({session:e,runtimeLabel:t,selected:r,onSelect:i,onDelete:s}){const[o,c]=_.useState(!1),[d,m]=_.useState(!1),[f,g]=_.useState(!1),p=_.useRef(null),b=_.useRef(null),x=KG(e.updatedAt??e.createdAt),w=e.agent??(e.provider?Ky(e.provider):void 0)??e.source,S=e.title??w??"Untitled session";_.useEffect(()=>()=>{p.current!==null&&window.clearTimeout(p.current),b.current!==null&&window.clearTimeout(b.current)},[]);const E=()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},C=()=>{b.current!==null&&(window.clearTimeout(b.current),b.current=null)},A=()=>{E(),C(),!f&&m(!0)},N=()=>{C(),!(f||d||p.current!==null)&&(p.current=window.setTimeout(()=>{p.current=null,m(!0)},WG))},k=()=>{E(),C(),m(!1)},O=()=>{E(),C(),d&&(b.current=window.setTimeout(()=>{b.current=null,m(!1)},qG))};return u.jsxs("li",{className:qe("group relative flex min-h-9 items-center rounded-md transition-colors",r?"bg-[var(--muted)]/70":"hover:bg-[var(--muted)]/40"),onMouseEnter:N,onMouseLeave:O,children:[u.jsxs(E_,{modal:!1,open:d,onOpenChange:z=>{z?A():k()},children:[u.jsx(mf,{asChild:!0,children:u.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute right-0 top-2 size-px"})}),u.jsxs(pf,{side:"right",align:"start",sideOffset:8,className:"w-72 p-3","aria-label":`Details for ${S}`,onMouseEnter:A,onMouseLeave:O,onOpenAutoFocus:z=>z.preventDefault(),onCloseAutoFocus:z=>z.preventDefault(),children:[u.jsxs("div",{className:"mb-2.5 flex min-w-0 items-center justify-between gap-3",children:[u.jsx("p",{className:"min-w-0 truncate text-xs font-medium",children:S}),u.jsx("span",{className:"shrink-0 text-[10px] text-[var(--muted-foreground)]",children:x})]}),u.jsxs("div",{className:"space-y-2 font-mono text-[11px] leading-4",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2","aria-label":`Target: ${w}`,children:[u.jsx(J0,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),u.jsx("span",{className:"min-w-0 truncate",children:w})]}),u.jsxs("div",{className:"flex min-w-0 items-center gap-2","aria-label":`Source: ${e.source}`,children:[u.jsx(Q0,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),u.jsx("span",{className:"min-w-0 truncate",children:e.source})]}),u.jsxs("div",{className:"flex min-w-0 items-start gap-2","aria-label":`Session: ${e.id}`,children:[u.jsx(C4,{"aria-hidden":"true",className:"mt-px size-3.5 shrink-0 text-[var(--muted-foreground)]"}),u.jsx("span",{className:"min-w-0 select-text break-all",children:e.id})]})]})]})]}),u.jsx("button",{type:"button",className:"min-w-0 flex-1 px-2.5 py-2 text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]","aria-current":r?"page":void 0,onClick:i,onFocus:A,onBlur:O,children:u.jsx("span",{className:"block truncate text-sm font-medium",children:S})}),u.jsxs("div",{className:"group/actions relative mr-2 size-8 shrink-0",onMouseEnter:k,onMouseLeave:N,children:[e.status==="running"&&u.jsx("span",{role:"status","aria-label":"Running",title:"Running",className:"pointer-events-none absolute inset-0 grid place-items-center text-[var(--muted-foreground)] transition-opacity duration-150 group-hover:opacity-0 group-focus-within/actions:opacity-0 group-has-data-[state=open]/actions:opacity-0 [@media(hover:none)]:opacity-0",children:u.jsx(ht,{className:"size-3.5 animate-spin motion-reduce:animate-none"})}),u.jsxs(E_,{open:f,onOpenChange:z=>{g(z),z&&k()},children:[u.jsx(mf,{asChild:!0,children:u.jsx(ge,{variant:"ghost",size:"icon",className:"absolute inset-0 size-8 text-[var(--muted-foreground)] opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100 [@media(hover:none)]:opacity-100",title:`Session actions for ${S}`,"aria-label":`Session actions for ${S}`,children:u.jsx(_4,{})})}),u.jsx(pf,{align:"end",children:u.jsxs(gf,{variant:"destructive",onSelect:()=>c(!0),children:[u.jsx(ql,{}),"Delete session"]})})]}),u.jsx(Ca,{open:o,onOpenChange:c,children:u.jsxs(Ss,{children:[u.jsxs(Ra,{children:[u.jsx(Cs,{children:"Delete this session?"}),u.jsxs(Es,{children:["“",S,"” will be deleted from ",t,". This cannot be undone."]})]}),u.jsxs(ka,{children:[u.jsx(ks,{children:"Cancel"}),u.jsx(Rs,{variant:"destructive",onClick:()=>void s(),children:"Delete"})]})]})})]})]})}function YG(){return u.jsx("div",{"aria-label":"Loading sessions",className:"space-y-0.5 px-1.5 py-1.5",children:Array.from({length:6},(e,t)=>u.jsx("div",{className:"grid min-h-9 content-center rounded-md px-2.5",children:u.jsx("div",{className:"h-3 w-2/3 animate-pulse rounded bg-[var(--muted)]"})},t))})}function KG(e){const t=Date.parse(e);if(!Number.isFinite(t))return"unknown";const r=Math.max(0,Math.round((Date.now()-t)/1e3));return r<60?"now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:r<604800?`${Math.floor(r/86400)}d ago`:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(t)}function XG({runtimeLabel:e,options:t,selection:r,loading:i,submitting:s,error:o,listCollapsed:c,onShowSessions:d,onRetryOptions:m,onSelectionChange:f,onSubmit:g}){const[p,b]=_.useState(""),x=_.useRef(null),w=_.useRef(!1),S=AA(r,t),E=!!(S!=null&&S.ready),C=!!(p.trim()&&r&&E&&!i&&!s);async function A(){const N=p.trim();!N||!r||!E||i||s||await g(N)}return u.jsxs("main",{className:"relative h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-[radial-gradient(circle_at_50%_-10%,color-mix(in_srgb,var(--primary)_9%,transparent),transparent_38%)]",children:[c&&u.jsx(ge,{type:"button",variant:"ghost",size:"icon-sm",className:"desktop-macos-titlebar-leading-control absolute left-3 top-2.5 z-10 hidden md:inline-flex",onClick:d,title:"Show session list","aria-label":"Show session list",children:u.jsx(OE,{className:"size-3.5"})}),u.jsx("div",{className:"desktop-macos-home-titlebar","aria-hidden":"true"}),u.jsx(un,{className:"h-full",children:u.jsxs("div",{className:"mx-auto grid min-h-full w-full max-w-3xl content-center px-4 py-8 sm:px-6 lg:py-12",children:[u.jsx("div",{className:"mb-6 flex items-center gap-2 md:hidden",children:u.jsxs(ge,{type:"button",variant:"ghost",size:"sm",className:"h-11 px-2",onClick:d,children:[u.jsx(Pl,{})," Sessions"]})}),u.jsxs("div",{className:"mb-7",children:[u.jsx("p",{className:"label-caps mb-3 text-[10px] text-[var(--primary)]",children:"New session"}),u.jsx("h1",{className:"text-3xl font-semibold tracking-[-0.035em] sm:text-4xl",children:"What should we work on?"}),u.jsxs("p",{className:"mt-3 max-w-2xl text-sm leading-6 text-[var(--muted-foreground)] sm:text-base",children:["Describe the outcome you want. The session and terminal will run on"," ",u.jsx("span",{className:"font-medium text-[var(--foreground)]",children:e}),"."]})]}),u.jsxs("form",{ref:x,onSubmit:N=>{N.preventDefault(),A()},children:[u.jsxs("div",{className:"overflow-hidden rounded-xl border border-[var(--border)] bg-[var(--card)] shadow-[0_12px_34px_rgba(24,24,27,0.08)] transition-[border-color,box-shadow] focus-within:border-[color-mix(in_srgb,var(--primary)_55%,var(--border))] focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--primary)_9%,transparent),0_12px_34px_rgba(24,24,27,0.08)]","aria-busy":s,children:[u.jsx("label",{htmlFor:"session-initial-prompt",className:"sr-only",children:"Initial task"}),u.jsx(rm,{id:"session-initial-prompt",value:p,disabled:s,rows:7,className:"min-h-40 max-h-[min(45dvh,24rem)] resize-none overflow-y-auto rounded-none border-0 bg-transparent px-5 py-5 text-base leading-7 shadow-none focus-visible:border-0 focus-visible:ring-0 md:text-base",placeholder:"Fix a bug, build a feature, or investigate the codebase…",onChange:N=>b(N.target.value),onCompositionStart:()=>{w.current=!0},onCompositionEnd:()=>{w.current=!1},onKeyDown:N=>{var k;N.key!=="Enter"||N.shiftKey||w.current||N.nativeEvent.isComposing||N.keyCode===229||(N.preventDefault(),(k=x.current)==null||k.requestSubmit())}}),u.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-[var(--border)] bg-[var(--muted)]/15 p-2.5 sm:flex-nowrap sm:pl-4",children:[u.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 text-xs text-[var(--muted-foreground)]",children:[u.jsx(jf,{className:"size-3.5 shrink-0","aria-hidden":"true"}),u.jsx("span",{className:"truncate",children:e})]}),u.jsx("label",{htmlFor:"session-launch-target",className:"sr-only",children:"Run with"}),u.jsxs(lm,{value:r?RA(r):void 0,disabled:i||s,onValueChange:N=>{const k=kA(N);k&&f(k)},children:[u.jsx(Ku,{id:"session-launch-target",className:"h-11 w-[min(100%,17rem)] bg-[var(--background)] md:h-9 md:w-56","aria-label":"Run with",children:u.jsx(Yu,{placeholder:i?"Loading…":"Choose how to run",children:S&&u.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[u.jsx("span",{className:"truncate",children:S.name}),u.jsx(u_,{status:Dv(S)})]})})}),u.jsxs(Xu,{align:"end",children:[t.providers.length>0&&u.jsxs(O_,{children:[u.jsx(P_,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Providers"}),t.providers.map(N=>u.jsx(zn,{value:`provider:${N.id}`,textValue:N.name,children:u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx(u_,{status:Dv(N)}),u.jsx("span",{children:N.name})]})},`provider:${N.id}`))]}),t.agents.length>0&&u.jsxs(O_,{children:[u.jsx(P_,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Agents"}),t.agents.map(N=>u.jsx(zn,{value:`agent:${N.id}`,textValue:N.name??N.id,children:u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx(u_,{status:Dv(N)}),u.jsx("span",{children:N.name??N.id})]})},`agent:${N.id}`))]})]})]}),u.jsx(ge,{type:"submit",size:"icon",className:"size-11 shrink-0 rounded-full md:size-10",disabled:!C,"aria-label":s?"Starting session":"Start session",children:s?u.jsx(ht,{className:"animate-spin"}):u.jsx($E,{})})]})]}),u.jsxs("div",{className:"mt-2 flex min-h-6 flex-wrap items-start justify-between gap-x-4 gap-y-1 px-1 text-xs text-[var(--muted-foreground)]",children:[u.jsxs("span",{className:"flex items-center gap-2",role:o?"alert":"status","aria-live":o?"assertive":"polite",children:[u.jsx("span",{children:o??(S&&!S.ready?S.reason??`${S.name} needs setup on ${e} before it can start.`:"A session is created only when you start.")}),o&&t.providers.length===0&&t.agents.length===0&&!i&&u.jsx(ge,{type:"button",variant:"link",size:"sm",className:"h-auto px-0 text-xs",onClick:m,children:"Retry"})]}),u.jsx("span",{className:"hidden font-mono text-[10px] sm:inline",children:"Enter to start · Shift+Enter for newline"})]})]})]})})]})}function u_({status:e}){const t=e==="ready"?"Ready":e==="needs_setup"?"Needs setup":"Readiness not reported",r=e==="ready"?"bg-[var(--success)]":e==="needs_setup"?"bg-[var(--warning)]":"bg-[var(--muted-foreground)]/55";return u.jsxs("span",{className:"inline-flex size-3.5 shrink-0 items-center justify-center",title:t,children:[u.jsx("span",{className:`size-2 rounded-full ${r}`,"aria-hidden":"true"}),u.jsx("span",{className:"sr-only",children:t})]})}function d_(){const e=wa(),{sessionId:t}=SE(),{runtimeSelector:r,selectedRuntime:i}=Kl(),[s,o]=_.useState([]),[c,d]=_.useState({providers:[],agents:[]}),[m,f]=_.useState(null),[g,p]=_.useState(!0),[b,x]=_.useState(),[w,S]=_.useState(),[E,C]=_.useState(!0),[A,N]=_.useState(!1),[k,O]=_.useState(!1),[z,H]=_.useState(!1),[D,G]=_.useState(),Y=_.useRef(!1),W=_.useRef(0),L=_.useRef(0),T=_.useRef(0),j=_.useRef(r),U=_.useRef(r),M=_.useRef({selector:r});M.current.selector!==r&&(M.current={selector:r});const P=M.current,I=t??null,F=_.useRef(I);_.useEffect(()=>()=>{T.current+=1},[]),_.useEffect(()=>{F.current!==I&&(F.current=I,T.current+=1)},[I]);const q=_.useCallback(async(ae=!1)=>{const ee=++W.current;ae&&C(!0);try{const se=await xe.listSessions(r);if(W.current!==ee)return;j.current=r,o(se),S(void 0)}catch(se){if(W.current!==ee)return;S(`Could not load sessions: ${se.message}`)}finally{W.current===ee&&C(!1)}},[r]);_.useEffect(()=>{U.current!==r&&(U.current=r,W.current+=1,o([]),S(void 0),C(!0))},[r]),_.useEffect(()=>{q(!0);const ae=setInterval(()=>void q(),4e3);return()=>clearInterval(ae)},[q]);const $=_.useCallback(async()=>{const ae=++L.current;p(!0),x(void 0);try{let ee;try{ee=await xe.listSessionLaunchOptions(r)}catch(ce){if(!(ce instanceof Wh)||ce.code!=="incompatible"&&ce.code!=="method_not_found")throw ce;ee=C9(await xe.listSessionAgentOptions(r))}if(L.current!==ae)return;const se=b9(r,typeof window>"u"?void 0:window.localStorage);d(ee),f(y9(ee,se))}catch(ee){if(L.current!==ae)return;d({providers:[],agents:[]}),f(null),x(`Could not load launch options: ${ee.message}`)}finally{L.current===ae&&p(!1)}},[r]);_.useEffect(()=>(d({providers:[],agents:[]}),f(null),p(!0),x(void 0),O(!1),G(void 0),$(),()=>{L.current+=1}),[$]);const X=_.useCallback(async ae=>{if(Y.current)return;const ee=m;if(!ee){x("Choose a provider or Agent before starting.");return}const se=AA(ee,c);if(!(se!=null&&se.ready)){x((se==null?void 0:se.reason)??`${(se==null?void 0:se.name)??"This launch target"} needs setup on ${i.displayName} before it can start.`);return}const ce=M.current,Se=i.displayName,Re=++T.current,Ne=S9(ae);Y.current=!0,H(!0),x(void 0);try{const{sessionId:Q}=await xe.createSession(w9(ee,Ne),ce.selector);let re;try{await xe.sendSessionMessage(Q,ae,()=>{},void 0,ce.selector)}catch(Ie){re=Ie}const be=re instanceof Wh&&(re.outcome==="not_started"||re.code==="failed_precondition");if(M.current!==ce){re?be?we.error(`Session created on ${Se}, but the first message was not sent: ${re.message}`):we.warning(`Session created on ${Se}, but message delivery is unknown. Check its history before retrying.`):we.success(`Session started on ${Se}; switch back to view it.`);return}if(T.current!==Re){re?be?we.error(`Session created on ${Se}, but the first message was not sent. Open it to retry.`):we.warning(`Session created on ${Se}, but message delivery is unknown. Check its history before retrying.`):we.success(`Session started on ${Se} in the background.`);return}const pe=new Date().toISOString(),Ee={id:Q,...ee.kind==="provider"?{provider:ee.id}:{agent:ee.id},title:Ne,status:be?"idle":"running",createdAt:pe,updatedAt:pe,source:"console"};j.current=ce.selector,o(Ie=>[Ee,...Ie.filter(Te=>Te.id!==Q)]),G(be?{sessionId:Q,message:ae}:void 0),O(!1),e(I_(ce.selector,Q)),q(),re&&(be?we.error(`Session created, but the first message was not sent: ${re.message}`):we.warning("Session created, but message delivery is unknown. Check its history before retrying."))}catch(Q){const re=Q instanceof Wh&&Q.outcome==="unknown",be=re?"Session creation outcome is unknown. Check the Session list before retrying.":`Could not start session: ${Q.message}`;M.current===ce&&T.current===Re?x(be):re?we.warning(`Session creation on ${Se} may have succeeded. Check its Session list before retrying.`):we.error(`Could not start Session on ${Se}: ${Q.message}`)}finally{Y.current=!1,H(!1)}},[c,m,e,q,i.displayName]),V=j.current===r?s:[],J=V.find(ae=>ae.id===I)??null;_.useEffect(()=>{(D==null?void 0:D.sessionId)===(J==null?void 0:J.id)&&G(void 0)},[D,J==null?void 0:J.id]);const le=J?u.jsxs("div",{className:qe("flex shrink-0 items-center gap-1",A&&"desktop-macos-titlebar-leading-inset"),children:[u.jsx(ge,{variant:"ghost",size:"icon",className:"size-10 md:hidden",title:"Back to sessions","aria-label":"Back to sessions",onClick:()=>{O(!0),e(so(r),{replace:!0})},children:u.jsx(Pl,{})}),A&&u.jsx(ge,{variant:"ghost",size:"icon-sm",className:"-ml-1 hidden md:inline-flex",title:"Show session list","aria-label":"Show session list",onClick:()=>N(!1),children:u.jsx(OE,{className:"size-3.5"})})]}):void 0;return u.jsxs("div",{className:qe("grid h-full min-h-0 min-w-0 bg-[var(--background)]",A?"grid-cols-[minmax(0,1fr)]":"md:grid-cols-[14rem_minmax(0,1fr)]"),children:[!A&&u.jsx("div",{className:qe("min-h-0 min-w-0 border-r border-[var(--border)]",(!k||J)&&"hidden md:block"),children:u.jsx(VG,{sessions:V,runtimeSelector:r,runtimeLabel:i.displayName,listError:w,loading:E,selectedId:I,onCollapsedChange:N,onSelect:ae=>{T.current+=1,O(!1),G(void 0),e(I_(r,ae))},onNew:()=>{T.current+=1,O(!1),G(void 0),e(so(r))},onRetry:()=>void q(!0),onDeleted:ae=>{M.current===P&&(I===ae&&e(so(r),{replace:!0}),q())}},r)}),J?u.jsx($G,{session:J,runtimeSelector:r,leadingControls:le,initialDraft:(D==null?void 0:D.sessionId)===J.id?D.message:void 0},`${r}:${J.id}`):I&&E?u.jsx("div",{className:"grid min-h-0 min-w-0 place-items-center",role:"status","aria-live":"polite",children:u.jsxs("span",{className:"flex items-center gap-2 text-sm text-[var(--muted-foreground)]",children:[u.jsx(ht,{className:"size-4 animate-spin"})," Loading session…"]})}):u.jsx("div",{className:qe("min-h-0 min-w-0",k&&!A&&"hidden md:block"),children:u.jsx(XG,{runtimeLabel:i.displayName,options:c,selection:m,loading:g,submitting:z,error:b??w??(I?"Session not found. Start a new session or choose another from the list.":void 0),listCollapsed:A,onShowSessions:()=>{T.current+=1,N(!1),O(!0)},onRetryOptions:()=>{$()},onSelectionChange:ae=>{f(ae),x(void 0),x9(r,typeof window>"u"?void 0:window.localStorage,ae)},onSubmit:X},r)})]})}new TextEncoder;function cT(e){return e?e.tool==="skills-cli"?{source:e.source}:{source:e.command}:{}}function ZG({name:e,onClose:t}){const[r,i]=_.useState(null),[s,o]=_.useState("meta"),[c,d]=_.useState(null),[m,f]=_.useState(""),[g,p]=_.useState(!1),[b,x]=_.useState(new Set),w=S=>x(E=>{const C=new Set(E);return C.has(S)?C.delete(S):C.add(S),C});return _.useEffect(()=>{if(!e){i(null),d(null),f("");return}o("meta");let S=!1;return xe.getSkill(e).then(E=>{var C;S||(i(E),x(new Set(JG(E.files))),d(((C=E.files.find(A=>A.path==="SKILL.md")??E.files[0])==null?void 0:C.path)??null))}).catch(E=>we.error(`Load skill failed: ${E.message}`)),()=>{S=!0}},[e]),_.useEffect(()=>{if(!e||!c){f("");return}let S=!1;return p(!0),xe.readSkillFile(e,c).then(E=>!S&&f(E.content)).catch(E=>!S&&f(`⚠ ${E.message}`)).finally(()=>!S&&p(!1)),()=>{S=!0}},[e,c]),u.jsx(wo,{open:e!=null,onOpenChange:S=>!S&&t(),children:u.jsxs(Na,{className:"flex max-h-[85vh] max-w-3xl flex-col overflow-hidden",children:[u.jsx(So,{children:u.jsx(Aa,{className:"font-mono",children:e})}),u.jsxs(MA,{value:s,onValueChange:o,className:"flex min-h-0 flex-1 flex-col gap-3",children:[u.jsxs(TA,{className:"self-start",children:[u.jsx(V_,{value:"meta",children:"Meta"}),u.jsxs(V_,{value:"files",children:["Files",r?` (${r.files.length})`:""]})]}),u.jsx(Du,{value:"meta",className:"mt-0 min-h-0 flex-1",children:u.jsx(un,{className:"h-full",children:r===null?u.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Loading…"}):u.jsxs("div",{className:"grid gap-5 pr-1",children:[r.description&&u.jsxs("div",{className:"grid gap-1.5",children:[u.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:"Description"}),u.jsx("p",{className:"text-sm leading-relaxed",children:r.description})]}),u.jsxs("dl",{className:"grid grid-cols-[5.5rem_1fr] items-baseline gap-x-5 gap-y-3",children:[(()=>{var E,C;const S=cT((E=r.ref)==null?void 0:E.install);return u.jsxs(u.Fragment,{children:[u.jsx(cu,{label:"Source",children:S.source?/^https?:\/\//.test(S.source)?u.jsx("a",{href:S.source,target:"_blank",rel:"noreferrer",className:"break-all font-mono text-xs text-[var(--primary)] hover:underline",children:S.source}):u.jsx("span",{className:"break-all font-mono text-xs",children:S.source}):u.jsx("span",{className:"text-[var(--muted-foreground)]",children:"— no receipt"})}),S.version&&u.jsx(cu,{label:"Version",children:u.jsx("span",{className:"font-mono text-xs",children:S.version})}),((C=r.ref)==null?void 0:C.contentHash)&&u.jsx(cu,{label:"Content",children:u.jsx("span",{className:"break-all font-mono text-xs",children:r.ref.contentHash})})]})})(),u.jsx(cu,{label:"Files",children:r.files.length}),u.jsx(cu,{label:"Size",children:uT(r.totalSize)})]})]})})}),u.jsx(Du,{value:"files",className:"mt-0 flex min-h-0 flex-1 flex-col",children:u.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-[14rem_1fr] gap-3",children:[u.jsx(un,{className:"min-h-0 rounded-md border border-[var(--border)]",children:u.jsx("div",{className:"p-1",children:r===null?u.jsx("p",{className:"p-2 text-xs text-[var(--muted-foreground)]",children:"Loading…"}):r.files.length===0?u.jsx("p",{className:"p-2 text-xs text-[var(--muted-foreground)]",children:"No files."}):u.jsx(hT,{nodes:QG(r.files),depth:0,active:c,onSelect:d,collapsed:b,onToggle:w})})}),u.jsx("pre",{className:"min-h-0 overflow-auto whitespace-pre-wrap break-words rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-3 font-mono text-xs",children:g?"Loading…":m})]})})]})]})})}function cu({label:e,children:t}){return u.jsxs(u.Fragment,{children:[u.jsx("dt",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e}),u.jsx("dd",{className:"min-w-0 break-words text-sm",children:t})]})}function uT(e){return Number.isFinite(e)?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:"—"}function JG(e){const t=new Set;for(const r of e){const i=r.path.split("/");for(let s=0;s<i.length-1;s++)t.add(i.slice(0,s+1).join("/"))}return[...t]}function QG(e){const t={children:[]};for(const r of e){const i=r.path.split("/");let s=t;i.forEach((o,c)=>{const d=c===i.length-1;let m=s.children.find(f=>f.name===o);m||(m={name:o,path:i.slice(0,c+1).join("/"),isDir:!d,children:[]},d&&(m.size=r.size),s.children.push(m)),s=m})}return dT(t),t.children}function dT(e){e.children.sort((t,r)=>t.isDir===r.isDir?t.name.localeCompare(r.name):t.isDir?-1:1),e.children.forEach(dT)}function hT({nodes:e,depth:t,active:r,onSelect:i,collapsed:s,onToggle:o}){const c=d=>({paddingLeft:d*14+8});return u.jsx(u.Fragment,{children:e.map(d=>d.isDir?u.jsxs("div",{children:[u.jsxs("button",{type:"button",onClick:()=>o(d.path),style:c(t),className:"flex w-full items-center gap-1.5 rounded-sm py-1 pr-2 text-left text-xs text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50",children:[u.jsx(yo,{className:qe("size-3 shrink-0 transition-transform",!s.has(d.path)&&"rotate-90")}),u.jsx(R4,{className:"size-3.5 shrink-0"}),u.jsx("span",{className:"truncate font-mono",children:d.name})]}),!s.has(d.path)&&u.jsx(hT,{nodes:d.children,depth:t+1,active:r,onSelect:i,collapsed:s,onToggle:o})]},d.path):u.jsxs("button",{type:"button",onClick:()=>i(d.path),style:c(t),className:qe("flex w-full items-center justify-between gap-2 rounded-sm py-1 pr-2 text-left",r===d.path?"bg-[var(--muted)]":"hover:bg-[var(--muted)]/50"),children:[u.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[u.jsx(w4,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),u.jsx("span",{className:"truncate font-mono text-xs",children:d.name})]}),u.jsx("span",{className:"shrink-0 text-[10px] text-[var(--muted-foreground)]",children:uT(d.size??0)})]},d.path))})}function eY(){const[e,t]=_.useState(null),[r,i]=_.useState(null);async function s(){try{t(await xe.listSkills())}catch(o){t([]),we.error(`Failed to load skills: ${o.message}`)}}return _.useEffect(()=>{s()},[]),u.jsxs(Yi,{children:[u.jsxs($n,{className:"items-start",children:[u.jsxs("div",{className:"grid gap-1",children:[u.jsxs(dn,{children:["Skills ",u.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:(e==null?void 0:e.length)??0})]}),u.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["Global catalog (",u.jsx("code",{children:"~/.rynx/skills"}),"), installed via ",u.jsx("code",{children:"npx skills"}),". Agents pick a subset in their Skills section."]})]}),u.jsx("div",{className:"shrink-0",children:u.jsx(vA,{onInstalled:t})})]}),u.jsx(hn,{className:"p-0",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"label-caps border-b border-[var(--border)] text-left text-xs text-[var(--muted-foreground)]",children:[u.jsx("th",{className:"px-5 py-2.5 font-medium",children:"Skill"}),u.jsx("th",{className:"px-5 py-2.5 text-right font-medium",children:"Actions"})]})}),u.jsxs("tbody",{children:[e===null&&u.jsx("tr",{children:u.jsx("td",{colSpan:2,className:"px-5 py-8 text-center text-[var(--muted-foreground)]",children:"Loading…"})}),(e==null?void 0:e.length)===0&&u.jsx("tr",{children:u.jsx("td",{colSpan:2,className:"px-5 py-8 text-center text-[var(--muted-foreground)]",children:"No skills installed yet. Install one from a skills.sh source above."})}),e==null?void 0:e.map(o=>u.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0 hover:bg-[var(--muted)]/40",children:[u.jsx("td",{className:"px-5 py-3",children:u.jsxs("button",{type:"button",onClick:()=>i(o.name),className:"block text-left hover:underline",children:[u.jsx("div",{className:"font-mono font-medium",children:o.name}),u.jsx("div",{className:"text-xs text-[var(--muted-foreground)]",children:o.description}),(()=>{var d;const c=cT((d=o.ref)==null?void 0:d.install);return c.source?u.jsxs("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--muted-foreground)]",children:[c.source,c.version?`@${c.version}`:""]}):null})()]})}),u.jsx("td",{className:"px-5 py-3",children:u.jsxs("div",{className:"flex justify-end gap-1.5",children:[u.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>i(o.name),children:"View"}),u.jsx(tY,{name:o.name,onDeleted:s})]})})]},o.name))]})]})}),u.jsx(ZG,{name:r,onClose:()=>i(null)})]})}function tY({name:e,onDeleted:t}){return u.jsxs(Ca,{children:[u.jsx(Ea,{asChild:!0,children:u.jsx(ge,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:u.jsx(ql,{})})}),u.jsxs(Ss,{children:[u.jsxs(Ra,{children:[u.jsxs(Cs,{children:['Remove skill "',e,'"?']}),u.jsx(Es,{children:"Deletes it from the global catalog. Agents that reference it will no longer resolve it."})]}),u.jsxs(ka,{children:[u.jsx(ks,{children:"Cancel"}),u.jsx(Rs,{variant:"destructive",onClick:async()=>{try{await xe.deleteSkill(e),we.success(`Skill "${e}" removed`),await t()}catch(r){we.error(`Remove failed: ${r.message}`)}},children:"Remove"})]})]})]})}function rY(){const{theme:e,toggle:t}=Xy(),r=Pr(),i=p7(r.pathname),s=_.useRef(null),[o,c]=_.useState([]),[d,m]=_.useState([]),[f,g]=_.useState([]),[p,b]=_.useState([]),x=_.useCallback(async()=>{try{c(await xe.listAgents())}catch(C){we.error(`Failed to load agents: ${C.message}`)}},[]),w=_.useCallback(async()=>{const C=await Promise.allSettled([xe.channelTypes(),xe.listChannels(),xe.listInstances(),xe.listAgents()]);C[0].status==="fulfilled"&&m(C[0].value),C[1].status==="fulfilled"&&g(C[1].value),C[2].status==="fulfilled"&&b(C[2].value),C[3].status==="fulfilled"&&c(C[3].value)},[]);_.useEffect(()=>{i&&i!=="emulator"&&w()},[w,i]),_.useEffect(()=>{const C=window.requestAnimationFrame(()=>{var A;return(A=s.current)==null?void 0:A.focus({preventScroll:!0})});return()=>window.cancelAnimationFrame(C)},[r.pathname]);const S=bL([{path:"/",element:u.jsx(Al,{replace:!0,to:Et.sessions})},{path:Au,element:u.jsx(Al,{replace:!0,to:sA})},{path:Et.overview,element:u.jsx(e9,{instances:p,channels:f,agents:o})},{path:Et.runtimes,element:u.jsx(u9,{})},{path:Et.providers,element:u.jsx(r9,{})},{path:Et.instances,element:u.jsx(K$,{instances:p,channels:f,agents:o,onChange:w})},{path:Et.channels,element:u.jsx(E$,{channels:f,channelTypes:d,onChange:w})},{path:Et.agents,element:u.jsx(K7,{agents:o,onChange:x})},{path:Et.skills,element:u.jsx(eY,{})},{path:d7,element:u.jsx(d_,{})},{path:h7,element:u.jsx(d_,{})},{path:Et.sessions,element:u.jsx(d_,{})},{path:`${Et.sessions}/:sessionId`,element:u.jsx(iY,{})},{path:Et.emulator,element:u.jsx(Y$,{})},{path:Et.logs,element:u.jsx(J$,{})},...Object.entries(m7).map(([C,A])=>({path:A,element:u.jsx(Al,{replace:!0,to:Et[C]})})),{path:"*",element:u.jsx(Al,{replace:!0,to:Et.sessions})}]),E=i?u.jsx(M7,{activeView:i,children:S}):S;return u.jsx(N7,{theme:e,onToggleTheme:t,children:u.jsx("div",{ref:s,id:"main-content",tabIndex:-1,className:"h-full min-h-0 overflow-hidden focus:outline-none",children:E})})}function iY(){const{sessionId:e}=SE(),t=Pr();if(!e)return u.jsx(Al,{replace:!0,to:Et.sessions});const r=oA(t.search)??"local";return u.jsx(Al,{replace:!0,to:I_(r,e)})}function nY(e){const{theme:t}=Xy();return u.jsx(Uj,{theme:t,...e})}window.rynxDesktopBrowser&&/mac/i.test(navigator.platform)&&(document.documentElement.dataset.rynxDesktopPlatform="macos");BD.createRoot(document.getElementById("root")).render(u.jsx(_.StrictMode,{children:u.jsx(nj,{children:u.jsxs(R7,{children:[u.jsx(rY,{}),u.jsx(nY,{richColors:!0,position:"top-right"})]})})}));export{SG as _,_o as a,hy as c,H0 as g,u as j,_ as r,HR as t};
|