kaizenai 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,648 @@
1
+ var HL=Object.defineProperty;var Bk=e=>{throw TypeError(e)};var $L=(e,t,n)=>t in e?HL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var tr=(e,t,n)=>$L(e,typeof t!="symbol"?t+"":t,n),Fk=(e,t,n)=>t.has(e)||Bk("Cannot "+n);var sd=(e,t,n)=>(Fk(e,t,"read from private field"),n?n.call(e):t.get(e)),Hk=(e,t,n)=>t.has(e)?Bk("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),$k=(e,t,n,r)=>(Fk(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function UL(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const o=Object.getOwnPropertyDescriptor(r,i);o&&Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:()=>r[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function qp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var K_={exports:{}},od={};/**
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 Uk;function VL(){if(Uk)return od;Uk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,o){var l=null;if(o!==void 0&&(l=""+o),i.key!==void 0&&(l=""+i.key),"key"in i){o={};for(var c in i)c!=="key"&&(o[c]=i[c])}else o=i;return i=o.ref,{$$typeof:e,type:r,key:l,ref:i!==void 0?i:null,props:o}}return od.Fragment=t,od.jsx=n,od.jsxs=n,od}var Vk;function WL(){return Vk||(Vk=1,K_.exports=VL()),K_.exports}var f=WL(),G_={exports:{}},ut={};/**
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 Wk;function qL(){if(Wk)return ut;Wk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),_=Symbol.iterator;function y(B){return B===null||typeof B!="object"?null:(B=_&&B[_]||B["@@iterator"],typeof B=="function"?B:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function k(B,X,A){this.props=B,this.context=X,this.refs=C,this.updater=A||w}k.prototype.isReactComponent={},k.prototype.setState=function(B,X){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,X,"setState")},k.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function R(){}R.prototype=k.prototype;function E(B,X,A){this.props=B,this.context=X,this.refs=C,this.updater=A||w}var N=E.prototype=new R;N.constructor=E,S(N,k.prototype),N.isPureReactComponent=!0;var L=Array.isArray;function j(){}var O={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function Z(B,X,A){var ie=A.ref;return{$$typeof:e,type:B,key:X,ref:ie!==void 0?ie:null,props:A}}function I(B,X){return Z(B.type,X,B.props)}function W(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function F(B){var X={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(A){return X[A]})}var $=/\/+/g;function V(B,X){return typeof B=="object"&&B!==null&&B.key!=null?F(""+B.key):X.toString(36)}function q(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(j,j):(B.status="pending",B.then(function(X){B.status==="pending"&&(B.status="fulfilled",B.value=X)},function(X){B.status==="pending"&&(B.status="rejected",B.reason=X)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function D(B,X,A,ie,J){var ee=typeof B;(ee==="undefined"||ee==="boolean")&&(B=null);var re=!1;if(B===null)re=!0;else switch(ee){case"bigint":case"string":case"number":re=!0;break;case"object":switch(B.$$typeof){case e:case t:re=!0;break;case g:return re=B._init,D(re(B._payload),X,A,ie,J)}}if(re)return J=J(B),re=ie===""?"."+V(B,0):ie,L(J)?(A="",re!=null&&(A=re.replace($,"$&/")+"/"),D(J,X,A,"",function(ge){return ge})):J!=null&&(W(J)&&(J=I(J,A+(J.key==null||B&&B.key===J.key?"":(""+J.key).replace($,"$&/")+"/")+re)),X.push(J)),1;re=0;var ue=ie===""?".":ie+":";if(L(B))for(var fe=0;fe<B.length;fe++)ie=B[fe],ee=ue+V(ie,fe),re+=D(ie,X,A,ee,J);else if(fe=y(B),typeof fe=="function")for(B=fe.call(B),fe=0;!(ie=B.next()).done;)ie=ie.value,ee=ue+V(ie,fe++),re+=D(ie,X,A,ee,J);else if(ee==="object"){if(typeof B.then=="function")return D(q(B),X,A,ie,J);throw X=String(B),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return re}function U(B,X,A){if(B==null)return B;var ie=[],J=0;return D(B,ie,"","",function(ee){return X.call(A,ee,J++)}),ie}function z(B){if(B._status===-1){var X=B._result;X=X(),X.then(function(A){(B._status===0||B._status===-1)&&(B._status=1,B._result=A)},function(A){(B._status===0||B._status===-1)&&(B._status=2,B._result=A)}),B._status===-1&&(B._status=0,B._result=X)}if(B._status===1)return B._result.default;throw B._result}var G=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},M={map:U,forEach:function(B,X,A){U(B,function(){X.apply(this,arguments)},A)},count:function(B){var X=0;return U(B,function(){X++}),X},toArray:function(B){return U(B,function(X){return X})||[]},only:function(B){if(!W(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return ut.Activity=p,ut.Children=M,ut.Component=k,ut.Fragment=n,ut.Profiler=i,ut.PureComponent=E,ut.StrictMode=r,ut.Suspense=h,ut.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,ut.__COMPILER_RUNTIME={__proto__:null,c:function(B){return O.H.useMemoCache(B)}},ut.cache=function(B){return function(){return B.apply(null,arguments)}},ut.cacheSignal=function(){return null},ut.cloneElement=function(B,X,A){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var ie=S({},B.props),J=B.key;if(X!=null)for(ee in X.key!==void 0&&(J=""+X.key),X)!H.call(X,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&X.ref===void 0||(ie[ee]=X[ee]);var ee=arguments.length-2;if(ee===1)ie.children=A;else if(1<ee){for(var re=Array(ee),ue=0;ue<ee;ue++)re[ue]=arguments[ue+2];ie.children=re}return Z(B.type,J,ie)},ut.createContext=function(B){return B={$$typeof:l,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:o,_context:B},B},ut.createElement=function(B,X,A){var ie,J={},ee=null;if(X!=null)for(ie in X.key!==void 0&&(ee=""+X.key),X)H.call(X,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(J[ie]=X[ie]);var re=arguments.length-2;if(re===1)J.children=A;else if(1<re){for(var ue=Array(re),fe=0;fe<re;fe++)ue[fe]=arguments[fe+2];J.children=ue}if(B&&B.defaultProps)for(ie in re=B.defaultProps,re)J[ie]===void 0&&(J[ie]=re[ie]);return Z(B,ee,J)},ut.createRef=function(){return{current:null}},ut.forwardRef=function(B){return{$$typeof:c,render:B}},ut.isValidElement=W,ut.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:z}},ut.memo=function(B,X){return{$$typeof:d,type:B,compare:X===void 0?null:X}},ut.startTransition=function(B){var X=O.T,A={};O.T=A;try{var ie=B(),J=O.S;J!==null&&J(A,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(j,G)}catch(ee){G(ee)}finally{X!==null&&A.types!==null&&(X.types=A.types),O.T=X}},ut.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},ut.use=function(B){return O.H.use(B)},ut.useActionState=function(B,X,A){return O.H.useActionState(B,X,A)},ut.useCallback=function(B,X){return O.H.useCallback(B,X)},ut.useContext=function(B){return O.H.useContext(B)},ut.useDebugValue=function(){},ut.useDeferredValue=function(B,X){return O.H.useDeferredValue(B,X)},ut.useEffect=function(B,X){return O.H.useEffect(B,X)},ut.useEffectEvent=function(B){return O.H.useEffectEvent(B)},ut.useId=function(){return O.H.useId()},ut.useImperativeHandle=function(B,X,A){return O.H.useImperativeHandle(B,X,A)},ut.useInsertionEffect=function(B,X){return O.H.useInsertionEffect(B,X)},ut.useLayoutEffect=function(B,X){return O.H.useLayoutEffect(B,X)},ut.useMemo=function(B,X){return O.H.useMemo(B,X)},ut.useOptimistic=function(B,X){return O.H.useOptimistic(B,X)},ut.useReducer=function(B,X,A){return O.H.useReducer(B,X,A)},ut.useRef=function(B){return O.H.useRef(B)},ut.useState=function(B){return O.H.useState(B)},ut.useSyncExternalStore=function(B,X,A){return O.H.useSyncExternalStore(B,X,A)},ut.useTransition=function(){return O.H.useTransition()},ut.version="19.2.1",ut}var qk;function d0(){return qk||(qk=1,G_.exports=qL()),G_.exports}var v=d0();const we=qp(v),xN=UL({__proto__:null,default:we},[v]);var Y_={exports:{}},ad={},X_={exports:{}},Z_={};/**
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 Kk;function KL(){return Kk||(Kk=1,function(e){function t(D,U){var z=D.length;D.push(U);e:for(;0<z;){var G=z-1>>>1,M=D[G];if(0<i(M,U))D[G]=U,D[z]=M,z=G;else break e}}function n(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var U=D[0],z=D.pop();if(z!==U){D[0]=z;e:for(var G=0,M=D.length,B=M>>>1;G<B;){var X=2*(G+1)-1,A=D[X],ie=X+1,J=D[ie];if(0>i(A,z))ie<M&&0>i(J,A)?(D[G]=J,D[ie]=z,G=ie):(D[G]=A,D[X]=z,G=X);else if(ie<M&&0>i(J,z))D[G]=J,D[ie]=z,G=ie;else break e}}return U}function i(D,U){var z=D.sortIndex-U.sortIndex;return z!==0?z:D.id-U.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 l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var h=[],d=[],g=1,p=null,_=3,y=!1,w=!1,S=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function N(D){for(var U=n(d);U!==null;){if(U.callback===null)r(d);else if(U.startTime<=D)r(d),U.sortIndex=U.expirationTime,t(h,U);else break;U=n(d)}}function L(D){if(S=!1,N(D),!w)if(n(h)!==null)w=!0,j||(j=!0,F());else{var U=n(d);U!==null&&q(L,U.startTime-D)}}var j=!1,O=-1,H=5,Z=-1;function I(){return C?!0:!(e.unstable_now()-Z<H)}function W(){if(C=!1,j){var D=e.unstable_now();Z=D;var U=!0;try{e:{w=!1,S&&(S=!1,R(O),O=-1),y=!0;var z=_;try{t:{for(N(D),p=n(h);p!==null&&!(p.expirationTime>D&&I());){var G=p.callback;if(typeof G=="function"){p.callback=null,_=p.priorityLevel;var M=G(p.expirationTime<=D);if(D=e.unstable_now(),typeof M=="function"){p.callback=M,N(D),U=!0;break t}p===n(h)&&r(h),N(D)}else r(h);p=n(h)}if(p!==null)U=!0;else{var B=n(d);B!==null&&q(L,B.startTime-D),U=!1}}break e}finally{p=null,_=z,y=!1}U=void 0}}finally{U?F():j=!1}}}var F;if(typeof E=="function")F=function(){E(W)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,V=$.port2;$.port1.onmessage=W,F=function(){V.postMessage(null)}}else F=function(){k(W,0)};function q(D,U){O=k(function(){D(e.unstable_now())},U)}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(D){D.callback=null},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function(D){switch(_){case 1:case 2:case 3:var U=3;break;default:U=_}var z=_;_=U;try{return D()}finally{_=z}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(D,U){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var z=_;_=D;try{return U()}finally{_=z}},e.unstable_scheduleCallback=function(D,U,z){var G=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?G+z:G):z=G,D){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=z+M,D={id:g++,callback:U,priorityLevel:D,startTime:z,expirationTime:M,sortIndex:-1},z>G?(D.sortIndex=z,t(d,D),n(h)===null&&D===n(d)&&(S?(R(O),O=-1):S=!0,q(L,z-G))):(D.sortIndex=M,t(h,D),w||y||(w=!0,j||(j=!0,F()))),D},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(D){var U=_;return function(){var z=_;_=U;try{return D.apply(this,arguments)}finally{_=z}}}}(Z_)),Z_}var Gk;function GL(){return Gk||(Gk=1,X_.exports=KL()),X_.exports}var Q_={exports:{}},Ar={};/**
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 Yk;function YL(){if(Yk)return Ar;Yk=1;var e=d0();function t(h){var d="https://react.dev/errors/"+h;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)d+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+h+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function o(h,d,g){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:p==null?null:""+p,children:h,containerInfo:d,implementation:g}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Ar.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Ar.createPortal=function(h,d){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return o(h,d,null,g)},Ar.flushSync=function(h){var d=l.T,g=r.p;try{if(l.T=null,r.p=2,h)return h()}finally{l.T=d,r.p=g,r.d.f()}},Ar.preconnect=function(h,d){typeof h=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(h,d))},Ar.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},Ar.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var g=d.as,p=c(g,d.crossOrigin),_=typeof d.integrity=="string"?d.integrity:void 0,y=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;g==="style"?r.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:p,integrity:_,fetchPriority:y}):g==="script"&&r.d.X(h,{crossOrigin:p,integrity:_,fetchPriority:y,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Ar.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var g=c(d.as,d.crossOrigin);r.d.M(h,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(h)},Ar.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var g=d.as,p=c(g,d.crossOrigin);r.d.L(h,g,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Ar.preloadModule=function(h,d){if(typeof h=="string")if(d){var g=c(d.as,d.crossOrigin);r.d.m(h,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(h)},Ar.requestFormReset=function(h){r.d.r(h)},Ar.unstable_batchedUpdates=function(h,d){return h(d)},Ar.useFormState=function(h,d,g){return l.H.useFormState(h,d,g)},Ar.useFormStatus=function(){return l.H.useHostTransitionStatus()},Ar.version="19.2.1",Ar}var Xk;function wN(){if(Xk)return Q_.exports;Xk=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(),Q_.exports=YL(),Q_.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 Zk;function XL(){if(Zk)return ad;Zk=1;var e=GL(),t=d0(),n=wN();function r(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var a=s,u=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(u=a.return),s=a.return;while(s)}return a.tag===3?u:null}function l(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function c(s){if(s.tag===31){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function h(s){if(o(s)!==s)throw Error(r(188))}function d(s){var a=s.alternate;if(!a){if(a=o(s),a===null)throw Error(r(188));return a!==s?null:s}for(var u=s,m=a;;){var b=u.return;if(b===null)break;var x=b.alternate;if(x===null){if(m=b.return,m!==null){u=m;continue}break}if(b.child===x.child){for(x=b.child;x;){if(x===u)return h(b),s;if(x===m)return h(b),a;x=x.sibling}throw Error(r(188))}if(u.return!==m.return)u=b,m=x;else{for(var T=!1,P=b.child;P;){if(P===u){T=!0,u=b,m=x;break}if(P===m){T=!0,m=b,u=x;break}P=P.sibling}if(!T){for(P=x.child;P;){if(P===u){T=!0,u=x,m=b;break}if(P===m){T=!0,m=x,u=b;break}P=P.sibling}if(!T)throw Error(r(189))}}if(u.alternate!==m)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?s:a}function g(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=g(s),a!==null)return a;s=s.sibling}return null}var p=Object.assign,_=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),E=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function F(s){return s===null||typeof s!="object"?null:(s=W&&s[W]||s["@@iterator"],typeof s=="function"?s:null)}var $=Symbol.for("react.client.reference");function V(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===$?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case S:return"Fragment";case k:return"Profiler";case C:return"StrictMode";case L:return"Suspense";case j:return"SuspenseList";case Z:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case E:return s.displayName||"Context";case R:return(s._context.displayName||"Context")+".Consumer";case N:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case O:return a=s.displayName||null,a!==null?a:V(s.type)||"Memo";case H:a=s._payload,s=s._init;try{return V(s(a))}catch{}}return null}var q=Array.isArray,D=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z={pending:!1,data:null,method:null,action:null},G=[],M=-1;function B(s){return{current:s}}function X(s){0>M||(s.current=G[M],G[M]=null,M--)}function A(s,a){M++,G[M]=s.current,s.current=a}var ie=B(null),J=B(null),ee=B(null),re=B(null);function ue(s,a){switch(A(ee,a),A(J,s),A(ie,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?lk(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=lk(a),s=ck(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}X(ie),A(ie,s)}function fe(){X(ie),X(J),X(ee)}function ge(s){s.memoizedState!==null&&A(re,s);var a=ie.current,u=ck(a,s.type);a!==u&&(A(J,s),A(ie,u))}function Ce(s){J.current===s&&(X(ie),X(J)),re.current===s&&(X(re),td._currentValue=z)}var Te,je;function Xe(s){if(Te===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);Te=a&&a[1]||"",je=-1<u.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Te+s+je}var xt=!1;function Et(s,a){if(!s||xt)return"";xt=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(a){var be=function(){throw Error()};if(Object.defineProperty(be.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(be,[])}catch(he){var ce=he}Reflect.construct(s,[],be)}else{try{be.call()}catch(he){ce=he}s.call(be.prototype)}}else{try{throw Error()}catch(he){ce=he}(be=s())&&typeof be.catch=="function"&&be.catch(function(){})}}catch(he){if(he&&ce&&typeof he.stack=="string")return[he.stack,ce.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=m.DetermineComponentFrameRoot(),T=x[0],P=x[1];if(T&&P){var Q=T.split(`
44
+ `),le=P.split(`
45
+ `);for(b=m=0;m<Q.length&&!Q[m].includes("DetermineComponentFrameRoot");)m++;for(;b<le.length&&!le[b].includes("DetermineComponentFrameRoot");)b++;if(m===Q.length||b===le.length)for(m=Q.length-1,b=le.length-1;1<=m&&0<=b&&Q[m]!==le[b];)b--;for(;1<=m&&0<=b;m--,b--)if(Q[m]!==le[b]){if(m!==1||b!==1)do if(m--,b--,0>b||Q[m]!==le[b]){var ve=`
46
+ `+Q[m].replace(" at new "," at ");return s.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",s.displayName)),ve}while(1<=m&&0<=b);break}}}finally{xt=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?Xe(u):""}function me(s,a){switch(s.tag){case 26:case 27:case 5:return Xe(s.type);case 16:return Xe("Lazy");case 13:return s.child!==a&&a!==null?Xe("Suspense Fallback"):Xe("Suspense");case 19:return Xe("SuspenseList");case 0:case 15:return Et(s.type,!1);case 11:return Et(s.type.render,!1);case 1:return Et(s.type,!0);case 31:return Xe("Activity");default:return""}}function Fe(s){try{var a="",u=null;do a+=me(s,u),u=s,s=s.return;while(s);return a}catch(m){return`
47
+ Error generating stack: `+m.message+`
48
+ `+m.stack}}var De=Object.prototype.hasOwnProperty,ft=e.unstable_scheduleCallback,at=e.unstable_cancelCallback,it=e.unstable_shouldYield,hn=e.unstable_requestPaint,Mt=e.unstable_now,Pn=e.unstable_getCurrentPriorityLevel,de=e.unstable_ImmediatePriority,se=e.unstable_UserBlockingPriority,ye=e.unstable_NormalPriority,Ee=e.unstable_LowPriority,qe=e.unstable_IdlePriority,lt=e.log,Je=e.unstable_setDisableYieldValue,Ae=null,He=null;function mt(s){if(typeof lt=="function"&&Je(s),He&&typeof He.setStrictMode=="function")try{He.setStrictMode(Ae,s)}catch{}}var Ve=Math.clz32?Math.clz32:et,fn=Math.log,rn=Math.LN2;function et(s){return s>>>=0,s===0?32:31-(fn(s)/rn|0)|0}var en=256,Un=262144,Qt=4194304;function qt(s){var a=s&42;if(a!==0)return a;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Ie(s,a,u){var m=s.pendingLanes;if(m===0)return 0;var b=0,x=s.suspendedLanes,T=s.pingedLanes;s=s.warmLanes;var P=m&134217727;return P!==0?(m=P&~x,m!==0?b=qt(m):(T&=P,T!==0?b=qt(T):u||(u=P&~s,u!==0&&(b=qt(u))))):(P=m&~x,P!==0?b=qt(P):T!==0?b=qt(T):u||(u=m&~s,u!==0&&(b=qt(u)))),b===0?0:a!==0&&a!==b&&(a&x)===0&&(x=b&-b,u=a&-a,x>=u||x===32&&(u&4194048)!==0)?a:b}function gt(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function wt(s,a){switch(s){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 Rt(){var s=Qt;return Qt<<=1,(Qt&62914560)===0&&(Qt=4194304),s}function Jt(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function vt(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function _t(s,a,u,m,b,x){var T=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var P=s.entanglements,Q=s.expirationTimes,le=s.hiddenUpdates;for(u=T&~u;0<u;){var ve=31-Ve(u),be=1<<ve;P[ve]=0,Q[ve]=-1;var ce=le[ve];if(ce!==null)for(le[ve]=null,ve=0;ve<ce.length;ve++){var he=ce[ve];he!==null&&(he.lane&=-536870913)}u&=~be}m!==0&&Sn(s,m,0),x!==0&&b===0&&s.tag!==0&&(s.suspendedLanes|=x&~(T&~a))}function Sn(s,a,u){s.pendingLanes|=a,s.suspendedLanes&=~a;var m=31-Ve(a);s.entangledLanes|=a,s.entanglements[m]=s.entanglements[m]|1073741824|u&261930}function ke(s,a){var u=s.entangledLanes|=a;for(s=s.entanglements;u;){var m=31-Ve(u),b=1<<m;b&a|s[m]&a&&(s[m]|=a),u&=~b}}function Oe(s,a){var u=a&-a;return u=(u&42)!==0?1:Tt(u),(u&(s.suspendedLanes|a))!==0?0:u}function Tt(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function ct(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function mn(){var s=U.p;return s!==0?s:(s=window.event,s===void 0?32:jk(s.type))}function bn(s,a){var u=U.p;try{return U.p=s,a()}finally{U.p=u}}var sn=Math.random().toString(36).slice(2),Kt="__reactFiber$"+sn,Gt="__reactProps$"+sn,Mr="__reactContainer$"+sn,fs="__reactEvents$"+sn,Dl="__reactListeners$"+sn,K="__reactHandles$"+sn,st="__reactResources$"+sn,Vn="__reactMarker$"+sn;function ms(s){delete s[Kt],delete s[Gt],delete s[fs],delete s[Dl],delete s[K]}function Ei(s){var a=s[Kt];if(a)return a;for(var u=s.parentNode;u;){if(a=u[Mr]||u[Kt]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(s=gk(s);s!==null;){if(u=s[Kt])return u;s=gk(s)}return a}s=u,u=s.parentNode}return null}function Ft(s){if(s=s[Kt]||s[Mr]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function In(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(r(33))}function ps(s){var a=s[st];return a||(a=s[st]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Wn(s){s[Vn]=!0}var Fh=new Set,Hh={};function $s(s,a){jo(s,a),jo(s+"Capture",a)}function jo(s,a){for(Hh[s]=a,s=0;s<a.length;s++)Fh.add(a[s])}var Fg=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]*$"),$h={},Uh={};function Hg(s){return De.call(Uh,s)?!0:De.call($h,s)?!1:Fg.test(s)?Uh[s]=!0:($h[s]=!0,!1)}function Ol(s,a,u){if(Hg(a))if(u===null)s.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":s.removeAttribute(a);return;case"boolean":var m=a.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){s.removeAttribute(a);return}}s.setAttribute(a,""+u)}}function Ll(s,a,u){if(u===null)s.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttribute(a,""+u)}}function Qi(s,a,u,m){if(m===null)s.removeAttribute(u);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(u);return}s.setAttributeNS(a,u,""+m)}}function yr(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Vh(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function $g(s,a,u){var m=Object.getOwnPropertyDescriptor(s.constructor.prototype,a);if(!s.hasOwnProperty(a)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var b=m.get,x=m.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return b.call(this)},set:function(T){u=""+T,x.call(this,T)}}),Object.defineProperty(s,a,{enumerable:m.enumerable}),{getValue:function(){return u},setValue:function(T){u=""+T},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function pu(s){if(!s._valueTracker){var a=Vh(s)?"checked":"value";s._valueTracker=$g(s,a,""+s[a])}}function gu(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var u=a.getValue(),m="";return s&&(m=Vh(s)?s.checked?"true":"false":s.value),s=m,s!==u?(a.setValue(s),!0):!1}function Aa(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Wh=/[\n"\\]/g;function Y(s){return s.replace(Wh,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function ne(s,a,u,m,b,x,T,P){s.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?s.type=T:s.removeAttribute("type"),a!=null?T==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+yr(a)):s.value!==""+yr(a)&&(s.value=""+yr(a)):T!=="submit"&&T!=="reset"||s.removeAttribute("value"),a!=null?$e(s,T,yr(a)):u!=null?$e(s,T,yr(u)):m!=null&&s.removeAttribute("value"),b==null&&x!=null&&(s.defaultChecked=!!x),b!=null&&(s.checked=b&&typeof b!="function"&&typeof b!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?s.name=""+yr(P):s.removeAttribute("name")}function Se(s,a,u,m,b,x,T,P){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.type=x),a!=null||u!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){pu(s);return}u=u!=null?""+yr(u):"",a=a!=null?""+yr(a):u,P||a===s.value||(s.value=a),s.defaultValue=a}m=m??b,m=typeof m!="function"&&typeof m!="symbol"&&!!m,s.checked=P?s.checked:!!m,s.defaultChecked=!!m,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(s.name=T),pu(s)}function $e(s,a,u){a==="number"&&Aa(s.ownerDocument)===s||s.defaultValue===""+u||(s.defaultValue=""+u)}function It(s,a,u,m){if(s=s.options,a){a={};for(var b=0;b<u.length;b++)a["$"+u[b]]=!0;for(u=0;u<s.length;u++)b=a.hasOwnProperty("$"+s[u].value),s[u].selected!==b&&(s[u].selected=b),b&&m&&(s[u].defaultSelected=!0)}else{for(u=""+yr(u),a=null,b=0;b<s.length;b++){if(s[b].value===u){s[b].selected=!0,m&&(s[b].defaultSelected=!0);return}a!==null||s[b].disabled||(a=s[b])}a!==null&&(a.selected=!0)}}function Cn(s,a,u){if(a!=null&&(a=""+yr(a),a!==s.value&&(s.value=a),u==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=u!=null?""+yr(u):""}function xr(s,a,u,m){if(a==null){if(m!=null){if(u!=null)throw Error(r(92));if(q(m)){if(1<m.length)throw Error(r(93));m=m[0]}u=m}u==null&&(u=""),a=u}u=yr(a),s.defaultValue=u,m=s.textContent,m===u&&m!==""&&m!==null&&(s.value=m),pu(s)}function Gr(s,a){if(a){var u=s.firstChild;if(u&&u===s.lastChild&&u.nodeType===3){u.nodeValue=a;return}}s.textContent=a}var qh=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 vu(s,a,u){var m=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?m?s.setProperty(a,""):a==="float"?s.cssFloat="":s[a]="":m?s.setProperty(a,u):typeof u!="number"||u===0||qh.has(a)?a==="float"?s.cssFloat=u:s[a]=(""+u).trim():s[a]=u+"px"}function o1(s,a,u){if(a!=null&&typeof a!="object")throw Error(r(62));if(s=s.style,u!=null){for(var m in u)!u.hasOwnProperty(m)||a!=null&&a.hasOwnProperty(m)||(m.indexOf("--")===0?s.setProperty(m,""):m==="float"?s.cssFloat="":s[m]="");for(var b in a)m=a[b],a.hasOwnProperty(b)&&u[b]!==m&&vu(s,b,m)}else for(var x in a)a.hasOwnProperty(x)&&vu(s,x,a[x])}function Ug(s){if(s.indexOf("-")===-1)return!1;switch(s){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 PO=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"]]),IO=/^[\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 Kh(s){return IO.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Us(){}var Vg=null;function Wg(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var zl=null,Pl=null;function a1(s){var a=Ft(s);if(a&&(s=a.stateNode)){var u=s[Gt]||null;e:switch(s=a.stateNode,a.type){case"input":if(ne(s,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=s;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Y(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var m=u[a];if(m!==s&&m.form===s.form){var b=m[Gt]||null;if(!b)throw Error(r(90));ne(m,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(a=0;a<u.length;a++)m=u[a],m.form===s.form&&gu(m)}break e;case"textarea":Cn(s,u.value,u.defaultValue);break e;case"select":a=u.value,a!=null&&It(s,!!u.multiple,a,!1)}}}var qg=!1;function l1(s,a,u){if(qg)return s(a,u);qg=!0;try{var m=s(a);return m}finally{if(qg=!1,(zl!==null||Pl!==null)&&(Lf(),zl&&(a=zl,s=Pl,Pl=zl=null,a1(a),s)))for(a=0;a<s.length;a++)a1(s[a])}}function _u(s,a){var u=s.stateNode;if(u===null)return null;var m=u[Gt]||null;if(m===null)return null;u=m[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":(m=!m.disabled)||(s=s.type,m=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!m;break e;default:s=!1}if(s)return null;if(u&&typeof u!="function")throw Error(r(231,a,typeof u));return u}var Vs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Kg=!1;if(Vs)try{var bu={};Object.defineProperty(bu,"passive",{get:function(){Kg=!0}}),window.addEventListener("test",bu,bu),window.removeEventListener("test",bu,bu)}catch{Kg=!1}var Do=null,Gg=null,Gh=null;function c1(){if(Gh)return Gh;var s,a=Gg,u=a.length,m,b="value"in Do?Do.value:Do.textContent,x=b.length;for(s=0;s<u&&a[s]===b[s];s++);var T=u-s;for(m=1;m<=T&&a[u-m]===b[x-m];m++);return Gh=b.slice(s,1<m?1-m:void 0)}function Yh(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function Xh(){return!0}function u1(){return!1}function Yr(s){function a(u,m,b,x,T){this._reactName=u,this._targetInst=b,this.type=m,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var P in s)s.hasOwnProperty(P)&&(u=s[P],this[P]=u?u(x):x[P]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Xh:u1,this.isPropagationStopped=u1,this}return p(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Xh)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Xh)},persist:function(){},isPersistent:Xh}),a}var ja={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zh=Yr(ja),yu=p({},ja,{view:0,detail:0}),BO=Yr(yu),Yg,Xg,xu,Qh=p({},yu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qg,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==xu&&(xu&&s.type==="mousemove"?(Yg=s.screenX-xu.screenX,Xg=s.screenY-xu.screenY):Xg=Yg=0,xu=s),Yg)},movementY:function(s){return"movementY"in s?s.movementY:Xg}}),d1=Yr(Qh),FO=p({},Qh,{dataTransfer:0}),HO=Yr(FO),$O=p({},yu,{relatedTarget:0}),Zg=Yr($O),UO=p({},ja,{animationName:0,elapsedTime:0,pseudoElement:0}),VO=Yr(UO),WO=p({},ja,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),qO=Yr(WO),KO=p({},ja,{data:0}),h1=Yr(KO),GO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},YO={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"},XO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ZO(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=XO[s])?!!a[s]:!1}function Qg(){return ZO}var QO=p({},yu,{key:function(s){if(s.key){var a=GO[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=Yh(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?YO[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qg,charCode:function(s){return s.type==="keypress"?Yh(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Yh(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),JO=Yr(QO),e3=p({},Qh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),f1=Yr(e3),t3=p({},yu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qg}),n3=Yr(t3),r3=p({},ja,{propertyName:0,elapsedTime:0,pseudoElement:0}),i3=Yr(r3),s3=p({},Qh,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),o3=Yr(s3),a3=p({},ja,{newState:0,oldState:0}),l3=Yr(a3),c3=[9,13,27,32],Jg=Vs&&"CompositionEvent"in window,wu=null;Vs&&"documentMode"in document&&(wu=document.documentMode);var u3=Vs&&"TextEvent"in window&&!wu,m1=Vs&&(!Jg||wu&&8<wu&&11>=wu),p1=" ",g1=!1;function v1(s,a){switch(s){case"keyup":return c3.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _1(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Il=!1;function d3(s,a){switch(s){case"compositionend":return _1(a);case"keypress":return a.which!==32?null:(g1=!0,p1);case"textInput":return s=a.data,s===p1&&g1?null:s;default:return null}}function h3(s,a){if(Il)return s==="compositionend"||!Jg&&v1(s,a)?(s=c1(),Gh=Gg=Do=null,Il=!1,s):null;switch(s){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 m1&&a.locale!=="ko"?null:a.data;default:return null}}var f3={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 b1(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!f3[s.type]:a==="textarea"}function y1(s,a,u,m){zl?Pl?Pl.push(m):Pl=[m]:zl=m,a=$f(a,"onChange"),0<a.length&&(u=new Zh("onChange","change",null,u,m),s.push({event:u,listeners:a}))}var Su=null,Cu=null;function m3(s){nk(s,0)}function Jh(s){var a=In(s);if(gu(a))return s}function x1(s,a){if(s==="change")return a}var w1=!1;if(Vs){var ev;if(Vs){var tv="oninput"in document;if(!tv){var S1=document.createElement("div");S1.setAttribute("oninput","return;"),tv=typeof S1.oninput=="function"}ev=tv}else ev=!1;w1=ev&&(!document.documentMode||9<document.documentMode)}function C1(){Su&&(Su.detachEvent("onpropertychange",k1),Cu=Su=null)}function k1(s){if(s.propertyName==="value"&&Jh(Cu)){var a=[];y1(a,Cu,s,Wg(s)),l1(m3,a)}}function p3(s,a,u){s==="focusin"?(C1(),Su=a,Cu=u,Su.attachEvent("onpropertychange",k1)):s==="focusout"&&C1()}function g3(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Jh(Cu)}function v3(s,a){if(s==="click")return Jh(a)}function _3(s,a){if(s==="input"||s==="change")return Jh(a)}function b3(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var ci=typeof Object.is=="function"?Object.is:b3;function ku(s,a){if(ci(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var u=Object.keys(s),m=Object.keys(a);if(u.length!==m.length)return!1;for(m=0;m<u.length;m++){var b=u[m];if(!De.call(a,b)||!ci(s[b],a[b]))return!1}return!0}function E1(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function R1(s,a){var u=E1(s);s=0;for(var m;u;){if(u.nodeType===3){if(m=s+u.textContent.length,s<=a&&m>=a)return{node:u,offset:a-s};s=m}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=E1(u)}}function T1(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?T1(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function N1(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=Aa(s.document);a instanceof s.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)s=a.contentWindow;else break;a=Aa(s.document)}return a}function nv(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}var y3=Vs&&"documentMode"in document&&11>=document.documentMode,Bl=null,rv=null,Eu=null,iv=!1;function M1(s,a,u){var m=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;iv||Bl==null||Bl!==Aa(m)||(m=Bl,"selectionStart"in m&&nv(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Eu&&ku(Eu,m)||(Eu=m,m=$f(rv,"onSelect"),0<m.length&&(a=new Zh("onSelect","select",null,a,u),s.push({event:a,listeners:m}),a.target=Bl)))}function Da(s,a){var u={};return u[s.toLowerCase()]=a.toLowerCase(),u["Webkit"+s]="webkit"+a,u["Moz"+s]="moz"+a,u}var Fl={animationend:Da("Animation","AnimationEnd"),animationiteration:Da("Animation","AnimationIteration"),animationstart:Da("Animation","AnimationStart"),transitionrun:Da("Transition","TransitionRun"),transitionstart:Da("Transition","TransitionStart"),transitioncancel:Da("Transition","TransitionCancel"),transitionend:Da("Transition","TransitionEnd")},sv={},A1={};Vs&&(A1=document.createElement("div").style,"AnimationEvent"in window||(delete Fl.animationend.animation,delete Fl.animationiteration.animation,delete Fl.animationstart.animation),"TransitionEvent"in window||delete Fl.transitionend.transition);function Oa(s){if(sv[s])return sv[s];if(!Fl[s])return s;var a=Fl[s],u;for(u in a)if(a.hasOwnProperty(u)&&u in A1)return sv[s]=a[u];return s}var j1=Oa("animationend"),D1=Oa("animationiteration"),O1=Oa("animationstart"),x3=Oa("transitionrun"),w3=Oa("transitionstart"),S3=Oa("transitioncancel"),L1=Oa("transitionend"),z1=new Map,ov="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(" ");ov.push("scrollEnd");function Ji(s,a){z1.set(s,a),$s(a,[s])}var ef=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Ri=[],Hl=0,av=0;function tf(){for(var s=Hl,a=av=Hl=0;a<s;){var u=Ri[a];Ri[a++]=null;var m=Ri[a];Ri[a++]=null;var b=Ri[a];Ri[a++]=null;var x=Ri[a];if(Ri[a++]=null,m!==null&&b!==null){var T=m.pending;T===null?b.next=b:(b.next=T.next,T.next=b),m.pending=b}x!==0&&P1(u,b,x)}}function nf(s,a,u,m){Ri[Hl++]=s,Ri[Hl++]=a,Ri[Hl++]=u,Ri[Hl++]=m,av|=m,s.lanes|=m,s=s.alternate,s!==null&&(s.lanes|=m)}function lv(s,a,u,m){return nf(s,a,u,m),rf(s)}function La(s,a){return nf(s,null,null,a),rf(s)}function P1(s,a,u){s.lanes|=u;var m=s.alternate;m!==null&&(m.lanes|=u);for(var b=!1,x=s.return;x!==null;)x.childLanes|=u,m=x.alternate,m!==null&&(m.childLanes|=u),x.tag===22&&(s=x.stateNode,s===null||s._visibility&1||(b=!0)),s=x,x=x.return;return s.tag===3?(x=s.stateNode,b&&a!==null&&(b=31-Ve(u),s=x.hiddenUpdates,m=s[b],m===null?s[b]=[a]:m.push(a),a.lane=u|536870912),x):null}function rf(s){if(50<Gu)throw Gu=0,v_=null,Error(r(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var $l={};function C3(s,a,u,m){this.tag=s,this.key=u,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=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ui(s,a,u,m){return new C3(s,a,u,m)}function cv(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Ws(s,a){var u=s.alternate;return u===null?(u=ui(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function I1(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function sf(s,a,u,m,b,x){var T=0;if(m=s,typeof s=="function")cv(s)&&(T=1);else if(typeof s=="string")T=NL(s,u,ie.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case Z:return s=ui(31,u,a,b),s.elementType=Z,s.lanes=x,s;case S:return za(u.children,b,x,a);case C:T=8,b|=24;break;case k:return s=ui(12,u,a,b|2),s.elementType=k,s.lanes=x,s;case L:return s=ui(13,u,a,b),s.elementType=L,s.lanes=x,s;case j:return s=ui(19,u,a,b),s.elementType=j,s.lanes=x,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case E:T=10;break e;case R:T=9;break e;case N:T=11;break e;case O:T=14;break e;case H:T=16,m=null;break e}T=29,u=Error(r(130,s===null?"null":typeof s,"")),m=null}return a=ui(T,u,a,b),a.elementType=s,a.type=m,a.lanes=x,a}function za(s,a,u,m){return s=ui(7,s,m,a),s.lanes=u,s}function uv(s,a,u){return s=ui(6,s,null,a),s.lanes=u,s}function B1(s){var a=ui(18,null,null,0);return a.stateNode=s,a}function dv(s,a,u){return a=ui(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var F1=new WeakMap;function Ti(s,a){if(typeof s=="object"&&s!==null){var u=F1.get(s);return u!==void 0?u:(a={value:s,source:a,stack:Fe(a)},F1.set(s,a),a)}return{value:s,source:a,stack:Fe(a)}}var Ul=[],Vl=0,of=null,Ru=0,Ni=[],Mi=0,Oo=null,gs=1,vs="";function qs(s,a){Ul[Vl++]=Ru,Ul[Vl++]=of,of=s,Ru=a}function H1(s,a,u){Ni[Mi++]=gs,Ni[Mi++]=vs,Ni[Mi++]=Oo,Oo=s;var m=gs;s=vs;var b=32-Ve(m)-1;m&=~(1<<b),u+=1;var x=32-Ve(a)+b;if(30<x){var T=b-b%5;x=(m&(1<<T)-1).toString(32),m>>=T,b-=T,gs=1<<32-Ve(a)+b|u<<b|m,vs=x+s}else gs=1<<x|u<<b|m,vs=s}function hv(s){s.return!==null&&(qs(s,1),H1(s,1,0))}function fv(s){for(;s===of;)of=Ul[--Vl],Ul[Vl]=null,Ru=Ul[--Vl],Ul[Vl]=null;for(;s===Oo;)Oo=Ni[--Mi],Ni[Mi]=null,vs=Ni[--Mi],Ni[Mi]=null,gs=Ni[--Mi],Ni[Mi]=null}function $1(s,a){Ni[Mi++]=gs,Ni[Mi++]=vs,Ni[Mi++]=Oo,gs=a.id,vs=a.overflow,Oo=s}var wr=null,yn=null,Pt=!1,Lo=null,Ai=!1,mv=Error(r(519));function zo(s){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Tu(Ti(a,s)),mv}function U1(s){var a=s.stateNode,u=s.type,m=s.memoizedProps;switch(a[Kt]=s,a[Gt]=m,u){case"dialog":jt("cancel",a),jt("close",a);break;case"iframe":case"object":case"embed":jt("load",a);break;case"video":case"audio":for(u=0;u<Xu.length;u++)jt(Xu[u],a);break;case"source":jt("error",a);break;case"img":case"image":case"link":jt("error",a),jt("load",a);break;case"details":jt("toggle",a);break;case"input":jt("invalid",a),Se(a,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":jt("invalid",a);break;case"textarea":jt("invalid",a),xr(a,m.value,m.defaultValue,m.children)}u=m.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||a.textContent===""+u||m.suppressHydrationWarning===!0||ok(a.textContent,u)?(m.popover!=null&&(jt("beforetoggle",a),jt("toggle",a)),m.onScroll!=null&&jt("scroll",a),m.onScrollEnd!=null&&jt("scrollend",a),m.onClick!=null&&(a.onclick=Us),a=!0):a=!1,a||zo(s,!0)}function V1(s){for(wr=s.return;wr;)switch(wr.tag){case 5:case 31:case 13:Ai=!1;return;case 27:case 3:Ai=!0;return;default:wr=wr.return}}function Wl(s){if(s!==wr)return!1;if(!Pt)return V1(s),Pt=!0,!1;var a=s.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=s.type,u=!(u!=="form"&&u!=="button")||j_(s.type,s.memoizedProps)),u=!u),u&&yn&&zo(s),V1(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));yn=pk(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));yn=pk(s)}else a===27?(a=yn,Xo(s.type)?(s=P_,P_=null,yn=s):yn=a):yn=wr?Di(s.stateNode.nextSibling):null;return!0}function Pa(){yn=wr=null,Pt=!1}function pv(){var s=Lo;return s!==null&&(Jr===null?Jr=s:Jr.push.apply(Jr,s),Lo=null),s}function Tu(s){Lo===null?Lo=[s]:Lo.push(s)}var gv=B(null),Ia=null,Ks=null;function Po(s,a,u){A(gv,a._currentValue),a._currentValue=u}function Gs(s){s._currentValue=gv.current,X(gv)}function vv(s,a,u){for(;s!==null;){var m=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,m!==null&&(m.childLanes|=a)):m!==null&&(m.childLanes&a)!==a&&(m.childLanes|=a),s===u)break;s=s.return}}function _v(s,a,u,m){var b=s.child;for(b!==null&&(b.return=s);b!==null;){var x=b.dependencies;if(x!==null){var T=b.child;x=x.firstContext;e:for(;x!==null;){var P=x;x=b;for(var Q=0;Q<a.length;Q++)if(P.context===a[Q]){x.lanes|=u,P=x.alternate,P!==null&&(P.lanes|=u),vv(x.return,u,s),m||(T=null);break e}x=P.next}}else if(b.tag===18){if(T=b.return,T===null)throw Error(r(341));T.lanes|=u,x=T.alternate,x!==null&&(x.lanes|=u),vv(T,u,s),T=null}else T=b.child;if(T!==null)T.return=b;else for(T=b;T!==null;){if(T===s){T=null;break}if(b=T.sibling,b!==null){b.return=T.return,T=b;break}T=T.return}b=T}}function ql(s,a,u,m){s=null;for(var b=a,x=!1;b!==null;){if(!x){if((b.flags&524288)!==0)x=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var T=b.alternate;if(T===null)throw Error(r(387));if(T=T.memoizedProps,T!==null){var P=b.type;ci(b.pendingProps.value,T.value)||(s!==null?s.push(P):s=[P])}}else if(b===re.current){if(T=b.alternate,T===null)throw Error(r(387));T.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(s!==null?s.push(td):s=[td])}b=b.return}s!==null&&_v(a,s,u,m),a.flags|=262144}function af(s){for(s=s.firstContext;s!==null;){if(!ci(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Ba(s){Ia=s,Ks=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Sr(s){return W1(Ia,s)}function lf(s,a){return Ia===null&&Ba(s),W1(s,a)}function W1(s,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},Ks===null){if(s===null)throw Error(r(308));Ks=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else Ks=Ks.next=a;return u}var k3=typeof AbortController<"u"?AbortController:function(){var s=[],a=this.signal={aborted:!1,addEventListener:function(u,m){s.push(m)}};this.abort=function(){a.aborted=!0,s.forEach(function(u){return u()})}},E3=e.unstable_scheduleCallback,R3=e.unstable_NormalPriority,qn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bv(){return{controller:new k3,data:new Map,refCount:0}}function Nu(s){s.refCount--,s.refCount===0&&E3(R3,function(){s.controller.abort()})}var Mu=null,yv=0,Kl=0,Gl=null;function T3(s,a){if(Mu===null){var u=Mu=[];yv=0,Kl=S_(),Gl={status:"pending",value:void 0,then:function(m){u.push(m)}}}return yv++,a.then(q1,q1),a}function q1(){if(--yv===0&&Mu!==null){Gl!==null&&(Gl.status="fulfilled");var s=Mu;Mu=null,Kl=0,Gl=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function N3(s,a){var u=[],m={status:"pending",value:null,reason:null,then:function(b){u.push(b)}};return s.then(function(){m.status="fulfilled",m.value=a;for(var b=0;b<u.length;b++)(0,u[b])(a)},function(b){for(m.status="rejected",m.reason=b,b=0;b<u.length;b++)(0,u[b])(void 0)}),m}var K1=D.S;D.S=function(s,a){MC=Mt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&T3(s,a),K1!==null&&K1(s,a)};var Fa=B(null);function xv(){var s=Fa.current;return s!==null?s:pn.pooledCache}function cf(s,a){a===null?A(Fa,Fa.current):A(Fa,a.pool)}function G1(){var s=xv();return s===null?null:{parent:qn._currentValue,pool:s}}var Yl=Error(r(460)),wv=Error(r(474)),uf=Error(r(542)),df={then:function(){}};function Y1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function X1(s,a,u){switch(u=s[u],u===void 0?s.push(a):u!==a&&(a.then(Us,Us),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Q1(s),s;default:if(typeof a.status=="string")a.then(Us,Us);else{if(s=pn,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=a,s.status="pending",s.then(function(m){if(a.status==="pending"){var b=a;b.status="fulfilled",b.value=m}},function(m){if(a.status==="pending"){var b=a;b.status="rejected",b.reason=m}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Q1(s),s}throw $a=a,Yl}}function Ha(s){try{var a=s._init;return a(s._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?($a=u,Yl):u}}var $a=null;function Z1(){if($a===null)throw Error(r(459));var s=$a;return $a=null,s}function Q1(s){if(s===Yl||s===uf)throw Error(r(483))}var Xl=null,Au=0;function hf(s){var a=Au;return Au+=1,Xl===null&&(Xl=[]),X1(Xl,s,a)}function ju(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function ff(s,a){throw a.$$typeof===_?Error(r(525)):(s=Object.prototype.toString.call(a),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function J1(s){function a(oe,te){if(s){var ae=oe.deletions;ae===null?(oe.deletions=[te],oe.flags|=16):ae.push(te)}}function u(oe,te){if(!s)return null;for(;te!==null;)a(oe,te),te=te.sibling;return null}function m(oe){for(var te=new Map;oe!==null;)oe.key!==null?te.set(oe.key,oe):te.set(oe.index,oe),oe=oe.sibling;return te}function b(oe,te){return oe=Ws(oe,te),oe.index=0,oe.sibling=null,oe}function x(oe,te,ae){return oe.index=ae,s?(ae=oe.alternate,ae!==null?(ae=ae.index,ae<te?(oe.flags|=67108866,te):ae):(oe.flags|=67108866,te)):(oe.flags|=1048576,te)}function T(oe){return s&&oe.alternate===null&&(oe.flags|=67108866),oe}function P(oe,te,ae,_e){return te===null||te.tag!==6?(te=uv(ae,oe.mode,_e),te.return=oe,te):(te=b(te,ae),te.return=oe,te)}function Q(oe,te,ae,_e){var tt=ae.type;return tt===S?ve(oe,te,ae.props.children,_e,ae.key):te!==null&&(te.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===H&&Ha(tt)===te.type)?(te=b(te,ae.props),ju(te,ae),te.return=oe,te):(te=sf(ae.type,ae.key,ae.props,null,oe.mode,_e),ju(te,ae),te.return=oe,te)}function le(oe,te,ae,_e){return te===null||te.tag!==4||te.stateNode.containerInfo!==ae.containerInfo||te.stateNode.implementation!==ae.implementation?(te=dv(ae,oe.mode,_e),te.return=oe,te):(te=b(te,ae.children||[]),te.return=oe,te)}function ve(oe,te,ae,_e,tt){return te===null||te.tag!==7?(te=za(ae,oe.mode,_e,tt),te.return=oe,te):(te=b(te,ae),te.return=oe,te)}function be(oe,te,ae){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=uv(""+te,oe.mode,ae),te.return=oe,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case y:return ae=sf(te.type,te.key,te.props,null,oe.mode,ae),ju(ae,te),ae.return=oe,ae;case w:return te=dv(te,oe.mode,ae),te.return=oe,te;case H:return te=Ha(te),be(oe,te,ae)}if(q(te)||F(te))return te=za(te,oe.mode,ae,null),te.return=oe,te;if(typeof te.then=="function")return be(oe,hf(te),ae);if(te.$$typeof===E)return be(oe,lf(oe,te),ae);ff(oe,te)}return null}function ce(oe,te,ae,_e){var tt=te!==null?te.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return tt!==null?null:P(oe,te,""+ae,_e);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case y:return ae.key===tt?Q(oe,te,ae,_e):null;case w:return ae.key===tt?le(oe,te,ae,_e):null;case H:return ae=Ha(ae),ce(oe,te,ae,_e)}if(q(ae)||F(ae))return tt!==null?null:ve(oe,te,ae,_e,null);if(typeof ae.then=="function")return ce(oe,te,hf(ae),_e);if(ae.$$typeof===E)return ce(oe,te,lf(oe,ae),_e);ff(oe,ae)}return null}function he(oe,te,ae,_e,tt){if(typeof _e=="string"&&_e!==""||typeof _e=="number"||typeof _e=="bigint")return oe=oe.get(ae)||null,P(te,oe,""+_e,tt);if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case y:return oe=oe.get(_e.key===null?ae:_e.key)||null,Q(te,oe,_e,tt);case w:return oe=oe.get(_e.key===null?ae:_e.key)||null,le(te,oe,_e,tt);case H:return _e=Ha(_e),he(oe,te,ae,_e,tt)}if(q(_e)||F(_e))return oe=oe.get(ae)||null,ve(te,oe,_e,tt,null);if(typeof _e.then=="function")return he(oe,te,ae,hf(_e),tt);if(_e.$$typeof===E)return he(oe,te,ae,lf(te,_e),tt);ff(te,_e)}return null}function Ue(oe,te,ae,_e){for(var tt=null,Ut=null,Ye=te,bt=te=0,zt=null;Ye!==null&&bt<ae.length;bt++){Ye.index>bt?(zt=Ye,Ye=null):zt=Ye.sibling;var Vt=ce(oe,Ye,ae[bt],_e);if(Vt===null){Ye===null&&(Ye=zt);break}s&&Ye&&Vt.alternate===null&&a(oe,Ye),te=x(Vt,te,bt),Ut===null?tt=Vt:Ut.sibling=Vt,Ut=Vt,Ye=zt}if(bt===ae.length)return u(oe,Ye),Pt&&qs(oe,bt),tt;if(Ye===null){for(;bt<ae.length;bt++)Ye=be(oe,ae[bt],_e),Ye!==null&&(te=x(Ye,te,bt),Ut===null?tt=Ye:Ut.sibling=Ye,Ut=Ye);return Pt&&qs(oe,bt),tt}for(Ye=m(Ye);bt<ae.length;bt++)zt=he(Ye,oe,bt,ae[bt],_e),zt!==null&&(s&&zt.alternate!==null&&Ye.delete(zt.key===null?bt:zt.key),te=x(zt,te,bt),Ut===null?tt=zt:Ut.sibling=zt,Ut=zt);return s&&Ye.forEach(function(ta){return a(oe,ta)}),Pt&&qs(oe,bt),tt}function rt(oe,te,ae,_e){if(ae==null)throw Error(r(151));for(var tt=null,Ut=null,Ye=te,bt=te=0,zt=null,Vt=ae.next();Ye!==null&&!Vt.done;bt++,Vt=ae.next()){Ye.index>bt?(zt=Ye,Ye=null):zt=Ye.sibling;var ta=ce(oe,Ye,Vt.value,_e);if(ta===null){Ye===null&&(Ye=zt);break}s&&Ye&&ta.alternate===null&&a(oe,Ye),te=x(ta,te,bt),Ut===null?tt=ta:Ut.sibling=ta,Ut=ta,Ye=zt}if(Vt.done)return u(oe,Ye),Pt&&qs(oe,bt),tt;if(Ye===null){for(;!Vt.done;bt++,Vt=ae.next())Vt=be(oe,Vt.value,_e),Vt!==null&&(te=x(Vt,te,bt),Ut===null?tt=Vt:Ut.sibling=Vt,Ut=Vt);return Pt&&qs(oe,bt),tt}for(Ye=m(Ye);!Vt.done;bt++,Vt=ae.next())Vt=he(Ye,oe,bt,Vt.value,_e),Vt!==null&&(s&&Vt.alternate!==null&&Ye.delete(Vt.key===null?bt:Vt.key),te=x(Vt,te,bt),Ut===null?tt=Vt:Ut.sibling=Vt,Ut=Vt);return s&&Ye.forEach(function(FL){return a(oe,FL)}),Pt&&qs(oe,bt),tt}function ln(oe,te,ae,_e){if(typeof ae=="object"&&ae!==null&&ae.type===S&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case y:e:{for(var tt=ae.key;te!==null;){if(te.key===tt){if(tt=ae.type,tt===S){if(te.tag===7){u(oe,te.sibling),_e=b(te,ae.props.children),_e.return=oe,oe=_e;break e}}else if(te.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===H&&Ha(tt)===te.type){u(oe,te.sibling),_e=b(te,ae.props),ju(_e,ae),_e.return=oe,oe=_e;break e}u(oe,te);break}else a(oe,te);te=te.sibling}ae.type===S?(_e=za(ae.props.children,oe.mode,_e,ae.key),_e.return=oe,oe=_e):(_e=sf(ae.type,ae.key,ae.props,null,oe.mode,_e),ju(_e,ae),_e.return=oe,oe=_e)}return T(oe);case w:e:{for(tt=ae.key;te!==null;){if(te.key===tt)if(te.tag===4&&te.stateNode.containerInfo===ae.containerInfo&&te.stateNode.implementation===ae.implementation){u(oe,te.sibling),_e=b(te,ae.children||[]),_e.return=oe,oe=_e;break e}else{u(oe,te);break}else a(oe,te);te=te.sibling}_e=dv(ae,oe.mode,_e),_e.return=oe,oe=_e}return T(oe);case H:return ae=Ha(ae),ln(oe,te,ae,_e)}if(q(ae))return Ue(oe,te,ae,_e);if(F(ae)){if(tt=F(ae),typeof tt!="function")throw Error(r(150));return ae=tt.call(ae),rt(oe,te,ae,_e)}if(typeof ae.then=="function")return ln(oe,te,hf(ae),_e);if(ae.$$typeof===E)return ln(oe,te,lf(oe,ae),_e);ff(oe,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,te!==null&&te.tag===6?(u(oe,te.sibling),_e=b(te,ae),_e.return=oe,oe=_e):(u(oe,te),_e=uv(ae,oe.mode,_e),_e.return=oe,oe=_e),T(oe)):u(oe,te)}return function(oe,te,ae,_e){try{Au=0;var tt=ln(oe,te,ae,_e);return Xl=null,tt}catch(Ye){if(Ye===Yl||Ye===uf)throw Ye;var Ut=ui(29,Ye,null,oe.mode);return Ut.lanes=_e,Ut.return=oe,Ut}finally{}}}var Ua=J1(!0),eS=J1(!1),Io=!1;function Sv(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Cv(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Bo(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Fo(s,a,u){var m=s.updateQueue;if(m===null)return null;if(m=m.shared,(Yt&2)!==0){var b=m.pending;return b===null?a.next=a:(a.next=b.next,b.next=a),m.pending=a,a=rf(s),P1(s,null,u),a}return nf(s,m,a,u),rf(s)}function Du(s,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var m=a.lanes;m&=s.pendingLanes,u|=m,a.lanes=u,ke(s,u)}}function kv(s,a){var u=s.updateQueue,m=s.alternate;if(m!==null&&(m=m.updateQueue,u===m)){var b=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var T={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};x===null?b=x=T:x=x.next=T,u=u.next}while(u!==null);x===null?b=x=a:x=x.next=a}else b=x=a;u={baseState:m.baseState,firstBaseUpdate:b,lastBaseUpdate:x,shared:m.shared,callbacks:m.callbacks},s.updateQueue=u;return}s=u.lastBaseUpdate,s===null?u.firstBaseUpdate=a:s.next=a,u.lastBaseUpdate=a}var Ev=!1;function Ou(){if(Ev){var s=Gl;if(s!==null)throw s}}function Lu(s,a,u,m){Ev=!1;var b=s.updateQueue;Io=!1;var x=b.firstBaseUpdate,T=b.lastBaseUpdate,P=b.shared.pending;if(P!==null){b.shared.pending=null;var Q=P,le=Q.next;Q.next=null,T===null?x=le:T.next=le,T=Q;var ve=s.alternate;ve!==null&&(ve=ve.updateQueue,P=ve.lastBaseUpdate,P!==T&&(P===null?ve.firstBaseUpdate=le:P.next=le,ve.lastBaseUpdate=Q))}if(x!==null){var be=b.baseState;T=0,ve=le=Q=null,P=x;do{var ce=P.lane&-536870913,he=ce!==P.lane;if(he?(Lt&ce)===ce:(m&ce)===ce){ce!==0&&ce===Kl&&(Ev=!0),ve!==null&&(ve=ve.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var Ue=s,rt=P;ce=a;var ln=u;switch(rt.tag){case 1:if(Ue=rt.payload,typeof Ue=="function"){be=Ue.call(ln,be,ce);break e}be=Ue;break e;case 3:Ue.flags=Ue.flags&-65537|128;case 0:if(Ue=rt.payload,ce=typeof Ue=="function"?Ue.call(ln,be,ce):Ue,ce==null)break e;be=p({},be,ce);break e;case 2:Io=!0}}ce=P.callback,ce!==null&&(s.flags|=64,he&&(s.flags|=8192),he=b.callbacks,he===null?b.callbacks=[ce]:he.push(ce))}else he={lane:ce,tag:P.tag,payload:P.payload,callback:P.callback,next:null},ve===null?(le=ve=he,Q=be):ve=ve.next=he,T|=ce;if(P=P.next,P===null){if(P=b.shared.pending,P===null)break;he=P,P=he.next,he.next=null,b.lastBaseUpdate=he,b.shared.pending=null}}while(!0);ve===null&&(Q=be),b.baseState=Q,b.firstBaseUpdate=le,b.lastBaseUpdate=ve,x===null&&(b.shared.lanes=0),Wo|=T,s.lanes=T,s.memoizedState=be}}function tS(s,a){if(typeof s!="function")throw Error(r(191,s));s.call(a)}function nS(s,a){var u=s.callbacks;if(u!==null)for(s.callbacks=null,s=0;s<u.length;s++)tS(u[s],a)}var Zl=B(null),mf=B(0);function rS(s,a){s=ro,A(mf,s),A(Zl,a),ro=s|a.baseLanes}function Rv(){A(mf,ro),A(Zl,Zl.current)}function Tv(){ro=mf.current,X(Zl),X(mf)}var di=B(null),ji=null;function Ho(s){var a=s.alternate;A(Bn,Bn.current&1),A(di,s),ji===null&&(a===null||Zl.current!==null||a.memoizedState!==null)&&(ji=s)}function Nv(s){A(Bn,Bn.current),A(di,s),ji===null&&(ji=s)}function iS(s){s.tag===22?(A(Bn,Bn.current),A(di,s),ji===null&&(ji=s)):$o()}function $o(){A(Bn,Bn.current),A(di,di.current)}function hi(s){X(di),ji===s&&(ji=null),X(Bn)}var Bn=B(0);function pf(s){for(var a=s;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||L_(u)||z_(u)))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===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Ys=0,pt=null,on=null,Kn=null,gf=!1,Ql=!1,Va=!1,vf=0,zu=0,Jl=null,M3=0;function Mn(){throw Error(r(321))}function Mv(s,a){if(a===null)return!1;for(var u=0;u<a.length&&u<s.length;u++)if(!ci(s[u],a[u]))return!1;return!0}function Av(s,a,u,m,b,x){return Ys=x,pt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,D.H=s===null||s.memoizedState===null?HS:qv,Va=!1,x=u(m,b),Va=!1,Ql&&(x=oS(a,u,m,b)),sS(s),x}function sS(s){D.H=Bu;var a=on!==null&&on.next!==null;if(Ys=0,Kn=on=pt=null,gf=!1,zu=0,Jl=null,a)throw Error(r(300));s===null||Gn||(s=s.dependencies,s!==null&&af(s)&&(Gn=!0))}function oS(s,a,u,m){pt=s;var b=0;do{if(Ql&&(Jl=null),zu=0,Ql=!1,25<=b)throw Error(r(301));if(b+=1,Kn=on=null,s.updateQueue!=null){var x=s.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}D.H=$S,x=a(u,m)}while(Ql);return x}function A3(){var s=D.H,a=s.useState()[0];return a=typeof a.then=="function"?Pu(a):a,s=s.useState()[0],(on!==null?on.memoizedState:null)!==s&&(pt.flags|=1024),a}function jv(){var s=vf!==0;return vf=0,s}function Dv(s,a,u){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~u}function Ov(s){if(gf){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}gf=!1}Ys=0,Kn=on=pt=null,Ql=!1,zu=vf=0,Jl=null}function Br(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Kn===null?pt.memoizedState=Kn=s:Kn=Kn.next=s,Kn}function Fn(){if(on===null){var s=pt.alternate;s=s!==null?s.memoizedState:null}else s=on.next;var a=Kn===null?pt.memoizedState:Kn.next;if(a!==null)Kn=a,on=s;else{if(s===null)throw pt.alternate===null?Error(r(467)):Error(r(310));on=s,s={memoizedState:on.memoizedState,baseState:on.baseState,baseQueue:on.baseQueue,queue:on.queue,next:null},Kn===null?pt.memoizedState=Kn=s:Kn=Kn.next=s}return Kn}function _f(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Pu(s){var a=zu;return zu+=1,Jl===null&&(Jl=[]),s=X1(Jl,s,a),a=pt,(Kn===null?a.memoizedState:Kn.next)===null&&(a=a.alternate,D.H=a===null||a.memoizedState===null?HS:qv),s}function bf(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Pu(s);if(s.$$typeof===E)return Sr(s)}throw Error(r(438,String(s)))}function Lv(s){var a=null,u=pt.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var m=pt.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(a={data:m.data.map(function(b){return b.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=_f(),pt.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(s),m=0;m<s;m++)u[m]=I;return a.index++,u}function Xs(s,a){return typeof a=="function"?a(s):a}function yf(s){var a=Fn();return zv(a,on,s)}function zv(s,a,u){var m=s.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=u;var b=s.baseQueue,x=m.pending;if(x!==null){if(b!==null){var T=b.next;b.next=x.next,x.next=T}a.baseQueue=b=x,m.pending=null}if(x=s.baseState,b===null)s.memoizedState=x;else{a=b.next;var P=T=null,Q=null,le=a,ve=!1;do{var be=le.lane&-536870913;if(be!==le.lane?(Lt&be)===be:(Ys&be)===be){var ce=le.revertLane;if(ce===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),be===Kl&&(ve=!0);else if((Ys&ce)===ce){le=le.next,ce===Kl&&(ve=!0);continue}else be={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},Q===null?(P=Q=be,T=x):Q=Q.next=be,pt.lanes|=ce,Wo|=ce;be=le.action,Va&&u(x,be),x=le.hasEagerState?le.eagerState:u(x,be)}else ce={lane:be,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},Q===null?(P=Q=ce,T=x):Q=Q.next=ce,pt.lanes|=be,Wo|=be;le=le.next}while(le!==null&&le!==a);if(Q===null?T=x:Q.next=P,!ci(x,s.memoizedState)&&(Gn=!0,ve&&(u=Gl,u!==null)))throw u;s.memoizedState=x,s.baseState=T,s.baseQueue=Q,m.lastRenderedState=x}return b===null&&(m.lanes=0),[s.memoizedState,m.dispatch]}function Pv(s){var a=Fn(),u=a.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=s;var m=u.dispatch,b=u.pending,x=a.memoizedState;if(b!==null){u.pending=null;var T=b=b.next;do x=s(x,T.action),T=T.next;while(T!==b);ci(x,a.memoizedState)||(Gn=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),u.lastRenderedState=x}return[x,m]}function aS(s,a,u){var m=pt,b=Fn(),x=Pt;if(x){if(u===void 0)throw Error(r(407));u=u()}else u=a();var T=!ci((on||b).memoizedState,u);if(T&&(b.memoizedState=u,Gn=!0),b=b.queue,Fv(uS.bind(null,m,b,s),[s]),b.getSnapshot!==a||T||Kn!==null&&Kn.memoizedState.tag&1){if(m.flags|=2048,ec(9,{destroy:void 0},cS.bind(null,m,b,u,a),null),pn===null)throw Error(r(349));x||(Ys&127)!==0||lS(m,a,u)}return u}function lS(s,a,u){s.flags|=16384,s={getSnapshot:a,value:u},a=pt.updateQueue,a===null?(a=_f(),pt.updateQueue=a,a.stores=[s]):(u=a.stores,u===null?a.stores=[s]:u.push(s))}function cS(s,a,u,m){a.value=u,a.getSnapshot=m,dS(a)&&hS(s)}function uS(s,a,u){return u(function(){dS(a)&&hS(s)})}function dS(s){var a=s.getSnapshot;s=s.value;try{var u=a();return!ci(s,u)}catch{return!0}}function hS(s){var a=La(s,2);a!==null&&ei(a,s,2)}function Iv(s){var a=Br();if(typeof s=="function"){var u=s;if(s=u(),Va){mt(!0);try{u()}finally{mt(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xs,lastRenderedState:s},a}function fS(s,a,u,m){return s.baseState=u,zv(s,on,typeof m=="function"?m:Xs)}function j3(s,a,u,m,b){if(Sf(s))throw Error(r(485));if(s=a.action,s!==null){var x={payload:b,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(T){x.listeners.push(T)}};D.T!==null?u(!0):x.isTransition=!1,m(x),u=a.pending,u===null?(x.next=a.pending=x,mS(a,x)):(x.next=u.next,a.pending=u.next=x)}}function mS(s,a){var u=a.action,m=a.payload,b=s.state;if(a.isTransition){var x=D.T,T={};D.T=T;try{var P=u(b,m),Q=D.S;Q!==null&&Q(T,P),pS(s,a,P)}catch(le){Bv(s,a,le)}finally{x!==null&&T.types!==null&&(x.types=T.types),D.T=x}}else try{x=u(b,m),pS(s,a,x)}catch(le){Bv(s,a,le)}}function pS(s,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(m){gS(s,a,m)},function(m){return Bv(s,a,m)}):gS(s,a,u)}function gS(s,a,u){a.status="fulfilled",a.value=u,vS(a),s.state=u,a=s.pending,a!==null&&(u=a.next,u===a?s.pending=null:(u=u.next,a.next=u,mS(s,u)))}function Bv(s,a,u){var m=s.pending;if(s.pending=null,m!==null){m=m.next;do a.status="rejected",a.reason=u,vS(a),a=a.next;while(a!==m)}s.action=null}function vS(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function _S(s,a){return a}function bS(s,a){if(Pt){var u=pn.formState;if(u!==null){e:{var m=pt;if(Pt){if(yn){t:{for(var b=yn,x=Ai;b.nodeType!==8;){if(!x){b=null;break t}if(b=Di(b.nextSibling),b===null){b=null;break t}}x=b.data,b=x==="F!"||x==="F"?b:null}if(b){yn=Di(b.nextSibling),m=b.data==="F!";break e}}zo(m)}m=!1}m&&(a=u[0])}}return u=Br(),u.memoizedState=u.baseState=a,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_S,lastRenderedState:a},u.queue=m,u=IS.bind(null,pt,m),m.dispatch=u,m=Iv(!1),x=Wv.bind(null,pt,!1,m.queue),m=Br(),b={state:a,dispatch:null,action:s,pending:null},m.queue=b,u=j3.bind(null,pt,b,x,u),b.dispatch=u,m.memoizedState=s,[a,u,!1]}function yS(s){var a=Fn();return xS(a,on,s)}function xS(s,a,u){if(a=zv(s,a,_S)[0],s=yf(Xs)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var m=Pu(a)}catch(T){throw T===Yl?uf:T}else m=a;a=Fn();var b=a.queue,x=b.dispatch;return u!==a.memoizedState&&(pt.flags|=2048,ec(9,{destroy:void 0},D3.bind(null,b,u),null)),[m,x,s]}function D3(s,a){s.action=a}function wS(s){var a=Fn(),u=on;if(u!==null)return xS(a,u,s);Fn(),a=a.memoizedState,u=Fn();var m=u.queue.dispatch;return u.memoizedState=s,[a,m,!1]}function ec(s,a,u,m){return s={tag:s,create:u,deps:m,inst:a,next:null},a=pt.updateQueue,a===null&&(a=_f(),pt.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=s.next=s:(m=u.next,u.next=s,s.next=m,a.lastEffect=s),s}function SS(){return Fn().memoizedState}function xf(s,a,u,m){var b=Br();pt.flags|=s,b.memoizedState=ec(1|a,{destroy:void 0},u,m===void 0?null:m)}function wf(s,a,u,m){var b=Fn();m=m===void 0?null:m;var x=b.memoizedState.inst;on!==null&&m!==null&&Mv(m,on.memoizedState.deps)?b.memoizedState=ec(a,x,u,m):(pt.flags|=s,b.memoizedState=ec(1|a,x,u,m))}function CS(s,a){xf(8390656,8,s,a)}function Fv(s,a){wf(2048,8,s,a)}function O3(s){pt.flags|=4;var a=pt.updateQueue;if(a===null)a=_f(),pt.updateQueue=a,a.events=[s];else{var u=a.events;u===null?a.events=[s]:u.push(s)}}function kS(s){var a=Fn().memoizedState;return O3({ref:a,nextImpl:s}),function(){if((Yt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function ES(s,a){return wf(4,2,s,a)}function RS(s,a){return wf(4,4,s,a)}function TS(s,a){if(typeof a=="function"){s=s();var u=a(s);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function NS(s,a,u){u=u!=null?u.concat([s]):null,wf(4,4,TS.bind(null,a,s),u)}function Hv(){}function MS(s,a){var u=Fn();a=a===void 0?null:a;var m=u.memoizedState;return a!==null&&Mv(a,m[1])?m[0]:(u.memoizedState=[s,a],s)}function AS(s,a){var u=Fn();a=a===void 0?null:a;var m=u.memoizedState;if(a!==null&&Mv(a,m[1]))return m[0];if(m=s(),Va){mt(!0);try{s()}finally{mt(!1)}}return u.memoizedState=[m,a],m}function $v(s,a,u){return u===void 0||(Ys&1073741824)!==0&&(Lt&261930)===0?s.memoizedState=a:(s.memoizedState=u,s=jC(),pt.lanes|=s,Wo|=s,u)}function jS(s,a,u,m){return ci(u,a)?u:Zl.current!==null?(s=$v(s,u,m),ci(s,a)||(Gn=!0),s):(Ys&42)===0||(Ys&1073741824)!==0&&(Lt&261930)===0?(Gn=!0,s.memoizedState=u):(s=jC(),pt.lanes|=s,Wo|=s,a)}function DS(s,a,u,m,b){var x=U.p;U.p=x!==0&&8>x?x:8;var T=D.T,P={};D.T=P,Wv(s,!1,a,u);try{var Q=b(),le=D.S;if(le!==null&&le(P,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var ve=N3(Q,m);Iu(s,a,ve,pi(s))}else Iu(s,a,m,pi(s))}catch(be){Iu(s,a,{then:function(){},status:"rejected",reason:be},pi())}finally{U.p=x,T!==null&&P.types!==null&&(T.types=P.types),D.T=T}}function L3(){}function Uv(s,a,u,m){if(s.tag!==5)throw Error(r(476));var b=OS(s).queue;DS(s,b,a,z,u===null?L3:function(){return LS(s),u(m)})}function OS(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xs,lastRenderedState:z},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xs,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function LS(s){var a=OS(s);a.next===null&&(a=s.alternate.memoizedState),Iu(s,a.next.queue,{},pi())}function Vv(){return Sr(td)}function zS(){return Fn().memoizedState}function PS(){return Fn().memoizedState}function z3(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=pi();s=Bo(u);var m=Fo(a,s,u);m!==null&&(ei(m,a,u),Du(m,a,u)),a={cache:bv()},s.payload=a;return}a=a.return}}function P3(s,a,u){var m=pi();u={lane:m,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Sf(s)?BS(a,u):(u=lv(s,a,u,m),u!==null&&(ei(u,s,m),FS(u,a,m)))}function IS(s,a,u){var m=pi();Iu(s,a,u,m)}function Iu(s,a,u,m){var b={lane:m,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Sf(s))BS(a,b);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var T=a.lastRenderedState,P=x(T,u);if(b.hasEagerState=!0,b.eagerState=P,ci(P,T))return nf(s,a,b,0),pn===null&&tf(),!1}catch{}finally{}if(u=lv(s,a,b,m),u!==null)return ei(u,s,m),FS(u,a,m),!0}return!1}function Wv(s,a,u,m){if(m={lane:2,revertLane:S_(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},Sf(s)){if(a)throw Error(r(479))}else a=lv(s,u,m,2),a!==null&&ei(a,s,2)}function Sf(s){var a=s.alternate;return s===pt||a!==null&&a===pt}function BS(s,a){Ql=gf=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function FS(s,a,u){if((u&4194048)!==0){var m=a.lanes;m&=s.pendingLanes,u|=m,a.lanes=u,ke(s,u)}}var Bu={readContext:Sr,use:bf,useCallback:Mn,useContext:Mn,useEffect:Mn,useImperativeHandle:Mn,useLayoutEffect:Mn,useInsertionEffect:Mn,useMemo:Mn,useReducer:Mn,useRef:Mn,useState:Mn,useDebugValue:Mn,useDeferredValue:Mn,useTransition:Mn,useSyncExternalStore:Mn,useId:Mn,useHostTransitionStatus:Mn,useFormState:Mn,useActionState:Mn,useOptimistic:Mn,useMemoCache:Mn,useCacheRefresh:Mn};Bu.useEffectEvent=Mn;var HS={readContext:Sr,use:bf,useCallback:function(s,a){return Br().memoizedState=[s,a===void 0?null:a],s},useContext:Sr,useEffect:CS,useImperativeHandle:function(s,a,u){u=u!=null?u.concat([s]):null,xf(4194308,4,TS.bind(null,a,s),u)},useLayoutEffect:function(s,a){return xf(4194308,4,s,a)},useInsertionEffect:function(s,a){xf(4,2,s,a)},useMemo:function(s,a){var u=Br();a=a===void 0?null:a;var m=s();if(Va){mt(!0);try{s()}finally{mt(!1)}}return u.memoizedState=[m,a],m},useReducer:function(s,a,u){var m=Br();if(u!==void 0){var b=u(a);if(Va){mt(!0);try{u(a)}finally{mt(!1)}}}else b=a;return m.memoizedState=m.baseState=b,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:b},m.queue=s,s=s.dispatch=P3.bind(null,pt,s),[m.memoizedState,s]},useRef:function(s){var a=Br();return s={current:s},a.memoizedState=s},useState:function(s){s=Iv(s);var a=s.queue,u=IS.bind(null,pt,a);return a.dispatch=u,[s.memoizedState,u]},useDebugValue:Hv,useDeferredValue:function(s,a){var u=Br();return $v(u,s,a)},useTransition:function(){var s=Iv(!1);return s=DS.bind(null,pt,s.queue,!0,!1),Br().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,u){var m=pt,b=Br();if(Pt){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),pn===null)throw Error(r(349));(Lt&127)!==0||lS(m,a,u)}b.memoizedState=u;var x={value:u,getSnapshot:a};return b.queue=x,CS(uS.bind(null,m,x,s),[s]),m.flags|=2048,ec(9,{destroy:void 0},cS.bind(null,m,x,u,a),null),u},useId:function(){var s=Br(),a=pn.identifierPrefix;if(Pt){var u=vs,m=gs;u=(m&~(1<<32-Ve(m)-1)).toString(32)+u,a="_"+a+"R_"+u,u=vf++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=M3++,a="_"+a+"r_"+u.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:Vv,useFormState:bS,useActionState:bS,useOptimistic:function(s){var a=Br();a.memoizedState=a.baseState=s;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=Wv.bind(null,pt,!0,u),u.dispatch=a,[s,a]},useMemoCache:Lv,useCacheRefresh:function(){return Br().memoizedState=z3.bind(null,pt)},useEffectEvent:function(s){var a=Br(),u={impl:s};return a.memoizedState=u,function(){if((Yt&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},qv={readContext:Sr,use:bf,useCallback:MS,useContext:Sr,useEffect:Fv,useImperativeHandle:NS,useInsertionEffect:ES,useLayoutEffect:RS,useMemo:AS,useReducer:yf,useRef:SS,useState:function(){return yf(Xs)},useDebugValue:Hv,useDeferredValue:function(s,a){var u=Fn();return jS(u,on.memoizedState,s,a)},useTransition:function(){var s=yf(Xs)[0],a=Fn().memoizedState;return[typeof s=="boolean"?s:Pu(s),a]},useSyncExternalStore:aS,useId:zS,useHostTransitionStatus:Vv,useFormState:yS,useActionState:yS,useOptimistic:function(s,a){var u=Fn();return fS(u,on,s,a)},useMemoCache:Lv,useCacheRefresh:PS};qv.useEffectEvent=kS;var $S={readContext:Sr,use:bf,useCallback:MS,useContext:Sr,useEffect:Fv,useImperativeHandle:NS,useInsertionEffect:ES,useLayoutEffect:RS,useMemo:AS,useReducer:Pv,useRef:SS,useState:function(){return Pv(Xs)},useDebugValue:Hv,useDeferredValue:function(s,a){var u=Fn();return on===null?$v(u,s,a):jS(u,on.memoizedState,s,a)},useTransition:function(){var s=Pv(Xs)[0],a=Fn().memoizedState;return[typeof s=="boolean"?s:Pu(s),a]},useSyncExternalStore:aS,useId:zS,useHostTransitionStatus:Vv,useFormState:wS,useActionState:wS,useOptimistic:function(s,a){var u=Fn();return on!==null?fS(u,on,s,a):(u.baseState=s,[s,u.queue.dispatch])},useMemoCache:Lv,useCacheRefresh:PS};$S.useEffectEvent=kS;function Kv(s,a,u,m){a=s.memoizedState,u=u(m,a),u=u==null?a:p({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}var Gv={enqueueSetState:function(s,a,u){s=s._reactInternals;var m=pi(),b=Bo(m);b.payload=a,u!=null&&(b.callback=u),a=Fo(s,b,m),a!==null&&(ei(a,s,m),Du(a,s,m))},enqueueReplaceState:function(s,a,u){s=s._reactInternals;var m=pi(),b=Bo(m);b.tag=1,b.payload=a,u!=null&&(b.callback=u),a=Fo(s,b,m),a!==null&&(ei(a,s,m),Du(a,s,m))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var u=pi(),m=Bo(u);m.tag=2,a!=null&&(m.callback=a),a=Fo(s,m,u),a!==null&&(ei(a,s,u),Du(a,s,u))}};function US(s,a,u,m,b,x,T){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(m,x,T):a.prototype&&a.prototype.isPureReactComponent?!ku(u,m)||!ku(b,x):!0}function VS(s,a,u,m){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,m),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,m),a.state!==s&&Gv.enqueueReplaceState(a,a.state,null)}function Wa(s,a){var u=a;if("ref"in a){u={};for(var m in a)m!=="ref"&&(u[m]=a[m])}if(s=s.defaultProps){u===a&&(u=p({},u));for(var b in s)u[b]===void 0&&(u[b]=s[b])}return u}function WS(s){ef(s)}function qS(s){console.error(s)}function KS(s){ef(s)}function Cf(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(m){setTimeout(function(){throw m})}}function GS(s,a,u){try{var m=s.onCaughtError;m(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function Yv(s,a,u){return u=Bo(u),u.tag=3,u.payload={element:null},u.callback=function(){Cf(s,a)},u}function YS(s){return s=Bo(s),s.tag=3,s}function XS(s,a,u,m){var b=u.type.getDerivedStateFromError;if(typeof b=="function"){var x=m.value;s.payload=function(){return b(x)},s.callback=function(){GS(a,u,m)}}var T=u.stateNode;T!==null&&typeof T.componentDidCatch=="function"&&(s.callback=function(){GS(a,u,m),typeof b!="function"&&(qo===null?qo=new Set([this]):qo.add(this));var P=m.stack;this.componentDidCatch(m.value,{componentStack:P!==null?P:""})})}function I3(s,a,u,m,b){if(u.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(a=u.alternate,a!==null&&ql(a,u,b,!0),u=di.current,u!==null){switch(u.tag){case 31:case 13:return ji===null?zf():u.alternate===null&&An===0&&(An=3),u.flags&=-257,u.flags|=65536,u.lanes=b,m===df?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([m]):a.add(m),y_(s,m,b)),!1;case 22:return u.flags|=65536,m===df?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([m])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([m]):u.add(m)),y_(s,m,b)),!1}throw Error(r(435,u.tag))}return y_(s,m,b),zf(),!1}if(Pt)return a=di.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=b,m!==mv&&(s=Error(r(422),{cause:m}),Tu(Ti(s,u)))):(m!==mv&&(a=Error(r(423),{cause:m}),Tu(Ti(a,u))),s=s.current.alternate,s.flags|=65536,b&=-b,s.lanes|=b,m=Ti(m,u),b=Yv(s.stateNode,m,b),kv(s,b),An!==4&&(An=2)),!1;var x=Error(r(520),{cause:m});if(x=Ti(x,u),Ku===null?Ku=[x]:Ku.push(x),An!==4&&(An=2),a===null)return!0;m=Ti(m,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=b&-b,u.lanes|=s,s=Yv(u.stateNode,m,s),kv(u,s),!1;case 1:if(a=u.type,x=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(qo===null||!qo.has(x))))return u.flags|=65536,b&=-b,u.lanes|=b,b=YS(b),XS(b,s,u,m),kv(u,b),!1}u=u.return}while(u!==null);return!1}var Xv=Error(r(461)),Gn=!1;function Cr(s,a,u,m){a.child=s===null?eS(a,null,u,m):Ua(a,s.child,u,m)}function ZS(s,a,u,m,b){u=u.render;var x=a.ref;if("ref"in m){var T={};for(var P in m)P!=="ref"&&(T[P]=m[P])}else T=m;return Ba(a),m=Av(s,a,u,T,x,b),P=jv(),s!==null&&!Gn?(Dv(s,a,b),Zs(s,a,b)):(Pt&&P&&hv(a),a.flags|=1,Cr(s,a,m,b),a.child)}function QS(s,a,u,m,b){if(s===null){var x=u.type;return typeof x=="function"&&!cv(x)&&x.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=x,JS(s,a,x,m,b)):(s=sf(u.type,null,m,a,a.mode,b),s.ref=a.ref,s.return=a,a.child=s)}if(x=s.child,!i_(s,b)){var T=x.memoizedProps;if(u=u.compare,u=u!==null?u:ku,u(T,m)&&s.ref===a.ref)return Zs(s,a,b)}return a.flags|=1,s=Ws(x,m),s.ref=a.ref,s.return=a,a.child=s}function JS(s,a,u,m,b){if(s!==null){var x=s.memoizedProps;if(ku(x,m)&&s.ref===a.ref)if(Gn=!1,a.pendingProps=m=x,i_(s,b))(s.flags&131072)!==0&&(Gn=!0);else return a.lanes=s.lanes,Zs(s,a,b)}return Zv(s,a,u,m,b)}function eC(s,a,u,m){var b=m.children,x=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|u:u,s!==null){for(m=a.child=s.child,b=0;m!==null;)b=b|m.lanes|m.childLanes,m=m.sibling;m=b&~x}else m=0,a.child=null;return tC(s,a,x,u,m)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&cf(a,x!==null?x.cachePool:null),x!==null?rS(a,x):Rv(),iS(a);else return m=a.lanes=536870912,tC(s,a,x!==null?x.baseLanes|u:u,u,m)}else x!==null?(cf(a,x.cachePool),rS(a,x),$o(),a.memoizedState=null):(s!==null&&cf(a,null),Rv(),$o());return Cr(s,a,b,u),a.child}function Fu(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function tC(s,a,u,m,b){var x=xv();return x=x===null?null:{parent:qn._currentValue,pool:x},a.memoizedState={baseLanes:u,cachePool:x},s!==null&&cf(a,null),Rv(),iS(a),s!==null&&ql(s,a,m,!0),a.childLanes=b,null}function kf(s,a){return a=Rf({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function nC(s,a,u){return Ua(a,s.child,null,u),s=kf(a,a.pendingProps),s.flags|=2,hi(a),a.memoizedState=null,s}function B3(s,a,u){var m=a.pendingProps,b=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Pt){if(m.mode==="hidden")return s=kf(a,m),a.lanes=536870912,Fu(null,s);if(Nv(a),(s=yn)?(s=mk(s,Ai),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:Oo!==null?{id:gs,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},u=B1(s),u.return=a,a.child=u,wr=a,yn=null)):s=null,s===null)throw zo(a);return a.lanes=536870912,null}return kf(a,m)}var x=s.memoizedState;if(x!==null){var T=x.dehydrated;if(Nv(a),b)if(a.flags&256)a.flags&=-257,a=nC(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(r(558));else if(Gn||ql(s,a,u,!1),b=(u&s.childLanes)!==0,Gn||b){if(m=pn,m!==null&&(T=Oe(m,u),T!==0&&T!==x.retryLane))throw x.retryLane=T,La(s,T),ei(m,s,T),Xv;zf(),a=nC(s,a,u)}else s=x.treeContext,yn=Di(T.nextSibling),wr=a,Pt=!0,Lo=null,Ai=!1,s!==null&&$1(a,s),a=kf(a,m),a.flags|=4096;return a}return s=Ws(s.child,{mode:m.mode,children:m.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Ef(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function Zv(s,a,u,m,b){return Ba(a),u=Av(s,a,u,m,void 0,b),m=jv(),s!==null&&!Gn?(Dv(s,a,b),Zs(s,a,b)):(Pt&&m&&hv(a),a.flags|=1,Cr(s,a,u,b),a.child)}function rC(s,a,u,m,b,x){return Ba(a),a.updateQueue=null,u=oS(a,m,u,b),sS(s),m=jv(),s!==null&&!Gn?(Dv(s,a,x),Zs(s,a,x)):(Pt&&m&&hv(a),a.flags|=1,Cr(s,a,u,x),a.child)}function iC(s,a,u,m,b){if(Ba(a),a.stateNode===null){var x=$l,T=u.contextType;typeof T=="object"&&T!==null&&(x=Sr(T)),x=new u(m,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Gv,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=m,x.state=a.memoizedState,x.refs={},Sv(a),T=u.contextType,x.context=typeof T=="object"&&T!==null?Sr(T):$l,x.state=a.memoizedState,T=u.getDerivedStateFromProps,typeof T=="function"&&(Kv(a,u,T,m),x.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(T=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),T!==x.state&&Gv.enqueueReplaceState(x,x.state,null),Lu(a,m,x,b),Ou(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),m=!0}else if(s===null){x=a.stateNode;var P=a.memoizedProps,Q=Wa(u,P);x.props=Q;var le=x.context,ve=u.contextType;T=$l,typeof ve=="object"&&ve!==null&&(T=Sr(ve));var be=u.getDerivedStateFromProps;ve=typeof be=="function"||typeof x.getSnapshotBeforeUpdate=="function",P=a.pendingProps!==P,ve||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(P||le!==T)&&VS(a,x,m,T),Io=!1;var ce=a.memoizedState;x.state=ce,Lu(a,m,x,b),Ou(),le=a.memoizedState,P||ce!==le||Io?(typeof be=="function"&&(Kv(a,u,be,m),le=a.memoizedState),(Q=Io||US(a,u,Q,m,ce,le,T))?(ve||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=m,a.memoizedState=le),x.props=m,x.state=le,x.context=T,m=Q):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),m=!1)}else{x=a.stateNode,Cv(s,a),T=a.memoizedProps,ve=Wa(u,T),x.props=ve,be=a.pendingProps,ce=x.context,le=u.contextType,Q=$l,typeof le=="object"&&le!==null&&(Q=Sr(le)),P=u.getDerivedStateFromProps,(le=typeof P=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T!==be||ce!==Q)&&VS(a,x,m,Q),Io=!1,ce=a.memoizedState,x.state=ce,Lu(a,m,x,b),Ou();var he=a.memoizedState;T!==be||ce!==he||Io||s!==null&&s.dependencies!==null&&af(s.dependencies)?(typeof P=="function"&&(Kv(a,u,P,m),he=a.memoizedState),(ve=Io||US(a,u,ve,m,ce,he,Q)||s!==null&&s.dependencies!==null&&af(s.dependencies))?(le||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(m,he,Q),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(m,he,Q)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||T===s.memoizedProps&&ce===s.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===s.memoizedProps&&ce===s.memoizedState||(a.flags|=1024),a.memoizedProps=m,a.memoizedState=he),x.props=m,x.state=he,x.context=Q,m=ve):(typeof x.componentDidUpdate!="function"||T===s.memoizedProps&&ce===s.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===s.memoizedProps&&ce===s.memoizedState||(a.flags|=1024),m=!1)}return x=m,Ef(s,a),m=(a.flags&128)!==0,x||m?(x=a.stateNode,u=m&&typeof u.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,s!==null&&m?(a.child=Ua(a,s.child,null,b),a.child=Ua(a,null,u,b)):Cr(s,a,u,b),a.memoizedState=x.state,s=a.child):s=Zs(s,a,b),s}function sC(s,a,u,m){return Pa(),a.flags|=256,Cr(s,a,u,m),a.child}var Qv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Jv(s){return{baseLanes:s,cachePool:G1()}}function e_(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=mi),s}function oC(s,a,u){var m=a.pendingProps,b=!1,x=(a.flags&128)!==0,T;if((T=x)||(T=s!==null&&s.memoizedState===null?!1:(Bn.current&2)!==0),T&&(b=!0,a.flags&=-129),T=(a.flags&32)!==0,a.flags&=-33,s===null){if(Pt){if(b?Ho(a):$o(),(s=yn)?(s=mk(s,Ai),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:Oo!==null?{id:gs,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},u=B1(s),u.return=a,a.child=u,wr=a,yn=null)):s=null,s===null)throw zo(a);return z_(s)?a.lanes=32:a.lanes=536870912,null}var P=m.children;return m=m.fallback,b?($o(),b=a.mode,P=Rf({mode:"hidden",children:P},b),m=za(m,b,u,null),P.return=a,m.return=a,P.sibling=m,a.child=P,m=a.child,m.memoizedState=Jv(u),m.childLanes=e_(s,T,u),a.memoizedState=Qv,Fu(null,m)):(Ho(a),t_(a,P))}var Q=s.memoizedState;if(Q!==null&&(P=Q.dehydrated,P!==null)){if(x)a.flags&256?(Ho(a),a.flags&=-257,a=n_(s,a,u)):a.memoizedState!==null?($o(),a.child=s.child,a.flags|=128,a=null):($o(),P=m.fallback,b=a.mode,m=Rf({mode:"visible",children:m.children},b),P=za(P,b,u,null),P.flags|=2,m.return=a,P.return=a,m.sibling=P,a.child=m,Ua(a,s.child,null,u),m=a.child,m.memoizedState=Jv(u),m.childLanes=e_(s,T,u),a.memoizedState=Qv,a=Fu(null,m));else if(Ho(a),z_(P)){if(T=P.nextSibling&&P.nextSibling.dataset,T)var le=T.dgst;T=le,m=Error(r(419)),m.stack="",m.digest=T,Tu({value:m,source:null,stack:null}),a=n_(s,a,u)}else if(Gn||ql(s,a,u,!1),T=(u&s.childLanes)!==0,Gn||T){if(T=pn,T!==null&&(m=Oe(T,u),m!==0&&m!==Q.retryLane))throw Q.retryLane=m,La(s,m),ei(T,s,m),Xv;L_(P)||zf(),a=n_(s,a,u)}else L_(P)?(a.flags|=192,a.child=s.child,a=null):(s=Q.treeContext,yn=Di(P.nextSibling),wr=a,Pt=!0,Lo=null,Ai=!1,s!==null&&$1(a,s),a=t_(a,m.children),a.flags|=4096);return a}return b?($o(),P=m.fallback,b=a.mode,Q=s.child,le=Q.sibling,m=Ws(Q,{mode:"hidden",children:m.children}),m.subtreeFlags=Q.subtreeFlags&65011712,le!==null?P=Ws(le,P):(P=za(P,b,u,null),P.flags|=2),P.return=a,m.return=a,m.sibling=P,a.child=m,Fu(null,m),m=a.child,P=s.child.memoizedState,P===null?P=Jv(u):(b=P.cachePool,b!==null?(Q=qn._currentValue,b=b.parent!==Q?{parent:Q,pool:Q}:b):b=G1(),P={baseLanes:P.baseLanes|u,cachePool:b}),m.memoizedState=P,m.childLanes=e_(s,T,u),a.memoizedState=Qv,Fu(s.child,m)):(Ho(a),u=s.child,s=u.sibling,u=Ws(u,{mode:"visible",children:m.children}),u.return=a,u.sibling=null,s!==null&&(T=a.deletions,T===null?(a.deletions=[s],a.flags|=16):T.push(s)),a.child=u,a.memoizedState=null,u)}function t_(s,a){return a=Rf({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Rf(s,a){return s=ui(22,s,null,a),s.lanes=0,s}function n_(s,a,u){return Ua(a,s.child,null,u),s=t_(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function aC(s,a,u){s.lanes|=a;var m=s.alternate;m!==null&&(m.lanes|=a),vv(s.return,a,u)}function r_(s,a,u,m,b,x){var T=s.memoizedState;T===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:m,tail:u,tailMode:b,treeForkCount:x}:(T.isBackwards=a,T.rendering=null,T.renderingStartTime=0,T.last=m,T.tail=u,T.tailMode=b,T.treeForkCount=x)}function lC(s,a,u){var m=a.pendingProps,b=m.revealOrder,x=m.tail;m=m.children;var T=Bn.current,P=(T&2)!==0;if(P?(T=T&1|2,a.flags|=128):T&=1,A(Bn,T),Cr(s,a,m,u),m=Pt?Ru:0,!P&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&aC(s,u,a);else if(s.tag===19)aC(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(b){case"forwards":for(u=a.child,b=null;u!==null;)s=u.alternate,s!==null&&pf(s)===null&&(b=u),u=u.sibling;u=b,u===null?(b=a.child,a.child=null):(b=u.sibling,u.sibling=null),r_(a,!1,b,u,x,m);break;case"backwards":case"unstable_legacy-backwards":for(u=null,b=a.child,a.child=null;b!==null;){if(s=b.alternate,s!==null&&pf(s)===null){a.child=b;break}s=b.sibling,b.sibling=u,u=b,b=s}r_(a,!0,u,null,x,m);break;case"together":r_(a,!1,null,null,void 0,m);break;default:a.memoizedState=null}return a.child}function Zs(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),Wo|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(ql(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(r(153));if(a.child!==null){for(s=a.child,u=Ws(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=Ws(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function i_(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&af(s)))}function F3(s,a,u){switch(a.tag){case 3:ue(a,a.stateNode.containerInfo),Po(a,qn,s.memoizedState.cache),Pa();break;case 27:case 5:ge(a);break;case 4:ue(a,a.stateNode.containerInfo);break;case 10:Po(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Nv(a),null;break;case 13:var m=a.memoizedState;if(m!==null)return m.dehydrated!==null?(Ho(a),a.flags|=128,null):(u&a.child.childLanes)!==0?oC(s,a,u):(Ho(a),s=Zs(s,a,u),s!==null?s.sibling:null);Ho(a);break;case 19:var b=(s.flags&128)!==0;if(m=(u&a.childLanes)!==0,m||(ql(s,a,u,!1),m=(u&a.childLanes)!==0),b){if(m)return lC(s,a,u);a.flags|=128}if(b=a.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),A(Bn,Bn.current),m)break;return null;case 22:return a.lanes=0,eC(s,a,u,a.pendingProps);case 24:Po(a,qn,s.memoizedState.cache)}return Zs(s,a,u)}function cC(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)Gn=!0;else{if(!i_(s,u)&&(a.flags&128)===0)return Gn=!1,F3(s,a,u);Gn=(s.flags&131072)!==0}else Gn=!1,Pt&&(a.flags&1048576)!==0&&H1(a,Ru,a.index);switch(a.lanes=0,a.tag){case 16:e:{var m=a.pendingProps;if(s=Ha(a.elementType),a.type=s,typeof s=="function")cv(s)?(m=Wa(s,m),a.tag=1,a=iC(null,a,s,m,u)):(a.tag=0,a=Zv(null,a,s,m,u));else{if(s!=null){var b=s.$$typeof;if(b===N){a.tag=11,a=ZS(null,a,s,m,u);break e}else if(b===O){a.tag=14,a=QS(null,a,s,m,u);break e}}throw a=V(s)||s,Error(r(306,a,""))}}return a;case 0:return Zv(s,a,a.type,a.pendingProps,u);case 1:return m=a.type,b=Wa(m,a.pendingProps),iC(s,a,m,b,u);case 3:e:{if(ue(a,a.stateNode.containerInfo),s===null)throw Error(r(387));m=a.pendingProps;var x=a.memoizedState;b=x.element,Cv(s,a),Lu(a,m,null,u);var T=a.memoizedState;if(m=T.cache,Po(a,qn,m),m!==x.cache&&_v(a,[qn],u,!0),Ou(),m=T.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:T.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=sC(s,a,m,u);break e}else if(m!==b){b=Ti(Error(r(424)),a),Tu(b),a=sC(s,a,m,u);break e}else{switch(s=a.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(yn=Di(s.firstChild),wr=a,Pt=!0,Lo=null,Ai=!0,u=eS(a,null,m,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(Pa(),m===b){a=Zs(s,a,u);break e}Cr(s,a,m,u)}a=a.child}return a;case 26:return Ef(s,a),s===null?(u=yk(a.type,null,a.pendingProps,null))?a.memoizedState=u:Pt||(u=a.type,s=a.pendingProps,m=Uf(ee.current).createElement(u),m[Kt]=a,m[Gt]=s,kr(m,u,s),Wn(m),a.stateNode=m):a.memoizedState=yk(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return ge(a),s===null&&Pt&&(m=a.stateNode=vk(a.type,a.pendingProps,ee.current),wr=a,Ai=!0,b=yn,Xo(a.type)?(P_=b,yn=Di(m.firstChild)):yn=b),Cr(s,a,a.pendingProps.children,u),Ef(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Pt&&((b=m=yn)&&(m=gL(m,a.type,a.pendingProps,Ai),m!==null?(a.stateNode=m,wr=a,yn=Di(m.firstChild),Ai=!1,b=!0):b=!1),b||zo(a)),ge(a),b=a.type,x=a.pendingProps,T=s!==null?s.memoizedProps:null,m=x.children,j_(b,x)?m=null:T!==null&&j_(b,T)&&(a.flags|=32),a.memoizedState!==null&&(b=Av(s,a,A3,null,null,u),td._currentValue=b),Ef(s,a),Cr(s,a,m,u),a.child;case 6:return s===null&&Pt&&((s=u=yn)&&(u=vL(u,a.pendingProps,Ai),u!==null?(a.stateNode=u,wr=a,yn=null,s=!0):s=!1),s||zo(a)),null;case 13:return oC(s,a,u);case 4:return ue(a,a.stateNode.containerInfo),m=a.pendingProps,s===null?a.child=Ua(a,null,m,u):Cr(s,a,m,u),a.child;case 11:return ZS(s,a,a.type,a.pendingProps,u);case 7:return Cr(s,a,a.pendingProps,u),a.child;case 8:return Cr(s,a,a.pendingProps.children,u),a.child;case 12:return Cr(s,a,a.pendingProps.children,u),a.child;case 10:return m=a.pendingProps,Po(a,a.type,m.value),Cr(s,a,m.children,u),a.child;case 9:return b=a.type._context,m=a.pendingProps.children,Ba(a),b=Sr(b),m=m(b),a.flags|=1,Cr(s,a,m,u),a.child;case 14:return QS(s,a,a.type,a.pendingProps,u);case 15:return JS(s,a,a.type,a.pendingProps,u);case 19:return lC(s,a,u);case 31:return B3(s,a,u);case 22:return eC(s,a,u,a.pendingProps);case 24:return Ba(a),m=Sr(qn),s===null?(b=xv(),b===null&&(b=pn,x=bv(),b.pooledCache=x,x.refCount++,x!==null&&(b.pooledCacheLanes|=u),b=x),a.memoizedState={parent:m,cache:b},Sv(a),Po(a,qn,b)):((s.lanes&u)!==0&&(Cv(s,a),Lu(a,null,null,u),Ou()),b=s.memoizedState,x=a.memoizedState,b.parent!==m?(b={parent:m,cache:m},a.memoizedState=b,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=b),Po(a,qn,m)):(m=x.cache,Po(a,qn,m),m!==b.cache&&_v(a,[qn],u,!0))),Cr(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Qs(s){s.flags|=4}function s_(s,a,u,m,b){if((a=(s.mode&32)!==0)&&(a=!1),a){if(s.flags|=16777216,(b&335544128)===b)if(s.stateNode.complete)s.flags|=8192;else if(zC())s.flags|=8192;else throw $a=df,wv}else s.flags&=-16777217}function uC(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!kk(a))if(zC())s.flags|=8192;else throw $a=df,wv}function Tf(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?Rt():536870912,s.lanes|=a,ic|=a)}function Hu(s,a){if(!Pt)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var m=null;u!==null;)u.alternate!==null&&(m=u),u=u.sibling;m===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:m.sibling=null}}function xn(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,m=0;if(a)for(var b=s.child;b!==null;)u|=b.lanes|b.childLanes,m|=b.subtreeFlags&65011712,m|=b.flags&65011712,b.return=s,b=b.sibling;else for(b=s.child;b!==null;)u|=b.lanes|b.childLanes,m|=b.subtreeFlags,m|=b.flags,b.return=s,b=b.sibling;return s.subtreeFlags|=m,s.childLanes=u,a}function H3(s,a,u){var m=a.pendingProps;switch(fv(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xn(a),null;case 1:return xn(a),null;case 3:return u=a.stateNode,m=null,s!==null&&(m=s.memoizedState.cache),a.memoizedState.cache!==m&&(a.flags|=2048),Gs(qn),fe(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(Wl(a)?Qs(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,pv())),xn(a),null;case 26:var b=a.type,x=a.memoizedState;return s===null?(Qs(a),x!==null?(xn(a),uC(a,x)):(xn(a),s_(a,b,null,m,u))):x?x!==s.memoizedState?(Qs(a),xn(a),uC(a,x)):(xn(a),a.flags&=-16777217):(s=s.memoizedProps,s!==m&&Qs(a),xn(a),s_(a,b,s,m,u)),null;case 27:if(Ce(a),u=ee.current,b=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==m&&Qs(a);else{if(!m){if(a.stateNode===null)throw Error(r(166));return xn(a),null}s=ie.current,Wl(a)?U1(a):(s=vk(b,m,u),a.stateNode=s,Qs(a))}return xn(a),null;case 5:if(Ce(a),b=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==m&&Qs(a);else{if(!m){if(a.stateNode===null)throw Error(r(166));return xn(a),null}if(x=ie.current,Wl(a))U1(a);else{var T=Uf(ee.current);switch(x){case 1:x=T.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:x=T.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":x=T.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":x=T.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":x=T.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof m.is=="string"?T.createElement("select",{is:m.is}):T.createElement("select"),m.multiple?x.multiple=!0:m.size&&(x.size=m.size);break;default:x=typeof m.is=="string"?T.createElement(b,{is:m.is}):T.createElement(b)}}x[Kt]=a,x[Gt]=m;e:for(T=a.child;T!==null;){if(T.tag===5||T.tag===6)x.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===a)break e;for(;T.sibling===null;){if(T.return===null||T.return===a)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}a.stateNode=x;e:switch(kr(x,b,m),b){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&Qs(a)}}return xn(a),s_(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==m&&Qs(a);else{if(typeof m!="string"&&a.stateNode===null)throw Error(r(166));if(s=ee.current,Wl(a)){if(s=a.stateNode,u=a.memoizedProps,m=null,b=wr,b!==null)switch(b.tag){case 27:case 5:m=b.memoizedProps}s[Kt]=a,s=!!(s.nodeValue===u||m!==null&&m.suppressHydrationWarning===!0||ok(s.nodeValue,u)),s||zo(a,!0)}else s=Uf(s).createTextNode(m),s[Kt]=a,a.stateNode=s}return xn(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(m=Wl(a),u!==null){if(s===null){if(!m)throw Error(r(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[Kt]=a}else Pa(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;xn(a),s=!1}else u=pv(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(hi(a),a):(hi(a),null);if((a.flags&128)!==0)throw Error(r(558))}return xn(a),null;case 13:if(m=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(b=Wl(a),m!==null&&m.dehydrated!==null){if(s===null){if(!b)throw Error(r(318));if(b=a.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(r(317));b[Kt]=a}else Pa(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;xn(a),b=!1}else b=pv(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=b),b=!0;if(!b)return a.flags&256?(hi(a),a):(hi(a),null)}return hi(a),(a.flags&128)!==0?(a.lanes=u,a):(u=m!==null,s=s!==null&&s.memoizedState!==null,u&&(m=a.child,b=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(b=m.alternate.memoizedState.cachePool.pool),x=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(x=m.memoizedState.cachePool.pool),x!==b&&(m.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Tf(a,a.updateQueue),xn(a),null);case 4:return fe(),s===null&&R_(a.stateNode.containerInfo),xn(a),null;case 10:return Gs(a.type),xn(a),null;case 19:if(X(Bn),m=a.memoizedState,m===null)return xn(a),null;if(b=(a.flags&128)!==0,x=m.rendering,x===null)if(b)Hu(m,!1);else{if(An!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(x=pf(s),x!==null){for(a.flags|=128,Hu(m,!1),s=x.updateQueue,a.updateQueue=s,Tf(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)I1(u,s),u=u.sibling;return A(Bn,Bn.current&1|2),Pt&&qs(a,m.treeForkCount),a.child}s=s.sibling}m.tail!==null&&Mt()>Df&&(a.flags|=128,b=!0,Hu(m,!1),a.lanes=4194304)}else{if(!b)if(s=pf(x),s!==null){if(a.flags|=128,b=!0,s=s.updateQueue,a.updateQueue=s,Tf(a,s),Hu(m,!0),m.tail===null&&m.tailMode==="hidden"&&!x.alternate&&!Pt)return xn(a),null}else 2*Mt()-m.renderingStartTime>Df&&u!==536870912&&(a.flags|=128,b=!0,Hu(m,!1),a.lanes=4194304);m.isBackwards?(x.sibling=a.child,a.child=x):(s=m.last,s!==null?s.sibling=x:a.child=x,m.last=x)}return m.tail!==null?(s=m.tail,m.rendering=s,m.tail=s.sibling,m.renderingStartTime=Mt(),s.sibling=null,u=Bn.current,A(Bn,b?u&1|2:u&1),Pt&&qs(a,m.treeForkCount),s):(xn(a),null);case 22:case 23:return hi(a),Tv(),m=a.memoizedState!==null,s!==null?s.memoizedState!==null!==m&&(a.flags|=8192):m&&(a.flags|=8192),m?(u&536870912)!==0&&(a.flags&128)===0&&(xn(a),a.subtreeFlags&6&&(a.flags|=8192)):xn(a),u=a.updateQueue,u!==null&&Tf(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),m=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(m=a.memoizedState.cachePool.pool),m!==u&&(a.flags|=2048),s!==null&&X(Fa),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Gs(qn),xn(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function $3(s,a){switch(fv(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Gs(qn),fe(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ce(a),null;case 31:if(a.memoizedState!==null){if(hi(a),a.alternate===null)throw Error(r(340));Pa()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(hi(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(r(340));Pa()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return X(Bn),null;case 4:return fe(),null;case 10:return Gs(a.type),null;case 22:case 23:return hi(a),Tv(),s!==null&&X(Fa),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Gs(qn),null;case 25:return null;default:return null}}function dC(s,a){switch(fv(a),a.tag){case 3:Gs(qn),fe();break;case 26:case 27:case 5:Ce(a);break;case 4:fe();break;case 31:a.memoizedState!==null&&hi(a);break;case 13:hi(a);break;case 19:X(Bn);break;case 10:Gs(a.type);break;case 22:case 23:hi(a),Tv(),s!==null&&X(Fa);break;case 24:Gs(qn)}}function $u(s,a){try{var u=a.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var b=m.next;u=b;do{if((u.tag&s)===s){m=void 0;var x=u.create,T=u.inst;m=x(),T.destroy=m}u=u.next}while(u!==b)}}catch(P){nn(a,a.return,P)}}function Uo(s,a,u){try{var m=a.updateQueue,b=m!==null?m.lastEffect:null;if(b!==null){var x=b.next;m=x;do{if((m.tag&s)===s){var T=m.inst,P=T.destroy;if(P!==void 0){T.destroy=void 0,b=a;var Q=u,le=P;try{le()}catch(ve){nn(b,Q,ve)}}}m=m.next}while(m!==x)}}catch(ve){nn(a,a.return,ve)}}function hC(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{nS(a,u)}catch(m){nn(s,s.return,m)}}}function fC(s,a,u){u.props=Wa(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(m){nn(s,a,m)}}function Uu(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var m=s.stateNode;break;case 30:m=s.stateNode;break;default:m=s.stateNode}typeof u=="function"?s.refCleanup=u(m):u.current=m}}catch(b){nn(s,a,b)}}function _s(s,a){var u=s.ref,m=s.refCleanup;if(u!==null)if(typeof m=="function")try{m()}catch(b){nn(s,a,b)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(b){nn(s,a,b)}else u.current=null}function mC(s){var a=s.type,u=s.memoizedProps,m=s.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&m.focus();break e;case"img":u.src?m.src=u.src:u.srcSet&&(m.srcset=u.srcSet)}}catch(b){nn(s,s.return,b)}}function o_(s,a,u){try{var m=s.stateNode;uL(m,s.type,u,a),m[Gt]=a}catch(b){nn(s,s.return,b)}}function pC(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Xo(s.type)||s.tag===4}function a_(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||pC(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Xo(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function l_(s,a,u){var m=s.tag;if(m===5||m===6)s=s.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(s,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(s),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=Us));else if(m!==4&&(m===27&&Xo(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(l_(s,a,u),s=s.sibling;s!==null;)l_(s,a,u),s=s.sibling}function Nf(s,a,u){var m=s.tag;if(m===5||m===6)s=s.stateNode,a?u.insertBefore(s,a):u.appendChild(s);else if(m!==4&&(m===27&&Xo(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Nf(s,a,u),s=s.sibling;s!==null;)Nf(s,a,u),s=s.sibling}function gC(s){var a=s.stateNode,u=s.memoizedProps;try{for(var m=s.type,b=a.attributes;b.length;)a.removeAttributeNode(b[0]);kr(a,m,u),a[Kt]=s,a[Gt]=u}catch(x){nn(s,s.return,x)}}var Js=!1,Yn=!1,c_=!1,vC=typeof WeakSet=="function"?WeakSet:Set,lr=null;function U3(s,a){if(s=s.containerInfo,M_=Xf,s=N1(s),nv(s)){if("selectionStart"in s)var u={start:s.selectionStart,end:s.selectionEnd};else e:{u=(u=s.ownerDocument)&&u.defaultView||window;var m=u.getSelection&&u.getSelection();if(m&&m.rangeCount!==0){u=m.anchorNode;var b=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var T=0,P=-1,Q=-1,le=0,ve=0,be=s,ce=null;t:for(;;){for(var he;be!==u||b!==0&&be.nodeType!==3||(P=T+b),be!==x||m!==0&&be.nodeType!==3||(Q=T+m),be.nodeType===3&&(T+=be.nodeValue.length),(he=be.firstChild)!==null;)ce=be,be=he;for(;;){if(be===s)break t;if(ce===u&&++le===b&&(P=T),ce===x&&++ve===m&&(Q=T),(he=be.nextSibling)!==null)break;be=ce,ce=be.parentNode}be=he}u=P===-1||Q===-1?null:{start:P,end:Q}}else u=null}u=u||{start:0,end:0}}else u=null;for(A_={focusedElem:s,selectionRange:u},Xf=!1,lr=a;lr!==null;)if(a=lr,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,lr=s;else for(;lr!==null;){switch(a=lr,x=a.alternate,s=a.flags,a.tag){case 0:if((s&4)!==0&&(s=a.updateQueue,s=s!==null?s.events:null,s!==null))for(u=0;u<s.length;u++)b=s[u],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&x!==null){s=void 0,u=a,b=x.memoizedProps,x=x.memoizedState,m=u.stateNode;try{var Ue=Wa(u.type,b);s=m.getSnapshotBeforeUpdate(Ue,x),m.__reactInternalSnapshotBeforeUpdate=s}catch(rt){nn(u,u.return,rt)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,u=s.nodeType,u===9)O_(s);else if(u===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":O_(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=a.sibling,s!==null){s.return=a.return,lr=s;break}lr=a.return}}function _C(s,a,u){var m=u.flags;switch(u.tag){case 0:case 11:case 15:to(s,u),m&4&&$u(5,u);break;case 1:if(to(s,u),m&4)if(s=u.stateNode,a===null)try{s.componentDidMount()}catch(T){nn(u,u.return,T)}else{var b=Wa(u.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(b,a,s.__reactInternalSnapshotBeforeUpdate)}catch(T){nn(u,u.return,T)}}m&64&&hC(u),m&512&&Uu(u,u.return);break;case 3:if(to(s,u),m&64&&(s=u.updateQueue,s!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{nS(s,a)}catch(T){nn(u,u.return,T)}}break;case 27:a===null&&m&4&&gC(u);case 26:case 5:to(s,u),a===null&&m&4&&mC(u),m&512&&Uu(u,u.return);break;case 12:to(s,u);break;case 31:to(s,u),m&4&&xC(s,u);break;case 13:to(s,u),m&4&&wC(s,u),m&64&&(s=u.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(u=Q3.bind(null,u),_L(s,u))));break;case 22:if(m=u.memoizedState!==null||Js,!m){a=a!==null&&a.memoizedState!==null||Yn,b=Js;var x=Yn;Js=m,(Yn=a)&&!x?no(s,u,(u.subtreeFlags&8772)!==0):to(s,u),Js=b,Yn=x}break;case 30:break;default:to(s,u)}}function bC(s){var a=s.alternate;a!==null&&(s.alternate=null,bC(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&ms(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var kn=null,Xr=!1;function eo(s,a,u){for(u=u.child;u!==null;)yC(s,a,u),u=u.sibling}function yC(s,a,u){if(He&&typeof He.onCommitFiberUnmount=="function")try{He.onCommitFiberUnmount(Ae,u)}catch{}switch(u.tag){case 26:Yn||_s(u,a),eo(s,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:Yn||_s(u,a);var m=kn,b=Xr;Xo(u.type)&&(kn=u.stateNode,Xr=!1),eo(s,a,u),Qu(u.stateNode),kn=m,Xr=b;break;case 5:Yn||_s(u,a);case 6:if(m=kn,b=Xr,kn=null,eo(s,a,u),kn=m,Xr=b,kn!==null)if(Xr)try{(kn.nodeType===9?kn.body:kn.nodeName==="HTML"?kn.ownerDocument.body:kn).removeChild(u.stateNode)}catch(x){nn(u,a,x)}else try{kn.removeChild(u.stateNode)}catch(x){nn(u,a,x)}break;case 18:kn!==null&&(Xr?(s=kn,hk(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,u.stateNode),hc(s)):hk(kn,u.stateNode));break;case 4:m=kn,b=Xr,kn=u.stateNode.containerInfo,Xr=!0,eo(s,a,u),kn=m,Xr=b;break;case 0:case 11:case 14:case 15:Uo(2,u,a),Yn||Uo(4,u,a),eo(s,a,u);break;case 1:Yn||(_s(u,a),m=u.stateNode,typeof m.componentWillUnmount=="function"&&fC(u,a,m)),eo(s,a,u);break;case 21:eo(s,a,u);break;case 22:Yn=(m=Yn)||u.memoizedState!==null,eo(s,a,u),Yn=m;break;default:eo(s,a,u)}}function xC(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{hc(s)}catch(u){nn(a,a.return,u)}}}function wC(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{hc(s)}catch(u){nn(a,a.return,u)}}function V3(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new vC),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new vC),a;default:throw Error(r(435,s.tag))}}function Mf(s,a){var u=V3(s);a.forEach(function(m){if(!u.has(m)){u.add(m);var b=J3.bind(null,s,m);m.then(b,b)}})}function Zr(s,a){var u=a.deletions;if(u!==null)for(var m=0;m<u.length;m++){var b=u[m],x=s,T=a,P=T;e:for(;P!==null;){switch(P.tag){case 27:if(Xo(P.type)){kn=P.stateNode,Xr=!1;break e}break;case 5:kn=P.stateNode,Xr=!1;break e;case 3:case 4:kn=P.stateNode.containerInfo,Xr=!0;break e}P=P.return}if(kn===null)throw Error(r(160));yC(x,T,b),kn=null,Xr=!1,x=b.alternate,x!==null&&(x.return=null),b.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)SC(a,s),a=a.sibling}var es=null;function SC(s,a){var u=s.alternate,m=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Zr(a,s),Qr(s),m&4&&(Uo(3,s,s.return),$u(3,s),Uo(5,s,s.return));break;case 1:Zr(a,s),Qr(s),m&512&&(Yn||u===null||_s(u,u.return)),m&64&&Js&&(s=s.updateQueue,s!==null&&(m=s.callbacks,m!==null&&(u=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=u===null?m:u.concat(m))));break;case 26:var b=es;if(Zr(a,s),Qr(s),m&512&&(Yn||u===null||_s(u,u.return)),m&4){var x=u!==null?u.memoizedState:null;if(m=s.memoizedState,u===null)if(m===null)if(s.stateNode===null){e:{m=s.type,u=s.memoizedProps,b=b.ownerDocument||b;t:switch(m){case"title":x=b.getElementsByTagName("title")[0],(!x||x[Vn]||x[Kt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=b.createElement(m),b.head.insertBefore(x,b.querySelector("head > title"))),kr(x,m,u),x[Kt]=s,Wn(x),m=x;break e;case"link":var T=Sk("link","href",b).get(m+(u.href||""));if(T){for(var P=0;P<T.length;P++)if(x=T[P],x.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&x.getAttribute("rel")===(u.rel==null?null:u.rel)&&x.getAttribute("title")===(u.title==null?null:u.title)&&x.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){T.splice(P,1);break t}}x=b.createElement(m),kr(x,m,u),b.head.appendChild(x);break;case"meta":if(T=Sk("meta","content",b).get(m+(u.content||""))){for(P=0;P<T.length;P++)if(x=T[P],x.getAttribute("content")===(u.content==null?null:""+u.content)&&x.getAttribute("name")===(u.name==null?null:u.name)&&x.getAttribute("property")===(u.property==null?null:u.property)&&x.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&x.getAttribute("charset")===(u.charSet==null?null:u.charSet)){T.splice(P,1);break t}}x=b.createElement(m),kr(x,m,u),b.head.appendChild(x);break;default:throw Error(r(468,m))}x[Kt]=s,Wn(x),m=x}s.stateNode=m}else Ck(b,s.type,s.stateNode);else s.stateNode=wk(b,m,s.memoizedProps);else x!==m?(x===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):x.count--,m===null?Ck(b,s.type,s.stateNode):wk(b,m,s.memoizedProps)):m===null&&s.stateNode!==null&&o_(s,s.memoizedProps,u.memoizedProps)}break;case 27:Zr(a,s),Qr(s),m&512&&(Yn||u===null||_s(u,u.return)),u!==null&&m&4&&o_(s,s.memoizedProps,u.memoizedProps);break;case 5:if(Zr(a,s),Qr(s),m&512&&(Yn||u===null||_s(u,u.return)),s.flags&32){b=s.stateNode;try{Gr(b,"")}catch(Ue){nn(s,s.return,Ue)}}m&4&&s.stateNode!=null&&(b=s.memoizedProps,o_(s,b,u!==null?u.memoizedProps:b)),m&1024&&(c_=!0);break;case 6:if(Zr(a,s),Qr(s),m&4){if(s.stateNode===null)throw Error(r(162));m=s.memoizedProps,u=s.stateNode;try{u.nodeValue=m}catch(Ue){nn(s,s.return,Ue)}}break;case 3:if(qf=null,b=es,es=Vf(a.containerInfo),Zr(a,s),es=b,Qr(s),m&4&&u!==null&&u.memoizedState.isDehydrated)try{hc(a.containerInfo)}catch(Ue){nn(s,s.return,Ue)}c_&&(c_=!1,CC(s));break;case 4:m=es,es=Vf(s.stateNode.containerInfo),Zr(a,s),Qr(s),es=m;break;case 12:Zr(a,s),Qr(s);break;case 31:Zr(a,s),Qr(s),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,Mf(s,m)));break;case 13:Zr(a,s),Qr(s),s.child.flags&8192&&s.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(jf=Mt()),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,Mf(s,m)));break;case 22:b=s.memoizedState!==null;var Q=u!==null&&u.memoizedState!==null,le=Js,ve=Yn;if(Js=le||b,Yn=ve||Q,Zr(a,s),Yn=ve,Js=le,Qr(s),m&8192)e:for(a=s.stateNode,a._visibility=b?a._visibility&-2:a._visibility|1,b&&(u===null||Q||Js||Yn||qa(s)),u=null,a=s;;){if(a.tag===5||a.tag===26){if(u===null){Q=u=a;try{if(x=Q.stateNode,b)T=x.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none";else{P=Q.stateNode;var be=Q.memoizedProps.style,ce=be!=null&&be.hasOwnProperty("display")?be.display:null;P.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(Ue){nn(Q,Q.return,Ue)}}}else if(a.tag===6){if(u===null){Q=a;try{Q.stateNode.nodeValue=b?"":Q.memoizedProps}catch(Ue){nn(Q,Q.return,Ue)}}}else if(a.tag===18){if(u===null){Q=a;try{var he=Q.stateNode;b?fk(he,!0):fk(Q.stateNode,!1)}catch(Ue){nn(Q,Q.return,Ue)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===s)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break e;for(;a.sibling===null;){if(a.return===null||a.return===s)break e;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}m&4&&(m=s.updateQueue,m!==null&&(u=m.retryQueue,u!==null&&(m.retryQueue=null,Mf(s,u))));break;case 19:Zr(a,s),Qr(s),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,Mf(s,m)));break;case 30:break;case 21:break;default:Zr(a,s),Qr(s)}}function Qr(s){var a=s.flags;if(a&2){try{for(var u,m=s.return;m!==null;){if(pC(m)){u=m;break}m=m.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var b=u.stateNode,x=a_(s);Nf(s,x,b);break;case 5:var T=u.stateNode;u.flags&32&&(Gr(T,""),u.flags&=-33);var P=a_(s);Nf(s,P,T);break;case 3:case 4:var Q=u.stateNode.containerInfo,le=a_(s);l_(s,le,Q);break;default:throw Error(r(161))}}catch(ve){nn(s,s.return,ve)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function CC(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;CC(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function to(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)_C(s,a.alternate,a),a=a.sibling}function qa(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:Uo(4,a,a.return),qa(a);break;case 1:_s(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&fC(a,a.return,u),qa(a);break;case 27:Qu(a.stateNode);case 26:case 5:_s(a,a.return),qa(a);break;case 22:a.memoizedState===null&&qa(a);break;case 30:qa(a);break;default:qa(a)}s=s.sibling}}function no(s,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var m=a.alternate,b=s,x=a,T=x.flags;switch(x.tag){case 0:case 11:case 15:no(b,x,u),$u(4,x);break;case 1:if(no(b,x,u),m=x,b=m.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(le){nn(m,m.return,le)}if(m=x,b=m.updateQueue,b!==null){var P=m.stateNode;try{var Q=b.shared.hiddenCallbacks;if(Q!==null)for(b.shared.hiddenCallbacks=null,b=0;b<Q.length;b++)tS(Q[b],P)}catch(le){nn(m,m.return,le)}}u&&T&64&&hC(x),Uu(x,x.return);break;case 27:gC(x);case 26:case 5:no(b,x,u),u&&m===null&&T&4&&mC(x),Uu(x,x.return);break;case 12:no(b,x,u);break;case 31:no(b,x,u),u&&T&4&&xC(b,x);break;case 13:no(b,x,u),u&&T&4&&wC(b,x);break;case 22:x.memoizedState===null&&no(b,x,u),Uu(x,x.return);break;case 30:break;default:no(b,x,u)}a=a.sibling}}function u_(s,a){var u=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==u&&(s!=null&&s.refCount++,u!=null&&Nu(u))}function d_(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Nu(s))}function ts(s,a,u,m){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)kC(s,a,u,m),a=a.sibling}function kC(s,a,u,m){var b=a.flags;switch(a.tag){case 0:case 11:case 15:ts(s,a,u,m),b&2048&&$u(9,a);break;case 1:ts(s,a,u,m);break;case 3:ts(s,a,u,m),b&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Nu(s)));break;case 12:if(b&2048){ts(s,a,u,m),s=a.stateNode;try{var x=a.memoizedProps,T=x.id,P=x.onPostCommit;typeof P=="function"&&P(T,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(Q){nn(a,a.return,Q)}}else ts(s,a,u,m);break;case 31:ts(s,a,u,m);break;case 13:ts(s,a,u,m);break;case 23:break;case 22:x=a.stateNode,T=a.alternate,a.memoizedState!==null?x._visibility&2?ts(s,a,u,m):Vu(s,a):x._visibility&2?ts(s,a,u,m):(x._visibility|=2,tc(s,a,u,m,(a.subtreeFlags&10256)!==0||!1)),b&2048&&u_(T,a);break;case 24:ts(s,a,u,m),b&2048&&d_(a.alternate,a);break;default:ts(s,a,u,m)}}function tc(s,a,u,m,b){for(b=b&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=s,T=a,P=u,Q=m,le=T.flags;switch(T.tag){case 0:case 11:case 15:tc(x,T,P,Q,b),$u(8,T);break;case 23:break;case 22:var ve=T.stateNode;T.memoizedState!==null?ve._visibility&2?tc(x,T,P,Q,b):Vu(x,T):(ve._visibility|=2,tc(x,T,P,Q,b)),b&&le&2048&&u_(T.alternate,T);break;case 24:tc(x,T,P,Q,b),b&&le&2048&&d_(T.alternate,T);break;default:tc(x,T,P,Q,b)}a=a.sibling}}function Vu(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=s,m=a,b=m.flags;switch(m.tag){case 22:Vu(u,m),b&2048&&u_(m.alternate,m);break;case 24:Vu(u,m),b&2048&&d_(m.alternate,m);break;default:Vu(u,m)}a=a.sibling}}var Wu=8192;function nc(s,a,u){if(s.subtreeFlags&Wu)for(s=s.child;s!==null;)EC(s,a,u),s=s.sibling}function EC(s,a,u){switch(s.tag){case 26:nc(s,a,u),s.flags&Wu&&s.memoizedState!==null&&ML(u,es,s.memoizedState,s.memoizedProps);break;case 5:nc(s,a,u);break;case 3:case 4:var m=es;es=Vf(s.stateNode.containerInfo),nc(s,a,u),es=m;break;case 22:s.memoizedState===null&&(m=s.alternate,m!==null&&m.memoizedState!==null?(m=Wu,Wu=16777216,nc(s,a,u),Wu=m):nc(s,a,u));break;default:nc(s,a,u)}}function RC(s){var a=s.alternate;if(a!==null&&(s=a.child,s!==null)){a.child=null;do a=s.sibling,s.sibling=null,s=a;while(s!==null)}}function qu(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var m=a[u];lr=m,NC(m,s)}RC(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)TC(s),s=s.sibling}function TC(s){switch(s.tag){case 0:case 11:case 15:qu(s),s.flags&2048&&Uo(9,s,s.return);break;case 3:qu(s);break;case 12:qu(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,Af(s)):qu(s);break;default:qu(s)}}function Af(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var m=a[u];lr=m,NC(m,s)}RC(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:Uo(8,a,a.return),Af(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,Af(a));break;default:Af(a)}s=s.sibling}}function NC(s,a){for(;lr!==null;){var u=lr;switch(u.tag){case 0:case 11:case 15:Uo(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var m=u.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:Nu(u.memoizedState.cache)}if(m=u.child,m!==null)m.return=u,lr=m;else e:for(u=s;lr!==null;){m=lr;var b=m.sibling,x=m.return;if(bC(m),m===u){lr=null;break e}if(b!==null){b.return=x,lr=b;break e}lr=x}}}var W3={getCacheForType:function(s){var a=Sr(qn),u=a.data.get(s);return u===void 0&&(u=s(),a.data.set(s,u)),u},cacheSignal:function(){return Sr(qn).controller.signal}},q3=typeof WeakMap=="function"?WeakMap:Map,Yt=0,pn=null,At=null,Lt=0,tn=0,fi=null,Vo=!1,rc=!1,h_=!1,ro=0,An=0,Wo=0,Ka=0,f_=0,mi=0,ic=0,Ku=null,Jr=null,m_=!1,jf=0,MC=0,Df=1/0,Of=null,qo=null,er=0,Ko=null,sc=null,io=0,p_=0,g_=null,AC=null,Gu=0,v_=null;function pi(){return(Yt&2)!==0&&Lt!==0?Lt&-Lt:D.T!==null?S_():mn()}function jC(){if(mi===0)if((Lt&536870912)===0||Pt){var s=Un;Un<<=1,(Un&3932160)===0&&(Un=262144),mi=s}else mi=536870912;return s=di.current,s!==null&&(s.flags|=32),mi}function ei(s,a,u){(s===pn&&(tn===2||tn===9)||s.cancelPendingCommit!==null)&&(oc(s,0),Go(s,Lt,mi,!1)),vt(s,u),((Yt&2)===0||s!==pn)&&(s===pn&&((Yt&2)===0&&(Ka|=u),An===4&&Go(s,Lt,mi,!1)),bs(s))}function DC(s,a,u){if((Yt&6)!==0)throw Error(r(327));var m=!u&&(a&127)===0&&(a&s.expiredLanes)===0||gt(s,a),b=m?Y3(s,a):b_(s,a,!0),x=m;do{if(b===0){rc&&!m&&Go(s,a,0,!1);break}else{if(u=s.current.alternate,x&&!K3(u)){b=b_(s,a,!1),x=!1;continue}if(b===2){if(x=a,s.errorRecoveryDisabledLanes&x)var T=0;else T=s.pendingLanes&-536870913,T=T!==0?T:T&536870912?536870912:0;if(T!==0){a=T;e:{var P=s;b=Ku;var Q=P.current.memoizedState.isDehydrated;if(Q&&(oc(P,T).flags|=256),T=b_(P,T,!1),T!==2){if(h_&&!Q){P.errorRecoveryDisabledLanes|=x,Ka|=x,b=4;break e}x=Jr,Jr=b,x!==null&&(Jr===null?Jr=x:Jr.push.apply(Jr,x))}b=T}if(x=!1,b!==2)continue}}if(b===1){oc(s,0),Go(s,a,0,!0);break}e:{switch(m=s,x=b,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Go(m,a,mi,!Vo);break e;case 2:Jr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(b=jf+300-Mt(),10<b)){if(Go(m,a,mi,!Vo),Ie(m,0,!0)!==0)break e;io=a,m.timeoutHandle=uk(OC.bind(null,m,u,Jr,Of,m_,a,mi,Ka,ic,Vo,x,"Throttled",-0,0),b);break e}OC(m,u,Jr,Of,m_,a,mi,Ka,ic,Vo,x,null,-0,0)}}break}while(!0);bs(s)}function OC(s,a,u,m,b,x,T,P,Q,le,ve,be,ce,he){if(s.timeoutHandle=-1,be=a.subtreeFlags,be&8192||(be&16785408)===16785408){be={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Us},EC(a,x,be);var Ue=(x&62914560)===x?jf-Mt():(x&4194048)===x?MC-Mt():0;if(Ue=AL(be,Ue),Ue!==null){io=x,s.cancelPendingCommit=Ue($C.bind(null,s,a,x,u,m,b,T,P,Q,ve,be,null,ce,he)),Go(s,x,T,!le);return}}$C(s,a,x,u,m,b,T,P,Q)}function K3(s){for(var a=s;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var m=0;m<u.length;m++){var b=u[m],x=b.getSnapshot;b=b.value;try{if(!ci(x(),b))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Go(s,a,u,m){a&=~f_,a&=~Ka,s.suspendedLanes|=a,s.pingedLanes&=~a,m&&(s.warmLanes|=a),m=s.expirationTimes;for(var b=a;0<b;){var x=31-Ve(b),T=1<<x;m[x]=-1,b&=~T}u!==0&&Sn(s,u,a)}function Lf(){return(Yt&6)===0?(Yu(0),!1):!0}function __(){if(At!==null){if(tn===0)var s=At.return;else s=At,Ks=Ia=null,Ov(s),Xl=null,Au=0,s=At;for(;s!==null;)dC(s.alternate,s),s=s.return;At=null}}function oc(s,a){var u=s.timeoutHandle;u!==-1&&(s.timeoutHandle=-1,fL(u)),u=s.cancelPendingCommit,u!==null&&(s.cancelPendingCommit=null,u()),io=0,__(),pn=s,At=u=Ws(s.current,null),Lt=a,tn=0,fi=null,Vo=!1,rc=gt(s,a),h_=!1,ic=mi=f_=Ka=Wo=An=0,Jr=Ku=null,m_=!1,(a&8)!==0&&(a|=a&32);var m=s.entangledLanes;if(m!==0)for(s=s.entanglements,m&=a;0<m;){var b=31-Ve(m),x=1<<b;a|=s[b],m&=~x}return ro=a,tf(),u}function LC(s,a){pt=null,D.H=Bu,a===Yl||a===uf?(a=Z1(),tn=3):a===wv?(a=Z1(),tn=4):tn=a===Xv?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,fi=a,At===null&&(An=1,Cf(s,Ti(a,s.current)))}function zC(){var s=di.current;return s===null?!0:(Lt&4194048)===Lt?ji===null:(Lt&62914560)===Lt||(Lt&536870912)!==0?s===ji:!1}function PC(){var s=D.H;return D.H=Bu,s===null?Bu:s}function IC(){var s=D.A;return D.A=W3,s}function zf(){An=4,Vo||(Lt&4194048)!==Lt&&di.current!==null||(rc=!0),(Wo&134217727)===0&&(Ka&134217727)===0||pn===null||Go(pn,Lt,mi,!1)}function b_(s,a,u){var m=Yt;Yt|=2;var b=PC(),x=IC();(pn!==s||Lt!==a)&&(Of=null,oc(s,a)),a=!1;var T=An;e:do try{if(tn!==0&&At!==null){var P=At,Q=fi;switch(tn){case 8:__(),T=6;break e;case 3:case 2:case 9:case 6:di.current===null&&(a=!0);var le=tn;if(tn=0,fi=null,ac(s,P,Q,le),u&&rc){T=0;break e}break;default:le=tn,tn=0,fi=null,ac(s,P,Q,le)}}G3(),T=An;break}catch(ve){LC(s,ve)}while(!0);return a&&s.shellSuspendCounter++,Ks=Ia=null,Yt=m,D.H=b,D.A=x,At===null&&(pn=null,Lt=0,tf()),T}function G3(){for(;At!==null;)BC(At)}function Y3(s,a){var u=Yt;Yt|=2;var m=PC(),b=IC();pn!==s||Lt!==a?(Of=null,Df=Mt()+500,oc(s,a)):rc=gt(s,a);e:do try{if(tn!==0&&At!==null){a=At;var x=fi;t:switch(tn){case 1:tn=0,fi=null,ac(s,a,x,1);break;case 2:case 9:if(Y1(x)){tn=0,fi=null,FC(a);break}a=function(){tn!==2&&tn!==9||pn!==s||(tn=7),bs(s)},x.then(a,a);break e;case 3:tn=7;break e;case 4:tn=5;break e;case 7:Y1(x)?(tn=0,fi=null,FC(a)):(tn=0,fi=null,ac(s,a,x,7));break;case 5:var T=null;switch(At.tag){case 26:T=At.memoizedState;case 5:case 27:var P=At;if(T?kk(T):P.stateNode.complete){tn=0,fi=null;var Q=P.sibling;if(Q!==null)At=Q;else{var le=P.return;le!==null?(At=le,Pf(le)):At=null}break t}}tn=0,fi=null,ac(s,a,x,5);break;case 6:tn=0,fi=null,ac(s,a,x,6);break;case 8:__(),An=6;break e;default:throw Error(r(462))}}X3();break}catch(ve){LC(s,ve)}while(!0);return Ks=Ia=null,D.H=m,D.A=b,Yt=u,At!==null?0:(pn=null,Lt=0,tf(),An)}function X3(){for(;At!==null&&!it();)BC(At)}function BC(s){var a=cC(s.alternate,s,ro);s.memoizedProps=s.pendingProps,a===null?Pf(s):At=a}function FC(s){var a=s,u=a.alternate;switch(a.tag){case 15:case 0:a=rC(u,a,a.pendingProps,a.type,void 0,Lt);break;case 11:a=rC(u,a,a.pendingProps,a.type.render,a.ref,Lt);break;case 5:Ov(a);default:dC(u,a),a=At=I1(a,ro),a=cC(u,a,ro)}s.memoizedProps=s.pendingProps,a===null?Pf(s):At=a}function ac(s,a,u,m){Ks=Ia=null,Ov(a),Xl=null,Au=0;var b=a.return;try{if(I3(s,b,a,u,Lt)){An=1,Cf(s,Ti(u,s.current)),At=null;return}}catch(x){if(b!==null)throw At=b,x;An=1,Cf(s,Ti(u,s.current)),At=null;return}a.flags&32768?(Pt||m===1?s=!0:rc||(Lt&536870912)!==0?s=!1:(Vo=s=!0,(m===2||m===9||m===3||m===6)&&(m=di.current,m!==null&&m.tag===13&&(m.flags|=16384))),HC(a,s)):Pf(a)}function Pf(s){var a=s;do{if((a.flags&32768)!==0){HC(a,Vo);return}s=a.return;var u=H3(a.alternate,a,ro);if(u!==null){At=u;return}if(a=a.sibling,a!==null){At=a;return}At=a=s}while(a!==null);An===0&&(An=5)}function HC(s,a){do{var u=$3(s.alternate,s);if(u!==null){u.flags&=32767,At=u;return}if(u=s.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(s=s.sibling,s!==null)){At=s;return}At=s=u}while(s!==null);An=6,At=null}function $C(s,a,u,m,b,x,T,P,Q){s.cancelPendingCommit=null;do If();while(er!==0);if((Yt&6)!==0)throw Error(r(327));if(a!==null){if(a===s.current)throw Error(r(177));if(x=a.lanes|a.childLanes,x|=av,_t(s,u,x,T,P,Q),s===pn&&(At=pn=null,Lt=0),sc=a,Ko=s,io=u,p_=x,g_=b,AC=m,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,eL(ye,function(){return KC(),null})):(s.callbackNode=null,s.callbackPriority=0),m=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||m){m=D.T,D.T=null,b=U.p,U.p=2,T=Yt,Yt|=4;try{U3(s,a,u)}finally{Yt=T,U.p=b,D.T=m}}er=1,UC(),VC(),WC()}}function UC(){if(er===1){er=0;var s=Ko,a=sc,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=D.T,D.T=null;var m=U.p;U.p=2;var b=Yt;Yt|=4;try{SC(a,s);var x=A_,T=N1(s.containerInfo),P=x.focusedElem,Q=x.selectionRange;if(T!==P&&P&&P.ownerDocument&&T1(P.ownerDocument.documentElement,P)){if(Q!==null&&nv(P)){var le=Q.start,ve=Q.end;if(ve===void 0&&(ve=le),"selectionStart"in P)P.selectionStart=le,P.selectionEnd=Math.min(ve,P.value.length);else{var be=P.ownerDocument||document,ce=be&&be.defaultView||window;if(ce.getSelection){var he=ce.getSelection(),Ue=P.textContent.length,rt=Math.min(Q.start,Ue),ln=Q.end===void 0?rt:Math.min(Q.end,Ue);!he.extend&&rt>ln&&(T=ln,ln=rt,rt=T);var oe=R1(P,rt),te=R1(P,ln);if(oe&&te&&(he.rangeCount!==1||he.anchorNode!==oe.node||he.anchorOffset!==oe.offset||he.focusNode!==te.node||he.focusOffset!==te.offset)){var ae=be.createRange();ae.setStart(oe.node,oe.offset),he.removeAllRanges(),rt>ln?(he.addRange(ae),he.extend(te.node,te.offset)):(ae.setEnd(te.node,te.offset),he.addRange(ae))}}}}for(be=[],he=P;he=he.parentNode;)he.nodeType===1&&be.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;P<be.length;P++){var _e=be[P];_e.element.scrollLeft=_e.left,_e.element.scrollTop=_e.top}}Xf=!!M_,A_=M_=null}finally{Yt=b,U.p=m,D.T=u}}s.current=a,er=2}}function VC(){if(er===2){er=0;var s=Ko,a=sc,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=D.T,D.T=null;var m=U.p;U.p=2;var b=Yt;Yt|=4;try{_C(s,a.alternate,a)}finally{Yt=b,U.p=m,D.T=u}}er=3}}function WC(){if(er===4||er===3){er=0,hn();var s=Ko,a=sc,u=io,m=AC;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?er=5:(er=0,sc=Ko=null,qC(s,s.pendingLanes));var b=s.pendingLanes;if(b===0&&(qo=null),ct(u),a=a.stateNode,He&&typeof He.onCommitFiberRoot=="function")try{He.onCommitFiberRoot(Ae,a,void 0,(a.current.flags&128)===128)}catch{}if(m!==null){a=D.T,b=U.p,U.p=2,D.T=null;try{for(var x=s.onRecoverableError,T=0;T<m.length;T++){var P=m[T];x(P.value,{componentStack:P.stack})}}finally{D.T=a,U.p=b}}(io&3)!==0&&If(),bs(s),b=s.pendingLanes,(u&261930)!==0&&(b&42)!==0?s===v_?Gu++:(Gu=0,v_=s):Gu=0,Yu(0)}}function qC(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,Nu(a)))}function If(){return UC(),VC(),WC(),KC()}function KC(){if(er!==5)return!1;var s=Ko,a=p_;p_=0;var u=ct(io),m=D.T,b=U.p;try{U.p=32>u?32:u,D.T=null,u=g_,g_=null;var x=Ko,T=io;if(er=0,sc=Ko=null,io=0,(Yt&6)!==0)throw Error(r(331));var P=Yt;if(Yt|=4,TC(x.current),kC(x,x.current,T,u),Yt=P,Yu(0,!1),He&&typeof He.onPostCommitFiberRoot=="function")try{He.onPostCommitFiberRoot(Ae,x)}catch{}return!0}finally{U.p=b,D.T=m,qC(s,a)}}function GC(s,a,u){a=Ti(u,a),a=Yv(s.stateNode,a,2),s=Fo(s,a,2),s!==null&&(vt(s,2),bs(s))}function nn(s,a,u){if(s.tag===3)GC(s,s,u);else for(;a!==null;){if(a.tag===3){GC(a,s,u);break}else if(a.tag===1){var m=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(qo===null||!qo.has(m))){s=Ti(u,s),u=YS(2),m=Fo(a,u,2),m!==null&&(XS(u,m,a,s),vt(m,2),bs(m));break}}a=a.return}}function y_(s,a,u){var m=s.pingCache;if(m===null){m=s.pingCache=new q3;var b=new Set;m.set(a,b)}else b=m.get(a),b===void 0&&(b=new Set,m.set(a,b));b.has(u)||(h_=!0,b.add(u),s=Z3.bind(null,s,a,u),a.then(s,s))}function Z3(s,a,u){var m=s.pingCache;m!==null&&m.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,pn===s&&(Lt&u)===u&&(An===4||An===3&&(Lt&62914560)===Lt&&300>Mt()-jf?(Yt&2)===0&&oc(s,0):f_|=u,ic===Lt&&(ic=0)),bs(s)}function YC(s,a){a===0&&(a=Rt()),s=La(s,a),s!==null&&(vt(s,a),bs(s))}function Q3(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),YC(s,u)}function J3(s,a){var u=0;switch(s.tag){case 31:case 13:var m=s.stateNode,b=s.memoizedState;b!==null&&(u=b.retryLane);break;case 19:m=s.stateNode;break;case 22:m=s.stateNode._retryCache;break;default:throw Error(r(314))}m!==null&&m.delete(a),YC(s,u)}function eL(s,a){return ft(s,a)}var Bf=null,lc=null,x_=!1,Ff=!1,w_=!1,Yo=0;function bs(s){s!==lc&&s.next===null&&(lc===null?Bf=lc=s:lc=lc.next=s),Ff=!0,x_||(x_=!0,nL())}function Yu(s,a){if(!w_&&Ff){w_=!0;do for(var u=!1,m=Bf;m!==null;){if(s!==0){var b=m.pendingLanes;if(b===0)var x=0;else{var T=m.suspendedLanes,P=m.pingedLanes;x=(1<<31-Ve(42|s)+1)-1,x&=b&~(T&~P),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(u=!0,JC(m,x))}else x=Lt,x=Ie(m,m===pn?x:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(x&3)===0||gt(m,x)||(u=!0,JC(m,x));m=m.next}while(u);w_=!1}}function tL(){XC()}function XC(){Ff=x_=!1;var s=0;Yo!==0&&hL()&&(s=Yo);for(var a=Mt(),u=null,m=Bf;m!==null;){var b=m.next,x=ZC(m,a);x===0?(m.next=null,u===null?Bf=b:u.next=b,b===null&&(lc=u)):(u=m,(s!==0||(x&3)!==0)&&(Ff=!0)),m=b}er!==0&&er!==5||Yu(s),Yo!==0&&(Yo=0)}function ZC(s,a){for(var u=s.suspendedLanes,m=s.pingedLanes,b=s.expirationTimes,x=s.pendingLanes&-62914561;0<x;){var T=31-Ve(x),P=1<<T,Q=b[T];Q===-1?((P&u)===0||(P&m)!==0)&&(b[T]=wt(P,a)):Q<=a&&(s.expiredLanes|=P),x&=~P}if(a=pn,u=Lt,u=Ie(s,s===a?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),m=s.callbackNode,u===0||s===a&&(tn===2||tn===9)||s.cancelPendingCommit!==null)return m!==null&&m!==null&&at(m),s.callbackNode=null,s.callbackPriority=0;if((u&3)===0||gt(s,u)){if(a=u&-u,a===s.callbackPriority)return a;switch(m!==null&&at(m),ct(u)){case 2:case 8:u=se;break;case 32:u=ye;break;case 268435456:u=qe;break;default:u=ye}return m=QC.bind(null,s),u=ft(u,m),s.callbackPriority=a,s.callbackNode=u,a}return m!==null&&m!==null&&at(m),s.callbackPriority=2,s.callbackNode=null,2}function QC(s,a){if(er!==0&&er!==5)return s.callbackNode=null,s.callbackPriority=0,null;var u=s.callbackNode;if(If()&&s.callbackNode!==u)return null;var m=Lt;return m=Ie(s,s===pn?m:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),m===0?null:(DC(s,m,a),ZC(s,Mt()),s.callbackNode!=null&&s.callbackNode===u?QC.bind(null,s):null)}function JC(s,a){if(If())return null;DC(s,a,!0)}function nL(){mL(function(){(Yt&6)!==0?ft(de,tL):XC()})}function S_(){if(Yo===0){var s=Kl;s===0&&(s=en,en<<=1,(en&261888)===0&&(en=256)),Yo=s}return Yo}function ek(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Kh(""+s)}function tk(s,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,s.id&&u.setAttribute("form",s.id),a.parentNode.insertBefore(u,a),s=new FormData(s),u.parentNode.removeChild(u),s}function rL(s,a,u,m,b){if(a==="submit"&&u&&u.stateNode===b){var x=ek((b[Gt]||null).action),T=m.submitter;T&&(a=(a=T[Gt]||null)?ek(a.formAction):T.getAttribute("formAction"),a!==null&&(x=a,T=null));var P=new Zh("action","action",null,m,b);s.push({event:P,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(Yo!==0){var Q=T?tk(b,T):new FormData(b);Uv(u,{pending:!0,data:Q,method:b.method,action:x},null,Q)}}else typeof x=="function"&&(P.preventDefault(),Q=T?tk(b,T):new FormData(b),Uv(u,{pending:!0,data:Q,method:b.method,action:x},x,Q))},currentTarget:b}]})}}for(var C_=0;C_<ov.length;C_++){var k_=ov[C_],iL=k_.toLowerCase(),sL=k_[0].toUpperCase()+k_.slice(1);Ji(iL,"on"+sL)}Ji(j1,"onAnimationEnd"),Ji(D1,"onAnimationIteration"),Ji(O1,"onAnimationStart"),Ji("dblclick","onDoubleClick"),Ji("focusin","onFocus"),Ji("focusout","onBlur"),Ji(x3,"onTransitionRun"),Ji(w3,"onTransitionStart"),Ji(S3,"onTransitionCancel"),Ji(L1,"onTransitionEnd"),jo("onMouseEnter",["mouseout","mouseover"]),jo("onMouseLeave",["mouseout","mouseover"]),jo("onPointerEnter",["pointerout","pointerover"]),jo("onPointerLeave",["pointerout","pointerover"]),$s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),$s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),$s("onBeforeInput",["compositionend","keypress","textInput","paste"]),$s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),$s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),$s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xu="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(" "),oL=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xu));function nk(s,a){a=(a&4)!==0;for(var u=0;u<s.length;u++){var m=s[u],b=m.event;m=m.listeners;e:{var x=void 0;if(a)for(var T=m.length-1;0<=T;T--){var P=m[T],Q=P.instance,le=P.currentTarget;if(P=P.listener,Q!==x&&b.isPropagationStopped())break e;x=P,b.currentTarget=le;try{x(b)}catch(ve){ef(ve)}b.currentTarget=null,x=Q}else for(T=0;T<m.length;T++){if(P=m[T],Q=P.instance,le=P.currentTarget,P=P.listener,Q!==x&&b.isPropagationStopped())break e;x=P,b.currentTarget=le;try{x(b)}catch(ve){ef(ve)}b.currentTarget=null,x=Q}}}}function jt(s,a){var u=a[fs];u===void 0&&(u=a[fs]=new Set);var m=s+"__bubble";u.has(m)||(rk(a,s,2,!1),u.add(m))}function E_(s,a,u){var m=0;a&&(m|=4),rk(u,s,m,a)}var Hf="_reactListening"+Math.random().toString(36).slice(2);function R_(s){if(!s[Hf]){s[Hf]=!0,Fh.forEach(function(u){u!=="selectionchange"&&(oL.has(u)||E_(u,!1,s),E_(u,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[Hf]||(a[Hf]=!0,E_("selectionchange",!1,a))}}function rk(s,a,u,m){switch(jk(a)){case 2:var b=OL;break;case 8:b=LL;break;default:b=$_}u=b.bind(null,a,u,s),b=void 0,!Kg||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(b=!0),m?b!==void 0?s.addEventListener(a,u,{capture:!0,passive:b}):s.addEventListener(a,u,!0):b!==void 0?s.addEventListener(a,u,{passive:b}):s.addEventListener(a,u,!1)}function T_(s,a,u,m,b){var x=m;if((a&1)===0&&(a&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var P=m.stateNode.containerInfo;if(P===b)break;if(T===4)for(T=m.return;T!==null;){var Q=T.tag;if((Q===3||Q===4)&&T.stateNode.containerInfo===b)return;T=T.return}for(;P!==null;){if(T=Ei(P),T===null)return;if(Q=T.tag,Q===5||Q===6||Q===26||Q===27){m=x=T;continue e}P=P.parentNode}}m=m.return}l1(function(){var le=x,ve=Wg(u),be=[];e:{var ce=z1.get(s);if(ce!==void 0){var he=Zh,Ue=s;switch(s){case"keypress":if(Yh(u)===0)break e;case"keydown":case"keyup":he=JO;break;case"focusin":Ue="focus",he=Zg;break;case"focusout":Ue="blur",he=Zg;break;case"beforeblur":case"afterblur":he=Zg;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":he=d1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=HO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=n3;break;case j1:case D1:case O1:he=VO;break;case L1:he=i3;break;case"scroll":case"scrollend":he=BO;break;case"wheel":he=o3;break;case"copy":case"cut":case"paste":he=qO;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=f1;break;case"toggle":case"beforetoggle":he=l3}var rt=(a&4)!==0,ln=!rt&&(s==="scroll"||s==="scrollend"),oe=rt?ce!==null?ce+"Capture":null:ce;rt=[];for(var te=le,ae;te!==null;){var _e=te;if(ae=_e.stateNode,_e=_e.tag,_e!==5&&_e!==26&&_e!==27||ae===null||oe===null||(_e=_u(te,oe),_e!=null&&rt.push(Zu(te,_e,ae))),ln)break;te=te.return}0<rt.length&&(ce=new he(ce,Ue,null,u,ve),be.push({event:ce,listeners:rt}))}}if((a&7)===0){e:{if(ce=s==="mouseover"||s==="pointerover",he=s==="mouseout"||s==="pointerout",ce&&u!==Vg&&(Ue=u.relatedTarget||u.fromElement)&&(Ei(Ue)||Ue[Mr]))break e;if((he||ce)&&(ce=ve.window===ve?ve:(ce=ve.ownerDocument)?ce.defaultView||ce.parentWindow:window,he?(Ue=u.relatedTarget||u.toElement,he=le,Ue=Ue?Ei(Ue):null,Ue!==null&&(ln=o(Ue),rt=Ue.tag,Ue!==ln||rt!==5&&rt!==27&&rt!==6)&&(Ue=null)):(he=null,Ue=le),he!==Ue)){if(rt=d1,_e="onMouseLeave",oe="onMouseEnter",te="mouse",(s==="pointerout"||s==="pointerover")&&(rt=f1,_e="onPointerLeave",oe="onPointerEnter",te="pointer"),ln=he==null?ce:In(he),ae=Ue==null?ce:In(Ue),ce=new rt(_e,te+"leave",he,u,ve),ce.target=ln,ce.relatedTarget=ae,_e=null,Ei(ve)===le&&(rt=new rt(oe,te+"enter",Ue,u,ve),rt.target=ae,rt.relatedTarget=ln,_e=rt),ln=_e,he&&Ue)t:{for(rt=aL,oe=he,te=Ue,ae=0,_e=oe;_e;_e=rt(_e))ae++;_e=0;for(var tt=te;tt;tt=rt(tt))_e++;for(;0<ae-_e;)oe=rt(oe),ae--;for(;0<_e-ae;)te=rt(te),_e--;for(;ae--;){if(oe===te||te!==null&&oe===te.alternate){rt=oe;break t}oe=rt(oe),te=rt(te)}rt=null}else rt=null;he!==null&&ik(be,ce,he,rt,!1),Ue!==null&&ln!==null&&ik(be,ln,Ue,rt,!0)}}e:{if(ce=le?In(le):window,he=ce.nodeName&&ce.nodeName.toLowerCase(),he==="select"||he==="input"&&ce.type==="file")var Ut=x1;else if(b1(ce))if(w1)Ut=_3;else{Ut=g3;var Ye=p3}else he=ce.nodeName,!he||he.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&Ug(le.elementType)&&(Ut=x1):Ut=v3;if(Ut&&(Ut=Ut(s,le))){y1(be,Ut,u,ve);break e}Ye&&Ye(s,ce,le),s==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&$e(ce,"number",ce.value)}switch(Ye=le?In(le):window,s){case"focusin":(b1(Ye)||Ye.contentEditable==="true")&&(Bl=Ye,rv=le,Eu=null);break;case"focusout":Eu=rv=Bl=null;break;case"mousedown":iv=!0;break;case"contextmenu":case"mouseup":case"dragend":iv=!1,M1(be,u,ve);break;case"selectionchange":if(y3)break;case"keydown":case"keyup":M1(be,u,ve)}var bt;if(Jg)e:{switch(s){case"compositionstart":var zt="onCompositionStart";break e;case"compositionend":zt="onCompositionEnd";break e;case"compositionupdate":zt="onCompositionUpdate";break e}zt=void 0}else Il?v1(s,u)&&(zt="onCompositionEnd"):s==="keydown"&&u.keyCode===229&&(zt="onCompositionStart");zt&&(m1&&u.locale!=="ko"&&(Il||zt!=="onCompositionStart"?zt==="onCompositionEnd"&&Il&&(bt=c1()):(Do=ve,Gg="value"in Do?Do.value:Do.textContent,Il=!0)),Ye=$f(le,zt),0<Ye.length&&(zt=new h1(zt,s,null,u,ve),be.push({event:zt,listeners:Ye}),bt?zt.data=bt:(bt=_1(u),bt!==null&&(zt.data=bt)))),(bt=u3?d3(s,u):h3(s,u))&&(zt=$f(le,"onBeforeInput"),0<zt.length&&(Ye=new h1("onBeforeInput","beforeinput",null,u,ve),be.push({event:Ye,listeners:zt}),Ye.data=bt)),rL(be,s,le,u,ve)}nk(be,a)})}function Zu(s,a,u){return{instance:s,listener:a,currentTarget:u}}function $f(s,a){for(var u=a+"Capture",m=[];s!==null;){var b=s,x=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||x===null||(b=_u(s,u),b!=null&&m.unshift(Zu(s,b,x)),b=_u(s,a),b!=null&&m.push(Zu(s,b,x))),s.tag===3)return m;s=s.return}return[]}function aL(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function ik(s,a,u,m,b){for(var x=a._reactName,T=[];u!==null&&u!==m;){var P=u,Q=P.alternate,le=P.stateNode;if(P=P.tag,Q!==null&&Q===m)break;P!==5&&P!==26&&P!==27||le===null||(Q=le,b?(le=_u(u,x),le!=null&&T.unshift(Zu(u,le,Q))):b||(le=_u(u,x),le!=null&&T.push(Zu(u,le,Q)))),u=u.return}T.length!==0&&s.push({event:a,listeners:T})}var lL=/\r\n?/g,cL=/\u0000|\uFFFD/g;function sk(s){return(typeof s=="string"?s:""+s).replace(lL,`
49
+ `).replace(cL,"")}function ok(s,a){return a=sk(a),sk(s)===a}function an(s,a,u,m,b,x){switch(u){case"children":typeof m=="string"?a==="body"||a==="textarea"&&m===""||Gr(s,m):(typeof m=="number"||typeof m=="bigint")&&a!=="body"&&Gr(s,""+m);break;case"className":Ll(s,"class",m);break;case"tabIndex":Ll(s,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":Ll(s,u,m);break;case"style":o1(s,m,x);break;case"data":if(a!=="object"){Ll(s,"data",m);break}case"src":case"href":if(m===""&&(a!=="a"||u!=="href")){s.removeAttribute(u);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){s.removeAttribute(u);break}m=Kh(""+m),s.setAttribute(u,m);break;case"action":case"formAction":if(typeof m=="function"){s.setAttribute(u,"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 x=="function"&&(u==="formAction"?(a!=="input"&&an(s,a,"name",b.name,b,null),an(s,a,"formEncType",b.formEncType,b,null),an(s,a,"formMethod",b.formMethod,b,null),an(s,a,"formTarget",b.formTarget,b,null)):(an(s,a,"encType",b.encType,b,null),an(s,a,"method",b.method,b,null),an(s,a,"target",b.target,b,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){s.removeAttribute(u);break}m=Kh(""+m),s.setAttribute(u,m);break;case"onClick":m!=null&&(s.onclick=Us);break;case"onScroll":m!=null&&jt("scroll",s);break;case"onScrollEnd":m!=null&&jt("scrollend",s);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(u=m.__html,u!=null){if(b.children!=null)throw Error(r(60));s.innerHTML=u}}break;case"multiple":s.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":s.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){s.removeAttribute("xlink:href");break}u=Kh(""+m),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(u,""+m):s.removeAttribute(u);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":m&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(u,""):s.removeAttribute(u);break;case"capture":case"download":m===!0?s.setAttribute(u,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(u,m):s.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?s.setAttribute(u,m):s.removeAttribute(u);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?s.removeAttribute(u):s.setAttribute(u,m);break;case"popover":jt("beforetoggle",s),jt("toggle",s),Ol(s,"popover",m);break;case"xlinkActuate":Qi(s,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":Qi(s,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":Qi(s,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":Qi(s,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":Qi(s,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":Qi(s,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":Qi(s,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":Qi(s,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":Qi(s,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":Ol(s,"is",m);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=PO.get(u)||u,Ol(s,u,m))}}function N_(s,a,u,m,b,x){switch(u){case"style":o1(s,m,x);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(u=m.__html,u!=null){if(b.children!=null)throw Error(r(60));s.innerHTML=u}}break;case"children":typeof m=="string"?Gr(s,m):(typeof m=="number"||typeof m=="bigint")&&Gr(s,""+m);break;case"onScroll":m!=null&&jt("scroll",s);break;case"onScrollEnd":m!=null&&jt("scrollend",s);break;case"onClick":m!=null&&(s.onclick=Us);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Hh.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(b=u.endsWith("Capture"),a=u.slice(2,b?u.length-7:void 0),x=s[Gt]||null,x=x!=null?x[u]:null,typeof x=="function"&&s.removeEventListener(a,x,b),typeof m=="function")){typeof x!="function"&&x!==null&&(u in s?s[u]=null:s.hasAttribute(u)&&s.removeAttribute(u)),s.addEventListener(a,m,b);break e}u in s?s[u]=m:m===!0?s.setAttribute(u,""):Ol(s,u,m)}}}function kr(s,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":jt("error",s),jt("load",s);var m=!1,b=!1,x;for(x in u)if(u.hasOwnProperty(x)){var T=u[x];if(T!=null)switch(x){case"src":m=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:an(s,a,x,T,u,null)}}b&&an(s,a,"srcSet",u.srcSet,u,null),m&&an(s,a,"src",u.src,u,null);return;case"input":jt("invalid",s);var P=x=T=b=null,Q=null,le=null;for(m in u)if(u.hasOwnProperty(m)){var ve=u[m];if(ve!=null)switch(m){case"name":b=ve;break;case"type":T=ve;break;case"checked":Q=ve;break;case"defaultChecked":le=ve;break;case"value":x=ve;break;case"defaultValue":P=ve;break;case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(r(137,a));break;default:an(s,a,m,ve,u,null)}}Se(s,x,P,Q,le,T,b,!1);return;case"select":jt("invalid",s),m=T=x=null;for(b in u)if(u.hasOwnProperty(b)&&(P=u[b],P!=null))switch(b){case"value":x=P;break;case"defaultValue":T=P;break;case"multiple":m=P;default:an(s,a,b,P,u,null)}a=x,u=T,s.multiple=!!m,a!=null?It(s,!!m,a,!1):u!=null&&It(s,!!m,u,!0);return;case"textarea":jt("invalid",s),x=b=m=null;for(T in u)if(u.hasOwnProperty(T)&&(P=u[T],P!=null))switch(T){case"value":m=P;break;case"defaultValue":b=P;break;case"children":x=P;break;case"dangerouslySetInnerHTML":if(P!=null)throw Error(r(91));break;default:an(s,a,T,P,u,null)}xr(s,m,b,x);return;case"option":for(Q in u)if(u.hasOwnProperty(Q)&&(m=u[Q],m!=null))switch(Q){case"selected":s.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:an(s,a,Q,m,u,null)}return;case"dialog":jt("beforetoggle",s),jt("toggle",s),jt("cancel",s),jt("close",s);break;case"iframe":case"object":jt("load",s);break;case"video":case"audio":for(m=0;m<Xu.length;m++)jt(Xu[m],s);break;case"image":jt("error",s),jt("load",s);break;case"details":jt("toggle",s);break;case"embed":case"source":case"link":jt("error",s),jt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(le in u)if(u.hasOwnProperty(le)&&(m=u[le],m!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:an(s,a,le,m,u,null)}return;default:if(Ug(a)){for(ve in u)u.hasOwnProperty(ve)&&(m=u[ve],m!==void 0&&N_(s,a,ve,m,u,void 0));return}}for(P in u)u.hasOwnProperty(P)&&(m=u[P],m!=null&&an(s,a,P,m,u,null))}function uL(s,a,u,m){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,x=null,T=null,P=null,Q=null,le=null,ve=null;for(he in u){var be=u[he];if(u.hasOwnProperty(he)&&be!=null)switch(he){case"checked":break;case"value":break;case"defaultValue":Q=be;default:m.hasOwnProperty(he)||an(s,a,he,null,m,be)}}for(var ce in m){var he=m[ce];if(be=u[ce],m.hasOwnProperty(ce)&&(he!=null||be!=null))switch(ce){case"type":x=he;break;case"name":b=he;break;case"checked":le=he;break;case"defaultChecked":ve=he;break;case"value":T=he;break;case"defaultValue":P=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(r(137,a));break;default:he!==be&&an(s,a,ce,he,m,be)}}ne(s,T,P,Q,le,ve,x,b);return;case"select":he=T=P=ce=null;for(x in u)if(Q=u[x],u.hasOwnProperty(x)&&Q!=null)switch(x){case"value":break;case"multiple":he=Q;default:m.hasOwnProperty(x)||an(s,a,x,null,m,Q)}for(b in m)if(x=m[b],Q=u[b],m.hasOwnProperty(b)&&(x!=null||Q!=null))switch(b){case"value":ce=x;break;case"defaultValue":P=x;break;case"multiple":T=x;default:x!==Q&&an(s,a,b,x,m,Q)}a=P,u=T,m=he,ce!=null?It(s,!!u,ce,!1):!!m!=!!u&&(a!=null?It(s,!!u,a,!0):It(s,!!u,u?[]:"",!1));return;case"textarea":he=ce=null;for(P in u)if(b=u[P],u.hasOwnProperty(P)&&b!=null&&!m.hasOwnProperty(P))switch(P){case"value":break;case"children":break;default:an(s,a,P,null,m,b)}for(T in m)if(b=m[T],x=u[T],m.hasOwnProperty(T)&&(b!=null||x!=null))switch(T){case"value":ce=b;break;case"defaultValue":he=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(r(91));break;default:b!==x&&an(s,a,T,b,m,x)}Cn(s,ce,he);return;case"option":for(var Ue in u)if(ce=u[Ue],u.hasOwnProperty(Ue)&&ce!=null&&!m.hasOwnProperty(Ue))switch(Ue){case"selected":s.selected=!1;break;default:an(s,a,Ue,null,m,ce)}for(Q in m)if(ce=m[Q],he=u[Q],m.hasOwnProperty(Q)&&ce!==he&&(ce!=null||he!=null))switch(Q){case"selected":s.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:an(s,a,Q,ce,m,he)}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 rt in u)ce=u[rt],u.hasOwnProperty(rt)&&ce!=null&&!m.hasOwnProperty(rt)&&an(s,a,rt,null,m,ce);for(le in m)if(ce=m[le],he=u[le],m.hasOwnProperty(le)&&ce!==he&&(ce!=null||he!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(r(137,a));break;default:an(s,a,le,ce,m,he)}return;default:if(Ug(a)){for(var ln in u)ce=u[ln],u.hasOwnProperty(ln)&&ce!==void 0&&!m.hasOwnProperty(ln)&&N_(s,a,ln,void 0,m,ce);for(ve in m)ce=m[ve],he=u[ve],!m.hasOwnProperty(ve)||ce===he||ce===void 0&&he===void 0||N_(s,a,ve,ce,m,he);return}}for(var oe in u)ce=u[oe],u.hasOwnProperty(oe)&&ce!=null&&!m.hasOwnProperty(oe)&&an(s,a,oe,null,m,ce);for(be in m)ce=m[be],he=u[be],!m.hasOwnProperty(be)||ce===he||ce==null&&he==null||an(s,a,be,ce,m,he)}function ak(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function dL(){if(typeof performance.getEntriesByType=="function"){for(var s=0,a=0,u=performance.getEntriesByType("resource"),m=0;m<u.length;m++){var b=u[m],x=b.transferSize,T=b.initiatorType,P=b.duration;if(x&&P&&ak(T)){for(T=0,P=b.responseEnd,m+=1;m<u.length;m++){var Q=u[m],le=Q.startTime;if(le>P)break;var ve=Q.transferSize,be=Q.initiatorType;ve&&ak(be)&&(Q=Q.responseEnd,T+=ve*(Q<P?1:(P-le)/(Q-le)))}if(--m,a+=8*(x+T)/(b.duration/1e3),s++,10<s)break}}if(0<s)return a/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var M_=null,A_=null;function Uf(s){return s.nodeType===9?s:s.ownerDocument}function lk(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ck(s,a){if(s===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&a==="foreignObject"?0:s}function j_(s,a){return s==="textarea"||s==="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 D_=null;function hL(){var s=window.event;return s&&s.type==="popstate"?s===D_?!1:(D_=s,!0):(D_=null,!1)}var uk=typeof setTimeout=="function"?setTimeout:void 0,fL=typeof clearTimeout=="function"?clearTimeout:void 0,dk=typeof Promise=="function"?Promise:void 0,mL=typeof queueMicrotask=="function"?queueMicrotask:typeof dk<"u"?function(s){return dk.resolve(null).then(s).catch(pL)}:uk;function pL(s){setTimeout(function(){throw s})}function Xo(s){return s==="head"}function hk(s,a){var u=a,m=0;do{var b=u.nextSibling;if(s.removeChild(u),b&&b.nodeType===8)if(u=b.data,u==="/$"||u==="/&"){if(m===0){s.removeChild(b),hc(a);return}m--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")m++;else if(u==="html")Qu(s.ownerDocument.documentElement);else if(u==="head"){u=s.ownerDocument.head,Qu(u);for(var x=u.firstChild;x;){var T=x.nextSibling,P=x.nodeName;x[Vn]||P==="SCRIPT"||P==="STYLE"||P==="LINK"&&x.rel.toLowerCase()==="stylesheet"||u.removeChild(x),x=T}}else u==="body"&&Qu(s.ownerDocument.body);u=b}while(u);hc(a)}function fk(s,a){var u=s;s=0;do{var m=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),m&&m.nodeType===8)if(u=m.data,u==="/$"){if(s===0)break;s--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||s++;u=m}while(u)}function O_(s){var a=s.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":O_(u),ms(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}s.removeChild(u)}}function gL(s,a,u,m){for(;s.nodeType===1;){var b=u;if(s.nodeName.toLowerCase()!==a.toLowerCase()){if(!m&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(m){if(!s[Vn])switch(a){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(x=s.getAttribute("rel"),x==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(x!==b.rel||s.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||s.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||s.getAttribute("title")!==(b.title==null?null:b.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(x=s.getAttribute("src"),(x!==(b.src==null?null:b.src)||s.getAttribute("type")!==(b.type==null?null:b.type)||s.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&x&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var x=b.name==null?null:""+b.name;if(b.type==="hidden"&&s.getAttribute("name")===x)return s}else return s;if(s=Di(s.nextSibling),s===null)break}return null}function vL(s,a,u){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!u||(s=Di(s.nextSibling),s===null))return null;return s}function mk(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=Di(s.nextSibling),s===null))return null;return s}function L_(s){return s.data==="$?"||s.data==="$~"}function z_(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function _L(s,a){var u=s.ownerDocument;if(s.data==="$~")s._reactRetry=a;else if(s.data!=="$?"||u.readyState!=="loading")a();else{var m=function(){a(),u.removeEventListener("DOMContentLoaded",m)};u.addEventListener("DOMContentLoaded",m),s._reactRetry=m}}function Di(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var P_=null;function pk(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var u=s.data;if(u==="/$"||u==="/&"){if(a===0)return Di(s.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}s=s.nextSibling}return null}function gk(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var u=s.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return s;a--}else u!=="/$"&&u!=="/&"||a++}s=s.previousSibling}return null}function vk(s,a,u){switch(a=Uf(u),s){case"html":if(s=a.documentElement,!s)throw Error(r(452));return s;case"head":if(s=a.head,!s)throw Error(r(453));return s;case"body":if(s=a.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function Qu(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);ms(s)}var Oi=new Map,_k=new Set;function Vf(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var so=U.d;U.d={f:bL,r:yL,D:xL,C:wL,L:SL,m:CL,X:EL,S:kL,M:RL};function bL(){var s=so.f(),a=Lf();return s||a}function yL(s){var a=Ft(s);a!==null&&a.tag===5&&a.type==="form"?LS(a):so.r(s)}var cc=typeof document>"u"?null:document;function bk(s,a,u){var m=cc;if(m&&typeof a=="string"&&a){var b=Y(a);b='link[rel="'+s+'"][href="'+b+'"]',typeof u=="string"&&(b+='[crossorigin="'+u+'"]'),_k.has(b)||(_k.add(b),s={rel:s,crossOrigin:u,href:a},m.querySelector(b)===null&&(a=m.createElement("link"),kr(a,"link",s),Wn(a),m.head.appendChild(a)))}}function xL(s){so.D(s),bk("dns-prefetch",s,null)}function wL(s,a){so.C(s,a),bk("preconnect",s,a)}function SL(s,a,u){so.L(s,a,u);var m=cc;if(m&&s&&a){var b='link[rel="preload"][as="'+Y(a)+'"]';a==="image"&&u&&u.imageSrcSet?(b+='[imagesrcset="'+Y(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(b+='[imagesizes="'+Y(u.imageSizes)+'"]')):b+='[href="'+Y(s)+'"]';var x=b;switch(a){case"style":x=uc(s);break;case"script":x=dc(s)}Oi.has(x)||(s=p({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:s,as:a},u),Oi.set(x,s),m.querySelector(b)!==null||a==="style"&&m.querySelector(Ju(x))||a==="script"&&m.querySelector(ed(x))||(a=m.createElement("link"),kr(a,"link",s),Wn(a),m.head.appendChild(a)))}}function CL(s,a){so.m(s,a);var u=cc;if(u&&s){var m=a&&typeof a.as=="string"?a.as:"script",b='link[rel="modulepreload"][as="'+Y(m)+'"][href="'+Y(s)+'"]',x=b;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=dc(s)}if(!Oi.has(x)&&(s=p({rel:"modulepreload",href:s},a),Oi.set(x,s),u.querySelector(b)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(ed(x)))return}m=u.createElement("link"),kr(m,"link",s),Wn(m),u.head.appendChild(m)}}}function kL(s,a,u){so.S(s,a,u);var m=cc;if(m&&s){var b=ps(m).hoistableStyles,x=uc(s);a=a||"default";var T=b.get(x);if(!T){var P={loading:0,preload:null};if(T=m.querySelector(Ju(x)))P.loading=5;else{s=p({rel:"stylesheet",href:s,"data-precedence":a},u),(u=Oi.get(x))&&I_(s,u);var Q=T=m.createElement("link");Wn(Q),kr(Q,"link",s),Q._p=new Promise(function(le,ve){Q.onload=le,Q.onerror=ve}),Q.addEventListener("load",function(){P.loading|=1}),Q.addEventListener("error",function(){P.loading|=2}),P.loading|=4,Wf(T,a,m)}T={type:"stylesheet",instance:T,count:1,state:P},b.set(x,T)}}}function EL(s,a){so.X(s,a);var u=cc;if(u&&s){var m=ps(u).hoistableScripts,b=dc(s),x=m.get(b);x||(x=u.querySelector(ed(b)),x||(s=p({src:s,async:!0},a),(a=Oi.get(b))&&B_(s,a),x=u.createElement("script"),Wn(x),kr(x,"link",s),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},m.set(b,x))}}function RL(s,a){so.M(s,a);var u=cc;if(u&&s){var m=ps(u).hoistableScripts,b=dc(s),x=m.get(b);x||(x=u.querySelector(ed(b)),x||(s=p({src:s,async:!0,type:"module"},a),(a=Oi.get(b))&&B_(s,a),x=u.createElement("script"),Wn(x),kr(x,"link",s),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},m.set(b,x))}}function yk(s,a,u,m){var b=(b=ee.current)?Vf(b):null;if(!b)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=uc(u.href),u=ps(b).hoistableStyles,m=u.get(a),m||(m={type:"style",instance:null,count:0,state:null},u.set(a,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){s=uc(u.href);var x=ps(b).hoistableStyles,T=x.get(s);if(T||(b=b.ownerDocument||b,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(s,T),(x=b.querySelector(Ju(s)))&&!x._p&&(T.instance=x,T.state.loading=5),Oi.has(s)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Oi.set(s,u),x||TL(b,s,u,T.state))),a&&m===null)throw Error(r(528,""));return T}if(a&&m!==null)throw Error(r(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=dc(u),u=ps(b).hoistableScripts,m=u.get(a),m||(m={type:"script",instance:null,count:0,state:null},u.set(a,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function uc(s){return'href="'+Y(s)+'"'}function Ju(s){return'link[rel="stylesheet"]['+s+"]"}function xk(s){return p({},s,{"data-precedence":s.precedence,precedence:null})}function TL(s,a,u,m){s.querySelector('link[rel="preload"][as="style"]['+a+"]")?m.loading=1:(a=s.createElement("link"),m.preload=a,a.addEventListener("load",function(){return m.loading|=1}),a.addEventListener("error",function(){return m.loading|=2}),kr(a,"link",u),Wn(a),s.head.appendChild(a))}function dc(s){return'[src="'+Y(s)+'"]'}function ed(s){return"script[async]"+s}function wk(s,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var m=s.querySelector('style[data-href~="'+Y(u.href)+'"]');if(m)return a.instance=m,Wn(m),m;var b=p({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return m=(s.ownerDocument||s).createElement("style"),Wn(m),kr(m,"style",b),Wf(m,u.precedence,s),a.instance=m;case"stylesheet":b=uc(u.href);var x=s.querySelector(Ju(b));if(x)return a.state.loading|=4,a.instance=x,Wn(x),x;m=xk(u),(b=Oi.get(b))&&I_(m,b),x=(s.ownerDocument||s).createElement("link"),Wn(x);var T=x;return T._p=new Promise(function(P,Q){T.onload=P,T.onerror=Q}),kr(x,"link",m),a.state.loading|=4,Wf(x,u.precedence,s),a.instance=x;case"script":return x=dc(u.src),(b=s.querySelector(ed(x)))?(a.instance=b,Wn(b),b):(m=u,(b=Oi.get(x))&&(m=p({},u),B_(m,b)),s=s.ownerDocument||s,b=s.createElement("script"),Wn(b),kr(b,"link",m),s.head.appendChild(b),a.instance=b);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(m=a.instance,a.state.loading|=4,Wf(m,u.precedence,s));return a.instance}function Wf(s,a,u){for(var m=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=m.length?m[m.length-1]:null,x=b,T=0;T<m.length;T++){var P=m[T];if(P.dataset.precedence===a)x=P;else if(x!==b)break}x?x.parentNode.insertBefore(s,x.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(s,a.firstChild))}function I_(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function B_(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var qf=null;function Sk(s,a,u){if(qf===null){var m=new Map,b=qf=new Map;b.set(u,m)}else b=qf,m=b.get(u),m||(m=new Map,b.set(u,m));if(m.has(s))return m;for(m.set(s,null),u=u.getElementsByTagName(s),b=0;b<u.length;b++){var x=u[b];if(!(x[Vn]||x[Kt]||s==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var T=x.getAttribute(a)||"";T=s+T;var P=m.get(T);P?P.push(x):m.set(T,[x])}}return m}function Ck(s,a,u){s=s.ownerDocument||s,s.head.insertBefore(u,a==="title"?s.querySelector("head > title"):null)}function NL(s,a,u){if(u===1||a.itemProp!=null)return!1;switch(s){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 s=a.disabled,typeof a.precedence=="string"&&s==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 kk(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function ML(s,a,u,m){if(u.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var b=uc(m.href),x=a.querySelector(Ju(b));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=Kf.bind(s),a.then(s,s)),u.state.loading|=4,u.instance=x,Wn(x);return}x=a.ownerDocument||a,m=xk(m),(b=Oi.get(b))&&I_(m,b),x=x.createElement("link"),Wn(x);var T=x;T._p=new Promise(function(P,Q){T.onload=P,T.onerror=Q}),kr(x,"link",m),u.instance=x}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(s.count++,u=Kf.bind(s),a.addEventListener("load",u),a.addEventListener("error",u))}}var F_=0;function AL(s,a){return s.stylesheets&&s.count===0&&Yf(s,s.stylesheets),0<s.count||0<s.imgCount?function(u){var m=setTimeout(function(){if(s.stylesheets&&Yf(s,s.stylesheets),s.unsuspend){var x=s.unsuspend;s.unsuspend=null,x()}},6e4+a);0<s.imgBytes&&F_===0&&(F_=62500*dL());var b=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Yf(s,s.stylesheets),s.unsuspend)){var x=s.unsuspend;s.unsuspend=null,x()}},(s.imgBytes>F_?50:800)+a);return s.unsuspend=u,function(){s.unsuspend=null,clearTimeout(m),clearTimeout(b)}}:null}function Kf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yf(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Gf=null;function Yf(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Gf=new Map,a.forEach(jL,s),Gf=null,Kf.call(s))}function jL(s,a){if(!(a.state.loading&4)){var u=Gf.get(s);if(u)var m=u.get(null);else{u=new Map,Gf.set(s,u);for(var b=s.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<b.length;x++){var T=b[x];(T.nodeName==="LINK"||T.getAttribute("media")!=="not all")&&(u.set(T.dataset.precedence,T),m=T)}m&&u.set(null,m)}b=a.instance,T=b.getAttribute("data-precedence"),x=u.get(T)||m,x===m&&u.set(null,b),u.set(T,b),this.count++,m=Kf.bind(this),b.addEventListener("load",m),b.addEventListener("error",m),x?x.parentNode.insertBefore(b,x.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(b,s.firstChild)),a.state.loading|=4}}var td={$$typeof:E,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function DL(s,a,u,m,b,x,T,P,Q){this.tag=1,this.containerInfo=s,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=Jt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jt(0),this.hiddenUpdates=Jt(null),this.identifierPrefix=m,this.onUncaughtError=b,this.onCaughtError=x,this.onRecoverableError=T,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function Ek(s,a,u,m,b,x,T,P,Q,le,ve,be){return s=new DL(s,a,u,T,Q,le,ve,be,P),a=1,x===!0&&(a|=24),x=ui(3,null,null,a),s.current=x,x.stateNode=s,a=bv(),a.refCount++,s.pooledCache=a,a.refCount++,x.memoizedState={element:m,isDehydrated:u,cache:a},Sv(x),s}function Rk(s){return s?(s=$l,s):$l}function Tk(s,a,u,m,b,x){b=Rk(b),m.context===null?m.context=b:m.pendingContext=b,m=Bo(a),m.payload={element:u},x=x===void 0?null:x,x!==null&&(m.callback=x),u=Fo(s,m,a),u!==null&&(ei(u,s,a),Du(u,s,a))}function Nk(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u<a?u:a}}function H_(s,a){Nk(s,a),(s=s.alternate)&&Nk(s,a)}function Mk(s){if(s.tag===13||s.tag===31){var a=La(s,67108864);a!==null&&ei(a,s,67108864),H_(s,67108864)}}function Ak(s){if(s.tag===13||s.tag===31){var a=pi();a=Tt(a);var u=La(s,a);u!==null&&ei(u,s,a),H_(s,a)}}var Xf=!0;function OL(s,a,u,m){var b=D.T;D.T=null;var x=U.p;try{U.p=2,$_(s,a,u,m)}finally{U.p=x,D.T=b}}function LL(s,a,u,m){var b=D.T;D.T=null;var x=U.p;try{U.p=8,$_(s,a,u,m)}finally{U.p=x,D.T=b}}function $_(s,a,u,m){if(Xf){var b=U_(m);if(b===null)T_(s,a,m,Zf,u),Dk(s,m);else if(PL(b,s,a,u,m))m.stopPropagation();else if(Dk(s,m),a&4&&-1<zL.indexOf(s)){for(;b!==null;){var x=Ft(b);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var T=qt(x.pendingLanes);if(T!==0){var P=x;for(P.pendingLanes|=2,P.entangledLanes|=2;T;){var Q=1<<31-Ve(T);P.entanglements[1]|=Q,T&=~Q}bs(x),(Yt&6)===0&&(Df=Mt()+500,Yu(0))}}break;case 31:case 13:P=La(x,2),P!==null&&ei(P,x,2),Lf(),H_(x,2)}if(x=U_(m),x===null&&T_(s,a,m,Zf,u),x===b)break;b=x}b!==null&&m.stopPropagation()}else T_(s,a,m,null,u)}}function U_(s){return s=Wg(s),V_(s)}var Zf=null;function V_(s){if(Zf=null,s=Ei(s),s!==null){var a=o(s);if(a===null)s=null;else{var u=a.tag;if(u===13){if(s=l(a),s!==null)return s;s=null}else if(u===31){if(s=c(a),s!==null)return s;s=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null)}}return Zf=s,null}function jk(s){switch(s){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(Pn()){case de:return 2;case se:return 8;case ye:case Ee:return 32;case qe:return 268435456;default:return 32}default:return 32}}var W_=!1,Zo=null,Qo=null,Jo=null,nd=new Map,rd=new Map,ea=[],zL="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 Dk(s,a){switch(s){case"focusin":case"focusout":Zo=null;break;case"dragenter":case"dragleave":Qo=null;break;case"mouseover":case"mouseout":Jo=null;break;case"pointerover":case"pointerout":nd.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":rd.delete(a.pointerId)}}function id(s,a,u,m,b,x){return s===null||s.nativeEvent!==x?(s={blockedOn:a,domEventName:u,eventSystemFlags:m,nativeEvent:x,targetContainers:[b]},a!==null&&(a=Ft(a),a!==null&&Mk(a)),s):(s.eventSystemFlags|=m,a=s.targetContainers,b!==null&&a.indexOf(b)===-1&&a.push(b),s)}function PL(s,a,u,m,b){switch(a){case"focusin":return Zo=id(Zo,s,a,u,m,b),!0;case"dragenter":return Qo=id(Qo,s,a,u,m,b),!0;case"mouseover":return Jo=id(Jo,s,a,u,m,b),!0;case"pointerover":var x=b.pointerId;return nd.set(x,id(nd.get(x)||null,s,a,u,m,b)),!0;case"gotpointercapture":return x=b.pointerId,rd.set(x,id(rd.get(x)||null,s,a,u,m,b)),!0}return!1}function Ok(s){var a=Ei(s.target);if(a!==null){var u=o(a);if(u!==null){if(a=u.tag,a===13){if(a=l(u),a!==null){s.blockedOn=a,bn(s.priority,function(){Ak(u)});return}}else if(a===31){if(a=c(u),a!==null){s.blockedOn=a,bn(s.priority,function(){Ak(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){s.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Qf(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var u=U_(s.nativeEvent);if(u===null){u=s.nativeEvent;var m=new u.constructor(u.type,u);Vg=m,u.target.dispatchEvent(m),Vg=null}else return a=Ft(u),a!==null&&Mk(a),s.blockedOn=u,!1;a.shift()}return!0}function Lk(s,a,u){Qf(s)&&u.delete(a)}function IL(){W_=!1,Zo!==null&&Qf(Zo)&&(Zo=null),Qo!==null&&Qf(Qo)&&(Qo=null),Jo!==null&&Qf(Jo)&&(Jo=null),nd.forEach(Lk),rd.forEach(Lk)}function Jf(s,a){s.blockedOn===a&&(s.blockedOn=null,W_||(W_=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,IL)))}var em=null;function zk(s){em!==s&&(em=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){em===s&&(em=null);for(var a=0;a<s.length;a+=3){var u=s[a],m=s[a+1],b=s[a+2];if(typeof m!="function"){if(V_(m||u)===null)continue;break}var x=Ft(u);x!==null&&(s.splice(a,3),a-=3,Uv(x,{pending:!0,data:b,method:u.method,action:m},m,b))}}))}function hc(s){function a(Q){return Jf(Q,s)}Zo!==null&&Jf(Zo,s),Qo!==null&&Jf(Qo,s),Jo!==null&&Jf(Jo,s),nd.forEach(a),rd.forEach(a);for(var u=0;u<ea.length;u++){var m=ea[u];m.blockedOn===s&&(m.blockedOn=null)}for(;0<ea.length&&(u=ea[0],u.blockedOn===null);)Ok(u),u.blockedOn===null&&ea.shift();if(u=(s.ownerDocument||s).$$reactFormReplay,u!=null)for(m=0;m<u.length;m+=3){var b=u[m],x=u[m+1],T=b[Gt]||null;if(typeof x=="function")T||zk(u);else if(T){var P=null;if(x&&x.hasAttribute("formAction")){if(b=x,T=x[Gt]||null)P=T.formAction;else if(V_(b)!==null)continue}else P=T.action;typeof P=="function"?u[m+1]=P:(u.splice(m,3),m-=3),zk(u)}}}function Pk(){function s(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(T){return b=T})},focusReset:"manual",scroll:"manual"})}function a(){b!==null&&(b(),b=null),m||setTimeout(u,20)}function u(){if(!m&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,b=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){m=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),b!==null&&(b(),b=null)}}}function q_(s){this._internalRoot=s}tm.prototype.render=q_.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(r(409));var u=a.current,m=pi();Tk(u,m,s,a,null,null)},tm.prototype.unmount=q_.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;Tk(s.current,2,null,s,null,null),Lf(),a[Mr]=null}};function tm(s){this._internalRoot=s}tm.prototype.unstable_scheduleHydration=function(s){if(s){var a=mn();s={blockedOn:null,target:s,priority:a};for(var u=0;u<ea.length&&a!==0&&a<ea[u].priority;u++);ea.splice(u,0,s),u===0&&Ok(s)}};var Ik=t.version;if(Ik!=="19.2.1")throw Error(r(527,Ik,"19.2.1"));U.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=d(a),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var BL={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nm.isDisabled&&nm.supportsFiber)try{Ae=nm.inject(BL),He=nm}catch{}}return ad.createRoot=function(s,a){if(!i(s))throw Error(r(299));var u=!1,m="",b=WS,x=qS,T=KS;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(m=a.identifierPrefix),a.onUncaughtError!==void 0&&(b=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(T=a.onRecoverableError)),a=Ek(s,1,!1,null,null,u,m,null,b,x,T,Pk),s[Mr]=a.current,R_(s),new q_(a)},ad.hydrateRoot=function(s,a,u){if(!i(s))throw Error(r(299));var m=!1,b="",x=WS,T=qS,P=KS,Q=null;return u!=null&&(u.unstable_strictMode===!0&&(m=!0),u.identifierPrefix!==void 0&&(b=u.identifierPrefix),u.onUncaughtError!==void 0&&(x=u.onUncaughtError),u.onCaughtError!==void 0&&(T=u.onCaughtError),u.onRecoverableError!==void 0&&(P=u.onRecoverableError),u.formState!==void 0&&(Q=u.formState)),a=Ek(s,1,!0,a,u??null,m,b,Q,x,T,P,Pk),a.context=Rk(null),u=a.current,m=pi(),m=Tt(m),b=Bo(m),b.callback=null,Fo(u,b,m),u=m,a.current.lanes=u,vt(a,u),bs(a),s[Mr]=a.current,R_(s),new tm(a)},ad.version="19.2.1",ad}var Qk;function ZL(){if(Qk)return Y_.exports;Qk=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(),Y_.exports=XL(),Y_.exports}var QL=ZL();/**
50
+ * react-router v7.13.2
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 Jk="popstate";function e2(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function JL(e={}){function t(r,i){var d;let o=(d=i.state)==null?void 0:d.masked,{pathname:l,search:c,hash:h}=o||r.location;return vy("",{pathname:l,search:c,hash:h},i.state&&i.state.usr||null,i.state&&i.state.key||"default",o?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,i){return typeof i=="string"?i:Kd(i)}return tz(t,n,null,e)}function En(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Gi(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ez(){return Math.random().toString(36).substring(2,10)}function t2(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function vy(e,t,n=null,r,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Xc(t):t,state:n,key:t&&t.key||r||ez(),unstable_mask:i}}function Kd({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Xc(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function tz(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:o=!1}=r,l=i.history,c="POP",h=null,d=g();d==null&&(d=0,l.replaceState({...l.state,idx:d},""));function g(){return(l.state||{idx:null}).idx}function p(){c="POP";let C=g(),k=C==null?null:C-d;d=C,h&&h({action:c,location:S.location,delta:k})}function _(C,k){c="PUSH";let R=e2(C)?C:vy(S.location,C,k);d=g()+1;let E=t2(R,d),N=S.createHref(R.unstable_mask||R);try{l.pushState(E,"",N)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;i.location.assign(N)}o&&h&&h({action:c,location:S.location,delta:1})}function y(C,k){c="REPLACE";let R=e2(C)?C:vy(S.location,C,k);d=g();let E=t2(R,d),N=S.createHref(R.unstable_mask||R);l.replaceState(E,"",N),o&&h&&h({action:c,location:S.location,delta:0})}function w(C){return nz(C)}let S={get action(){return c},get location(){return e(i,l)},listen(C){if(h)throw new Error("A history only accepts one active listener");return i.addEventListener(Jk,p),h=C,()=>{i.removeEventListener(Jk,p),h=null}},createHref(C){return t(i,C)},createURL:w,encodeLocation(C){let k=w(C);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:_,replace:y,go(C){return l.go(C)}};return S}function nz(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),En(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Kd(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function SN(e,t,n="/"){return rz(e,t,n,!1)}function rz(e,t,n,r){let i=typeof t=="string"?Xc(t):t,o=vo(i.pathname||"/",n);if(o==null)return null;let l=CN(e);iz(l);let c=null;for(let h=0;c==null&&h<l.length;++h){let d=pz(o);c=fz(l[h],d,r)}return c}function CN(e,t=[],n=[],r="",i=!1){let o=(l,c,h=i,d)=>{let g={relativePath:d===void 0?l.path||"":d,caseSensitive:l.caseSensitive===!0,childrenIndex:c,route:l};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(r)&&h)return;En(g.relativePath.startsWith(r),`Absolute route path "${g.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(r.length)}let p=Os([r,g.relativePath]),_=n.concat(g);l.children&&l.children.length>0&&(En(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),CN(l.children,t,_,p,h)),!(l.path==null&&!l.index)&&t.push({path:p,score:dz(p,l.index),routesMeta:_})};return e.forEach((l,c)=>{var h;if(l.path===""||!((h=l.path)!=null&&h.includes("?")))o(l,c);else for(let d of kN(l.path))o(l,c,!0,d)}),t}function kN(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let l=kN(r.join("/")),c=[];return c.push(...l.map(h=>h===""?o:[o,h].join("/"))),i&&c.push(...l),c.map(h=>e.startsWith("/")&&h===""?"/":h)}function iz(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:hz(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var sz=/^:[\w-]+$/,oz=3,az=2,lz=1,cz=10,uz=-2,n2=e=>e==="*";function dz(e,t){let n=e.split("/"),r=n.length;return n.some(n2)&&(r+=uz),t&&(r+=az),n.filter(i=>!n2(i)).reduce((i,o)=>i+(sz.test(o)?oz:o===""?lz:cz),r)}function hz(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function fz(e,t,n=!1){let{routesMeta:r}=e,i={},o="/",l=[];for(let c=0;c<r.length;++c){let h=r[c],d=c===r.length-1,g=o==="/"?t:t.slice(o.length)||"/",p=np({path:h.relativePath,caseSensitive:h.caseSensitive,end:d},g),_=h.route;if(!p&&d&&n&&!r[r.length-1].route.index&&(p=np({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},g)),!p)return null;Object.assign(i,p.params),l.push({params:i,pathname:Os([o,p.pathname]),pathnameBase:bz(Os([o,p.pathnameBase])),route:_}),p.pathnameBase!=="/"&&(o=Os([o,p.pathnameBase]))}return l}function np(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=mz(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let o=i[0],l=o.replace(/(.)\/+$/,"$1"),c=i.slice(1);return{params:r.reduce((d,{paramName:g,isOptional:p},_)=>{if(g==="*"){let w=c[_]||"";l=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const y=c[_];return p&&!y?d[g]=void 0:d[g]=(y||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:l,pattern:e}}function mz(e,t=!1,n=!0){Gi(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 r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,c,h,d,g)=>{if(r.push({paramName:c,isOptional:h!=null}),h){let p=g.charAt(d+l.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function pz(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Gi(!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 vo(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var gz=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function vz(e,t="/"){let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Xc(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=r2(n.substring(1),"/"):o=r2(n,t)):o=t,{pathname:o,search:yz(r),hash:xz(i)}}function r2(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function J_(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function _z(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function h0(e){let t=_z(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Kp(e,t,n,r=!1){let i;typeof e=="string"?i=Xc(e):(i={...e},En(!i.pathname||!i.pathname.includes("?"),J_("?","pathname","search",i)),En(!i.pathname||!i.pathname.includes("#"),J_("#","pathname","hash",i)),En(!i.search||!i.search.includes("#"),J_("#","search","hash",i)));let o=e===""||i.pathname==="",l=o?"/":i.pathname,c;if(l==null)c=n;else{let p=t.length-1;if(!r&&l.startsWith("..")){let _=l.split("/");for(;_[0]==="..";)_.shift(),p-=1;i.pathname=_.join("/")}c=p>=0?t[p]:"/"}let h=vz(i,c),d=l&&l!=="/"&&l.endsWith("/"),g=(o||l===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(d||g)&&(h.pathname+="/"),h}var Os=e=>e.join("/").replace(/\/\/+/g,"/"),bz=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),yz=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,xz=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,wz=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Sz(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Cz(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var EN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function RN(e,t){let n=e;if(typeof n!="string"||!gz.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(EN)try{let o=new URL(window.location.href),l=n.startsWith("//")?new URL(o.protocol+n):new URL(n),c=vo(l.pathname,t);l.origin===o.origin&&c!=null?n=c+l.search+l.hash:i=!0}catch{Gi(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var TN=["POST","PUT","PATCH","DELETE"];new Set(TN);var kz=["GET",...TN];new Set(kz);var Zc=v.createContext(null);Zc.displayName="DataRouter";var Gp=v.createContext(null);Gp.displayName="DataRouterState";var Ez=v.createContext(!1),NN=v.createContext({isTransitioning:!1});NN.displayName="ViewTransition";var Rz=v.createContext(new Map);Rz.displayName="Fetchers";var Tz=v.createContext(null);Tz.displayName="Await";var ki=v.createContext(null);ki.displayName="Navigation";var mh=v.createContext(null);mh.displayName="Location";var Yi=v.createContext({outlet:null,matches:[],isDataRoute:!1});Yi.displayName="Route";var f0=v.createContext(null);f0.displayName="RouteError";var MN="REACT_ROUTER_ERROR",Nz="REDIRECT",Mz="ROUTE_ERROR_RESPONSE";function Az(e){if(e.startsWith(`${MN}:${Nz}:{`))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 jz(e){if(e.startsWith(`${MN}:${Mz}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new wz(t.status,t.statusText,t.data)}catch{}}function Dz(e,{relative:t}={}){En(Qc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=v.useContext(ki),{hash:i,pathname:o,search:l}=ph(e,{relative:t}),c=o;return n!=="/"&&(c=o==="/"?n:Os([n,o])),r.createHref({pathname:c,search:l,hash:i})}function Qc(){return v.useContext(mh)!=null}function oi(){return En(Qc(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(mh).location}var AN="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function jN(e){v.useContext(ki).static||v.useLayoutEffect(e)}function kl(){let{isDataRoute:e}=v.useContext(Yi);return e?Kz():Oz()}function Oz(){En(Qc(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Zc),{basename:t,navigator:n}=v.useContext(ki),{matches:r}=v.useContext(Yi),{pathname:i}=oi(),o=JSON.stringify(h0(r)),l=v.useRef(!1);return jN(()=>{l.current=!0}),v.useCallback((h,d={})=>{if(Gi(l.current,AN),!l.current)return;if(typeof h=="number"){n.go(h);return}let g=Kp(h,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Os([t,g.pathname])),(d.replace?n.replace:n.push)(g,d.state,d)},[t,n,o,i,e])}var DN=v.createContext(null);function Yp(){return v.useContext(DN)}function Lz(e){let t=v.useContext(Yi).outlet;return v.useMemo(()=>t&&v.createElement(DN.Provider,{value:e},t),[t,e])}function ON(){let{matches:e}=v.useContext(Yi),t=e[e.length-1];return t?t.params:{}}function ph(e,{relative:t}={}){let{matches:n}=v.useContext(Yi),{pathname:r}=oi(),i=JSON.stringify(h0(n));return v.useMemo(()=>Kp(e,JSON.parse(i),r,t==="path"),[e,i,r,t])}function zz(e,t){return LN(e,t)}function LN(e,t,n){var C;En(Qc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=v.useContext(ki),{matches:i}=v.useContext(Yi),o=i[i.length-1],l=o?o.params:{},c=o?o.pathname:"/",h=o?o.pathnameBase:"/",d=o&&o.route;{let k=d&&d.path||"";PN(c,!d||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${k}">) 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="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let g=oi(),p;if(t){let k=typeof t=="string"?Xc(t):t;En(h==="/"||((C=k.pathname)==null?void 0:C.startsWith(h)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${k.pathname}" was given in the \`location\` prop.`),p=k}else p=g;let _=p.pathname||"/",y=_;if(h!=="/"){let k=h.replace(/^\//,"").split("/");y="/"+_.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=SN(e,{pathname:y});Gi(d||w!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Gi(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.`);let S=Hz(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Os([h,r.encodeLocation?r.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?h:Os([h,r.encodeLocation?r.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),i,n);return t&&S?v.createElement(mh.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},S):S}function Pz(){let e=qz(),t=Sz(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:o},"ErrorBoundary")," or"," ",v.createElement("code",{style:o},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:i},n):null,l)}var Iz=v.createElement(Pz,null),zN=class extends v.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 n=jz(e.digest);n&&(e=n)}let t=e!==void 0?v.createElement(Yi.Provider,{value:this.props.routeContext},v.createElement(f0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(Bz,{error:e},t):t}};zN.contextType=Ez;var eb=new WeakMap;function Bz({children:e,error:t}){let{basename:n}=v.useContext(ki);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=Az(t.digest);if(r){let i=eb.get(t);if(i)throw i;let o=RN(r.location,n);if(EN&&!eb.get(t))if(o.isExternal||r.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:r.replace}));throw eb.set(t,l),l}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function Fz({routeContext:e,match:t,children:n}){let r=v.useContext(Zc);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(Yi.Provider,{value:e},n)}function Hz(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,o=r==null?void 0:r.errors;if(o!=null){let g=i.findIndex(p=>p.route.id&&(o==null?void 0:o[p.route.id])!==void 0);En(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),i=i.slice(0,Math.min(i.length,g+1))}let l=!1,c=-1;if(n&&r){l=r.renderFallback;for(let g=0;g<i.length;g++){let p=i[g];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(c=g),p.route.id){let{loaderData:_,errors:y}=r,w=p.route.loader&&!_.hasOwnProperty(p.route.id)&&(!y||y[p.route.id]===void 0);if(p.route.lazy||w){n.isStatic&&(l=!0),c>=0?i=i.slice(0,c+1):i=[i[0]];break}}}}let h=n==null?void 0:n.onError,d=r&&h?(g,p)=>{var _,y;h(g,{location:r.location,params:((y=(_=r.matches)==null?void 0:_[0])==null?void 0:y.params)??{},unstable_pattern:Cz(r.matches),errorInfo:p})}:void 0;return i.reduceRight((g,p,_)=>{let y,w=!1,S=null,C=null;r&&(y=o&&p.route.id?o[p.route.id]:void 0,S=p.route.errorElement||Iz,l&&(c<0&&_===0?(PN("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,C=null):c===_&&(w=!0,C=p.route.hydrateFallbackElement||null)));let k=t.concat(i.slice(0,_+1)),R=()=>{let E;return y?E=S:w?E=C:p.route.Component?E=v.createElement(p.route.Component,null):p.route.element?E=p.route.element:E=g,v.createElement(Fz,{match:p,routeContext:{outlet:g,matches:k,isDataRoute:r!=null},children:E})};return r&&(p.route.ErrorBoundary||p.route.errorElement||_===0)?v.createElement(zN,{location:r.location,revalidation:r.revalidation,component:S,error:y,children:R(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:d}):R()},null)}function m0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $z(e){let t=v.useContext(Zc);return En(t,m0(e)),t}function Uz(e){let t=v.useContext(Gp);return En(t,m0(e)),t}function Vz(e){let t=v.useContext(Yi);return En(t,m0(e)),t}function p0(e){let t=Vz(e),n=t.matches[t.matches.length-1];return En(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Wz(){return p0("useRouteId")}function qz(){var r;let e=v.useContext(f0),t=Uz("useRouteError"),n=p0("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function Kz(){let{router:e}=$z("useNavigate"),t=p0("useNavigate"),n=v.useRef(!1);return jN(()=>{n.current=!0}),v.useCallback(async(i,o={})=>{Gi(n.current,AN),n.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...o}))},[e,t])}var i2={};function PN(e,t,n){!t&&!i2[e]&&(i2[e]=!0,Gi(!1,n))}v.memo(Gz);function Gz({routes:e,future:t,state:n,isStatic:r,onError:i}){return LN(e,void 0,{state:n,isStatic:r,onError:i})}function Yz({to:e,replace:t,state:n,relative:r}){En(Qc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=v.useContext(ki);Gi(!i,"<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}=v.useContext(Yi),{pathname:l}=oi(),c=kl(),h=Kp(e,h0(o),l,r==="path"),d=JSON.stringify(h);return v.useEffect(()=>{c(JSON.parse(d),{replace:t,state:n,relative:r})},[c,d,r,t,n]),null}function Xz(e){return Lz(e.context)}function uo(e){En(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Zz({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:i,static:o=!1,unstable_useTransitions:l}){En(!Qc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),h=v.useMemo(()=>({basename:c,navigator:i,static:o,unstable_useTransitions:l,future:{}}),[c,i,o,l]);typeof n=="string"&&(n=Xc(n));let{pathname:d="/",search:g="",hash:p="",state:_=null,key:y="default",unstable_mask:w}=n,S=v.useMemo(()=>{let C=vo(d,c);return C==null?null:{location:{pathname:C,search:g,hash:p,state:_,key:y,unstable_mask:w},navigationType:r}},[c,d,g,p,_,y,r,w]);return Gi(S!=null,`<Router basename="${c}"> is not able to match the URL "${d}${g}${p}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:v.createElement(ki.Provider,{value:h},v.createElement(mh.Provider,{children:t,value:S}))}function Qz({children:e,location:t}){return zz(_y(e),t)}function _y(e,t=[]){let n=[];return v.Children.forEach(e,(r,i)=>{if(!v.isValidElement(r))return;let o=[...t,i];if(r.type===v.Fragment){n.push.apply(n,_y(r.props.children,o));return}En(r.type===uo,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),En(!r.props.index||!r.props.children,"An index route cannot have child routes.");let l={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=_y(r.props.children,o)),n.push(l)}),n}var Bm="get",Fm="application/x-www-form-urlencoded";function Xp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Jz(e){return Xp(e)&&e.tagName.toLowerCase()==="button"}function eP(e){return Xp(e)&&e.tagName.toLowerCase()==="form"}function tP(e){return Xp(e)&&e.tagName.toLowerCase()==="input"}function nP(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function rP(e,t){return e.button===0&&(!t||t==="_self")&&!nP(e)}function by(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function iP(e,t){let n=by(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(o=>{n.append(i,o)})}),n}var rm=null;function sP(){if(rm===null)try{new FormData(document.createElement("form"),0),rm=!1}catch{rm=!0}return rm}var oP=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function tb(e){return e!=null&&!oP.has(e)?(Gi(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Fm}"`),null):e}function aP(e,t){let n,r,i,o,l;if(eP(e)){let c=e.getAttribute("action");r=c?vo(c,t):null,n=e.getAttribute("method")||Bm,i=tb(e.getAttribute("enctype"))||Fm,o=new FormData(e)}else if(Jz(e)||tP(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||c.getAttribute("action");if(r=h?vo(h,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||Bm,i=tb(e.getAttribute("formenctype"))||tb(c.getAttribute("enctype"))||Fm,o=new FormData(c,e),!sP()){let{name:d,type:g,value:p}=e;if(g==="image"){let _=d?`${d}.`:"";o.append(`${_}x`,"0"),o.append(`${_}y`,"0")}else d&&o.append(d,p)}}else{if(Xp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Bm,r=null,i=Fm,l=e}return o&&i==="text/plain"&&(l=o,o=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:o,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function g0(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function lP(e,t,n,r){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:t&&vo(i.pathname,t)==="/"?i.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${r}`,i}async function cP(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function uP(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 dP(e,t,n){let r=await Promise.all(e.map(async i=>{let o=t.routes[i.route.id];if(o){let l=await cP(o,n);return l.links?l.links():[]}return[]}));return pP(r.flat(1).filter(uP).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function s2(e,t,n,r,i,o){let l=(h,d)=>n[d]?h.route.id!==n[d].route.id:!0,c=(h,d)=>{var g;return n[d].pathname!==h.pathname||((g=n[d].route.path)==null?void 0:g.endsWith("*"))&&n[d].params["*"]!==h.params["*"]};return o==="assets"?t.filter((h,d)=>l(h,d)||c(h,d)):o==="data"?t.filter((h,d)=>{var p;let g=r.routes[h.route.id];if(!g||!g.hasLoader)return!1;if(l(h,d)||c(h,d))return!0;if(h.route.shouldRevalidate){let _=h.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((p=n[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function hP(e,t,{includeHydrateFallback:n}={}){return fP(e.map(r=>{let i=t.routes[r.route.id];if(!i)return[];let o=[i.module];return i.clientActionModule&&(o=o.concat(i.clientActionModule)),i.clientLoaderModule&&(o=o.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(o=o.concat(i.hydrateFallbackModule)),i.imports&&(o=o.concat(i.imports)),o}).flat(1))}function fP(e){return[...new Set(e)]}function mP(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function pP(e,t){let n=new Set;return new Set(t),e.reduce((r,i)=>{let o=JSON.stringify(mP(i));return n.has(o)||(n.add(o),r.push({key:o,link:i})),r},[])}function IN(){let e=v.useContext(Zc);return g0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function gP(){let e=v.useContext(Gp);return g0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var v0=v.createContext(void 0);v0.displayName="FrameworkContext";function BN(){let e=v.useContext(v0);return g0(e,"You must render this element inside a <HydratedRouter> element"),e}function vP(e,t){let n=v.useContext(v0),[r,i]=v.useState(!1),[o,l]=v.useState(!1),{onFocus:c,onBlur:h,onMouseEnter:d,onMouseLeave:g,onTouchStart:p}=t,_=v.useRef(null);v.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let S=k=>{k.forEach(R=>{l(R.isIntersecting)})},C=new IntersectionObserver(S,{threshold:.5});return _.current&&C.observe(_.current),()=>{C.disconnect()}}},[e]),v.useEffect(()=>{if(r){let S=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(S)}}},[r]);let y=()=>{i(!0)},w=()=>{i(!1),l(!1)};return n?e!=="intent"?[o,_,{}]:[o,_,{onFocus:ld(c,y),onBlur:ld(h,w),onMouseEnter:ld(d,y),onMouseLeave:ld(g,w),onTouchStart:ld(p,y)}]:[!1,_,{}]}function ld(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function _P({page:e,...t}){let{router:n}=IN(),r=v.useMemo(()=>SN(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?v.createElement(yP,{page:e,matches:r,...t}):null}function bP(e){let{manifest:t,routeModules:n}=BN(),[r,i]=v.useState([]);return v.useEffect(()=>{let o=!1;return dP(e,t,n).then(l=>{o||i(l)}),()=>{o=!0}},[e,t,n]),r}function yP({page:e,matches:t,...n}){let r=oi(),{future:i,manifest:o,routeModules:l}=BN(),{basename:c}=IN(),{loaderData:h,matches:d}=gP(),g=v.useMemo(()=>s2(e,t,d,o,r,"data"),[e,t,d,o,r]),p=v.useMemo(()=>s2(e,t,d,o,r,"assets"),[e,t,d,o,r]),_=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let S=new Set,C=!1;if(t.forEach(R=>{var N;let E=o.routes[R.route.id];!E||!E.hasLoader||(!g.some(L=>L.route.id===R.route.id)&&R.route.id in h&&((N=l[R.route.id])!=null&&N.shouldRevalidate)||E.hasClientLoader?C=!0:S.add(R.route.id))}),S.size===0)return[];let k=lP(e,c,i.unstable_trailingSlashAwareDataRequests,"data");return C&&S.size>0&&k.searchParams.set("_routes",t.filter(R=>S.has(R.route.id)).map(R=>R.route.id).join(",")),[k.pathname+k.search]},[c,i.unstable_trailingSlashAwareDataRequests,h,r,o,g,t,e,l]),y=v.useMemo(()=>hP(p,o),[p,o]),w=bP(p);return v.createElement(v.Fragment,null,_.map(S=>v.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...n})),y.map(S=>v.createElement("link",{key:S,rel:"modulepreload",href:S,...n})),w.map(({key:S,link:C})=>v.createElement("link",{key:S,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function xP(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var wP=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{wP&&(window.__reactRouterVersion="7.13.2")}catch{}function SP({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=v.useRef();i.current==null&&(i.current=JL({window:r,v5Compat:!0}));let o=i.current,[l,c]=v.useState({action:o.action,location:o.location}),h=v.useCallback(d=>{n===!1?c(d):v.startTransition(()=>c(d))},[n]);return v.useLayoutEffect(()=>o.listen(h),[o,h]),v.createElement(Zz,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:o,unstable_useTransitions:n})}var FN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Zp=v.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:i,reloadDocument:o,replace:l,unstable_mask:c,state:h,target:d,to:g,preventScrollReset:p,viewTransition:_,unstable_defaultShouldRevalidate:y,...w},S){let{basename:C,navigator:k,unstable_useTransitions:R}=v.useContext(ki),E=typeof g=="string"&&FN.test(g),N=RN(g,C);g=N.to;let L=Dz(g,{relative:i}),j=oi(),O=null;if(c){let q=Kp(c,[],j.unstable_mask?j.unstable_mask.pathname:"/",!0);C!=="/"&&(q.pathname=q.pathname==="/"?C:Os([C,q.pathname])),O=k.createHref(q)}let[H,Z,I]=vP(r,w),W=RP(g,{replace:l,unstable_mask:c,state:h,target:d,preventScrollReset:p,relative:i,viewTransition:_,unstable_defaultShouldRevalidate:y,unstable_useTransitions:R});function F(q){t&&t(q),q.defaultPrevented||W(q)}let $=!(N.isExternal||o),V=v.createElement("a",{...w,...I,href:($?O:void 0)||N.absoluteURL||L,onClick:$?F:t,ref:xP(S,Z),target:d,"data-discover":!E&&n==="render"?"true":void 0});return H&&!E?v.createElement(v.Fragment,null,V,v.createElement(_P,{page:L})):V});Zp.displayName="Link";var CP=v.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:i=!1,style:o,to:l,viewTransition:c,children:h,...d},g){let p=ph(l,{relative:d.relative}),_=oi(),y=v.useContext(Gp),{navigator:w,basename:S}=v.useContext(ki),C=y!=null&&DP(p)&&c===!0,k=w.encodeLocation?w.encodeLocation(p).pathname:p.pathname,R=_.pathname,E=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(R=R.toLowerCase(),E=E?E.toLowerCase():null,k=k.toLowerCase()),E&&S&&(E=vo(E,S)||E);const N=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let L=R===k||!i&&R.startsWith(k)&&R.charAt(N)==="/",j=E!=null&&(E===k||!i&&E.startsWith(k)&&E.charAt(k.length)==="/"),O={isActive:L,isPending:j,isTransitioning:C},H=L?t:void 0,Z;typeof r=="function"?Z=r(O):Z=[r,L?"active":null,j?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let I=typeof o=="function"?o(O):o;return v.createElement(Zp,{...d,"aria-current":H,className:Z,ref:g,style:I,to:l,viewTransition:c},typeof h=="function"?h(O):h)});CP.displayName="NavLink";var kP=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:o,method:l=Bm,action:c,onSubmit:h,relative:d,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:_,...y},w)=>{let{unstable_useTransitions:S}=v.useContext(ki),C=AP(),k=jP(c,{relative:d}),R=l.toLowerCase()==="get"?"get":"post",E=typeof c=="string"&&FN.test(c),N=L=>{if(h&&h(L),L.defaultPrevented)return;L.preventDefault();let j=L.nativeEvent.submitter,O=(j==null?void 0:j.getAttribute("formmethod"))||l,H=()=>C(j||L.currentTarget,{fetcherKey:t,method:O,navigate:n,replace:i,state:o,relative:d,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:_});S&&n!==!1?v.startTransition(()=>H()):H()};return v.createElement("form",{ref:w,method:R,action:k,onSubmit:r?h:N,...y,"data-discover":!E&&e==="render"?"true":void 0})});kP.displayName="Form";function EP(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function HN(e){let t=v.useContext(Zc);return En(t,EP(e)),t}function RP(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:o,relative:l,viewTransition:c,unstable_defaultShouldRevalidate:h,unstable_useTransitions:d}={}){let g=kl(),p=oi(),_=ph(e,{relative:l});return v.useCallback(y=>{if(rP(y,t)){y.preventDefault();let w=n!==void 0?n:Kd(p)===Kd(_),S=()=>g(e,{replace:w,unstable_mask:r,state:i,preventScrollReset:o,relative:l,viewTransition:c,unstable_defaultShouldRevalidate:h});d?v.startTransition(()=>S()):S()}},[p,g,_,n,r,i,t,e,o,l,c,h,d])}function TP(e){Gi(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=v.useRef(by(e)),n=v.useRef(!1),r=oi(),i=v.useMemo(()=>iP(r.search,n.current?null:t.current),[r.search]),o=kl(),l=v.useCallback((c,h)=>{const d=by(typeof c=="function"?c(new URLSearchParams(i)):c);n.current=!0,o("?"+d,h)},[o,i]);return[i,l]}var NP=0,MP=()=>`__${String(++NP)}__`;function AP(){let{router:e}=HN("useSubmit"),{basename:t}=v.useContext(ki),n=Wz(),r=e.fetch,i=e.navigate;return v.useCallback(async(o,l={})=>{let{action:c,method:h,encType:d,formData:g,body:p}=aP(o,t);if(l.navigate===!1){let _=l.fetcherKey||MP();await r(_,n,l.action||c,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:g,body:p,formMethod:l.method||h,formEncType:l.encType||d,flushSync:l.flushSync})}else await i(l.action||c,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:g,body:p,formMethod:l.method||h,formEncType:l.encType||d,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[r,i,t,n])}function jP(e,{relative:t}={}){let{basename:n}=v.useContext(ki),r=v.useContext(Yi);En(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),o={...ph(e||".",{relative:t})},l=oi();if(e==null){o.search=l.search;let c=new URLSearchParams(o.search),h=c.getAll("index");if(h.some(g=>g==="")){c.delete("index"),h.filter(p=>p).forEach(p=>c.append("index",p));let g=c.toString();o.search=g?`?${g}`:""}}return(!e||e===".")&&i.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Os([n,o.pathname])),Kd(o)}function DP(e,{relative:t}={}){let n=v.useContext(NN);En(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=HN("useViewTransitionState"),i=ph(e,{relative:t});if(!n.isTransitioning)return!1;let o=vo(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=vo(n.nextLocation.pathname,r)||n.nextLocation.pathname;return np(i.pathname,l)!=null||np(i.pathname,o)!=null}var ss=wN();const $N=qp(ss);function OP(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const LP=e=>{switch(e){case"success":return IP;case"info":return FP;case"warning":return BP;case"error":return HP;default:return null}},zP=Array(12).fill(0),PP=({visible:e,className:t})=>we.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},we.createElement("div",{className:"sonner-spinner"},zP.map((n,r)=>we.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),IP=we.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},we.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"})),BP=we.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},we.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"})),FP=we.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},we.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"})),HP=we.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},we.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"})),$P=we.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"},we.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),we.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),UP=()=>{const[e,t]=we.useState(document.hidden);return we.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let yy=1;class VP{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...i}=t,o=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:yy++,l=this.toasts.find(h=>h.id===o),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),l?this.toasts=this.toasts.map(h=>h.id===o?(this.publish({...h,...t,id:o,title:r}),{...h,...t,id:o,dismissible:c,title:r}):h):this.addToast({title:r,...i,dismissible:c,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(t instanceof Function?t():t);let o=r!==void 0,l;const c=i.then(async d=>{if(l=["resolve",d],we.isValidElement(d))o=!1,this.create({id:r,type:"default",message:d});else if(qP(d)&&!d.ok){o=!1;const p=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,_=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,w=typeof p=="object"&&!we.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:_,...w})}else if(d instanceof Error){o=!1;const p=typeof n.error=="function"?await n.error(d):n.error,_=typeof n.description=="function"?await n.description(d):n.description,w=typeof p=="object"&&!we.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:_,...w})}else if(n.success!==void 0){o=!1;const p=typeof n.success=="function"?await n.success(d):n.success,_=typeof n.description=="function"?await n.description(d):n.description,w=typeof p=="object"&&!we.isValidElement(p)?p:{message:p};this.create({id:r,type:"success",description:_,...w})}}).catch(async d=>{if(l=["reject",d],n.error!==void 0){o=!1;const g=typeof n.error=="function"?await n.error(d):n.error,p=typeof n.description=="function"?await n.description(d):n.description,y=typeof g=="object"&&!we.isValidElement(g)?g:{message:g};this.create({id:r,type:"error",description:p,...y})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),h=()=>new Promise((d,g)=>c.then(()=>l[0]==="reject"?g(l[1]):d(l[1])).catch(g));return typeof r!="string"&&typeof r!="number"?{unwrap:h}:Object.assign(r,{unwrap:h})},this.custom=(t,n)=>{const r=(n==null?void 0:n.id)||yy++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const ii=new VP,WP=(e,t)=>{const n=(t==null?void 0:t.id)||yy++;return ii.addToast({title:e,...t,id:n}),n},qP=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",KP=WP,GP=()=>ii.toasts,YP=()=>ii.getActiveToasts(),Ec=Object.assign(KP,{success:ii.success,info:ii.info,warning:ii.warning,error:ii.error,custom:ii.custom,message:ii.message,promise:ii.promise,dismiss:ii.dismiss,loading:ii.loading},{getHistory:GP,getToasts:YP});OP("[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 im(e){return e.label!==void 0}const XP=3,ZP="24px",QP="16px",o2=4e3,JP=356,eI=14,tI=45,nI=200;function ys(...e){return e.filter(Boolean).join(" ")}function rI(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const iI=e=>{var t,n,r,i,o,l,c,h,d;const{invert:g,toast:p,unstyled:_,interacting:y,setHeights:w,visibleToasts:S,heights:C,index:k,toasts:R,expanded:E,removeToast:N,defaultRichColors:L,closeButton:j,style:O,cancelButtonStyle:H,actionButtonStyle:Z,className:I="",descriptionClassName:W="",duration:F,position:$,gap:V,expandByDefault:q,classNames:D,icons:U,closeButtonAriaLabel:z="Close toast"}=e,[G,M]=we.useState(null),[B,X]=we.useState(null),[A,ie]=we.useState(!1),[J,ee]=we.useState(!1),[re,ue]=we.useState(!1),[fe,ge]=we.useState(!1),[Ce,Te]=we.useState(!1),[je,Xe]=we.useState(0),[xt,Et]=we.useState(0),me=we.useRef(p.duration||F||o2),Fe=we.useRef(null),De=we.useRef(null),ft=k===0,at=k+1<=S,it=p.type,hn=p.dismissible!==!1,Mt=p.className||"",Pn=p.descriptionClassName||"",de=we.useMemo(()=>C.findIndex(Ie=>Ie.toastId===p.id)||0,[C,p.id]),se=we.useMemo(()=>{var Ie;return(Ie=p.closeButton)!=null?Ie:j},[p.closeButton,j]),ye=we.useMemo(()=>p.duration||F||o2,[p.duration,F]),Ee=we.useRef(0),qe=we.useRef(0),lt=we.useRef(0),Je=we.useRef(null),[Ae,He]=$.split("-"),mt=we.useMemo(()=>C.reduce((Ie,gt,wt)=>wt>=de?Ie:Ie+gt.height,0),[C,de]),Ve=UP(),fn=p.invert||g,rn=it==="loading";qe.current=we.useMemo(()=>de*V+mt,[de,mt]),we.useEffect(()=>{me.current=ye},[ye]),we.useEffect(()=>{ie(!0)},[]),we.useEffect(()=>{const Ie=De.current;if(Ie){const gt=Ie.getBoundingClientRect().height;return Et(gt),w(wt=>[{toastId:p.id,height:gt,position:p.position},...wt]),()=>w(wt=>wt.filter(Rt=>Rt.toastId!==p.id))}},[w,p.id]),we.useLayoutEffect(()=>{if(!A)return;const Ie=De.current,gt=Ie.style.height;Ie.style.height="auto";const wt=Ie.getBoundingClientRect().height;Ie.style.height=gt,Et(wt),w(Rt=>Rt.find(vt=>vt.toastId===p.id)?Rt.map(vt=>vt.toastId===p.id?{...vt,height:wt}:vt):[{toastId:p.id,height:wt,position:p.position},...Rt])},[A,p.title,p.description,w,p.id,p.jsx,p.action,p.cancel]);const et=we.useCallback(()=>{ee(!0),Xe(qe.current),w(Ie=>Ie.filter(gt=>gt.toastId!==p.id)),setTimeout(()=>{N(p)},nI)},[p,N,w,qe]);we.useEffect(()=>{if(p.promise&&it==="loading"||p.duration===1/0||p.type==="loading")return;let Ie;return E||y||Ve?(()=>{if(lt.current<Ee.current){const Rt=new Date().getTime()-Ee.current;me.current=me.current-Rt}lt.current=new Date().getTime()})():(()=>{me.current!==1/0&&(Ee.current=new Date().getTime(),Ie=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),et()},me.current))})(),()=>clearTimeout(Ie)},[E,y,p,it,Ve,et]),we.useEffect(()=>{p.delete&&(et(),p.onDismiss==null||p.onDismiss.call(p,p))},[et,p.delete]);function en(){var Ie;if(U!=null&&U.loading){var gt;return we.createElement("div",{className:ys(D==null?void 0:D.loader,p==null||(gt=p.classNames)==null?void 0:gt.loader,"sonner-loader"),"data-visible":it==="loading"},U.loading)}return we.createElement(PP,{className:ys(D==null?void 0:D.loader,p==null||(Ie=p.classNames)==null?void 0:Ie.loader),visible:it==="loading"})}const Un=p.icon||(U==null?void 0:U[it])||LP(it);var Qt,qt;return we.createElement("li",{tabIndex:0,ref:De,className:ys(I,Mt,D==null?void 0:D.toast,p==null||(t=p.classNames)==null?void 0:t.toast,D==null?void 0:D.default,D==null?void 0:D[it],p==null||(n=p.classNames)==null?void 0:n[it]),"data-sonner-toast":"","data-rich-colors":(Qt=p.richColors)!=null?Qt:L,"data-styled":!(p.jsx||p.unstyled||_),"data-mounted":A,"data-promise":!!p.promise,"data-swiped":Ce,"data-removed":J,"data-visible":at,"data-y-position":Ae,"data-x-position":He,"data-index":k,"data-front":ft,"data-swiping":re,"data-dismissible":hn,"data-type":it,"data-invert":fn,"data-swipe-out":fe,"data-swipe-direction":B,"data-expanded":!!(E||q&&A),"data-testid":p.testId,style:{"--index":k,"--toasts-before":k,"--z-index":R.length-k,"--offset":`${J?je:qe.current}px`,"--initial-height":q?"auto":`${xt}px`,...O,...p.style},onDragEnd:()=>{ue(!1),M(null),Je.current=null},onPointerDown:Ie=>{Ie.button!==2&&(rn||!hn||(Fe.current=new Date,Xe(qe.current),Ie.target.setPointerCapture(Ie.pointerId),Ie.target.tagName!=="BUTTON"&&(ue(!0),Je.current={x:Ie.clientX,y:Ie.clientY})))},onPointerUp:()=>{var Ie,gt,wt;if(fe||!hn)return;Je.current=null;const Rt=Number(((Ie=De.current)==null?void 0:Ie.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Jt=Number(((gt=De.current)==null?void 0:gt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),vt=new Date().getTime()-((wt=Fe.current)==null?void 0:wt.getTime()),_t=G==="x"?Rt:Jt,Sn=Math.abs(_t)/vt;if(Math.abs(_t)>=tI||Sn>.11){Xe(qe.current),p.onDismiss==null||p.onDismiss.call(p,p),X(G==="x"?Rt>0?"right":"left":Jt>0?"down":"up"),et(),ge(!0);return}else{var ke,Oe;(ke=De.current)==null||ke.style.setProperty("--swipe-amount-x","0px"),(Oe=De.current)==null||Oe.style.setProperty("--swipe-amount-y","0px")}Te(!1),ue(!1),M(null)},onPointerMove:Ie=>{var gt,wt,Rt;if(!Je.current||!hn||((gt=window.getSelection())==null?void 0:gt.toString().length)>0)return;const vt=Ie.clientY-Je.current.y,_t=Ie.clientX-Je.current.x;var Sn;const ke=(Sn=e.swipeDirections)!=null?Sn:rI($);!G&&(Math.abs(_t)>1||Math.abs(vt)>1)&&M(Math.abs(_t)>Math.abs(vt)?"x":"y");let Oe={x:0,y:0};const Tt=ct=>1/(1.5+Math.abs(ct)/20);if(G==="y"){if(ke.includes("top")||ke.includes("bottom"))if(ke.includes("top")&&vt<0||ke.includes("bottom")&&vt>0)Oe.y=vt;else{const ct=vt*Tt(vt);Oe.y=Math.abs(ct)<Math.abs(vt)?ct:vt}}else if(G==="x"&&(ke.includes("left")||ke.includes("right")))if(ke.includes("left")&&_t<0||ke.includes("right")&&_t>0)Oe.x=_t;else{const ct=_t*Tt(_t);Oe.x=Math.abs(ct)<Math.abs(_t)?ct:_t}(Math.abs(Oe.x)>0||Math.abs(Oe.y)>0)&&Te(!0),(wt=De.current)==null||wt.style.setProperty("--swipe-amount-x",`${Oe.x}px`),(Rt=De.current)==null||Rt.style.setProperty("--swipe-amount-y",`${Oe.y}px`)}},se&&!p.jsx&&it!=="loading"?we.createElement("button",{"aria-label":z,"data-disabled":rn,"data-close-button":!0,onClick:rn||!hn?()=>{}:()=>{et(),p.onDismiss==null||p.onDismiss.call(p,p)},className:ys(D==null?void 0:D.closeButton,p==null||(r=p.classNames)==null?void 0:r.closeButton)},(qt=U==null?void 0:U.close)!=null?qt:$P):null,(it||p.icon||p.promise)&&p.icon!==null&&((U==null?void 0:U[it])!==null||p.icon)?we.createElement("div",{"data-icon":"",className:ys(D==null?void 0:D.icon,p==null||(i=p.classNames)==null?void 0:i.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||en():null,p.type!=="loading"?Un:null):null,we.createElement("div",{"data-content":"",className:ys(D==null?void 0:D.content,p==null||(o=p.classNames)==null?void 0:o.content)},we.createElement("div",{"data-title":"",className:ys(D==null?void 0:D.title,p==null||(l=p.classNames)==null?void 0:l.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?we.createElement("div",{"data-description":"",className:ys(W,Pn,D==null?void 0:D.description,p==null||(c=p.classNames)==null?void 0:c.description)},typeof p.description=="function"?p.description():p.description):null),we.isValidElement(p.cancel)?p.cancel:p.cancel&&im(p.cancel)?we.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||H,onClick:Ie=>{im(p.cancel)&&hn&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,Ie),et())},className:ys(D==null?void 0:D.cancelButton,p==null||(h=p.classNames)==null?void 0:h.cancelButton)},p.cancel.label):null,we.isValidElement(p.action)?p.action:p.action&&im(p.action)?we.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||Z,onClick:Ie=>{im(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,Ie),!Ie.defaultPrevented&&et())},className:ys(D==null?void 0:D.actionButton,p==null||(d=p.classNames)==null?void 0:d.actionButton)},p.action.label):null)};function a2(){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 sI(e,t){const n={};return[e,t].forEach((r,i)=>{const o=i===1,l=o?"--mobile-offset":"--offset",c=o?QP:ZP;function h(d){["top","right","bottom","left"].forEach(g=>{n[`${l}-${g}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?h(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${l}-${d}`]=c:n[`${l}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):h(c)}),n}const oI=we.forwardRef(function(t,n){const{id:r,invert:i,position:o="bottom-right",hotkey:l=["altKey","KeyT"],expand:c,closeButton:h,className:d,offset:g,mobileOffset:p,theme:_="light",richColors:y,duration:w,style:S,visibleToasts:C=XP,toastOptions:k,dir:R=a2(),gap:E=eI,icons:N,containerAriaLabel:L="Notifications"}=t,[j,O]=we.useState([]),H=we.useMemo(()=>r?j.filter(A=>A.toasterId===r):j.filter(A=>!A.toasterId),[j,r]),Z=we.useMemo(()=>Array.from(new Set([o].concat(H.filter(A=>A.position).map(A=>A.position)))),[H,o]),[I,W]=we.useState([]),[F,$]=we.useState(!1),[V,q]=we.useState(!1),[D,U]=we.useState(_!=="system"?_:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),z=we.useRef(null),G=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=we.useRef(null),B=we.useRef(!1),X=we.useCallback(A=>{O(ie=>{var J;return(J=ie.find(ee=>ee.id===A.id))!=null&&J.delete||ii.dismiss(A.id),ie.filter(({id:ee})=>ee!==A.id)})},[]);return we.useEffect(()=>ii.subscribe(A=>{if(A.dismiss){requestAnimationFrame(()=>{O(ie=>ie.map(J=>J.id===A.id?{...J,delete:!0}:J))});return}setTimeout(()=>{$N.flushSync(()=>{O(ie=>{const J=ie.findIndex(ee=>ee.id===A.id);return J!==-1?[...ie.slice(0,J),{...ie[J],...A},...ie.slice(J+1)]:[A,...ie]})})})}),[j]),we.useEffect(()=>{if(_!=="system"){U(_);return}if(_==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?U("dark"):U("light")),typeof window>"u")return;const A=window.matchMedia("(prefers-color-scheme: dark)");try{A.addEventListener("change",({matches:ie})=>{U(ie?"dark":"light")})}catch{A.addListener(({matches:J})=>{try{U(J?"dark":"light")}catch(ee){console.error(ee)}})}},[_]),we.useEffect(()=>{j.length<=1&&$(!1)},[j]),we.useEffect(()=>{const A=ie=>{var J;if(l.every(ue=>ie[ue]||ie.code===ue)){var re;$(!0),(re=z.current)==null||re.focus()}ie.code==="Escape"&&(document.activeElement===z.current||(J=z.current)!=null&&J.contains(document.activeElement))&&$(!1)};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[l]),we.useEffect(()=>{if(z.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,B.current=!1)}},[z.current]),we.createElement("section",{ref:n,"aria-label":`${L} ${G}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Z.map((A,ie)=>{var J;const[ee,re]=A.split("-");return H.length?we.createElement("ol",{key:A,dir:R==="auto"?a2():R,tabIndex:-1,ref:z,className:d,"data-sonner-toaster":!0,"data-sonner-theme":D,"data-y-position":ee,"data-x-position":re,style:{"--front-toast-height":`${((J=I[0])==null?void 0:J.height)||0}px`,"--width":`${JP}px`,"--gap":`${E}px`,...S,...sI(g,p)},onBlur:ue=>{B.current&&!ue.currentTarget.contains(ue.relatedTarget)&&(B.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:ue=>{ue.target instanceof HTMLElement&&ue.target.dataset.dismissible==="false"||B.current||(B.current=!0,M.current=ue.relatedTarget)},onMouseEnter:()=>$(!0),onMouseMove:()=>$(!0),onMouseLeave:()=>{V||$(!1)},onDragEnd:()=>$(!1),onPointerDown:ue=>{ue.target instanceof HTMLElement&&ue.target.dataset.dismissible==="false"||q(!0)},onPointerUp:()=>q(!1)},H.filter(ue=>!ue.position&&ie===0||ue.position===A).map((ue,fe)=>{var ge,Ce;return we.createElement(iI,{key:ue.id,icons:N,index:fe,toast:ue,defaultRichColors:y,duration:(ge=k==null?void 0:k.duration)!=null?ge:w,className:k==null?void 0:k.className,descriptionClassName:k==null?void 0:k.descriptionClassName,invert:i,visibleToasts:C,closeButton:(Ce=k==null?void 0:k.closeButton)!=null?Ce:h,interacting:V,position:A,style:k==null?void 0:k.style,unstyled:k==null?void 0:k.unstyled,classNames:k==null?void 0:k.classNames,cancelButtonStyle:k==null?void 0:k.cancelButtonStyle,actionButtonStyle:k==null?void 0:k.actionButtonStyle,closeButtonAriaLabel:k==null?void 0:k.closeButtonAriaLabel,removeToast:X,toasts:H.filter(Te=>Te.position==ue.position),heights:I.filter(Te=>Te.position==ue.position),setHeights:W,expandByDefault:c,gap:E,expanded:F,swipeDirections:t.swipeDirections})})):null}))});function UN(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=UN(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function VN(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=UN(e))&&(r&&(r+=" "),r+=t);return r}const l2=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,c2=VN,aI=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return c2(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=t,l=Object.keys(i).map(d=>{const g=n==null?void 0:n[d],p=o==null?void 0:o[d];if(g===null)return null;const _=l2(g)||l2(p);return i[d][_]}),c=n&&Object.entries(n).reduce((d,g)=>{let[p,_]=g;return _===void 0||(d[p]=_),d},{}),h=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,g)=>{let{class:p,className:_,...y}=g;return Object.entries(y).every(w=>{let[S,C]=w;return Array.isArray(C)?C.includes({...o,...c}[S]):{...o,...c}[S]===C})?[...d,p,_]:d},[]);return c2(e,l,h,n==null?void 0:n.class,n==null?void 0:n.className)},lI=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},cI=(e,t)=>({classGroupId:e,validator:t}),WN=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),rp="-",u2=[],uI="arbitrary..",dI=e=>{const t=fI(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return hI(l);const c=l.split(rp),h=c[0]===""&&c.length>1?1:0;return qN(c,h,t)},getConflictingClassGroupIds:(l,c)=>{if(c){const h=r[l],d=n[l];return h?d?lI(d,h):h:d||u2}return n[l]||u2}}},qN=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],o=n.nextPart.get(i);if(o){const d=qN(e,t+1,o);if(d)return d}const l=n.validators;if(l===null)return;const c=t===0?e.join(rp):e.slice(t).join(rp),h=l.length;for(let d=0;d<h;d++){const g=l[d];if(g.validator(c))return g.classGroupId}},hI=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?uI+r:void 0})(),fI=e=>{const{theme:t,classGroups:n}=e;return mI(n,t)},mI=(e,t)=>{const n=WN();for(const r in e){const i=e[r];_0(i,n,r,t)}return n},_0=(e,t,n,r)=>{const i=e.length;for(let o=0;o<i;o++){const l=e[o];pI(l,t,n,r)}},pI=(e,t,n,r)=>{if(typeof e=="string"){gI(e,t,n);return}if(typeof e=="function"){vI(e,t,n,r);return}_I(e,t,n,r)},gI=(e,t,n)=>{const r=e===""?t:KN(t,e);r.classGroupId=n},vI=(e,t,n,r)=>{if(bI(e)){_0(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(cI(n,e))},_I=(e,t,n,r)=>{const i=Object.entries(e),o=i.length;for(let l=0;l<o;l++){const[c,h]=i[l];_0(h,KN(t,c),n,r)}},KN=(e,t)=>{let n=e;const r=t.split(rp),i=r.length;for(let o=0;o<i;o++){const l=r[o];let c=n.nextPart.get(l);c||(c=WN(),n.nextPart.set(l,c)),n=c}return n},bI=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,yI=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(o,l)=>{n[o]=l,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let l=n[o];if(l!==void 0)return l;if((l=r[o])!==void 0)return i(o,l),l},set(o,l){o in n?n[o]=l:i(o,l)}}},xy="!",d2=":",xI=[],h2=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),wI=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const o=[];let l=0,c=0,h=0,d;const g=i.length;for(let S=0;S<g;S++){const C=i[S];if(l===0&&c===0){if(C===d2){o.push(i.slice(h,S)),h=S+1;continue}if(C==="/"){d=S;continue}}C==="["?l++:C==="]"?l--:C==="("?c++:C===")"&&c--}const p=o.length===0?i:i.slice(h);let _=p,y=!1;p.endsWith(xy)?(_=p.slice(0,-1),y=!0):p.startsWith(xy)&&(_=p.slice(1),y=!0);const w=d&&d>h?d-h:void 0;return h2(o,y,_,w)};if(t){const i=t+d2,o=r;r=l=>l.startsWith(i)?o(l.slice(i.length)):h2(xI,!1,l,void 0,!0)}if(n){const i=r;r=o=>n({className:o,parseClassName:i})}return r},SI=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let o=0;o<n.length;o++){const l=n[o],c=l[0]==="[",h=t.has(l);c||h?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(l)):i.push(l)}return i.length>0&&(i.sort(),r.push(...i)),r}},CI=e=>({cache:yI(e.cacheSize),parseClassName:wI(e),sortModifiers:SI(e),...dI(e)}),kI=/\s+/,EI=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:o}=t,l=[],c=e.trim().split(kI);let h="";for(let d=c.length-1;d>=0;d-=1){const g=c[d],{isExternal:p,modifiers:_,hasImportantModifier:y,baseClassName:w,maybePostfixModifierPosition:S}=n(g);if(p){h=g+(h.length>0?" "+h:h);continue}let C=!!S,k=r(C?w.substring(0,S):w);if(!k){if(!C){h=g+(h.length>0?" "+h:h);continue}if(k=r(w),!k){h=g+(h.length>0?" "+h:h);continue}C=!1}const R=_.length===0?"":_.length===1?_[0]:o(_).join(":"),E=y?R+xy:R,N=E+k;if(l.indexOf(N)>-1)continue;l.push(N);const L=i(k,C);for(let j=0;j<L.length;++j){const O=L[j];l.push(E+O)}h=g+(h.length>0?" "+h:h)}return h},RI=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=GN(n))&&(i&&(i+=" "),i+=r);return i},GN=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=GN(e[r]))&&(n&&(n+=" "),n+=t);return n},TI=(e,...t)=>{let n,r,i,o;const l=h=>{const d=t.reduce((g,p)=>p(g),e());return n=CI(d),r=n.cache.get,i=n.cache.set,o=c,c(h)},c=h=>{const d=r(h);if(d)return d;const g=EI(h,n);return i(h,g),g};return o=l,(...h)=>o(RI(...h))},NI=[],nr=e=>{const t=n=>n[e]||NI;return t.isThemeGetter=!0,t},YN=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,XN=/^\((?:(\w[\w-]*):)?(.+)\)$/i,MI=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,AI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,jI=/\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$/,DI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,OI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,na=e=>MI.test(e),Ct=e=>!!e&&!Number.isNaN(Number(e)),ra=e=>!!e&&Number.isInteger(Number(e)),nb=e=>e.endsWith("%")&&Ct(e.slice(0,-1)),oo=e=>AI.test(e),ZN=()=>!0,zI=e=>jI.test(e)&&!DI.test(e),b0=()=>!1,PI=e=>OI.test(e),II=e=>LI.test(e),BI=e=>!We(e)&&!Ke(e),FI=e=>ka(e,e5,b0),We=e=>YN.test(e),Ga=e=>ka(e,t5,zI),f2=e=>ka(e,GI,Ct),HI=e=>ka(e,r5,ZN),$I=e=>ka(e,n5,b0),m2=e=>ka(e,QN,b0),UI=e=>ka(e,JN,II),sm=e=>ka(e,i5,PI),Ke=e=>XN.test(e),cd=e=>El(e,t5),VI=e=>El(e,n5),p2=e=>El(e,QN),WI=e=>El(e,e5),qI=e=>El(e,JN),om=e=>El(e,i5,!0),KI=e=>El(e,r5,!0),ka=(e,t,n)=>{const r=YN.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},El=(e,t,n=!1)=>{const r=XN.exec(e);return r?r[1]?t(r[1]):n:!1},QN=e=>e==="position"||e==="percentage",JN=e=>e==="image"||e==="url",e5=e=>e==="length"||e==="size"||e==="bg-size",t5=e=>e==="length",GI=e=>e==="number",n5=e=>e==="family-name",r5=e=>e==="number"||e==="weight",i5=e=>e==="shadow",YI=()=>{const e=nr("color"),t=nr("font"),n=nr("text"),r=nr("font-weight"),i=nr("tracking"),o=nr("leading"),l=nr("breakpoint"),c=nr("container"),h=nr("spacing"),d=nr("radius"),g=nr("shadow"),p=nr("inset-shadow"),_=nr("text-shadow"),y=nr("drop-shadow"),w=nr("blur"),S=nr("perspective"),C=nr("aspect"),k=nr("ease"),R=nr("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...N(),Ke,We],j=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],H=()=>[Ke,We,h],Z=()=>[na,"full","auto",...H()],I=()=>[ra,"none","subgrid",Ke,We],W=()=>["auto",{span:["full",ra,Ke,We]},ra,Ke,We],F=()=>[ra,"auto",Ke,We],$=()=>["auto","min","max","fr",Ke,We],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],q=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...H()],U=()=>[na,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],z=()=>[na,"screen","full","dvw","lvw","svw","min","max","fit",...H()],G=()=>[na,"screen","full","lh","dvh","lvh","svh","min","max","fit",...H()],M=()=>[e,Ke,We],B=()=>[...N(),p2,m2,{position:[Ke,We]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",WI,FI,{size:[Ke,We]}],ie=()=>[nb,cd,Ga],J=()=>["","none","full",d,Ke,We],ee=()=>["",Ct,cd,Ga],re=()=>["solid","dashed","dotted","double"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[Ct,nb,p2,m2],ge=()=>["","none",w,Ke,We],Ce=()=>["none",Ct,Ke,We],Te=()=>["none",Ct,Ke,We],je=()=>[Ct,Ke,We],Xe=()=>[na,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[oo],breakpoint:[oo],color:[ZN],container:[oo],"drop-shadow":[oo],ease:["in","out","in-out"],font:[BI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[oo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[oo],shadow:[oo],spacing:["px",Ct],text:[oo],"text-shadow":[oo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",na,We,Ke,C]}],container:["container"],columns:[{columns:[Ct,We,Ke,c]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Z()}],"inset-x":[{"inset-x":Z()}],"inset-y":[{"inset-y":Z()}],start:[{"inset-s":Z(),start:Z()}],end:[{"inset-e":Z(),end:Z()}],"inset-bs":[{"inset-bs":Z()}],"inset-be":[{"inset-be":Z()}],top:[{top:Z()}],right:[{right:Z()}],bottom:[{bottom:Z()}],left:[{left:Z()}],visibility:["visible","invisible","collapse"],z:[{z:[ra,"auto",Ke,We]}],basis:[{basis:[na,"full","auto",c,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ct,na,"auto","initial","none",We]}],grow:[{grow:["",Ct,Ke,We]}],shrink:[{shrink:["",Ct,Ke,We]}],order:[{order:[ra,"first","last","none",Ke,We]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:W()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:W()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":$()}],"auto-rows":[{"auto-rows":$()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...q(),"normal"]}],"justify-self":[{"justify-self":["auto",...q()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...q(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...q(),"baseline"]}],"place-self":[{"place-self":["auto",...q()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pbs:[{pbs:H()}],pbe:[{pbe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mbs:[{mbs:D()}],mbe:[{mbe:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"inline-size":[{inline:["auto",...z()]}],"min-inline-size":[{"min-inline":["auto",...z()]}],"max-inline-size":[{"max-inline":["none",...z()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[c,"screen",...U()]}],"min-w":[{"min-w":[c,"screen","none",...U()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",n,cd,Ga]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,KI,HI]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",nb,We]}],"font-family":[{font:[VI,$I,t]}],"font-features":[{"font-features":[We]}],"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:[i,Ke,We]}],"line-clamp":[{"line-clamp":[Ct,"none",Ke,f2]}],leading:[{leading:[o,...H()]}],"list-image":[{"list-image":["none",Ke,We]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ke,We]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ct,"from-font","auto",Ke,Ga]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Ct,"auto",Ke,We]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ke,We]}],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",Ke,We]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:B()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ra,Ke,We],radial:["",Ke,We],conic:[ra,Ke,We]},qI,UI]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:J()}],"rounded-s":[{"rounded-s":J()}],"rounded-e":[{"rounded-e":J()}],"rounded-t":[{"rounded-t":J()}],"rounded-r":[{"rounded-r":J()}],"rounded-b":[{"rounded-b":J()}],"rounded-l":[{"rounded-l":J()}],"rounded-ss":[{"rounded-ss":J()}],"rounded-se":[{"rounded-se":J()}],"rounded-ee":[{"rounded-ee":J()}],"rounded-es":[{"rounded-es":J()}],"rounded-tl":[{"rounded-tl":J()}],"rounded-tr":[{"rounded-tr":J()}],"rounded-br":[{"rounded-br":J()}],"rounded-bl":[{"rounded-bl":J()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-bs":[{"border-bs":ee()}],"border-w-be":[{"border-be":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ct,Ke,We]}],"outline-w":[{outline:["",Ct,cd,Ga]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",g,om,sm]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",p,om,sm]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Ct,Ga]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",_,om,sm]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Ct,Ke,We]}],"mix-blend":[{"mix-blend":[...ue(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ue()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ct]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Ke,We]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":N()}],"mask-image-conic-pos":[{"mask-conic":[Ct]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:B()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ke,We]}],filter:[{filter:["","none",Ke,We]}],blur:[{blur:ge()}],brightness:[{brightness:[Ct,Ke,We]}],contrast:[{contrast:[Ct,Ke,We]}],"drop-shadow":[{"drop-shadow":["","none",y,om,sm]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Ct,Ke,We]}],"hue-rotate":[{"hue-rotate":[Ct,Ke,We]}],invert:[{invert:["",Ct,Ke,We]}],saturate:[{saturate:[Ct,Ke,We]}],sepia:[{sepia:["",Ct,Ke,We]}],"backdrop-filter":[{"backdrop-filter":["","none",Ke,We]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[Ct,Ke,We]}],"backdrop-contrast":[{"backdrop-contrast":[Ct,Ke,We]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ct,Ke,We]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ct,Ke,We]}],"backdrop-invert":[{"backdrop-invert":["",Ct,Ke,We]}],"backdrop-opacity":[{"backdrop-opacity":[Ct,Ke,We]}],"backdrop-saturate":[{"backdrop-saturate":[Ct,Ke,We]}],"backdrop-sepia":[{"backdrop-sepia":["",Ct,Ke,We]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ke,We]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ct,"initial",Ke,We]}],ease:[{ease:["linear","initial",k,Ke,We]}],delay:[{delay:[Ct,Ke,We]}],animate:[{animate:["none",R,Ke,We]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Ke,We]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Ce()}],"rotate-x":[{"rotate-x":Ce()}],"rotate-y":[{"rotate-y":Ce()}],"rotate-z":[{"rotate-z":Ce()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:je()}],"skew-x":[{"skew-x":je()}],"skew-y":[{"skew-y":je()}],transform:[{transform:[Ke,We,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Xe()}],"translate-x":[{"translate-x":Xe()}],"translate-y":[{"translate-y":Xe()}],"translate-z":[{"translate-z":Xe()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",Ke,We]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mbs":[{"scroll-mbs":H()}],"scroll-mbe":[{"scroll-mbe":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pbs":[{"scroll-pbs":H()}],"scroll-pbe":[{"scroll-pbe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"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",Ke,We]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Ct,cd,Ga,f2]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},XI=TI(YI);function pe(...e){return XI(VN(e))}function Od(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function g2(e){return e.startsWith("chatId:")?e.slice(7):e}const s5=aI("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none",{variants:{variant:{default:"bg-primary text-primary-foreground disabled:bg-primary/50 disabled:text-primary-foreground/90 hover:bg-primary/90",juicy:"bg-logo text-primary-foreground disabled:text-primary-foreground/50 hover:bg-logo/90",destructive:"bg-destructive/80 dark:text-white",outline:"border border-input disabled:bg-transparent disabled:text-foreground/50 disabled:border-input/90 bg-card hover:bg-muted hover:text-accent-foreground",secondary:"bg-transparent border border-border text-secondary-foreground hover:text-secondary-foreground/60 disabled:text-secondary-foreground/50",ghost:"hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground disabled:text-muted-foreground/50 border border-border/0 hover:border-border",link:"text-primary disabled:text-primary/50 underline-offset-4 hover:underline",none:""},size:{default:"h-10 px-4 rounded-full py-2",sm:"h-9 rounded-full px-3",lg:"h-11 rounded-full px-8",icon:"h-9 w-9 rounded-full","icon-sm":"h-5.5 w-5.5 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),Qe=v.forwardRef(({className:e,variant:t,size:n,...r},i)=>f.jsx("button",{className:pe(s5({variant:t,size:n,className:e})),ref:i,...r}));Qe.displayName="Button";function Be(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function v2(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function y0(...e){return t=>{let n=!1;const r=e.map(i=>{const o=v2(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():v2(e[i],null)}}}}function Zt(...e){return v.useCallback(y0(...e),e)}function ZI(e,t){const n=v.createContext(t),r=o=>{const{children:l,...c}=o,h=v.useMemo(()=>c,Object.values(c));return f.jsx(n.Provider,{value:h,children:l})};r.displayName=e+"Provider";function i(o){const l=v.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,i]}function Co(e,t=[]){let n=[];function r(o,l){const c=v.createContext(l),h=n.length;n=[...n,l];const d=p=>{var k;const{scope:_,children:y,...w}=p,S=((k=_==null?void 0:_[e])==null?void 0:k[h])||c,C=v.useMemo(()=>w,Object.values(w));return f.jsx(S.Provider,{value:C,children:y})};d.displayName=o+"Provider";function g(p,_){var S;const y=((S=_==null?void 0:_[e])==null?void 0:S[h])||c,w=v.useContext(y);if(w)return w;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[d,g]}const i=()=>{const o=n.map(l=>v.createContext(l));return function(c){const h=(c==null?void 0:c[e])||o;return v.useMemo(()=>({[`__scope${e}`]:{...c,[e]:h}}),[c,h])}};return i.scopeName=e,[r,QI(i,...t)]}function QI(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const l=r.reduce((c,{useScope:h,scopeName:d})=>{const p=h(o)[`__scope${d}`];return{...c,...p}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var Pr=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},JI=xN[" useId ".trim().toString()]||(()=>{}),e6=0;function go(e){const[t,n]=v.useState(JI());return Pr(()=>{n(r=>r??String(e6++))},[e]),t?`radix-${t}`:""}var t6=xN[" useInsertionEffect ".trim().toString()]||Pr;function Ic({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,l]=n6({defaultProp:t,onChange:n}),c=e!==void 0,h=c?e:i;{const g=v.useRef(e!==void 0);v.useEffect(()=>{const p=g.current;p!==c&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${c?"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=c},[c,r])}const d=v.useCallback(g=>{var p;if(c){const _=r6(g)?g(e):g;_!==e&&((p=l.current)==null||p.call(l,_))}else o(g)},[c,e,o,l]);return[h,d]}function n6({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),i=v.useRef(n),o=v.useRef(t);return t6(()=>{o.current=t},[t]),v.useEffect(()=>{var l;i.current!==n&&((l=o.current)==null||l.call(o,n),i.current=n)},[n,i]),[n,r,o]}function r6(e){return typeof e=="function"}function fl(e){const t=i6(e),n=v.forwardRef((r,i)=>{const{children:o,...l}=r,c=v.Children.toArray(o),h=c.find(o6);if(h){const d=h.props.children,g=c.map(p=>p===h?v.Children.count(d)>1?v.Children.only(null):v.isValidElement(d)?d.props.children:null:p);return f.jsx(t,{...l,ref:i,children:v.isValidElement(d)?v.cloneElement(d,void 0,g):null})}return f.jsx(t,{...l,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function i6(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const l=l6(i),c=a6(o,i.props);return i.type!==v.Fragment&&(c.ref=r?y0(r,l):l),v.cloneElement(i,c)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var o5=Symbol("radix.slottable");function s6(e){const t=({children:n})=>f.jsx(f.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=o5,t}function o6(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===o5}function a6(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...c)=>{const h=o(...c);return i(...c),h}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function l6(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var c6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ot=c6.reduce((e,t)=>{const n=fl(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:l,...c}=i,h=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(h,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function a5(e,t){e&&ss.flushSync(()=>e.dispatchEvent(t))}function ls(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function u6(e,t=globalThis==null?void 0:globalThis.document){const n=ls(e);v.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var d6="DismissableLayer",wy="dismissableLayer.update",h6="dismissableLayer.pointerDownOutside",f6="dismissableLayer.focusOutside",_2,l5=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jc=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:l,onDismiss:c,...h}=e,d=v.useContext(l5),[g,p]=v.useState(null),_=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=v.useState({}),w=Zt(t,O=>p(O)),S=Array.from(d.layers),[C]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=S.indexOf(C),R=g?S.indexOf(g):-1,E=d.layersWithOutsidePointerEventsDisabled.size>0,N=R>=k,L=g6(O=>{const H=O.target,Z=[...d.branches].some(I=>I.contains(H));!N||Z||(i==null||i(O),l==null||l(O),O.defaultPrevented||c==null||c())},_),j=v6(O=>{const H=O.target;[...d.branches].some(I=>I.contains(H))||(o==null||o(O),l==null||l(O),O.defaultPrevented||c==null||c())},_);return u6(O=>{R===d.layers.size-1&&(r==null||r(O),!O.defaultPrevented&&c&&(O.preventDefault(),c()))},_),v.useEffect(()=>{if(g)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(_2=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(g)),d.layers.add(g),b2(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=_2)}},[g,_,n,d]),v.useEffect(()=>()=>{g&&(d.layers.delete(g),d.layersWithOutsidePointerEventsDisabled.delete(g),b2())},[g,d]),v.useEffect(()=>{const O=()=>y({});return document.addEventListener(wy,O),()=>document.removeEventListener(wy,O)},[]),f.jsx(Ot.div,{...h,ref:w,style:{pointerEvents:E?N?"auto":"none":void 0,...e.style},onFocusCapture:Be(e.onFocusCapture,j.onFocusCapture),onBlurCapture:Be(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Be(e.onPointerDownCapture,L.onPointerDownCapture)})});Jc.displayName=d6;var m6="DismissableLayerBranch",p6=v.forwardRef((e,t)=>{const n=v.useContext(l5),r=v.useRef(null),i=Zt(t,r);return v.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),f.jsx(Ot.div,{...e,ref:i})});p6.displayName=m6;function g6(e,t=globalThis==null?void 0:globalThis.document){const n=ls(e),r=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{const o=c=>{if(c.target&&!r.current){let h=function(){c5(h6,n,d,{discrete:!0})};const d={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=h,t.addEventListener("click",i.current,{once:!0})):h()}else t.removeEventListener("click",i.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function v6(e,t=globalThis==null?void 0:globalThis.document){const n=ls(e),r=v.useRef(!1);return v.useEffect(()=>{const i=o=>{o.target&&!r.current&&c5(f6,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function b2(){const e=new CustomEvent(wy);document.dispatchEvent(e)}function c5(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?a5(i,o):i.dispatchEvent(o)}var rb="focusScope.autoFocusOnMount",ib="focusScope.autoFocusOnUnmount",y2={bubbles:!1,cancelable:!0},_6="FocusScope",gh=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...l}=e,[c,h]=v.useState(null),d=ls(i),g=ls(o),p=v.useRef(null),_=Zt(t,S=>h(S)),y=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let S=function(E){if(y.paused||!c)return;const N=E.target;c.contains(N)?p.current=N:ca(p.current,{select:!0})},C=function(E){if(y.paused||!c)return;const N=E.relatedTarget;N!==null&&(c.contains(N)||ca(p.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const L of E)L.removedNodes.length>0&&ca(c)};document.addEventListener("focusin",S),document.addEventListener("focusout",C);const R=new MutationObserver(k);return c&&R.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",C),R.disconnect()}}},[r,c,y.paused]),v.useEffect(()=>{if(c){w2.add(y);const S=document.activeElement;if(!c.contains(S)){const k=new CustomEvent(rb,y2);c.addEventListener(rb,d),c.dispatchEvent(k),k.defaultPrevented||(b6(C6(u5(c)),{select:!0}),document.activeElement===S&&ca(c))}return()=>{c.removeEventListener(rb,d),setTimeout(()=>{const k=new CustomEvent(ib,y2);c.addEventListener(ib,g),c.dispatchEvent(k),k.defaultPrevented||ca(S??document.body,{select:!0}),c.removeEventListener(ib,g),w2.remove(y)},0)}}},[c,d,g,y]);const w=v.useCallback(S=>{if(!n&&!r||y.paused)return;const C=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,k=document.activeElement;if(C&&k){const R=S.currentTarget,[E,N]=y6(R);E&&N?!S.shiftKey&&k===N?(S.preventDefault(),n&&ca(E,{select:!0})):S.shiftKey&&k===E&&(S.preventDefault(),n&&ca(N,{select:!0})):k===R&&S.preventDefault()}},[n,r,y.paused]);return f.jsx(Ot.div,{tabIndex:-1,...l,ref:_,onKeyDown:w})});gh.displayName=_6;function b6(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ca(r,{select:t}),document.activeElement!==n)return}function y6(e){const t=u5(e),n=x2(t,e),r=x2(t.reverse(),e);return[n,r]}function u5(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function x2(e,t){for(const n of e)if(!x6(n,{upTo:t}))return n}function x6(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 w6(e){return e instanceof HTMLInputElement&&"select"in e}function ca(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&w6(e)&&t&&e.select()}}var w2=S6();function S6(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=S2(e,t),e.unshift(t)},remove(t){var n;e=S2(e,t),(n=e[0])==null||n.resume()}}}function S2(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function C6(e){return e.filter(t=>t.tagName!=="A")}var k6="Portal",eu=v.forwardRef((e,t)=>{var c;const{container:n,...r}=e,[i,o]=v.useState(!1);Pr(()=>o(!0),[]);const l=n||i&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?$N.createPortal(f.jsx(Ot.div,{...r,ref:t}),l):null});eu.displayName=k6;function E6(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var Xi=e=>{const{present:t,children:n}=e,r=R6(t),i=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),o=Zt(r.ref,T6(i));return typeof n=="function"||r.isPresent?v.cloneElement(i,{ref:o}):null};Xi.displayName="Presence";function R6(e){const[t,n]=v.useState(),r=v.useRef(null),i=v.useRef(e),o=v.useRef("none"),l=e?"mounted":"unmounted",[c,h]=E6(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const d=am(r.current);o.current=c==="mounted"?d:"none"},[c]),Pr(()=>{const d=r.current,g=i.current;if(g!==e){const _=o.current,y=am(d);e?h("MOUNT"):y==="none"||(d==null?void 0:d.display)==="none"?h("UNMOUNT"):h(g&&_!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,h]),Pr(()=>{if(t){let d;const g=t.ownerDocument.defaultView??window,p=y=>{const S=am(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&S&&(h("ANIMATION_END"),!i.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",d=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},_=y=>{y.target===t&&(o.current=am(r.current))};return t.addEventListener("animationstart",_),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{g.clearTimeout(d),t.removeEventListener("animationstart",_),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:v.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function am(e){return(e==null?void 0:e.animationName)||"none"}function T6(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var sb=0;function Qp(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??C2()),document.body.insertAdjacentElement("beforeend",e[1]??C2()),sb++,()=>{sb===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),sb--}},[])}function C2(){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 Ts=function(){return Ts=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Ts.apply(this,arguments)};function d5(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function N6(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Hm="right-scroll-bar-position",$m="width-before-scroll-bar",M6="with-scroll-bars-hidden",A6="--removed-body-scroll-bar-size";function ob(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function j6(e,t){var n=v.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var D6=typeof window<"u"?v.useLayoutEffect:v.useEffect,k2=new WeakMap;function O6(e,t){var n=j6(null,function(r){return e.forEach(function(i){return ob(i,r)})});return D6(function(){var r=k2.get(n);if(r){var i=new Set(r),o=new Set(e),l=n.current;i.forEach(function(c){o.has(c)||ob(c,null)}),o.forEach(function(c){i.has(c)||ob(c,l)})}k2.set(n,e)},[e]),n}function L6(e){return e}function z6(e,t){t===void 0&&(t=L6);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var l=t(o,r);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(o){for(r=!0;n.length;){var l=n;n=[],l.forEach(o)}n={push:function(c){return o(c)},filter:function(){return n}}},assignMedium:function(o){r=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(o),l=n}var h=function(){var g=l;l=[],g.forEach(o)},d=function(){return Promise.resolve().then(h)};d(),n={push:function(g){l.push(g),d()},filter:function(g){return l=l.filter(g),n}}}};return i}function P6(e){e===void 0&&(e={});var t=z6(null);return t.options=Ts({async:!0,ssr:!1},e),t}var h5=function(e){var t=e.sideCar,n=d5(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,Ts({},n))};h5.isSideCarExport=!0;function I6(e,t){return e.useMedium(t),h5}var f5=P6(),ab=function(){},Jp=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:ab,onWheelCapture:ab,onTouchMoveCapture:ab}),i=r[0],o=r[1],l=e.forwardProps,c=e.children,h=e.className,d=e.removeScrollBar,g=e.enabled,p=e.shards,_=e.sideCar,y=e.noRelative,w=e.noIsolation,S=e.inert,C=e.allowPinchZoom,k=e.as,R=k===void 0?"div":k,E=e.gapMode,N=d5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=_,j=O6([n,t]),O=Ts(Ts({},N),i);return v.createElement(v.Fragment,null,g&&v.createElement(L,{sideCar:f5,removeScrollBar:d,shards:p,noRelative:y,noIsolation:w,inert:S,setCallbacks:o,allowPinchZoom:!!C,lockRef:n,gapMode:E}),l?v.cloneElement(v.Children.only(c),Ts(Ts({},O),{ref:j})):v.createElement(R,Ts({},O,{className:h,ref:j}),c))});Jp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Jp.classNames={fullWidth:$m,zeroRight:Hm};var B6=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function F6(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=B6();return t&&e.setAttribute("nonce",t),e}function H6(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function $6(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var U6=function(){var e=0,t=null;return{add:function(n){e==0&&(t=F6())&&(H6(t,n),$6(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},V6=function(){var e=U6();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},m5=function(){var e=V6(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},W6={left:0,top:0,right:0,gap:0},lb=function(e){return parseInt(e||"",10)||0},q6=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[lb(n),lb(r),lb(i)]},K6=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return W6;var t=q6(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},G6=m5(),jc="data-scroll-locked",Y6=function(e,t,n,r){var i=e.left,o=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
61
+ .`.concat(M6,` {
62
+ overflow: hidden `).concat(r,`;
63
+ padding-right: `).concat(c,"px ").concat(r,`;
64
+ }
65
+ body[`).concat(jc,`] {
66
+ overflow: hidden `).concat(r,`;
67
+ overscroll-behavior: contain;
68
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
69
+ padding-left: `.concat(i,`px;
70
+ padding-top: `).concat(o,`px;
71
+ padding-right: `).concat(l,`px;
72
+ margin-left:0;
73
+ margin-top:0;
74
+ margin-right: `).concat(c,"px ").concat(r,`;
75
+ `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
76
+ }
77
+
78
+ .`).concat(Hm,` {
79
+ right: `).concat(c,"px ").concat(r,`;
80
+ }
81
+
82
+ .`).concat($m,` {
83
+ margin-right: `).concat(c,"px ").concat(r,`;
84
+ }
85
+
86
+ .`).concat(Hm," .").concat(Hm,` {
87
+ right: 0 `).concat(r,`;
88
+ }
89
+
90
+ .`).concat($m," .").concat($m,` {
91
+ margin-right: 0 `).concat(r,`;
92
+ }
93
+
94
+ body[`).concat(jc,`] {
95
+ `).concat(A6,": ").concat(c,`px;
96
+ }
97
+ `)},E2=function(){var e=parseInt(document.body.getAttribute(jc)||"0",10);return isFinite(e)?e:0},X6=function(){v.useEffect(function(){return document.body.setAttribute(jc,(E2()+1).toString()),function(){var e=E2()-1;e<=0?document.body.removeAttribute(jc):document.body.setAttribute(jc,e.toString())}},[])},Z6=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;X6();var o=v.useMemo(function(){return K6(i)},[i]);return v.createElement(G6,{styles:Y6(o,!t,i,n?"":"!important")})},Sy=!1;if(typeof window<"u")try{var lm=Object.defineProperty({},"passive",{get:function(){return Sy=!0,!0}});window.addEventListener("test",lm,lm),window.removeEventListener("test",lm,lm)}catch{Sy=!1}var fc=Sy?{passive:!1}:!1,Q6=function(e){return e.tagName==="TEXTAREA"},p5=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Q6(e)&&n[t]==="visible")},J6=function(e){return p5(e,"overflowY")},eB=function(e){return p5(e,"overflowX")},R2=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=g5(e,r);if(i){var o=v5(e,r),l=o[1],c=o[2];if(l>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},tB=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},nB=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},g5=function(e,t){return e==="v"?J6(t):eB(t)},v5=function(e,t){return e==="v"?tB(t):nB(t)},rB=function(e,t){return e==="h"&&t==="rtl"?-1:1},iB=function(e,t,n,r,i){var o=rB(e,window.getComputedStyle(t).direction),l=o*r,c=n.target,h=t.contains(c),d=!1,g=l>0,p=0,_=0;do{if(!c)break;var y=v5(e,c),w=y[0],S=y[1],C=y[2],k=S-C-o*w;(w||k)&&g5(e,c)&&(p+=k,_+=w);var R=c.parentNode;c=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!h&&c!==document.body||h&&(t.contains(c)||t===c));return(g&&Math.abs(p)<1||!g&&Math.abs(_)<1)&&(d=!0),d},cm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},T2=function(e){return[e.deltaX,e.deltaY]},N2=function(e){return e&&"current"in e?e.current:e},sB=function(e,t){return e[0]===t[0]&&e[1]===t[1]},oB=function(e){return`
98
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
99
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
100
+ `)},aB=0,mc=[];function lB(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(aB++)[0],o=v.useState(m5)[0],l=v.useRef(e);v.useEffect(function(){l.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var S=N6([e.lockRef.current],(e.shards||[]).map(N2),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var c=v.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!l.current.allowPinchZoom;var k=cm(S),R=n.current,E="deltaX"in S?S.deltaX:R[0]-k[0],N="deltaY"in S?S.deltaY:R[1]-k[1],L,j=S.target,O=Math.abs(E)>Math.abs(N)?"h":"v";if("touches"in S&&O==="h"&&j.type==="range")return!1;var H=window.getSelection(),Z=H&&H.anchorNode,I=Z?Z===j||Z.contains(j):!1;if(I)return!1;var W=R2(O,j);if(!W)return!0;if(W?L=O:(L=O==="v"?"h":"v",W=R2(O,j)),!W)return!1;if(!r.current&&"changedTouches"in S&&(E||N)&&(r.current=L),!L)return!0;var F=r.current||L;return iB(F,C,S,F==="h"?E:N)},[]),h=v.useCallback(function(S){var C=S;if(!(!mc.length||mc[mc.length-1]!==o)){var k="deltaY"in C?T2(C):cm(C),R=t.current.filter(function(L){return L.name===C.type&&(L.target===C.target||C.target===L.shadowParent)&&sB(L.delta,k)})[0];if(R&&R.should){C.cancelable&&C.preventDefault();return}if(!R){var E=(l.current.shards||[]).map(N2).filter(Boolean).filter(function(L){return L.contains(C.target)}),N=E.length>0?c(C,E[0]):!l.current.noIsolation;N&&C.cancelable&&C.preventDefault()}}},[]),d=v.useCallback(function(S,C,k,R){var E={name:S,delta:C,target:k,should:R,shadowParent:cB(k)};t.current.push(E),setTimeout(function(){t.current=t.current.filter(function(N){return N!==E})},1)},[]),g=v.useCallback(function(S){n.current=cm(S),r.current=void 0},[]),p=v.useCallback(function(S){d(S.type,T2(S),S.target,c(S,e.lockRef.current))},[]),_=v.useCallback(function(S){d(S.type,cm(S),S.target,c(S,e.lockRef.current))},[]);v.useEffect(function(){return mc.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:_}),document.addEventListener("wheel",h,fc),document.addEventListener("touchmove",h,fc),document.addEventListener("touchstart",g,fc),function(){mc=mc.filter(function(S){return S!==o}),document.removeEventListener("wheel",h,fc),document.removeEventListener("touchmove",h,fc),document.removeEventListener("touchstart",g,fc)}},[]);var y=e.removeScrollBar,w=e.inert;return v.createElement(v.Fragment,null,w?v.createElement(o,{styles:oB(i)}):null,y?v.createElement(Z6,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function cB(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const uB=I6(f5,lB);var vh=v.forwardRef(function(e,t){return v.createElement(Jp,Ts({},e,{ref:t,sideCar:uB}))});vh.classNames=Jp.classNames;var dB=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},pc=new WeakMap,um=new WeakMap,dm={},cb=0,_5=function(e){return e&&(e.host||_5(e.parentNode))},hB=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=_5(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},fB=function(e,t,n,r){var i=hB(t,Array.isArray(e)?e:[e]);dm[n]||(dm[n]=new WeakMap);var o=dm[n],l=[],c=new Set,h=new Set(i),d=function(p){!p||c.has(p)||(c.add(p),d(p.parentNode))};i.forEach(d);var g=function(p){!p||h.has(p)||Array.prototype.forEach.call(p.children,function(_){if(c.has(_))g(_);else try{var y=_.getAttribute(r),w=y!==null&&y!=="false",S=(pc.get(_)||0)+1,C=(o.get(_)||0)+1;pc.set(_,S),o.set(_,C),l.push(_),S===1&&w&&um.set(_,!0),C===1&&_.setAttribute(n,"true"),w||_.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",_,k)}})};return g(t),c.clear(),cb++,function(){l.forEach(function(p){var _=pc.get(p)-1,y=o.get(p)-1;pc.set(p,_),o.set(p,y),_||(um.has(p)||p.removeAttribute(r),um.delete(p)),y||p.removeAttribute(n)}),cb--,cb||(pc=new WeakMap,pc=new WeakMap,um=new WeakMap,dm={})}},eg=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=dB(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),fB(r,i,n,"aria-hidden")):function(){return null}},tg="Dialog",[b5,toe]=Co(tg),[mB,hs]=b5(tg),y5=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,c=v.useRef(null),h=v.useRef(null),[d,g]=Ic({prop:r,defaultProp:i??!1,onChange:o,caller:tg});return f.jsx(mB,{scope:t,triggerRef:c,contentRef:h,contentId:go(),titleId:go(),descriptionId:go(),open:d,onOpenChange:g,onOpenToggle:v.useCallback(()=>g(p=>!p),[g]),modal:l,children:n})};y5.displayName=tg;var x5="DialogTrigger",pB=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=hs(x5,n),o=Zt(t,i.triggerRef);return f.jsx(Ot.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":S0(i.open),...r,ref:o,onClick:Be(e.onClick,i.onOpenToggle)})});pB.displayName=x5;var x0="DialogPortal",[gB,w5]=b5(x0,{forceMount:void 0}),S5=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=hs(x0,t);return f.jsx(gB,{scope:t,forceMount:n,children:v.Children.map(r,l=>f.jsx(Xi,{present:n||o.open,children:f.jsx(eu,{asChild:!0,container:i,children:l})}))})};S5.displayName=x0;var ip="DialogOverlay",C5=v.forwardRef((e,t)=>{const n=w5(ip,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=hs(ip,e.__scopeDialog);return o.modal?f.jsx(Xi,{present:r||o.open,children:f.jsx(_B,{...i,ref:t})}):null});C5.displayName=ip;var vB=fl("DialogOverlay.RemoveScroll"),_B=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=hs(ip,n);return f.jsx(vh,{as:vB,allowPinchZoom:!0,shards:[i.contentRef],children:f.jsx(Ot.div,{"data-state":S0(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ml="DialogContent",k5=v.forwardRef((e,t)=>{const n=w5(ml,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=hs(ml,e.__scopeDialog);return f.jsx(Xi,{present:r||o.open,children:o.modal?f.jsx(bB,{...i,ref:t}):f.jsx(yB,{...i,ref:t})})});k5.displayName=ml;var bB=v.forwardRef((e,t)=>{const n=hs(ml,e.__scopeDialog),r=v.useRef(null),i=Zt(t,n.contentRef,r);return v.useEffect(()=>{const o=r.current;if(o)return eg(o)},[]),f.jsx(E5,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Be(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&o.preventDefault()}),onFocusOutside:Be(e.onFocusOutside,o=>o.preventDefault())})}),yB=v.forwardRef((e,t)=>{const n=hs(ml,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return f.jsx(E5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((d=n.triggerRef.current)==null?void 0:d.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),E5=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...l}=e,c=hs(ml,n),h=v.useRef(null),d=Zt(t,h);return Qp(),f.jsxs(f.Fragment,{children:[f.jsx(gh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:f.jsx(Jc,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":S0(c.open),...l,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(xB,{titleId:c.titleId}),f.jsx(SB,{contentRef:h,descriptionId:c.descriptionId})]})]})}),w0="DialogTitle",R5=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=hs(w0,n);return f.jsx(Ot.h2,{id:i.titleId,...r,ref:t})});R5.displayName=w0;var T5="DialogDescription",N5=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=hs(T5,n);return f.jsx(Ot.p,{id:i.descriptionId,...r,ref:t})});N5.displayName=T5;var M5="DialogClose",A5=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=hs(M5,n);return f.jsx(Ot.button,{type:"button",...r,ref:t,onClick:Be(e.onClick,()=>i.onOpenChange(!1))})});A5.displayName=M5;function S0(e){return e?"open":"closed"}var j5="DialogTitleWarning",[noe,D5]=ZI(j5,{contentName:ml,titleName:w0,docsSlug:"dialog"}),xB=({titleId:e})=>{const t=D5(j5),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
101
+
102
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
103
+
104
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},wB="DialogDescriptionWarning",SB=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${D5(wB).contentName}}.`;return v.useEffect(()=>{var o;const i=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},CB=y5,kB=S5,O5=C5,L5=k5,EB=R5,RB=N5,TB=A5;/**
105
+ * @license lucide-react v0.562.0 - ISC
106
+ *
107
+ * This source code is licensed under the ISC license.
108
+ * See the LICENSE file in the root directory of this source tree.
109
+ */const NB=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),MB=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),M2=e=>{const t=MB(e);return t.charAt(0).toUpperCase()+t.slice(1)},z5=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),AB=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
110
+ * @license lucide-react v0.562.0 - ISC
111
+ *
112
+ * This source code is licensed under the ISC license.
113
+ * See the LICENSE file in the root directory of this source tree.
114
+ */var jB={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"};/**
115
+ * @license lucide-react v0.562.0 - ISC
116
+ *
117
+ * This source code is licensed under the ISC license.
118
+ * See the LICENSE file in the root directory of this source tree.
119
+ */const DB=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:l,...c},h)=>v.createElement("svg",{ref:h,...jB,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:z5("lucide",i),...!o&&!AB(c)&&{"aria-hidden":"true"},...c},[...l.map(([d,g])=>v.createElement(d,g)),...Array.isArray(o)?o:[o]]));/**
120
+ * @license lucide-react v0.562.0 - ISC
121
+ *
122
+ * This source code is licensed under the ISC license.
123
+ * See the LICENSE file in the root directory of this source tree.
124
+ */const Le=(e,t)=>{const n=v.forwardRef(({className:r,...i},o)=>v.createElement(DB,{ref:o,iconNode:t,className:z5(`lucide-${NB(M2(e))}`,`lucide-${e}`,r),...i}));return n.displayName=M2(e),n};/**
125
+ * @license lucide-react v0.562.0 - ISC
126
+ *
127
+ * This source code is licensed under the ISC license.
128
+ * See the LICENSE file in the root directory of this source tree.
129
+ */const OB=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],LB=Le("archive",OB);/**
130
+ * @license lucide-react v0.562.0 - ISC
131
+ *
132
+ * This source code is licensed under the ISC license.
133
+ * See the LICENSE file in the root directory of this source tree.
134
+ */const zB=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],PB=Le("arrow-down-to-line",zB);/**
135
+ * @license lucide-react v0.562.0 - ISC
136
+ *
137
+ * This source code is licensed under the ISC license.
138
+ * See the LICENSE file in the root directory of this source tree.
139
+ */const IB=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],BB=Le("arrow-down",IB);/**
140
+ * @license lucide-react v0.562.0 - ISC
141
+ *
142
+ * This source code is licensed under the ISC license.
143
+ * See the LICENSE file in the root directory of this source tree.
144
+ */const FB=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],HB=Le("arrow-left-right",FB);/**
145
+ * @license lucide-react v0.562.0 - ISC
146
+ *
147
+ * This source code is licensed under the ISC license.
148
+ * See the LICENSE file in the root directory of this source tree.
149
+ */const $B=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],UB=Le("arrow-left",$B);/**
150
+ * @license lucide-react v0.562.0 - ISC
151
+ *
152
+ * This source code is licensed under the ISC license.
153
+ * See the LICENSE file in the root directory of this source tree.
154
+ */const VB=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],WB=Le("arrow-up",VB);/**
155
+ * @license lucide-react v0.562.0 - ISC
156
+ *
157
+ * This source code is licensed under the ISC license.
158
+ * See the LICENSE file in the root directory of this source tree.
159
+ */const qB=[["path",{d:"M12 6v12",key:"1vza4d"}],["path",{d:"M17.196 9 6.804 15",key:"1ah31z"}],["path",{d:"m6.804 9 10.392 6",key:"1b6pxd"}]],KB=Le("asterisk",qB);/**
160
+ * @license lucide-react v0.562.0 - ISC
161
+ *
162
+ * This source code is licensed under the ISC license.
163
+ * See the LICENSE file in the root directory of this source tree.
164
+ */const GB=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],_i=Le("brain",GB);/**
165
+ * @license lucide-react v0.562.0 - ISC
166
+ *
167
+ * This source code is licensed under the ISC license.
168
+ * See the LICENSE file in the root directory of this source tree.
169
+ */const YB=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],XB=Le("check-check",YB);/**
170
+ * @license lucide-react v0.562.0 - ISC
171
+ *
172
+ * This source code is licensed under the ISC license.
173
+ * See the LICENSE file in the root directory of this source tree.
174
+ */const ZB=[["path",{d:"M20 4L9 15",key:"1qkx8z"}],["path",{d:"M21 19L3 19",key:"100sma"}],["path",{d:"M9 15L4 10",key:"9zxff7"}]],QB=Le("check-line",ZB);/**
175
+ * @license lucide-react v0.562.0 - ISC
176
+ *
177
+ * This source code is licensed under the ISC license.
178
+ * See the LICENSE file in the root directory of this source tree.
179
+ */const JB=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Wi=Le("check",JB);/**
180
+ * @license lucide-react v0.562.0 - ISC
181
+ *
182
+ * This source code is licensed under the ISC license.
183
+ * See the LICENSE file in the root directory of this source tree.
184
+ */const e8=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ng=Le("chevron-down",e8);/**
185
+ * @license lucide-react v0.562.0 - ISC
186
+ *
187
+ * This source code is licensed under the ISC license.
188
+ * See the LICENSE file in the root directory of this source tree.
189
+ */const t8=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],P5=Le("chevron-left",t8);/**
190
+ * @license lucide-react v0.562.0 - ISC
191
+ *
192
+ * This source code is licensed under the ISC license.
193
+ * See the LICENSE file in the root directory of this source tree.
194
+ */const n8=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vr=Le("chevron-right",n8);/**
195
+ * @license lucide-react v0.562.0 - ISC
196
+ *
197
+ * This source code is licensed under the ISC license.
198
+ * See the LICENSE file in the root directory of this source tree.
199
+ */const r8=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],i8=Le("chevron-up",r8);/**
200
+ * @license lucide-react v0.562.0 - ISC
201
+ *
202
+ * This source code is licensed under the ISC license.
203
+ * See the LICENSE file in the root directory of this source tree.
204
+ */const s8=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],o8=Le("chevrons-up",s8);/**
205
+ * @license lucide-react v0.562.0 - ISC
206
+ *
207
+ * This source code is licensed under the ISC license.
208
+ * See the LICENSE file in the root directory of this source tree.
209
+ */const a8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],l8=Le("circle-slash",a8);/**
210
+ * @license lucide-react v0.562.0 - ISC
211
+ *
212
+ * This source code is licensed under the ISC license.
213
+ * See the LICENSE file in the root directory of this source tree.
214
+ */const c8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],u8=Le("circle",c8);/**
215
+ * @license lucide-react v0.562.0 - ISC
216
+ *
217
+ * This source code is licensed under the ISC license.
218
+ * See the LICENSE file in the root directory of this source tree.
219
+ */const d8=[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],I5=Le("cloud-download",d8);/**
220
+ * @license lucide-react v0.562.0 - ISC
221
+ *
222
+ * This source code is licensed under the ISC license.
223
+ * See the LICENSE file in the root directory of this source tree.
224
+ */const h8=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],A2=Le("code-xml",h8);/**
225
+ * @license lucide-react v0.562.0 - ISC
226
+ *
227
+ * This source code is licensed under the ISC license.
228
+ * See the LICENSE file in the root directory of this source tree.
229
+ */const f8=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Cy=Le("code",f8);/**
230
+ * @license lucide-react v0.562.0 - ISC
231
+ *
232
+ * This source code is licensed under the ISC license.
233
+ * See the LICENSE file in the root directory of this source tree.
234
+ */const m8=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],p8=Le("command",m8);/**
235
+ * @license lucide-react v0.562.0 - ISC
236
+ *
237
+ * This source code is licensed under the ISC license.
238
+ * See the LICENSE file in the root directory of this source tree.
239
+ */const g8=[["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"}]],ul=Le("copy",g8);/**
240
+ * @license lucide-react v0.562.0 - ISC
241
+ *
242
+ * This source code is licensed under the ISC license.
243
+ * See the LICENSE file in the root directory of this source tree.
244
+ */const v8=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],_8=Le("corner-down-left",v8);/**
245
+ * @license lucide-react v0.562.0 - ISC
246
+ *
247
+ * This source code is licensed under the ISC license.
248
+ * See the LICENSE file in the root directory of this source tree.
249
+ */const b8=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],j2=Le("download",b8);/**
250
+ * @license lucide-react v0.562.0 - ISC
251
+ *
252
+ * This source code is licensed under the ISC license.
253
+ * See the LICENSE file in the root directory of this source tree.
254
+ */const y8=[["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"}]],x8=Le("ellipsis",y8);/**
255
+ * @license lucide-react v0.562.0 - ISC
256
+ *
257
+ * This source code is licensed under the ISC license.
258
+ * See the LICENSE file in the root directory of this source tree.
259
+ */const w8=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],S8=Le("eraser",w8);/**
260
+ * @license lucide-react v0.562.0 - ISC
261
+ *
262
+ * This source code is licensed under the ISC license.
263
+ * See the LICENSE file in the root directory of this source tree.
264
+ */const C8=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],k8=Le("external-link",C8);/**
265
+ * @license lucide-react v0.562.0 - ISC
266
+ *
267
+ * This source code is licensed under the ISC license.
268
+ * See the LICENSE file in the root directory of this source tree.
269
+ */const E8=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],D2=Le("eye",E8);/**
270
+ * @license lucide-react v0.562.0 - ISC
271
+ *
272
+ * This source code is licensed under the ISC license.
273
+ * See the LICENSE file in the root directory of this source tree.
274
+ */const R8=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],T8=Le("file-pen",R8);/**
275
+ * @license lucide-react v0.562.0 - ISC
276
+ *
277
+ * This source code is licensed under the ISC license.
278
+ * See the LICENSE file in the root directory of this source tree.
279
+ */const N8=[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]],M8=Le("file-plus-corner",N8);/**
280
+ * @license lucide-react v0.562.0 - ISC
281
+ *
282
+ * This source code is licensed under the ISC license.
283
+ * See the LICENSE file in the root directory of this source tree.
284
+ */const A8=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],j8=Le("file-text",A8);/**
285
+ * @license lucide-react v0.562.0 - ISC
286
+ *
287
+ * This source code is licensed under the ISC license.
288
+ * See the LICENSE file in the root directory of this source tree.
289
+ */const D8=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],O8=Le("file",D8);/**
290
+ * @license lucide-react v0.562.0 - ISC
291
+ *
292
+ * This source code is licensed under the ISC license.
293
+ * See the LICENSE file in the root directory of this source tree.
294
+ */const L8=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],ub=Le("folder-git-2",L8);/**
295
+ * @license lucide-react v0.562.0 - ISC
296
+ *
297
+ * This source code is licensed under the ISC license.
298
+ * See the LICENSE file in the root directory of this source tree.
299
+ */const z8=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],B5=Le("folder-open",z8);/**
300
+ * @license lucide-react v0.562.0 - ISC
301
+ *
302
+ * This source code is licensed under the ISC license.
303
+ * See the LICENSE file in the root directory of this source tree.
304
+ */const P8=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["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"}]],F5=Le("folder-plus",P8);/**
305
+ * @license lucide-react v0.562.0 - ISC
306
+ *
307
+ * This source code is licensed under the ISC license.
308
+ * See the LICENSE file in the root directory of this source tree.
309
+ */const I8=[["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"}]],H5=Le("folder",I8);/**
310
+ * @license lucide-react v0.562.0 - ISC
311
+ *
312
+ * This source code is licensed under the ISC license.
313
+ * See the LICENSE file in the root directory of this source tree.
314
+ */const B8=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],ao=Le("gauge",B8);/**
315
+ * @license lucide-react v0.562.0 - ISC
316
+ *
317
+ * This source code is licensed under the ISC license.
318
+ * See the LICENSE file in the root directory of this source tree.
319
+ */const F8=[["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"}]],H8=Le("git-branch",F8);/**
320
+ * @license lucide-react v0.562.0 - ISC
321
+ *
322
+ * This source code is licensed under the ISC license.
323
+ * See the LICENSE file in the root directory of this source tree.
324
+ */const $8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],U8=Le("info",$8);/**
325
+ * @license lucide-react v0.562.0 - ISC
326
+ *
327
+ * This source code is licensed under the ISC license.
328
+ * See the LICENSE file in the root directory of this source tree.
329
+ */const V8=[["rect",{width:"7",height:"18",x:"3",y:"3",rx:"1",key:"2obqm"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]],W8=Le("layout-panel-left",V8);/**
330
+ * @license lucide-react v0.562.0 - ISC
331
+ *
332
+ * This source code is licensed under the ISC license.
333
+ * See the LICENSE file in the root directory of this source tree.
334
+ */const q8=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],K8=Le("list-checks",q8);/**
335
+ * @license lucide-react v0.562.0 - ISC
336
+ *
337
+ * This source code is licensed under the ISC license.
338
+ * See the LICENSE file in the root directory of this source tree.
339
+ */const G8=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],sp=Le("list-todo",G8);/**
340
+ * @license lucide-react v0.562.0 - ISC
341
+ *
342
+ * This source code is licensed under the ISC license.
343
+ * See the LICENSE file in the root directory of this source tree.
344
+ */const Y8=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Lr=Le("loader-circle",Y8);/**
345
+ * @license lucide-react v0.562.0 - ISC
346
+ *
347
+ * This source code is licensed under the ISC license.
348
+ * See the LICENSE file in the root directory of this source tree.
349
+ */const X8=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],O2=Le("lock-open",X8);/**
350
+ * @license lucide-react v0.562.0 - ISC
351
+ *
352
+ * This source code is licensed under the ISC license.
353
+ * See the LICENSE file in the root directory of this source tree.
354
+ */const Z8=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],L2=Le("map",Z8);/**
355
+ * @license lucide-react v0.562.0 - ISC
356
+ *
357
+ * This source code is licensed under the ISC license.
358
+ * See the LICENSE file in the root directory of this source tree.
359
+ */const Q8=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],J8=Le("maximize-2",Q8);/**
360
+ * @license lucide-react v0.562.0 - ISC
361
+ *
362
+ * This source code is licensed under the ISC license.
363
+ * See the LICENSE file in the root directory of this source tree.
364
+ */const e9=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],ky=Le("menu",e9);/**
365
+ * @license lucide-react v0.562.0 - ISC
366
+ *
367
+ * This source code is licensed under the ISC license.
368
+ * See the LICENSE file in the root directory of this source tree.
369
+ */const t9=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["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"}]],$5=Le("message-circle-question-mark",t9);/**
370
+ * @license lucide-react v0.562.0 - ISC
371
+ *
372
+ * This source code is licensed under the ISC license.
373
+ * See the LICENSE file in the root directory of this source tree.
374
+ */const n9=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],r9=Le("message-square-quote",n9);/**
375
+ * @license lucide-react v0.562.0 - ISC
376
+ *
377
+ * This source code is licensed under the ISC license.
378
+ * See the LICENSE file in the root directory of this source tree.
379
+ */const i9=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],s9=Le("minimize-2",i9);/**
380
+ * @license lucide-react v0.562.0 - ISC
381
+ *
382
+ * This source code is licensed under the ISC license.
383
+ * See the LICENSE file in the root directory of this source tree.
384
+ */const o9=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],U5=Le("minimize",o9);/**
385
+ * @license lucide-react v0.562.0 - ISC
386
+ *
387
+ * This source code is licensed under the ISC license.
388
+ * See the LICENSE file in the root directory of this source tree.
389
+ */const a9=[["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"}]],V5=Le("monitor",a9);/**
390
+ * @license lucide-react v0.562.0 - ISC
391
+ *
392
+ * This source code is licensed under the ISC license.
393
+ * See the LICENSE file in the root directory of this source tree.
394
+ */const l9=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],c9=Le("palette",l9);/**
395
+ * @license lucide-react v0.562.0 - ISC
396
+ *
397
+ * This source code is licensed under the ISC license.
398
+ * See the LICENSE file in the root directory of this source tree.
399
+ */const u9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Ey=Le("panel-left",u9);/**
400
+ * @license lucide-react v0.562.0 - ISC
401
+ *
402
+ * This source code is licensed under the ISC license.
403
+ * See the LICENSE file in the root directory of this source tree.
404
+ */const d9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],h9=Le("panel-right",d9);/**
405
+ * @license lucide-react v0.562.0 - ISC
406
+ *
407
+ * This source code is licensed under the ISC license.
408
+ * See the LICENSE file in the root directory of this source tree.
409
+ */const f9=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],W5=Le("paperclip",f9);/**
410
+ * @license lucide-react v0.562.0 - ISC
411
+ *
412
+ * This source code is licensed under the ISC license.
413
+ * See the LICENSE file in the root directory of this source tree.
414
+ */const m9=[["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"}]],Bc=Le("pencil",m9);/**
415
+ * @license lucide-react v0.562.0 - ISC
416
+ *
417
+ * This source code is licensed under the ISC license.
418
+ * See the LICENSE file in the root directory of this source tree.
419
+ */const p9=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],C0=Le("plus",p9);/**
420
+ * @license lucide-react v0.562.0 - ISC
421
+ *
422
+ * This source code is licensed under the ISC license.
423
+ * See the LICENSE file in the root directory of this source tree.
424
+ */const g9=[["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"}]],op=Le("refresh-cw",g9);/**
425
+ * @license lucide-react v0.562.0 - ISC
426
+ *
427
+ * This source code is licensed under the ISC license.
428
+ * See the LICENSE file in the root directory of this source tree.
429
+ */const v9=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],db=Le("search",v9);/**
430
+ * @license lucide-react v0.562.0 - ISC
431
+ *
432
+ * This source code is licensed under the ISC license.
433
+ * See the LICENSE file in the root directory of this source tree.
434
+ */const _9=[["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"}]],b9=Le("send",_9);/**
435
+ * @license lucide-react v0.562.0 - ISC
436
+ *
437
+ * This source code is licensed under the ISC license.
438
+ * See the LICENSE file in the root directory of this source tree.
439
+ */const y9=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],x9=Le("settings",y9);/**
440
+ * @license lucide-react v0.562.0 - ISC
441
+ *
442
+ * This source code is licensed under the ISC license.
443
+ * See the LICENSE file in the root directory of this source tree.
444
+ */const w9=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],S9=Le("settings-2",w9);/**
445
+ * @license lucide-react v0.562.0 - ISC
446
+ *
447
+ * This source code is licensed under the ISC license.
448
+ * See the LICENSE file in the root directory of this source tree.
449
+ */const C9=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],k9=Le("slash",C9);/**
450
+ * @license lucide-react v0.562.0 - ISC
451
+ *
452
+ * This source code is licensed under the ISC license.
453
+ * See the LICENSE file in the root directory of this source tree.
454
+ */const E9=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],$n=Le("sparkles",E9);/**
455
+ * @license lucide-react v0.562.0 - ISC
456
+ *
457
+ * This source code is licensed under the ISC license.
458
+ * See the LICENSE file in the root directory of this source tree.
459
+ */const R9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]],z2=Le("square-menu",R9);/**
460
+ * @license lucide-react v0.562.0 - ISC
461
+ *
462
+ * This source code is licensed under the ISC license.
463
+ * See the LICENSE file in the root directory of this source tree.
464
+ */const T9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]],P2=Le("square-minus",T9);/**
465
+ * @license lucide-react v0.562.0 - ISC
466
+ *
467
+ * This source code is licensed under the ISC license.
468
+ * See the LICENSE file in the root directory of this source tree.
469
+ */const N9=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],q5=Le("square-pen",N9);/**
470
+ * @license lucide-react v0.562.0 - ISC
471
+ *
472
+ * This source code is licensed under the ISC license.
473
+ * See the LICENSE file in the root directory of this source tree.
474
+ */const M9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],A9=Le("square-x",M9);/**
475
+ * @license lucide-react v0.562.0 - ISC
476
+ *
477
+ * This source code is licensed under the ISC license.
478
+ * See the LICENSE file in the root directory of this source tree.
479
+ */const j9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],D9=Le("square",j9);/**
480
+ * @license lucide-react v0.562.0 - ISC
481
+ *
482
+ * This source code is licensed under the ISC license.
483
+ * See the LICENSE file in the root directory of this source tree.
484
+ */const O9=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],k0=Le("terminal",O9);/**
485
+ * @license lucide-react v0.562.0 - ISC
486
+ *
487
+ * This source code is licensed under the ISC license.
488
+ * See the LICENSE file in the root directory of this source tree.
489
+ */const L9=[["rect",{width:"18",height:"12",x:"3",y:"8",rx:"1",key:"158fvp"}],["path",{d:"M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3",key:"s0042v"}],["path",{d:"M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3",key:"9wmeh2"}]],z9=Le("toy-brick",L9);/**
490
+ * @license lucide-react v0.562.0 - ISC
491
+ *
492
+ * This source code is licensed under the ISC license.
493
+ * See the LICENSE file in the root directory of this source tree.
494
+ */const P9=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Gd=Le("trash-2",P9);/**
495
+ * @license lucide-react v0.562.0 - ISC
496
+ *
497
+ * This source code is licensed under the ISC license.
498
+ * See the LICENSE file in the root directory of this source tree.
499
+ */const I9=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],E0=Le("user-round",I9);/**
500
+ * @license lucide-react v0.562.0 - ISC
501
+ *
502
+ * This source code is licensed under the ISC license.
503
+ * See the LICENSE file in the root directory of this source tree.
504
+ */const B9=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],_o=Le("x",B9);/**
505
+ * @license lucide-react v0.562.0 - ISC
506
+ *
507
+ * This source code is licensed under the ISC license.
508
+ * See the LICENSE file in the root directory of this source tree.
509
+ */const F9=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Rs=Le("zap",F9),Yd="data-focus-fallback-ignore",K5="data-allow-focus-retain",ap="kaizen:restore-chat-input-focus",R0="data-chat-input",lp="data-chat-selection-zone";function rl(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function Ry(e){var n;const t=e;return t!=null&&t.matches?t.matches("input:not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='reset']), textarea, select")||t.isContentEditable||((n=t.getAttribute)==null?void 0:n.call(t,"role"))==="textbox"?!0:rl(e,K5):!1}function H9(e){const t=e;return t!=null&&t.matches?Ry(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:rl(e,K5):!1}function I2(e){return!!e.querySelector(`[${Yd}][data-state='open']`)}function $9(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function U9(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${R0}]`)).filter(l=>!l.disabled);if(n.length===0)return!1;const r=n.indexOf(e),i=r>=0?(r+1)%n.length:0,o=n[i];return o?(o.focus({preventScroll:!0}),!0):!1}function B2(e){const{activeElement:t,fallback:n,hasActiveOverlay:r}=e;if(!n||n.disabled||r||t===n)return"none";if(e.trigger==="escape")return e.defaultPrevented||rl(t,R0)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:o,root:l,hasActiveSelection:c}=e,h=o??i;return!l||!h||!l.contains(h)||rl(h,Yd)||rl(t,Yd)||Ry(h)||c&&(rl(i,lp)||rl(h,lp))||Ry(t)?"none":t&&t===h?"restore":H9(t)?"none":"restore"}const rg=CB,V9=kB,G5=v.forwardRef(({className:e,...t},n)=>f.jsx(O5,{ref:n,className:pe("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));G5.displayName=O5.displayName;const W9={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},_h=v.forwardRef(({className:e,children:t,size:n="md",...r},i)=>f.jsxs(V9,{children:[f.jsx(G5,{}),f.jsxs(L5,{ref:i,[Yd]:"",onCloseAutoFocus:o=>{var l;o.preventDefault(),window.dispatchEvent(new Event(ap)),(l=r.onCloseAutoFocus)==null||l.call(r,o)},className:pe("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl backdrop-blur-md duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","max-h-[85vh] flex flex-col",W9[n],e),...r,children:[t,f.jsxs(TB,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[f.jsx(_o,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_h.displayName=L5.displayName;function ig({className:e,...t}){return f.jsx(EB,{className:pe("text-lg font-medium leading-none tracking-tight",e),...t})}function T0({className:e,...t}){return f.jsx(RB,{className:pe("text-sm text-muted-foreground",e),...t})}function sg({className:e,...t}){return f.jsx("div",{className:pe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function og({className:e,...t}){return f.jsx("div",{className:pe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}const Fi=v.forwardRef(({className:e,type:t,...n},r)=>f.jsx("input",{ref:r,type:t,className:pe("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Fi.displayName="Input";const Y5=v.createContext(null);function q9({children:e}){const[t,n]=v.useState(null),[r,i]=v.useState(""),o=v.useRef(null);v.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(i(t.options.initialValue??""),setTimeout(()=>{var y,w;(y=o.current)==null||y.focus(),(w=o.current)==null||w.select()},0))},[t]);const l=v.useCallback(()=>{n(null),i("")},[]),c=v.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),l())},[l,t]),h=v.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.kind==="prompt"?t.resolve(r.trim()||null):t.resolve(),l())},[l,t,r]),d=v.useCallback(y=>new Promise(w=>{n({kind:"confirm",options:y,resolve:w})}),[]),g=v.useCallback(y=>new Promise(w=>{n({kind:"prompt",options:y,resolve:w})}),[]),p=v.useCallback(y=>new Promise(w=>{n({kind:"alert",options:y,resolve:w})}),[]),_=v.useMemo(()=>({confirm:d,prompt:g,alert:p}),[p,d,g]);return f.jsxs(Y5.Provider,{value:_,children:[e,f.jsx(rg,{open:t!==null,onOpenChange:y=>{y||!t||c()},children:f.jsx(_h,{size:"sm",onKeyDown:y=>{y.key!=="Enter"||y.shiftKey||!t||t.kind!=="confirm"||(y.preventDefault(),h())},children:t?f.jsxs(f.Fragment,{children:[f.jsxs(sg,{className:"space-y-4",children:[f.jsx(ig,{children:t.options.title}),t.options.description?f.jsx(T0,{children:t.options.description}):null,t.kind==="prompt"?f.jsx(Fi,{ref:o,type:"text",value:r,onChange:y=>i(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),h())},placeholder:t.options.placeholder}):null]}),f.jsxs(og,{children:[f.jsx(Qe,{variant:"ghost",size:"sm",onClick:c,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),f.jsx(Qe,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:h,disabled:t.kind==="prompt"&&!r.trim(),children:t.kind==="alert"?t.options.closeLabel??"OK":"confirmLabel"in t.options?t.options.confirmLabel??"Confirm":"Confirm"})]})]}):null})})]})}function K9(){const e=v.useContext(Y5);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const bh=v.forwardRef(({className:e,...t},n)=>f.jsx("textarea",{"data-gramm":"false","data-gramm_editor":"false","data-enable-grammarly":"false","data-1p-ignore":!0,autoComplete:"off",className:pe("flex w-full rounded-lg border border-border bg-background px-2.5 py-2 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));bh.displayName="Textarea";function G9(e){return e.trim().length>0}function Y9({open:e,onOpenChange:t,onConfirm:n}){const[r,i]=v.useState(""),[o,l]=v.useState(""),c=v.useRef(null);v.useEffect(()=>{e&&(i(""),l(""),setTimeout(()=>{var g;return(g=c.current)==null?void 0:g.focus()},0))},[e]);const h=G9(r),d=()=>{h&&n({title:r.trim(),description:o.trim()})};return f.jsx(rg,{open:e,onOpenChange:t,children:f.jsx(_h,{size:"sm",onKeyDown:g=>{(g.metaKey||g.ctrlKey)&&g.key==="Enter"&&(g.preventDefault(),d())},children:f.jsxs("form",{onSubmit:g=>{g.preventDefault(),d()},children:[f.jsxs(sg,{className:"space-y-4",children:[f.jsx(ig,{children:"Create Feature"}),f.jsx(T0,{children:"Name the feature folder and optionally add a short description for the feature."}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("label",{htmlFor:"feature-title",className:"text-sm font-medium",children:"Feature name"}),f.jsx(Fi,{id:"feature-title",ref:c,type:"text",value:r,onChange:g=>i(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),d())},placeholder:"Feature name"})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("label",{htmlFor:"feature-description",className:"text-sm font-medium",children:["Description ",f.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),f.jsx(bh,{id:"feature-description",value:o,onChange:g=>l(g.target.value),rows:5,placeholder:"Leave blank to add it later"})]})]}),f.jsxs(og,{children:[f.jsx(Qe,{type:"button",variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(Qe,{type:"submit",variant:"secondary",size:"sm",disabled:!h,children:"Create"})]})]})})})}const F2=`1. Sign in on the opened Cursor spending page.
510
+ 2. Open DevTools > Network.
511
+ 3. Refresh the page.
512
+ 4. Right-click the get-current-period-usage request.
513
+ 5. Copy > Copy as cURL.
514
+ 6. Paste it here.`;function X9({open:e,onOpenChange:t,onSubmit:n}){const r=v.useRef(null),[i,o]=v.useState(""),[l,c]=v.useState(!1);v.useEffect(()=>{e&&(o(""),setTimeout(()=>{var p;return(p=r.current)==null?void 0:p.focus()},0))},[e]);async function h(){const p=await navigator.clipboard.readText();o(p)}async function d(){await navigator.clipboard.writeText(F2),c(!0),setTimeout(()=>c(!1),2e3)}const g=i.trim().length>0;return f.jsx(rg,{open:e,onOpenChange:t,children:f.jsx(_h,{size:"lg",children:f.jsxs("form",{onSubmit:p=>{p.preventDefault(),g&&n(i.trim())},children:[f.jsxs(sg,{className:"space-y-4",children:[f.jsx(ig,{children:"Import Cursor Session"}),f.jsxs(T0,{children:["Paste the copied ",f.jsx("code",{children:"get-current-period-usage"})," curl command and Kaizen will import the session for you."]}),f.jsx("div",{className:"rounded-xl border border-border bg-card px-3 py-3 text-sm text-muted-foreground whitespace-pre-line",children:F2}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Qe,{type:"button",variant:"ghost",size:"sm",onClick:()=>void h(),children:"Paste Clipboard"}),f.jsxs(Qe,{type:"button",variant:"ghost",size:"sm",onClick:()=>void d(),children:[l?f.jsx(Wi,{className:"h-4 w-4"}):f.jsx(ul,{className:"h-4 w-4"}),f.jsx("span",{className:"ml-1",children:l?"Copied":"Copy Steps"})]})]}),f.jsx(bh,{ref:r,value:i,onChange:p=>o(p.target.value),rows:10,placeholder:"Paste the copied curl command here",className:"font-mono text-xs"})]}),f.jsxs(og,{children:[f.jsx(Qe,{type:"button",variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(Qe,{type:"submit",variant:"secondary",size:"sm",disabled:!g,children:"Import Session"})]})]})})})}const Z9=["top","right","bottom","left"],xa=Math.min,xi=Math.max,cp=Math.round,hm=Math.floor,Ls=e=>({x:e,y:e}),Q9={left:"right",right:"left",bottom:"top",top:"bottom"};function Ty(e,t,n){return xi(e,xa(t,n))}function bo(e,t){return typeof e=="function"?e(t):e}function yo(e){return e.split("-")[0]}function tu(e){return e.split("-")[1]}function N0(e){return e==="x"?"y":"x"}function M0(e){return e==="y"?"height":"width"}function Ns(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function A0(e){return N0(Ns(e))}function J9(e,t,n){n===void 0&&(n=!1);const r=tu(e),i=A0(e),o=M0(i);let l=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=up(l)),[l,up(l)]}function e7(e){const t=up(e);return[Ny(e),t,Ny(t)]}function Ny(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const H2=["left","right"],$2=["right","left"],t7=["top","bottom"],n7=["bottom","top"];function r7(e,t,n){switch(e){case"top":case"bottom":return n?t?$2:H2:t?H2:$2;case"left":case"right":return t?t7:n7;default:return[]}}function i7(e,t,n,r){const i=tu(e);let o=r7(yo(e),n==="start",r);return i&&(o=o.map(l=>l+"-"+i),t&&(o=o.concat(o.map(Ny)))),o}function up(e){const t=yo(e);return Q9[t]+e.slice(t.length)}function s7(e){return{top:0,right:0,bottom:0,left:0,...e}}function X5(e){return typeof e!="number"?s7(e):{top:e,right:e,bottom:e,left:e}}function dp(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function U2(e,t,n){let{reference:r,floating:i}=e;const o=Ns(t),l=A0(t),c=M0(l),h=yo(t),d=o==="y",g=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,_=r[c]/2-i[c]/2;let y;switch(h){case"top":y={x:g,y:r.y-i.height};break;case"bottom":y={x:g,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-i.width,y:p};break;default:y={x:r.x,y:r.y}}switch(tu(t)){case"start":y[l]-=_*(n&&d?-1:1);break;case"end":y[l]+=_*(n&&d?-1:1);break}return y}async function o7(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:l,elements:c,strategy:h}=e,{boundary:d="clippingAncestors",rootBoundary:g="viewport",elementContext:p="floating",altBoundary:_=!1,padding:y=0}=bo(t,e),w=X5(y),C=c[_?p==="floating"?"reference":"floating":p],k=dp(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(C)))==null||n?C:C.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:d,rootBoundary:g,strategy:h})),R=p==="floating"?{x:r,y:i,width:l.floating.width,height:l.floating.height}:l.reference,E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),N=await(o.isElement==null?void 0:o.isElement(E))?await(o.getScale==null?void 0:o.getScale(E))||{x:1,y:1}:{x:1,y:1},L=dp(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:R,offsetParent:E,strategy:h}):R);return{top:(k.top-L.top+w.top)/N.y,bottom:(L.bottom-k.bottom+w.bottom)/N.y,left:(k.left-L.left+w.left)/N.x,right:(L.right-k.right+w.right)/N.x}}const a7=50,l7=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:l}=n,c=l.detectOverflow?l:{...l,detectOverflow:o7},h=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:g,y:p}=U2(d,r,h),_=r,y=0;const w={};for(let S=0;S<o.length;S++){const C=o[S];if(!C)continue;const{name:k,fn:R}=C,{x:E,y:N,data:L,reset:j}=await R({x:g,y:p,initialPlacement:r,placement:_,strategy:i,middlewareData:w,rects:d,platform:c,elements:{reference:e,floating:t}});g=E??g,p=N??p,w[k]={...w[k],...L},j&&y<a7&&(y++,typeof j=="object"&&(j.placement&&(_=j.placement),j.rects&&(d=j.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:i}):j.rects),{x:g,y:p}=U2(d,_,h)),S=-1)}return{x:g,y:p,placement:_,strategy:i,middlewareData:w}},c7=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:l,elements:c,middlewareData:h}=t,{element:d,padding:g=0}=bo(e,t)||{};if(d==null)return{};const p=X5(g),_={x:n,y:r},y=A0(i),w=M0(y),S=await l.getDimensions(d),C=y==="y",k=C?"top":"left",R=C?"bottom":"right",E=C?"clientHeight":"clientWidth",N=o.reference[w]+o.reference[y]-_[y]-o.floating[w],L=_[y]-o.reference[y],j=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let O=j?j[E]:0;(!O||!await(l.isElement==null?void 0:l.isElement(j)))&&(O=c.floating[E]||o.floating[w]);const H=N/2-L/2,Z=O/2-S[w]/2-1,I=xa(p[k],Z),W=xa(p[R],Z),F=I,$=O-S[w]-W,V=O/2-S[w]/2+H,q=Ty(F,V,$),D=!h.arrow&&tu(i)!=null&&V!==q&&o.reference[w]/2-(V<F?I:W)-S[w]/2<0,U=D?V<F?V-F:V-$:0;return{[y]:_[y]+U,data:{[y]:q,centerOffset:V-q-U,...D&&{alignmentOffset:U}},reset:D}}}),u7=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:l,initialPlacement:c,platform:h,elements:d}=t,{mainAxis:g=!0,crossAxis:p=!0,fallbackPlacements:_,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...C}=bo(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const k=yo(i),R=Ns(c),E=yo(c)===c,N=await(h.isRTL==null?void 0:h.isRTL(d.floating)),L=_||(E||!S?[up(c)]:e7(c)),j=w!=="none";!_&&j&&L.push(...i7(c,S,w,N));const O=[c,...L],H=await h.detectOverflow(t,C),Z=[];let I=((r=o.flip)==null?void 0:r.overflows)||[];if(g&&Z.push(H[k]),p){const V=J9(i,l,N);Z.push(H[V[0]],H[V[1]])}if(I=[...I,{placement:i,overflows:Z}],!Z.every(V=>V<=0)){var W,F;const V=(((W=o.flip)==null?void 0:W.index)||0)+1,q=O[V];if(q&&(!(p==="alignment"?R!==Ns(q):!1)||I.every(z=>Ns(z.placement)===R?z.overflows[0]>0:!0)))return{data:{index:V,overflows:I},reset:{placement:q}};let D=(F=I.filter(U=>U.overflows[0]<=0).sort((U,z)=>U.overflows[1]-z.overflows[1])[0])==null?void 0:F.placement;if(!D)switch(y){case"bestFit":{var $;const U=($=I.filter(z=>{if(j){const G=Ns(z.placement);return G===R||G==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(G=>G>0).reduce((G,M)=>G+M,0)]).sort((z,G)=>z[1]-G[1])[0])==null?void 0:$[0];U&&(D=U);break}case"initialPlacement":D=c;break}if(i!==D)return{reset:{placement:D}}}return{}}}};function V2(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function W2(e){return Z9.some(t=>e[t]>=0)}const d7=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...o}=bo(e,t);switch(i){case"referenceHidden":{const l=await r.detectOverflow(t,{...o,elementContext:"reference"}),c=V2(l,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:W2(c)}}}case"escaped":{const l=await r.detectOverflow(t,{...o,altBoundary:!0}),c=V2(l,n.floating);return{data:{escapedOffsets:c,escaped:W2(c)}}}default:return{}}}}},Z5=new Set(["left","top"]);async function h7(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),l=yo(n),c=tu(n),h=Ns(n)==="y",d=Z5.has(l)?-1:1,g=o&&h?-1:1,p=bo(t,e);let{mainAxis:_,crossAxis:y,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof w=="number"&&(y=c==="end"?w*-1:w),h?{x:y*g,y:_*d}:{x:_*d,y:y*g}}const f7=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:l,middlewareData:c}=t,h=await h7(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+h.x,y:o+h.y,data:{...h,placement:l}}}}},m7=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:o}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:h={fn:k=>{let{x:R,y:E}=k;return{x:R,y:E}}},...d}=bo(e,t),g={x:n,y:r},p=await o.detectOverflow(t,d),_=Ns(yo(i)),y=N0(_);let w=g[y],S=g[_];if(l){const k=y==="y"?"top":"left",R=y==="y"?"bottom":"right",E=w+p[k],N=w-p[R];w=Ty(E,w,N)}if(c){const k=_==="y"?"top":"left",R=_==="y"?"bottom":"right",E=S+p[k],N=S-p[R];S=Ty(E,S,N)}const C=h.fn({...t,[y]:w,[_]:S});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[y]:l,[_]:c}}}}}},p7=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:l}=t,{offset:c=0,mainAxis:h=!0,crossAxis:d=!0}=bo(e,t),g={x:n,y:r},p=Ns(i),_=N0(p);let y=g[_],w=g[p];const S=bo(c,t),C=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const E=_==="y"?"height":"width",N=o.reference[_]-o.floating[E]+C.mainAxis,L=o.reference[_]+o.reference[E]-C.mainAxis;y<N?y=N:y>L&&(y=L)}if(d){var k,R;const E=_==="y"?"width":"height",N=Z5.has(yo(i)),L=o.reference[p]-o.floating[E]+(N&&((k=l.offset)==null?void 0:k[p])||0)+(N?0:C.crossAxis),j=o.reference[p]+o.reference[E]+(N?0:((R=l.offset)==null?void 0:R[p])||0)-(N?C.crossAxis:0);w<L?w=L:w>j&&(w=j)}return{[_]:y,[p]:w}}}},g7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:o,platform:l,elements:c}=t,{apply:h=()=>{},...d}=bo(e,t),g=await l.detectOverflow(t,d),p=yo(i),_=tu(i),y=Ns(i)==="y",{width:w,height:S}=o.floating;let C,k;p==="top"||p==="bottom"?(C=p,k=_===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(k=p,C=_==="end"?"top":"bottom");const R=S-g.top-g.bottom,E=w-g.left-g.right,N=xa(S-g[C],R),L=xa(w-g[k],E),j=!t.middlewareData.shift;let O=N,H=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(H=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(O=R),j&&!_){const I=xi(g.left,0),W=xi(g.right,0),F=xi(g.top,0),$=xi(g.bottom,0);y?H=w-2*(I!==0||W!==0?I+W:xi(g.left,g.right)):O=S-2*(F!==0||$!==0?F+$:xi(g.top,g.bottom))}await h({...t,availableWidth:H,availableHeight:O});const Z=await l.getDimensions(c.floating);return w!==Z.width||S!==Z.height?{reset:{rects:!0}}:{}}}};function ag(){return typeof window<"u"}function nu(e){return Q5(e)?(e.nodeName||"").toLowerCase():"#document"}function wi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Fs(e){var t;return(t=(Q5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Q5(e){return ag()?e instanceof Node||e instanceof wi(e).Node:!1}function cs(e){return ag()?e instanceof Element||e instanceof wi(e).Element:!1}function ko(e){return ag()?e instanceof HTMLElement||e instanceof wi(e).HTMLElement:!1}function q2(e){return!ag()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof wi(e).ShadowRoot}function yh(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=us(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function v7(e){return/^(table|td|th)$/.test(nu(e))}function lg(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const _7=/transform|translate|scale|rotate|perspective|filter/,b7=/paint|layout|strict|content/,Ya=e=>!!e&&e!=="none";let hb;function j0(e){const t=cs(e)?us(e):e;return Ya(t.transform)||Ya(t.translate)||Ya(t.scale)||Ya(t.rotate)||Ya(t.perspective)||!D0()&&(Ya(t.backdropFilter)||Ya(t.filter))||_7.test(t.willChange||"")||b7.test(t.contain||"")}function y7(e){let t=wa(e);for(;ko(t)&&!Fc(t);){if(j0(t))return t;if(lg(t))return null;t=wa(t)}return null}function D0(){return hb==null&&(hb=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),hb}function Fc(e){return/^(html|body|#document)$/.test(nu(e))}function us(e){return wi(e).getComputedStyle(e)}function cg(e){return cs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function wa(e){if(nu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||q2(e)&&e.host||Fs(e);return q2(t)?t.host:t}function J5(e){const t=wa(e);return Fc(t)?e.ownerDocument?e.ownerDocument.body:e.body:ko(t)&&yh(t)?t:J5(t)}function Xd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=J5(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),l=wi(i);if(o){const c=My(l);return t.concat(l,l.visualViewport||[],yh(i)?i:[],c&&n?Xd(c):[])}else return t.concat(i,Xd(i,[],n))}function My(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function eM(e){const t=us(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ko(e),o=i?e.offsetWidth:n,l=i?e.offsetHeight:r,c=cp(n)!==o||cp(r)!==l;return c&&(n=o,r=l),{width:n,height:r,$:c}}function O0(e){return cs(e)?e:e.contextElement}function Dc(e){const t=O0(e);if(!ko(t))return Ls(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=eM(t);let l=(o?cp(n.width):n.width)/r,c=(o?cp(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const x7=Ls(0);function tM(e){const t=wi(e);return!D0()||!t.visualViewport?x7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function w7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==wi(e)?!1:t}function pl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=O0(e);let l=Ls(1);t&&(r?cs(r)&&(l=Dc(r)):l=Dc(e));const c=w7(o,n,r)?tM(o):Ls(0);let h=(i.left+c.x)/l.x,d=(i.top+c.y)/l.y,g=i.width/l.x,p=i.height/l.y;if(o){const _=wi(o),y=r&&cs(r)?wi(r):r;let w=_,S=My(w);for(;S&&r&&y!==w;){const C=Dc(S),k=S.getBoundingClientRect(),R=us(S),E=k.left+(S.clientLeft+parseFloat(R.paddingLeft))*C.x,N=k.top+(S.clientTop+parseFloat(R.paddingTop))*C.y;h*=C.x,d*=C.y,g*=C.x,p*=C.y,h+=E,d+=N,w=wi(S),S=My(w)}}return dp({width:g,height:p,x:h,y:d})}function ug(e,t){const n=cg(e).scrollLeft;return t?t.left+n:pl(Fs(e)).left+n}function nM(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ug(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function S7(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",l=Fs(r),c=t?lg(t.floating):!1;if(r===l||c&&o)return n;let h={scrollLeft:0,scrollTop:0},d=Ls(1);const g=Ls(0),p=ko(r);if((p||!p&&!o)&&((nu(r)!=="body"||yh(l))&&(h=cg(r)),p)){const y=pl(r);d=Dc(r),g.x=y.x+r.clientLeft,g.y=y.y+r.clientTop}const _=l&&!p&&!o?nM(l,h):Ls(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-h.scrollLeft*d.x+g.x+_.x,y:n.y*d.y-h.scrollTop*d.y+g.y+_.y}}function C7(e){return Array.from(e.getClientRects())}function k7(e){const t=Fs(e),n=cg(e),r=e.ownerDocument.body,i=xi(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=xi(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ug(e);const c=-n.scrollTop;return us(r).direction==="rtl"&&(l+=xi(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:l,y:c}}const K2=25;function E7(e,t){const n=wi(e),r=Fs(e),i=n.visualViewport;let o=r.clientWidth,l=r.clientHeight,c=0,h=0;if(i){o=i.width,l=i.height;const g=D0();(!g||g&&t==="fixed")&&(c=i.offsetLeft,h=i.offsetTop)}const d=ug(r);if(d<=0){const g=r.ownerDocument,p=g.body,_=getComputedStyle(p),y=g.compatMode==="CSS1Compat"&&parseFloat(_.marginLeft)+parseFloat(_.marginRight)||0,w=Math.abs(r.clientWidth-p.clientWidth-y);w<=K2&&(o-=w)}else d<=K2&&(o+=d);return{width:o,height:l,x:c,y:h}}function R7(e,t){const n=pl(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=ko(e)?Dc(e):Ls(1),l=e.clientWidth*o.x,c=e.clientHeight*o.y,h=i*o.x,d=r*o.y;return{width:l,height:c,x:h,y:d}}function G2(e,t,n){let r;if(t==="viewport")r=E7(e,n);else if(t==="document")r=k7(Fs(e));else if(cs(t))r=R7(t,n);else{const i=tM(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return dp(r)}function rM(e,t){const n=wa(e);return n===t||!cs(n)||Fc(n)?!1:us(n).position==="fixed"||rM(n,t)}function T7(e,t){const n=t.get(e);if(n)return n;let r=Xd(e,[],!1).filter(c=>cs(c)&&nu(c)!=="body"),i=null;const o=us(e).position==="fixed";let l=o?wa(e):e;for(;cs(l)&&!Fc(l);){const c=us(l),h=j0(l);!h&&c.position==="fixed"&&(i=null),(o?!h&&!i:!h&&c.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||yh(l)&&!h&&rM(e,l))?r=r.filter(g=>g!==l):i=c,l=wa(l)}return t.set(e,r),r}function N7(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const l=[...n==="clippingAncestors"?lg(t)?[]:T7(t,this._c):[].concat(n),r],c=G2(t,l[0],i);let h=c.top,d=c.right,g=c.bottom,p=c.left;for(let _=1;_<l.length;_++){const y=G2(t,l[_],i);h=xi(y.top,h),d=xa(y.right,d),g=xa(y.bottom,g),p=xi(y.left,p)}return{width:d-p,height:g-h,x:p,y:h}}function M7(e){const{width:t,height:n}=eM(e);return{width:t,height:n}}function A7(e,t,n){const r=ko(t),i=Fs(t),o=n==="fixed",l=pl(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const h=Ls(0);function d(){h.x=ug(i)}if(r||!r&&!o)if((nu(t)!=="body"||yh(i))&&(c=cg(t)),r){const y=pl(t,!0,o,t);h.x=y.x+t.clientLeft,h.y=y.y+t.clientTop}else i&&d();o&&!r&&i&&d();const g=i&&!r&&!o?nM(i,c):Ls(0),p=l.left+c.scrollLeft-h.x-g.x,_=l.top+c.scrollTop-h.y-g.y;return{x:p,y:_,width:l.width,height:l.height}}function fb(e){return us(e).position==="static"}function Y2(e,t){if(!ko(e)||us(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Fs(e)===n&&(n=n.ownerDocument.body),n}function iM(e,t){const n=wi(e);if(lg(e))return n;if(!ko(e)){let i=wa(e);for(;i&&!Fc(i);){if(cs(i)&&!fb(i))return i;i=wa(i)}return n}let r=Y2(e,t);for(;r&&v7(r)&&fb(r);)r=Y2(r,t);return r&&Fc(r)&&fb(r)&&!j0(r)?n:r||y7(e)||n}const j7=async function(e){const t=this.getOffsetParent||iM,n=this.getDimensions,r=await n(e.floating);return{reference:A7(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function D7(e){return us(e).direction==="rtl"}const O7={convertOffsetParentRelativeRectToViewportRelativeRect:S7,getDocumentElement:Fs,getClippingRect:N7,getOffsetParent:iM,getElementRects:j7,getClientRects:C7,getDimensions:M7,getScale:Dc,isElement:cs,isRTL:D7};function sM(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function L7(e,t){let n=null,r;const i=Fs(e);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function l(c,h){c===void 0&&(c=!1),h===void 0&&(h=1),o();const d=e.getBoundingClientRect(),{left:g,top:p,width:_,height:y}=d;if(c||t(),!_||!y)return;const w=hm(p),S=hm(i.clientWidth-(g+_)),C=hm(i.clientHeight-(p+y)),k=hm(g),E={rootMargin:-w+"px "+-S+"px "+-C+"px "+-k+"px",threshold:xi(0,xa(1,h))||1};let N=!0;function L(j){const O=j[0].intersectionRatio;if(O!==h){if(!N)return l();O?l(!1,O):r=setTimeout(()=>{l(!1,1e-7)},1e3)}O===1&&!sM(d,e.getBoundingClientRect())&&l(),N=!1}try{n=new IntersectionObserver(L,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(L,E)}n.observe(e)}return l(!0),o}function z7(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,d=O0(e),g=i||o?[...d?Xd(d):[],...t?Xd(t):[]]:[];g.forEach(k=>{i&&k.addEventListener("scroll",n,{passive:!0}),o&&k.addEventListener("resize",n)});const p=d&&c?L7(d,n):null;let _=-1,y=null;l&&(y=new ResizeObserver(k=>{let[R]=k;R&&R.target===d&&y&&t&&(y.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var E;(E=y)==null||E.observe(t)})),n()}),d&&!h&&y.observe(d),t&&y.observe(t));let w,S=h?pl(e):null;h&&C();function C(){const k=pl(e);S&&!sM(S,k)&&n(),S=k,w=requestAnimationFrame(C)}return n(),()=>{var k;g.forEach(R=>{i&&R.removeEventListener("scroll",n),o&&R.removeEventListener("resize",n)}),p==null||p(),(k=y)==null||k.disconnect(),y=null,h&&cancelAnimationFrame(w)}}const P7=f7,I7=m7,B7=u7,F7=g7,H7=d7,X2=c7,$7=p7,U7=(e,t,n)=>{const r=new Map,i={platform:O7,...n},o={...i.platform,_c:r};return l7(e,t,{...i,platform:o})};var V7=typeof document<"u",W7=function(){},Um=V7?v.useLayoutEffect:W7;function hp(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 n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!hp(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!hp(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function oM(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Z2(e,t){const n=oM(e);return Math.round(t*n)/n}function mb(e){const t=v.useRef(e);return Um(()=>{t.current=e}),t}function q7(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:l}={},transform:c=!0,whileElementsMounted:h,open:d}=e,[g,p]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[_,y]=v.useState(r);hp(_,r)||y(r);const[w,S]=v.useState(null),[C,k]=v.useState(null),R=v.useCallback(z=>{z!==j.current&&(j.current=z,S(z))},[]),E=v.useCallback(z=>{z!==O.current&&(O.current=z,k(z))},[]),N=o||w,L=l||C,j=v.useRef(null),O=v.useRef(null),H=v.useRef(g),Z=h!=null,I=mb(h),W=mb(i),F=mb(d),$=v.useCallback(()=>{if(!j.current||!O.current)return;const z={placement:t,strategy:n,middleware:_};W.current&&(z.platform=W.current),U7(j.current,O.current,z).then(G=>{const M={...G,isPositioned:F.current!==!1};V.current&&!hp(H.current,M)&&(H.current=M,ss.flushSync(()=>{p(M)}))})},[_,t,n,W,F]);Um(()=>{d===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,p(z=>({...z,isPositioned:!1})))},[d]);const V=v.useRef(!1);Um(()=>(V.current=!0,()=>{V.current=!1}),[]),Um(()=>{if(N&&(j.current=N),L&&(O.current=L),N&&L){if(I.current)return I.current(N,L,$);$()}},[N,L,$,I,Z]);const q=v.useMemo(()=>({reference:j,floating:O,setReference:R,setFloating:E}),[R,E]),D=v.useMemo(()=>({reference:N,floating:L}),[N,L]),U=v.useMemo(()=>{const z={position:n,left:0,top:0};if(!D.floating)return z;const G=Z2(D.floating,g.x),M=Z2(D.floating,g.y);return c?{...z,transform:"translate("+G+"px, "+M+"px)",...oM(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:M}},[n,c,D.floating,g.x,g.y]);return v.useMemo(()=>({...g,update:$,refs:q,elements:D,floatingStyles:U}),[g,$,q,D,U])}const K7=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?X2({element:r.current,padding:i}).fn(n):{}:r?X2({element:r,padding:i}).fn(n):{}}}},G7=(e,t)=>{const n=P7(e);return{name:n.name,fn:n.fn,options:[e,t]}},Y7=(e,t)=>{const n=I7(e);return{name:n.name,fn:n.fn,options:[e,t]}},X7=(e,t)=>({fn:$7(e).fn,options:[e,t]}),Z7=(e,t)=>{const n=B7(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q7=(e,t)=>{const n=F7(e);return{name:n.name,fn:n.fn,options:[e,t]}},J7=(e,t)=>{const n=H7(e);return{name:n.name,fn:n.fn,options:[e,t]}},eF=(e,t)=>{const n=K7(e);return{name:n.name,fn:n.fn,options:[e,t]}};var tF="Arrow",aM=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...o}=e;return f.jsx(Ot.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});aM.displayName=tF;var nF=aM;function rF(e){const[t,n]=v.useState(void 0);return Pr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let l,c;if("borderBoxSize"in o){const h=o.borderBoxSize,d=Array.isArray(h)?h[0]:h;l=d.inlineSize,c=d.blockSize}else l=e.offsetWidth,c=e.offsetHeight;n({width:l,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var L0="Popper",[lM,Ea]=Co(L0),[iF,cM]=lM(L0),uM=e=>{const{__scopePopper:t,children:n}=e,[r,i]=v.useState(null);return f.jsx(iF,{scope:t,anchor:r,onAnchorChange:i,children:n})};uM.displayName=L0;var dM="PopperAnchor",hM=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=cM(dM,n),l=v.useRef(null),c=Zt(t,l),h=v.useRef(null);return v.useEffect(()=>{const d=h.current;h.current=(r==null?void 0:r.current)||l.current,d!==h.current&&o.onAnchorChange(h.current)}),r?null:f.jsx(Ot.div,{...i,ref:c})});hM.displayName=dM;var z0="PopperContent",[sF,oF]=lM(z0),fM=v.forwardRef((e,t)=>{var re,ue,fe,ge,Ce,Te;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:h=!0,collisionBoundary:d=[],collisionPadding:g=0,sticky:p="partial",hideWhenDetached:_=!1,updatePositionStrategy:y="optimized",onPlaced:w,...S}=e,C=cM(z0,n),[k,R]=v.useState(null),E=Zt(t,je=>R(je)),[N,L]=v.useState(null),j=rF(N),O=(j==null?void 0:j.width)??0,H=(j==null?void 0:j.height)??0,Z=r+(o!=="center"?"-"+o:""),I=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},W=Array.isArray(d)?d:[d],F=W.length>0,$={padding:I,boundary:W.filter(lF),altBoundary:F},{refs:V,floatingStyles:q,placement:D,isPositioned:U,middlewareData:z}=q7({strategy:"fixed",placement:Z,whileElementsMounted:(...je)=>z7(...je,{animationFrame:y==="always"}),elements:{reference:C.anchor},middleware:[G7({mainAxis:i+H,alignmentAxis:l}),h&&Y7({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?X7():void 0,...$}),h&&Z7({...$}),Q7({...$,apply:({elements:je,rects:Xe,availableWidth:xt,availableHeight:Et})=>{const{width:me,height:Fe}=Xe.reference,De=je.floating.style;De.setProperty("--radix-popper-available-width",`${xt}px`),De.setProperty("--radix-popper-available-height",`${Et}px`),De.setProperty("--radix-popper-anchor-width",`${me}px`),De.setProperty("--radix-popper-anchor-height",`${Fe}px`)}}),N&&eF({element:N,padding:c}),cF({arrowWidth:O,arrowHeight:H}),_&&J7({strategy:"referenceHidden",...$})]}),[G,M]=gM(D),B=ls(w);Pr(()=>{U&&(B==null||B())},[U,B]);const X=(re=z.arrow)==null?void 0:re.x,A=(ue=z.arrow)==null?void 0:ue.y,ie=((fe=z.arrow)==null?void 0:fe.centerOffset)!==0,[J,ee]=v.useState();return Pr(()=>{k&&ee(window.getComputedStyle(k).zIndex)},[k]),f.jsx("div",{ref:V.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:U?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[(ge=z.transformOrigin)==null?void 0:ge.x,(Ce=z.transformOrigin)==null?void 0:Ce.y].join(" "),...((Te=z.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(sF,{scope:n,placedSide:G,onArrowChange:L,arrowX:X,arrowY:A,shouldHideArrow:ie,children:f.jsx(Ot.div,{"data-side":G,"data-align":M,...S,ref:E,style:{...S.style,animation:U?void 0:"none"}})})})});fM.displayName=z0;var mM="PopperArrow",aF={top:"bottom",right:"left",bottom:"top",left:"right"},pM=v.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,o=oF(mM,r),l=aF[o.placedSide];return f.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]: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:f.jsx(nF,{...i,ref:n,style:{...i.style,display:"block"}})})});pM.displayName=mM;function lF(e){return e!==null}var cF=e=>({name:"transformOrigin",options:e,fn(t){var C,k,R;const{placement:n,rects:r,middlewareData:i}=t,l=((C=i.arrow)==null?void 0:C.centerOffset)!==0,c=l?0:e.arrowWidth,h=l?0:e.arrowHeight,[d,g]=gM(n),p={start:"0%",center:"50%",end:"100%"}[g],_=(((k=i.arrow)==null?void 0:k.x)??0)+c/2,y=(((R=i.arrow)==null?void 0:R.y)??0)+h/2;let w="",S="";return d==="bottom"?(w=l?p:`${_}px`,S=`${-h}px`):d==="top"?(w=l?p:`${_}px`,S=`${r.floating.height+h}px`):d==="right"?(w=`${-h}px`,S=l?p:`${y}px`):d==="left"&&(w=`${r.floating.width+h}px`,S=l?p:`${y}px`),{data:{x:w,y:S}}}});function gM(e){const[t,n="center"]=e.split("-");return[t,n]}var dg=uM,xh=hM,hg=fM,fg=pM,vM=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"}),uF="VisuallyHidden",_M=v.forwardRef((e,t)=>f.jsx(Ot.span,{...e,ref:t,style:{...vM,...e.style}}));_M.displayName=uF;var dF=_M,[mg,roe]=Co("Tooltip",[Ea]),pg=Ea(),bM="TooltipProvider",hF=700,Ay="tooltip.open",[fF,P0]=mg(bM),yM=e=>{const{__scopeTooltip:t,delayDuration:n=hF,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=e,l=v.useRef(!0),c=v.useRef(!1),h=v.useRef(0);return v.useEffect(()=>{const d=h.current;return()=>window.clearTimeout(d)},[]),f.jsx(fF,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(h.current),l.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(d=>{c.current=d},[]),disableHoverableContent:i,children:o})};yM.displayName=bM;var Zd="Tooltip",[mF,wh]=mg(Zd),xM=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:o,disableHoverableContent:l,delayDuration:c}=e,h=P0(Zd,e.__scopeTooltip),d=pg(t),[g,p]=v.useState(null),_=go(),y=v.useRef(0),w=l??h.disableHoverableContent,S=c??h.delayDuration,C=v.useRef(!1),[k,R]=Ic({prop:r,defaultProp:i??!1,onChange:O=>{O?(h.onOpen(),document.dispatchEvent(new CustomEvent(Ay))):h.onClose(),o==null||o(O)},caller:Zd}),E=v.useMemo(()=>k?C.current?"delayed-open":"instant-open":"closed",[k]),N=v.useCallback(()=>{window.clearTimeout(y.current),y.current=0,C.current=!1,R(!0)},[R]),L=v.useCallback(()=>{window.clearTimeout(y.current),y.current=0,R(!1)},[R]),j=v.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{C.current=!0,R(!0),y.current=0},S)},[S,R]);return v.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),f.jsx(dg,{...d,children:f.jsx(mF,{scope:t,contentId:_,open:k,stateAttribute:E,trigger:g,onTriggerChange:p,onTriggerEnter:v.useCallback(()=>{h.isOpenDelayedRef.current?j():N()},[h.isOpenDelayedRef,j,N]),onTriggerLeave:v.useCallback(()=>{w?L():(window.clearTimeout(y.current),y.current=0)},[L,w]),onOpen:N,onClose:L,disableHoverableContent:w,children:n})})};xM.displayName=Zd;var jy="TooltipTrigger",wM=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=wh(jy,n),o=P0(jy,n),l=pg(n),c=v.useRef(null),h=Zt(t,c,i.onTriggerChange),d=v.useRef(!1),g=v.useRef(!1),p=v.useCallback(()=>d.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),f.jsx(xh,{asChild:!0,...l,children:f.jsx(Ot.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:h,onPointerMove:Be(e.onPointerMove,_=>{_.pointerType!=="touch"&&!g.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),g.current=!0)}),onPointerLeave:Be(e.onPointerLeave,()=>{i.onTriggerLeave(),g.current=!1}),onPointerDown:Be(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Be(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Be(e.onBlur,i.onClose),onClick:Be(e.onClick,i.onClose)})})});wM.displayName=jy;var I0="TooltipPortal",[pF,gF]=mg(I0,{forceMount:void 0}),SM=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,o=wh(I0,t);return f.jsx(pF,{scope:t,forceMount:n,children:f.jsx(Xi,{present:n||o.open,children:f.jsx(eu,{asChild:!0,container:i,children:r})})})};SM.displayName=I0;var Hc="TooltipContent",CM=v.forwardRef((e,t)=>{const n=gF(Hc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=e,l=wh(Hc,e.__scopeTooltip);return f.jsx(Xi,{present:r||l.open,children:l.disableHoverableContent?f.jsx(kM,{side:i,...o,ref:t}):f.jsx(vF,{side:i,...o,ref:t})})}),vF=v.forwardRef((e,t)=>{const n=wh(Hc,e.__scopeTooltip),r=P0(Hc,e.__scopeTooltip),i=v.useRef(null),o=Zt(t,i),[l,c]=v.useState(null),{trigger:h,onClose:d}=n,g=i.current,{onPointerInTransitChange:p}=r,_=v.useCallback(()=>{c(null),p(!1)},[p]),y=v.useCallback((w,S)=>{const C=w.currentTarget,k={x:w.clientX,y:w.clientY},R=wF(k,C.getBoundingClientRect()),E=SF(k,R),N=CF(S.getBoundingClientRect()),L=EF([...E,...N]);c(L),p(!0)},[p]);return v.useEffect(()=>()=>_(),[_]),v.useEffect(()=>{if(h&&g){const w=C=>y(C,g),S=C=>y(C,h);return h.addEventListener("pointerleave",w),g.addEventListener("pointerleave",S),()=>{h.removeEventListener("pointerleave",w),g.removeEventListener("pointerleave",S)}}},[h,g,y,_]),v.useEffect(()=>{if(l){const w=S=>{const C=S.target,k={x:S.clientX,y:S.clientY},R=(h==null?void 0:h.contains(C))||(g==null?void 0:g.contains(C)),E=!kF(k,l);R?_():E&&(_(),d())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[h,g,l,d,_]),f.jsx(kM,{...e,ref:o})}),[_F,bF]=mg(Zd,{isInside:!1}),yF=s6("TooltipContent"),kM=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:l,...c}=e,h=wh(Hc,n),d=pg(n),{onClose:g}=h;return v.useEffect(()=>(document.addEventListener(Ay,g),()=>document.removeEventListener(Ay,g)),[g]),v.useEffect(()=>{if(h.trigger){const p=_=>{const y=_.target;y!=null&&y.contains(h.trigger)&&g()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[h.trigger,g]),f.jsx(Jc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:g,children:f.jsxs(hg,{"data-state":h.stateAttribute,...d,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[f.jsx(yF,{children:r}),f.jsx(_F,{scope:n,isInside:!0,children:f.jsx(dF,{id:h.contentId,role:"tooltip",children:i||r})})]})})});CM.displayName=Hc;var EM="TooltipArrow",xF=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=pg(n);return bF(EM,n).isInside?null:f.jsx(fg,{...i,...r,ref:t})});xF.displayName=EM;function wF(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function SF(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function CF(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function kF(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,l=t.length-1;o<t.length;l=o++){const c=t[o],h=t[l],d=c.x,g=c.y,p=h.x,_=h.y;g>r!=_>r&&n<(p-d)*(r-g)/(_-g)+d&&(i=!i)}return i}function EF(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),RF(t)}function RF(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const o=t[t.length-1],l=t[t.length-2];if((o.x-l.x)*(i.y-l.y)>=(o.y-l.y)*(i.x-l.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(i.y-l.y)>=(o.y-l.y)*(i.x-l.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var TF=yM,RM=xM,TM=wM,NM=SM,B0=CM;function NF({className:e,...t}){return f.jsx("kbd",{className:pe("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",e),...t})}function MF({className:e,...t}){return f.jsx("span",{className:pe("inline-flex items-center gap-0.5",e),...t})}const AF="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 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",jF=TF,Ms=RM,As=TM,os=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>f.jsx(NM,{children:f.jsx(B0,{ref:r,sideOffset:t,className:pe("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border backdrop-blur-md px-3 py-1.5 text-xs animate-in fade-in-0 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),...n})}));os.displayName=B0.displayName;const yd=RM,xd=TM;function MM(e){return e.toUpperCase()}function DF(e){const t=e.split("+");return f.jsx(MF,{children:t.map((n,r)=>f.jsx(NF,{children:MM(n)},`${n}-${r}`))})}const Rc=v.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...i},o)=>{const l=r===void 0?null:Array.isArray(r)?r[0]??null:r;return f.jsx(NM,{children:f.jsx(B0,{ref:o,sideOffset:t,className:pe(AF,e),...i,children:l?DF(l):f.jsx("span",{children:typeof n=="string"?MM(n):n})})})});Rc.displayName="HotkeyTooltipContent";const OF="0.6.0",LF={version:OF},Dn="Kaizen",Q2="kaizen",zF=".kaizen",PF=".kaizen-dev",pb=".kaizen",IF="KAIZEN_RUNTIME_PROFILE",F0=`kaizen/${LF.version}`,BF="[kaizen]",FF=`~/${Dn}`,gg="kaizen:";function ru(){var t;return(t=globalThis.process)==null?void 0:t.env}function HF(e=ru()){const t=e==null?void 0:e[IF];return(t==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function $F(e=ru()){return HF(e)==="dev"?PF:zF}function AM(e=ru()){return`~/${$F(e)}`}function UF(e=ru()){return`${AM(e)}/keybindings.json`}function VF(e=ru()){return`${AM(e)}/themes`}function WF(e=ru()){return`${VF(e)}/THEME_README.md`}function fm(e){return e?`${Q2} ${e}`:Q2}const fp=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],Dy=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"XHigh"}],Oy=[{id:"off",label:"Off"},{id:"standard",label:"Standard"},{id:"high",label:"High"}],Ly="claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",jM=[{id:"composer-2[fast=true]",label:"Composer 2",supportsEffort:!1},{id:"composer-1.5[]",label:"Composer 1.5",supportsEffort:!1},{id:"gpt-5.3-codex[reasoning=medium,fast=false]",label:"Codex 5.3",supportsEffort:!1},{id:"gpt-5.4[reasoning=medium,context=272k,fast=false]",label:"GPT-5.4",supportsEffort:!1},{id:"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]",label:"Sonnet 4.6",supportsEffort:!1},{id:"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",label:"Opus 4.6",supportsEffort:!1},{id:"claude-opus-4-5[thinking=true]",label:"Opus 4.5",supportsEffort:!1},{id:"gpt-5.2[reasoning=medium,fast=false]",label:"GPT-5.2",supportsEffort:!1},{id:"gemini-3.1-pro[]",label:"Gemini 3.1 Pro",supportsEffort:!1},{id:"gpt-5.4-mini[reasoning=medium]",label:"GPT-5.4 Mini",supportsEffort:!1},{id:"gpt-5.4-nano[reasoning=medium]",label:"GPT-5.4 Nano",supportsEffort:!1},{id:"claude-haiku-4-5[thinking=true]",label:"Haiku 4.5",supportsEffort:!1},{id:"gpt-5.3-codex-spark[reasoning=medium]",label:"Codex 5.3 Spark",supportsEffort:!1},{id:"grok-4-20[thinking=true]",label:"Grok 4.20",supportsEffort:!1},{id:"claude-sonnet-4-5[thinking=true,context=200k]",label:"Sonnet 4.5",supportsEffort:!1},{id:"gpt-5.2-codex[reasoning=medium,fast=false]",label:"Codex 5.2",supportsEffort:!1},{id:"gemini-3-flash[]",label:"Gemini 3 Flash",supportsEffort:!1},{id:"claude-sonnet-4[thinking=false,context=200k]",label:"Sonnet 4",supportsEffort:!1},{id:"kimi-k2.5[]",label:"Kimi K2.5",supportsEffort:!1}],qF={"composer-2-fast":"composer-2[fast=true]","composer-1.5":"composer-1.5[]","gpt-5.3-codex":"gpt-5.3-codex[reasoning=medium,fast=false]","gpt-5.4":"gpt-5.4[reasoning=medium,context=272k,fast=false]","gpt-5.4-medium":"gpt-5.4[reasoning=medium,context=272k,fast=false]","claude-4.6-sonnet-medium-thinking":"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]","claude-4.6-opus-high-thinking":"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]","claude-4.5-opus-high-thinking":"claude-opus-4-5[thinking=true]","gpt-5.2":"gpt-5.2[reasoning=medium,fast=false]","gemini-3.1-pro":"gemini-3.1-pro[]","gpt-5.4-mini":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-mini-medium":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-nano":"gpt-5.4-nano[reasoning=medium]","gpt-5.4-nano-medium":"gpt-5.4-nano[reasoning=medium]","claude-haiku-4.5":"claude-haiku-4-5[thinking=true]","gpt-5.3-codex-spark-preview":"gpt-5.3-codex-spark[reasoning=medium]","grok-4-20":"grok-4-20[thinking=true]","grok-4-20-thinking":"grok-4-20[thinking=true]","claude-4.5-sonnet-thinking":"claude-sonnet-4-5[thinking=true,context=200k]","gpt-5.2-codex":"gpt-5.2-codex[reasoning=medium,fast=false]","gemini-3-flash":"gemini-3-flash[]","claude-4-sonnet":"claude-sonnet-4[thinking=false,context=200k]","kimi-k2.5":"kimi-k2.5[]"};function KF(e){return e?jM.some(t=>t.id===e)?e:qF[e]??Ly:Ly}function J2(e){const t=e.indexOf("[");return t>=0?e.slice(0,t):e}function Sc(e){const t=e.match(/\bfast=(true|false)\b/);return t?t[1]==="true"?"fast":"standard":null}function eE(e){return fp.some(t=>t.id===e)}function tE(e){return Dy.some(t=>t.id===e)}const zy=[{id:"200k",label:"200k"},{id:"1m",label:"1M"}];function GF(e){return Oy.some(t=>t.id===e)}const pa=[{id:"claude",label:"Claude",systemActive:!0,defaultModel:"sonnet",defaultEffort:"high",defaultModelOptions:{reasoningEffort:"high",contextWindow:"200k"},supportsPlanMode:!0,models:[{id:"opus",label:"Opus",supportsEffort:!0,contextWindowOptions:[...zy]},{id:"sonnet",label:"Sonnet",supportsEffort:!0,contextWindowOptions:[...zy]},{id:"haiku",label:"Haiku",supportsEffort:!0}],efforts:[...fp]},{id:"codex",label:"Codex",systemActive:!0,defaultModel:"gpt-5.4",defaultModelOptions:{reasoningEffort:"high",fastMode:!1},supportsPlanMode:!0,models:[{id:"gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",supportsEffort:!1},{id:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark",supportsEffort:!1}],efforts:[]},{id:"gemini",label:"Gemini",systemActive:!1,defaultModel:"auto-gemini-2.5",defaultModelOptions:{thinkingMode:"standard"},supportsPlanMode:!0,models:[{id:"auto-gemini-3",label:"Auto (Gemini 3)",supportsEffort:!1},{id:"auto-gemini-2.5",label:"Auto (Gemini 2.5)",supportsEffort:!1},{id:"gemini-3.1-pro-preview",label:"3.1 Pro Preview",supportsEffort:!1},{id:"gemini-3-pro-preview",label:"3 Pro Preview",supportsEffort:!1},{id:"gemini-3-flash-preview",label:"3 Flash Preview",supportsEffort:!1},{id:"gemini-2.5-pro",label:"2.5 Pro",supportsEffort:!1},{id:"gemini-2.5-flash",label:"2.5 Flash",supportsEffort:!1},{id:"gemini-2.5-flash-lite",label:"2.5 Flash Lite",supportsEffort:!1}],efforts:[]},{id:"cursor",label:"Cursor",systemActive:!0,defaultModel:Ly,defaultModelOptions:{},supportsPlanMode:!0,models:[...jM],efforts:[]}],sr={claude:{active:!0},codex:{active:!0},gemini:{active:!0},cursor:{active:!0}};function un(e){const t=pa.find(n=>n.id===e);if(!t)throw new Error(`Unknown provider: ${e}`);return t}function H0(e,t){const n=sr[t],r=e==null?void 0:e[t];return{active:(r==null?void 0:r.active)??n.active}}function YF(e,t){const n=un(e),r=H0(t,e);return n.systemActive&&r.active?null:`Provider ${n.label} is currently not active.`}function nE(e,t){const n=un(e),r=H0(t,e);return n.systemActive&&r.active}function XF(e){return pa.map(t=>{const n=H0(e,t.id),r=t.systemActive&&n.active;return{...t,active:n.active,isSelectable:r,isUsageEnabled:r,isInactive:!r,inactiveMessage:YF(t.id,e)}})}function $0(e){return XF(e).filter(t=>t.isSelectable).map(({active:t,isSelectable:n,isUsageEnabled:r,isInactive:i,inactiveMessage:o,...l})=>l)}function Vi(e){return un(e).defaultModelOptions}const DM=Vi("claude");Vi("codex");Vi("gemini");Vi("cursor");function ZF(e){return un("claude").models.find(t=>t.id===e)}function QF(e){var t;return((t=ZF(e))==null?void 0:t.contextWindowOptions)??[]}function JF(e,t){const n=QF(e);if(n.length!==0)return n.some(r=>r.id===t)?t:DM.contextWindow}const eH=["idea","todo","progress","testing","done"],rE={idea:"IDEA",todo:"TODO",progress:"PROGRESS",testing:"TESTING",done:"DONE"},ks={submitChatMessage:["enter"],toggleProjectsSidebar:["ctrl+a"],toggleEmbeddedTerminal:["cmd+j","ctrl+`"],toggleRightSidebar:["cmd+b","ctrl+b"],openInFinder:["cmd+alt+f","ctrl+alt+f"],openInEditor:["cmd+shift+o","ctrl+shift+o"],addSplitTerminal:["cmd+/","ctrl+/"]},mp=8,OM=10*1024*1024,pp=["image/png","image/jpeg","image/webp","image/gif"],tH="/assets/icon-4rSnra9R.svg";function Ld({alt:e="",className:t,...n}){return f.jsx("img",{alt:e,src:tH,className:pe("shrink-0 object-contain",t),...n})}var vg="Popover",[LM,ioe]=Co(vg,[Ea]),Sh=Ea(),[nH,Ra]=LM(vg),zM=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:l=!1}=e,c=Sh(t),h=v.useRef(null),[d,g]=v.useState(!1),[p,_]=Ic({prop:r,defaultProp:i??!1,onChange:o,caller:vg});return f.jsx(dg,{...c,children:f.jsx(nH,{scope:t,contentId:go(),triggerRef:h,open:p,onOpenChange:_,onOpenToggle:v.useCallback(()=>_(y=>!y),[_]),hasCustomAnchor:d,onCustomAnchorAdd:v.useCallback(()=>g(!0),[]),onCustomAnchorRemove:v.useCallback(()=>g(!1),[]),modal:l,children:n})})};zM.displayName=vg;var PM="PopoverAnchor",IM=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ra(PM,n),o=Sh(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=i;return v.useEffect(()=>(l(),()=>c()),[l,c]),f.jsx(xh,{...o,...r,ref:t})});IM.displayName=PM;var BM="PopoverTrigger",FM=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ra(BM,n),o=Sh(n),l=Zt(t,i.triggerRef),c=f.jsx(Ot.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":WM(i.open),...r,ref:l,onClick:Be(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:f.jsx(xh,{asChild:!0,...o,children:c})});FM.displayName=BM;var U0="PopoverPortal",[rH,iH]=LM(U0,{forceMount:void 0}),HM=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,o=Ra(U0,t);return f.jsx(rH,{scope:t,forceMount:n,children:f.jsx(Xi,{present:n||o.open,children:f.jsx(eu,{asChild:!0,container:i,children:r})})})};HM.displayName=U0;var $c="PopoverContent",$M=v.forwardRef((e,t)=>{const n=iH($c,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,o=Ra($c,e.__scopePopover);return f.jsx(Xi,{present:r||o.open,children:o.modal?f.jsx(oH,{...i,ref:t}):f.jsx(aH,{...i,ref:t})})});$M.displayName=$c;var sH=fl("PopoverContent.RemoveScroll"),oH=v.forwardRef((e,t)=>{const n=Ra($c,e.__scopePopover),r=v.useRef(null),i=Zt(t,r),o=v.useRef(!1);return v.useEffect(()=>{const l=r.current;if(l)return eg(l)},[]),f.jsx(vh,{as:sH,allowPinchZoom:!0,children:f.jsx(UM,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Be(e.onCloseAutoFocus,l=>{var c;l.preventDefault(),o.current||(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,h=c.button===0&&c.ctrlKey===!0,d=c.button===2||h;o.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Be(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),aH=v.forwardRef((e,t)=>{const n=Ra($c,e.__scopePopover),r=v.useRef(!1),i=v.useRef(!1);return f.jsx(UM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((d=n.triggerRef.current)==null?void 0:d.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),UM=v.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:g,...p}=e,_=Ra($c,n),y=Sh(n);return Qp(),f.jsx(gh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:f.jsx(Jc,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:g,onEscapeKeyDown:c,onPointerDownOutside:h,onFocusOutside:d,onDismiss:()=>_.onOpenChange(!1),children:f.jsx(hg,{"data-state":WM(_.open),role:"dialog",id:_.contentId,...y,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),VM="PopoverClose",lH=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ra(VM,n);return f.jsx(Ot.button,{type:"button",...r,ref:t,onClick:Be(e.onClick,()=>i.onOpenChange(!1))})});lH.displayName=VM;var cH="PopoverArrow",uH=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Sh(n);return f.jsx(fg,{...i,...r,ref:t})});uH.displayName=cH;function WM(e){return e?"open":"closed"}var qM=zM,dH=IM,hH=FM,KM=HM,V0=$M;const GM=qM,YM=hH,W0=v.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>f.jsx(KM,{children:f.jsx(V0,{ref:i,align:t,sideOffset:n,[Yd]:"",onCloseAutoFocus:o=>{var l;o.preventDefault(),window.dispatchEvent(new Event(ap)),(l=r.onCloseAutoFocus)==null||l.call(r,o)},className:pe("z-50 w-72 rounded-xl border border-border bg-background p-4 shadow-lg backdrop-blur-md outline-hidden animate-in fade-in-0 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),...r})}));W0.displayName=V0.displayName;function fH({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})})}function mH({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 158.7128 157.296",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M60.8734 57.2556V42.3124c0-1.2586.4722-2.2029 1.5728-2.8314l30.0443-17.3023c4.0899-2.3593 8.9662-3.4599 13.9988-3.4599 18.8759 0 30.8307 14.6289 30.8307 30.2006 0 1.1007 0 2.3593-.158 3.6178l-31.1446-18.2467c-1.8872-1.1006-3.7754-1.1006-5.6629 0L60.8734 57.2556Zm70.1542 58.2005V79.7487c0-2.2028-.9446-3.7756-2.8318-4.8763l-39.481-22.9651 12.8982-7.3934c1.1007-.6285 2.0453-.6285 3.1458 0l30.0441 17.3024c8.6523 5.0341 14.4708 15.7296 14.4708 26.1107 0 11.9539-7.0769 22.965-18.2461 27.527ZM51.593 83.9964l-12.8982-7.5497c-1.1007-.6285-1.5728-1.5728-1.5728-2.8314V39.0105c0-16.8303 12.8982-29.5722 30.3585-29.5722 6.607 0 12.7403 2.2029 17.9324 6.1349l-30.987 17.9324c-1.8871 1.1007-2.8314 2.6735-2.8314 4.8764v45.6159ZM79.3562 100.0403 60.8733 89.6592V67.6383l18.4829-10.3811 18.4812 10.3811v22.0209l-18.4812 10.3811Zm11.8757 47.8188c-6.607 0-12.7403-2.2031-17.9324-6.1344l30.9866-17.9333c1.8872-1.1005 2.8318-2.6728 2.8318-4.8759v-45.616l13.0564 7.5498c1.1005.6285 1.5723 1.5728 1.5723 2.8314v34.6051c0 16.8297-13.0564 29.5723-30.5147 29.5723ZM53.9522 112.7822 23.9079 95.4798c-8.652-5.0343-14.471-15.7296-14.471-26.1107 0-12.1119 7.2356-22.9652 18.403-27.5272v35.8634c0 2.2028.9443 3.7756 2.8314 4.8763l39.3248 22.8068-12.8982 7.3938c-1.1007.6287-2.045.6287-3.1456 0ZM52.2229 138.5791c-17.7745 0-30.8306-13.3713-30.8306-29.8871 0-1.2585.1578-2.5169.3143-3.7754l30.987 17.9323c1.8871 1.1005 3.7757 1.1005 5.6628 0l39.4811-22.807v14.9435c0 1.2585-.4721 2.2021-1.5728 2.8308l-30.0443 17.3025c-4.0898 2.359-8.9662 3.4605-13.9989 3.4605h.0014ZM91.2319 157.296c19.0327 0 34.9188-13.5272 38.5383-31.4594 17.6164-4.562 28.9425-21.0779 28.9425-37.908 0-11.0112-4.719-21.7066-13.2133-29.4143.7867-3.3035 1.2595-6.607 1.2595-9.909 0-22.4929-18.2471-39.3247-39.3251-39.3247-4.2461 0-8.3363.6285-12.4262 2.045-7.0792-6.9213-16.8318-11.3254-27.5271-11.3254-19.0331 0-34.9191 13.5268-38.5384 31.4591C11.3255 36.0212 0 52.5373 0 69.3675c0 11.0112 4.7184 21.7065 13.2125 29.4142-.7865 3.3035-1.2586 6.6067-1.2586 9.9092 0 22.4923 18.2466 39.3241 39.3248 39.3241 4.2462 0 8.3362-.6277 12.426-2.0441 7.0776 6.921 16.8302 11.3251 27.5271 11.3251Z"})})}function pH({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M12 0C12 0 12 8 8 12C4 16 0 12 0 12C0 12 4 12 8 12C12 12 12 16 12 24C12 24 12 16 16 12C20 8 24 12 24 12C24 12 16 12 16 12C12 12 12 4 12 0Z"})})}function gH({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M12 0 2.4 5.5v13L12 24l9.6-5.5v-13Zm0 3.1 6.8 3.9v5.1L15 14.3V9.7L12 8l-3 1.7v4.6l-3.8-2.2V7Zm-6.8 9.8 3.8 2.2v4.5l3 1.8 3-1.8v-4.5l3.8-2.2v3.8L12 20.9l-6.8-3.9Z"})})}function vH(e){return!(e.startsWith("gemini-3")||e==="auto-gemini-3")}const _H=["Composer","GPT","Claude","Gemini","Grok","Kimi"];function bH(e){return e.startsWith("composer-")?"Composer":e.startsWith("gpt-")?"GPT":e.startsWith("claude-")?"Claude":e.startsWith("gemini-")?"Gemini":e.startsWith("grok-")?"Grok":"Kimi"}function gb(e,t){const n=Sc(t);return!n||n==="standard"?e:`${e} (${n==="fast"?"Fast":"Standard"})`}const gp={claude:fH,codex:mH,gemini:pH,cursor:gH},mm={auto:$n,opus:_i,sonnet:$n,haiku:Rs,"gpt-5.4":_i,"gpt-5.4[reasoning=medium,context=272k,fast=false]":_i,"gpt-5.4-mini[reasoning=medium]":$n,"gpt-5.4-nano[reasoning=medium]":Rs,"gpt-5.3-codex":$n,"gpt-5.3-codex[reasoning=medium,fast=false]":$n,"gpt-5.3-codex-spark[reasoning=medium]":Rs,"gpt-5.2[reasoning=medium,fast=false]":$n,"gpt-5.2-codex[reasoning=medium,fast=false]":$n,"gpt-5.3-codex-spark":Rs,"gemini-2.5-pro":_i,"gemini-2.5-flash":$n,"gemini-2.5-flash-lite":Rs,"auto-gemini-3":_i,"auto-gemini-2.5":$n,"gemini-3.1-pro-preview":_i,"gemini-3.1-pro[]":_i,"gemini-3-flash[]":$n,"gemini-3-pro-preview":_i,"gemini-3-flash-preview":$n,"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]":_i,"claude-opus-4-5[thinking=true]":_i,"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]":$n,"claude-sonnet-4-5[thinking=true,context=200k]":$n,"claude-sonnet-4[thinking=false,context=200k]":$n,"claude-haiku-4-5[thinking=true]":Rs,"grok-4-20[thinking=true]":_i,"kimi-k2.5[]":$n,"composer-2[fast=true]":_i,"composer-1.5[]":$n};function ti({onClick:e,selected:t,icon:n,label:r,description:i,disabled:o}){return f.jsxs("button",{onClick:e,disabled:o,className:pe("w-full flex items-center gap-2 p-2 border border-border/0 rounded-lg text-left transition-opacity",t?"bg-muted border-border":"hover:opacity-60",o&&"opacity-40 cursor-not-allowed"),children:[n,f.jsxs("div",{children:[f.jsx("div",{className:"text-sm font-medium",children:r}),i?f.jsx("div",{className:"text-xs text-muted-foreground",children:i}):null]})]})}function ia({trigger:e,triggerClassName:t,disabled:n=!1,children:r}){const[i,o]=v.useState(!1);return n?f.jsx("button",{disabled:!0,className:pe("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md text-muted-foreground [&>svg]:shrink-0 opacity-70 cursor-default",t),children:e}):f.jsxs(GM,{open:i,onOpenChange:o,children:[f.jsx(YM,{asChild:!0,children:f.jsx("button",{className:pe("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md transition-colors text-muted-foreground [&>svg]:shrink-0","hover:bg-muted/50",t),children:e})}),f.jsx(W0,{align:"center",className:"w-64 p-1",children:f.jsx("div",{className:"max-h-[min(24rem,60vh)] space-y-1 overflow-y-auto pr-1",children:typeof r=="function"?r(()=>o(!1)):r})})]})}function wd({availableProviders:e,selectedProvider:t,disabled:n=!1,showProviderPicker:r=!0,providerLocked:i=!1,model:o,modelOptions:l,onProviderChange:c,onModelChange:h,onClaudeReasoningEffortChange:d,onClaudeContextWindowChange:g,onCodexReasoningEffortChange:p,onGeminiThinkingModeChange:_,onCodexFastModeChange:y,planMode:w=!1,onPlanModeChange:S,includePlanMode:C=!0,className:k}){var G,M,B,X,A,ie,J;const[R,E]=v.useState(null),N=e.find(ee=>ee.id===t)??un(t),L=gp[t],j=mm[o]??$n,O=C&&(N==null?void 0:N.supportsPlanMode)&&S,H=t==="claude"?l:null,Z=t==="codex"?l:null,I=t==="gemini"?l:null,W=((G=N.models.find(ee=>ee.id===o))==null?void 0:G.contextWindowOptions)??[],F=(H==null?void 0:H.contextWindow)??zy[0].id,$=F==="1m"?z2:P2,V=t==="claude"||t==="codex",q=t==="cursor"?Sc(o):null,D=N.id==="cursor"?N.models.filter(ee=>J2(ee.id)===J2(o)):[],U=t==="cursor"&&D.some(ee=>Sc(ee.id)==="fast")&&D.some(ee=>Sc(ee.id)==="standard"),z=N.id==="cursor"?_H.map(ee=>({family:ee,models:N.models.filter(re=>bH(re.id)===ee)})).filter(ee=>ee.models.length>0):[];return v.useEffect(()=>{E(null)},[t]),f.jsx("div",{className:pe("max-w-full overflow-x-auto scrollbar-hide",n&&"pointer-events-none opacity-60",k),children:f.jsxs("div",{className:"flex w-max items-center justify-center gap-0.5 mx-auto",children:[r?f.jsx(ia,{disabled:i||!c,trigger:f.jsxs(f.Fragment,{children:[f.jsx(L,{className:"h-3.5 w-3.5"}),f.jsx("span",{className:"hidden md:inline",children:(N==null?void 0:N.label)??t})]}),children:ee=>e.map(re=>{const ue=gp[re.id];return f.jsx(ti,{onClick:()=>{c==null||c(re.id),ee()},selected:t===re.id,icon:f.jsx(ue,{className:"h-4 w-4 text-muted-foreground"}),label:re.label},re.id)})}):null,f.jsx(ia,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(j,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:N.id==="cursor"?gb(((M=N.models.find(ee=>ee.id===o))==null?void 0:M.label)??o,o):((B=N.models.find(ee=>ee.id===o))==null?void 0:B.label)??o})]}),children:ee=>{var re;return N.id==="cursor"?R?f.jsxs(f.Fragment,{children:[f.jsxs("button",{onClick:()=>E(null),className:"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm text-muted-foreground transition-opacity hover:opacity-70",children:[f.jsx(P5,{className:"h-4 w-4"}),f.jsx("span",{children:R})]}),(re=z.find(ue=>ue.family===R))==null?void 0:re.models.map(ue=>{const fe=mm[ue.id]??$n;return f.jsx(ti,{onClick:()=>{h(t,ue.id),E(null),ee()},selected:o===ue.id,icon:f.jsx(fe,{className:"h-4 w-4 text-muted-foreground"}),label:gb(ue.label,ue.id)},ue.id)})]}):z.map(ue=>{var Ce;const fe=ue.models.some(Te=>Te.id===o),ge=mm[((Ce=ue.models[0])==null?void 0:Ce.id)??""]??$n;return f.jsxs("div",{className:"relative",children:[f.jsx(ti,{onClick:()=>E(ue.family),selected:fe,icon:f.jsx(ge,{className:"h-4 w-4 text-muted-foreground"}),label:ue.family,description:`${ue.models.length} model${ue.models.length===1?"":"s"}`}),f.jsx(Vr,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"})]},ue.family)}):N.models.map(ue=>{const fe=mm[ue.id]??$n;return f.jsx(ti,{onClick:()=>{h(t,ue.id),ee()},selected:o===ue.id,icon:f.jsx(fe,{className:"h-4 w-4 text-muted-foreground"}),label:N.id==="cursor"?gb(ue.label,ue.id):ue.label},ue.id)})}}),U?f.jsx(ia,{trigger:f.jsxs(f.Fragment,{children:[q==="fast"?f.jsx(Rs,{className:"h-3.5 w-3.5"}):f.jsx(ao,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:q==="fast"?"Fast":"Standard"})]}),triggerClassName:q==="fast"?"text-emerald-500 dark:text-emerald-400":void 0,children:ee=>f.jsxs(f.Fragment,{children:[D.filter(re=>Sc(re.id)==="standard").map(re=>f.jsx(ti,{onClick:()=>{h(t,re.id),ee()},selected:o===re.id,icon:f.jsx(ao,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"},re.id)),D.filter(re=>Sc(re.id)==="fast").map(re=>f.jsx(ti,{onClick:()=>{h(t,re.id),ee()},selected:o===re.id,icon:f.jsx(Rs,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast"},re.id))]})}):null,V?f.jsx(ia,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(ao,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:t==="claude"?((X=fp.find(ee=>ee.id===l.reasoningEffort))==null?void 0:X.label)??l.reasoningEffort:((A=Dy.find(ee=>ee.id===l.reasoningEffort))==null?void 0:A.label)??l.reasoningEffort})]}),children:ee=>t==="claude"?fp.map(re=>f.jsx(ti,{onClick:()=>{d(re.id),ee()},selected:l.reasoningEffort===re.id,icon:f.jsx(ao,{className:"h-4 w-4 text-muted-foreground"}),label:re.label,disabled:re.id==="max"&&o!=="opus"},re.id)):Dy.map(re=>f.jsx(ti,{onClick:()=>{p(re.id),ee()},selected:l.reasoningEffort===re.id,icon:f.jsx(ao,{className:"h-4 w-4 text-muted-foreground"}),label:re.label},re.id))}):null,t==="claude"&&W.length>1?f.jsx(ia,{trigger:f.jsxs(f.Fragment,{children:[f.jsx($,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:((ie=W.find(ee=>ee.id===F))==null?void 0:ie.label)??F})]}),children:ee=>W.map(re=>f.jsx(ti,{onClick:()=>{g(re.id),ee()},selected:F===re.id,icon:re.id==="1m"?f.jsx(z2,{className:"h-4 w-4 text-muted-foreground"}):f.jsx(P2,{className:"h-4 w-4 text-muted-foreground"}),label:re.label,description:re.id==="1m"?"Expanded context window":"Standard context window"},re.id))}):null,t==="gemini"?f.jsx(ia,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(ao,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:((J=Oy.find(ee=>ee.id===(I==null?void 0:I.thinkingMode)))==null?void 0:J.label)??(I==null?void 0:I.thinkingMode)??"Standard"})]}),children:ee=>Oy.map(re=>f.jsx(ti,{onClick:()=>{_(re.id),ee()},selected:(I==null?void 0:I.thinkingMode)===re.id,icon:f.jsx(ao,{className:"h-4 w-4 text-muted-foreground"}),label:re.label,disabled:re.id==="off"&&!vH(o)},re.id))}):null,t==="codex"?f.jsx(ia,{trigger:f.jsxs(f.Fragment,{children:[Z!=null&&Z.fastMode?f.jsx(Rs,{className:"h-3.5 w-3.5"}):f.jsx(ao,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:Z!=null&&Z.fastMode?"Fast Mode":"Standard"})]}),triggerClassName:Z!=null&&Z.fastMode?"text-emerald-500 dark:text-emerald-400":void 0,children:ee=>f.jsxs(f.Fragment,{children:[f.jsx(ti,{onClick:()=>{y(!1),ee()},selected:!(Z!=null&&Z.fastMode),icon:f.jsx(ao,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"}),f.jsx(ti,{onClick:()=>{y(!0),ee()},selected:!!(Z!=null&&Z.fastMode),icon:f.jsx(Rs,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast Mode"})]})}):null,O?f.jsx(ia,{trigger:f.jsxs(f.Fragment,{children:[w?f.jsx(sp,{className:"h-3.5 w-3.5"}):f.jsx(O2,{className:"h-3.5 w-3.5"}),f.jsx("span",{className:"hidden md:inline",children:w?"Plan":"Implement"}),f.jsx("span",{className:"md:hidden",children:w?"Plan":"Impl"})]}),triggerClassName:w?"text-blue-400 dark:text-blue-300":void 0,children:ee=>f.jsxs(f.Fragment,{children:[f.jsx(ti,{onClick:()=>{S(!1),ee()},selected:!w,icon:f.jsx(O2,{className:"h-4 w-4 text-muted-foreground"}),label:"Implement",description:"Start execution"}),f.jsx(ti,{onClick:()=>{S(!0),ee()},selected:w,icon:f.jsx(sp,{className:"h-4 w-4 text-muted-foreground"}),label:"Plan",description:"Review a plan before execution"})]})}):null]})})}const _g=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>f.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:pe("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...i,children:e});function Py(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const yH=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function xH(e){const t=e.trim();for(const n of yH){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function vp(e){return e.split("/").pop()||e}function wH(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,o=24*i,l=7*o;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<o?`${Math.floor(n/i)}h`:n<l?`${Math.floor(n/o)}d`:`${Math.floor(n/l)}w`}const SH='button, select, input, textarea, [role="combobox"], [role="listbox"], [data-no-touch-drag]';function iE(e){var t;try{(t=navigator.vibrate)==null||t.call(navigator,e)}catch{}}function q0({enabled:e,visualElementRef:t,onTap:n,onContextMenu:r,onDragStart:i,onDragMove:o,onDragEnd:l,holdDelay:c=300,contextMenuDelay:h=2500,scrollThreshold:d=8,dragMoveThreshold:g=5}){const[p,_]=v.useState(!1),[y,w]=v.useState(!1),[S,C]=v.useState(null),[k,R]=v.useState(null),E=v.useCallback(D=>{R(D)},[]),N=v.useRef("idle"),L=v.useRef({x:0,y:0}),j=v.useRef(null),O=v.useRef(null),H=v.useRef(n),Z=v.useRef(r),I=v.useRef(i),W=v.useRef(o),F=v.useRef(l);H.current=n,Z.current=r,I.current=i,W.current=o,F.current=l;const $=v.useCallback((D,U)=>{const z=(t==null?void 0:t.current)??k;if(!z)return document.elementFromPoint(D,U);const G=z.style.pointerEvents;z.style.pointerEvents="none";const M=document.elementFromPoint(D,U);return z.style.pointerEvents=G,M},[t,k]),V=v.useCallback(()=>{j.current&&(clearTimeout(j.current),j.current=null),O.current&&(clearTimeout(O.current),O.current=null)},[]),q=v.useCallback(()=>{V(),N.current="idle",w(!1),_(!1),C(null)},[V]);return v.useEffect(()=>{if(!k||!e)return;const D=M=>{if(M.target.closest(SH))return;const B=M.touches[0];B&&(L.current={x:B.clientX,y:B.clientY},N.current="holding",j.current=setTimeout(()=>{j.current=null,N.current==="holding"&&(N.current="armed",w(!0),iE(30),O.current=setTimeout(()=>{var A;if(O.current=null,N.current!=="armed")return;iE(100);const X={...L.current};N.current="idle",w(!1),(A=Z.current)==null||A.call(Z,X)},h))},c))},U=M=>{var ee,re;const B=N.current;if(B==="idle")return;const X=M.touches[0];if(!X)return;const A=X.clientX-L.current.x,ie=X.clientY-L.current.y,J=Math.sqrt(A*A+ie*ie);if(B==="holding"){J>d&&(V(),N.current="idle");return}if(B==="armed"){J>g&&(O.current&&(clearTimeout(O.current),O.current=null),N.current="dragging",w(!1),_(!0),C({x:X.clientX,y:X.clientY}),M.preventDefault(),(ee=I.current)==null||ee.call(I,{x:X.clientX,y:X.clientY}));return}if(B==="dragging"){M.preventDefault(),C({x:X.clientX,y:X.clientY});const ue=$(X.clientX,X.clientY);(re=W.current)==null||re.call(W,{x:X.clientX,y:X.clientY,elementBelow:ue})}},z=M=>{var X,A;const B=N.current;if(B==="holding"){V(),N.current="idle",w(!1),_(!1),M.preventDefault(),(X=H.current)==null||X.call(H);return}if(B==="armed"){q();return}if(B==="dragging"){const ie=M.changedTouches[0];if(ie){const J=$(ie.clientX,ie.clientY);(A=F.current)==null||A.call(F,{x:ie.clientX,y:ie.clientY,elementBelow:J})}q()}},G=()=>{var M;N.current==="dragging"&&((M=F.current)==null||M.call(F,{x:0,y:0,elementBelow:null})),q()};return k.addEventListener("touchstart",D,{passive:!1}),k.addEventListener("touchmove",U,{passive:!1}),k.addEventListener("touchend",z),k.addEventListener("touchcancel",G),()=>{k.removeEventListener("touchstart",D),k.removeEventListener("touchmove",U),k.removeEventListener("touchend",z),k.removeEventListener("touchcancel",G),V(),N.current="idle"}},[k,e,c,h,d,g,V,q,$]),{touchRef:E,isDragging:p,isArmed:y,dragPosition:S}}function XM({position:e,children:t,className:n}){return e?ss.createPortal(f.jsx("div",{style:{position:"fixed",left:e.x,top:e.y,transform:"translate(-50%, calc(-100% - 14px))",zIndex:9999,pointerEvents:"none",willChange:"transform"},className:pe("flex items-center gap-2 rounded-xl border-2 border-primary/60 bg-card px-3 py-2","shadow-[0_8px_32px_rgba(0,0,0,0.25)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.5)]","min-w-[120px] max-w-[240px]","scale-[1.04]",n),children:t}),document.body):null}const CH=new Set(["starting","running"]);function kH({chat:e,activeChatId:t,nowMs:n,showProviderIcon:r=!1,isCompleted:i=!1,onSelectChat:o,onDeleteChat:l,draggable:c=!1,onDragStart:h,onDragEnd:d,isTouchDevice:g=!1,onTouchDragMove:p,onTouchDragEnd:_}){const y=wH(e.lastMessageAt,n),w=g&&c,S=e.provider?gp[e.provider]:null,{touchRef:C,isArmed:k,isDragging:R,dragPosition:E}=q0({enabled:w,onTap:()=>o(e.chatId),onDragStart:()=>h==null?void 0:h(e),onDragMove:({x:N,y:L,elementBelow:j})=>p==null?void 0:p(N,L,j),onDragEnd:({x:N,y:L,elementBelow:j})=>{_==null||_(N,L,j),d==null||d()}});return f.jsxs(f.Fragment,{children:[f.jsxs("div",{ref:w?C:void 0,"data-chat-id":g2(e.chatId),className:pe("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg cursor-pointer border transition-all duration-150 select-none",t===g2(e.chatId)?"bg-muted hover:bg-muted border-border":"border-border/0 hover:border-border hover:bg-muted/20 dark:hover:border-slate-400/10",k&&"scale-[1.03] shadow-md ring-2 ring-primary/50 bg-card border-primary/40",R&&!k&&"opacity-20 scale-[0.98]"),draggable:c&&!g,onDragStart:c&&!g?()=>h==null?void 0:h(e):void 0,onDragEnd:c&&!g?d:void 0,onClick:g?void 0:()=>o(e.chatId),children:[CH.has(e.status)?f.jsx(Lr,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[f.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),f.jsx("div",{className:"rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):i?f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[f.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),f.jsx("div",{className:"rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,r&&S?f.jsx(S,{className:"size-3.5 flex-shrink-0 text-muted-foreground/80","aria-label":`${e.provider} provider`}):null,f.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?f.jsx(_g,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),f.jsxs("div",{className:"relative h-7 w-7 mr-[2px] shrink-0",children:[y?f.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] text-muted-foreground opacity-50 transition-opacity group-hover:opacity-0",children:y}):null,f.jsx(Qe,{variant:"ghost",size:"icon",className:pe("absolute inset-0 h-7 w-7 opacity-100 cursor-pointer rounded-sm hover:!bg-transparent !border-0",y?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),"data-no-touch-drag":!0,onClick:N=>{N.stopPropagation(),l(e.chatId)},title:"Delete chat",children:f.jsx(LB,{className:"size-3.5"})})]})]},e._id),f.jsx(XM,{position:E,children:f.jsx("span",{className:"text-sm font-medium truncate",children:e.title})})]})}function EH(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const bg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function iu(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function K0(e){return"nodeType"in e}function ai(e){var t,n;return e?iu(e)?e:K0(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function G0(e){const{Document:t}=ai(e);return e instanceof t}function Ch(e){return iu(e)?!1:e instanceof ai(e).HTMLElement}function ZM(e){return e instanceof ai(e).SVGElement}function su(e){return e?iu(e)?e.document:K0(e)?G0(e)?e:Ch(e)||ZM(e)?e.ownerDocument:document:document:document}const Is=bg?v.useLayoutEffect:v.useEffect;function Y0(e){const t=v.useRef(e);return Is(()=>{t.current=e}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function RH(){const e=v.useRef(null),t=v.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=v.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Qd(e,t){t===void 0&&(t=[e]);const n=v.useRef(e);return Is(()=>{n.current!==e&&(n.current=e)},t),n}function kh(e,t){const n=v.useRef();return v.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function _p(e){const t=Y0(e),n=v.useRef(null),r=v.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function Iy(e){const t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}let vb={};function Eh(e,t){return v.useMemo(()=>{if(t)return t;const n=vb[e]==null?0:vb[e]+1;return vb[e]=n,e+"-"+n},[e,t])}function QM(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((o,l)=>{const c=Object.entries(l);for(const[h,d]of c){const g=o[h];g!=null&&(o[h]=g+e*d)}return o},{...t})}}const Oc=QM(1),bp=QM(-1);function TH(e){return"clientX"in e&&"clientY"in e}function X0(e){if(!e)return!1;const{KeyboardEvent:t}=ai(e.target);return t&&e instanceof t}function NH(e){if(!e)return!1;const{TouchEvent:t}=ai(e.target);return t&&e instanceof t}function By(e){if(NH(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return TH(e)?{x:e.clientX,y:e.clientY}:null}const Jd=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Jd.Translate.toString(e),Jd.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),sE="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function MH(e){return e.matches(sE)?e:e.querySelector(sE)}const AH={display:"none"};function jH(e){let{id:t,value:n}=e;return we.createElement("div",{id:t,style:AH},n)}function DH(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return we.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function OH(){const[e,t]=v.useState("");return{announce:v.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const JM=v.createContext(null);function LH(e){const t=v.useContext(JM);v.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function zH(){const[e]=v.useState(()=>new Set),t=v.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[v.useCallback(r=>{let{type:i,event:o}=r;e.forEach(l=>{var c;return(c=l[i])==null?void 0:c.call(l,o)})},[e]),t]}const PH={draggable:`
515
+ To pick up a draggable item, press the space bar.
516
+ While dragging, use the arrow keys to move the item.
517
+ Press space again to drop the item in its new position, or press escape to cancel.
518
+ `},IH={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function BH(e){let{announcements:t=IH,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=PH}=e;const{announce:o,announcement:l}=OH(),c=Eh("DndLiveRegion"),[h,d]=v.useState(!1);if(v.useEffect(()=>{d(!0)},[]),LH(v.useMemo(()=>({onDragStart(p){let{active:_}=p;o(t.onDragStart({active:_}))},onDragMove(p){let{active:_,over:y}=p;t.onDragMove&&o(t.onDragMove({active:_,over:y}))},onDragOver(p){let{active:_,over:y}=p;o(t.onDragOver({active:_,over:y}))},onDragEnd(p){let{active:_,over:y}=p;o(t.onDragEnd({active:_,over:y}))},onDragCancel(p){let{active:_,over:y}=p;o(t.onDragCancel({active:_,over:y}))}}),[o,t])),!h)return null;const g=we.createElement(we.Fragment,null,we.createElement(jH,{id:r,value:i.draggable}),we.createElement(DH,{id:c,announcement:l}));return n?ss.createPortal(g,n):g}var or;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(or||(or={}));function yp(){}function _b(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function FH(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ds=Object.freeze({x:0,y:0});function HH(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function $H(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function UH(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function VH(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function oE(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const WH=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=oE(t,t.left,t.top),o=[];for(const l of r){const{id:c}=l,h=n.get(c);if(h){const d=HH(oE(h),i);o.push({id:c,data:{droppableContainer:l,value:d}})}}return o.sort($H)};function qH(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),l=i-r,c=o-n;if(r<i&&n<o){const h=t.width*t.height,d=e.width*e.height,g=l*c,p=g/(h+d-g);return Number(p.toFixed(4))}return 0}const KH=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const h=qH(c,t);h>0&&i.push({id:l,data:{droppableContainer:o,value:h}})}}return i.sort(UH)};function GH(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function eA(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ds}function YH(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((l,c)=>({...l,top:l.top+e*c.y,bottom:l.bottom+e*c.y,left:l.left+e*c.x,right:l.right+e*c.x}),{...n})}}const XH=YH(1);function ZH(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function QH(e,t,n){const r=ZH(t);if(!r)return e;const{scaleX:i,scaleY:o,x:l,y:c}=r,h=e.left-l-(1-i)*parseFloat(n),d=e.top-c-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),g=i?e.width/i:e.width,p=o?e.height/o:e.height;return{width:g,height:p,top:d,right:h+g,bottom:d+p,left:h}}const JH={ignoreTransform:!1};function ou(e,t){t===void 0&&(t=JH);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ai(e).getComputedStyle(e);d&&(n=QH(n,d,g))}const{top:r,left:i,width:o,height:l,bottom:c,right:h}=n;return{top:r,left:i,width:o,height:l,bottom:c,right:h}}function aE(e){return ou(e,{ignoreTransform:!0})}function e$(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function t$(e,t){return t===void 0&&(t=ai(e).getComputedStyle(e)),t.position==="fixed"}function n$(e,t){t===void 0&&(t=ai(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function Z0(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(G0(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Ch(i)||ZM(i)||n.includes(i))return n;const o=ai(e).getComputedStyle(i);return i!==e&&n$(i,o)&&n.push(i),t$(i,o)?n:r(i.parentNode)}return e?r(e):n}function tA(e){const[t]=Z0(e,1);return t??null}function bb(e){return!bg||!e?null:iu(e)?e:K0(e)?G0(e)||e===su(e).scrollingElement?window:Ch(e)?e:null:null}function nA(e){return iu(e)?e.scrollX:e.scrollLeft}function rA(e){return iu(e)?e.scrollY:e.scrollTop}function Fy(e){return{x:nA(e),y:rA(e)}}var hr;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(hr||(hr={}));function iA(e){return!bg||!e?!1:e===document.scrollingElement}function sA(e){const t={x:0,y:0},n=iA(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,l=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:l,isRight:c,maxScroll:r,minScroll:t}}const r$={x:.2,y:.2};function i$(e,t,n,r,i){let{top:o,left:l,right:c,bottom:h}=n;r===void 0&&(r=10),i===void 0&&(i=r$);const{isTop:d,isBottom:g,isLeft:p,isRight:_}=sA(e),y={x:0,y:0},w={x:0,y:0},S={height:t.height*i.y,width:t.width*i.x};return!d&&o<=t.top+S.height?(y.y=hr.Backward,w.y=r*Math.abs((t.top+S.height-o)/S.height)):!g&&h>=t.bottom-S.height&&(y.y=hr.Forward,w.y=r*Math.abs((t.bottom-S.height-h)/S.height)),!_&&c>=t.right-S.width?(y.x=hr.Forward,w.x=r*Math.abs((t.right-S.width-c)/S.width)):!p&&l<=t.left+S.width&&(y.x=hr.Backward,w.x=r*Math.abs((t.left+S.width-l)/S.width)),{direction:y,speed:w}}function s$(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:l}=window;return{top:0,left:0,right:o,bottom:l,width:o,height:l}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function oA(e){return e.reduce((t,n)=>Oc(t,Fy(n)),ds)}function o$(e){return e.reduce((t,n)=>t+nA(n),0)}function a$(e){return e.reduce((t,n)=>t+rA(n),0)}function l$(e,t){if(t===void 0&&(t=ou),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);tA(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const c$=[["x",["left","right"],o$],["y",["top","bottom"],a$]];class Q0{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Z0(n),i=oA(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,l,c]of c$)for(const h of l)Object.defineProperty(this,h,{get:()=>{const d=c(r),g=i[o]-d;return this.rect[h]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class zd{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function u$(e){const{EventTarget:t}=ai(e);return e instanceof t?e:su(e)}function yb(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Hi;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Hi||(Hi={}));function lE(e){e.preventDefault()}function d$(e){e.stopPropagation()}var Xt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Xt||(Xt={}));const aA={start:[Xt.Space,Xt.Enter],cancel:[Xt.Esc],end:[Xt.Space,Xt.Enter,Xt.Tab]},h$=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Xt.Right:return{...n,x:n.x+25};case Xt.Left:return{...n,x:n.x-25};case Xt.Down:return{...n,y:n.y+25};case Xt.Up:return{...n,y:n.y-25}}};class J0{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new zd(su(n)),this.windowListeners=new zd(ai(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Hi.Resize,this.handleCancel),this.windowListeners.add(Hi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Hi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&l$(r),n(ds)}handleKeyDown(t){if(X0(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=aA,coordinateGetter:l=h$,scrollBehavior:c="smooth"}=i,{code:h}=t;if(o.end.includes(h)){this.handleEnd(t);return}if(o.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:ds;this.referenceCoordinates||(this.referenceCoordinates=g);const p=l(t,{active:n,context:r.current,currentCoordinates:g});if(p){const _=bp(p,g),y={x:0,y:0},{scrollableAncestors:w}=r.current;for(const S of w){const C=t.code,{isTop:k,isRight:R,isLeft:E,isBottom:N,maxScroll:L,minScroll:j}=sA(S),O=s$(S),H={x:Math.min(C===Xt.Right?O.right-O.width/2:O.right,Math.max(C===Xt.Right?O.left:O.left+O.width/2,p.x)),y:Math.min(C===Xt.Down?O.bottom-O.height/2:O.bottom,Math.max(C===Xt.Down?O.top:O.top+O.height/2,p.y))},Z=C===Xt.Right&&!R||C===Xt.Left&&!E,I=C===Xt.Down&&!N||C===Xt.Up&&!k;if(Z&&H.x!==p.x){const W=S.scrollLeft+_.x,F=C===Xt.Right&&W<=L.x||C===Xt.Left&&W>=j.x;if(F&&!_.y){S.scrollTo({left:W,behavior:c});return}F?y.x=S.scrollLeft-W:y.x=C===Xt.Right?S.scrollLeft-L.x:S.scrollLeft-j.x,y.x&&S.scrollBy({left:-y.x,behavior:c});break}else if(I&&H.y!==p.y){const W=S.scrollTop+_.y,F=C===Xt.Down&&W<=L.y||C===Xt.Up&&W>=j.y;if(F&&!_.x){S.scrollTo({top:W,behavior:c});return}F?y.y=S.scrollTop-W:y.y=C===Xt.Down?S.scrollTop-L.y:S.scrollTop-j.y,y.y&&S.scrollBy({top:-y.y,behavior:c});break}}this.handleMove(t,Oc(bp(p,this.referenceCoordinates),y))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}J0.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=aA,onActivation:i}=t,{active:o}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const c=o.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function cE(e){return!!(e&&"distance"in e)}function uE(e){return!!(e&&"delay"in e)}class ew{constructor(t,n,r){var i;r===void 0&&(r=u$(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:l}=o;this.props=t,this.events=n,this.document=su(l),this.documentListeners=new zd(this.document),this.listeners=new zd(r),this.windowListeners=new zd(ai(l)),this.initialCoordinates=(i=By(o))!=null?i:ds,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Hi.Resize,this.handleCancel),this.windowListeners.add(Hi.DragStart,lE),this.windowListeners.add(Hi.VisibilityChange,this.handleCancel),this.windowListeners.add(Hi.ContextMenu,lE),this.documentListeners.add(Hi.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(uE(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(cE(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Hi.Click,d$,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Hi.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:l,options:{activationConstraint:c}}=o;if(!i)return;const h=(n=By(t))!=null?n:ds,d=bp(i,h);if(!r&&c){if(cE(c)){if(c.tolerance!=null&&yb(d,c.tolerance))return this.handleCancel();if(yb(d,c.distance))return this.handleStart()}if(uE(c)&&yb(d,c.tolerance))return this.handleCancel();this.handlePending(c,d);return}t.cancelable&&t.preventDefault(),l(h)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Xt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const f$={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class tw extends ew{constructor(t){const{event:n}=t,r=su(n.target);super(t,f$,r)}}tw.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const m$={move:{name:"mousemove"},end:{name:"mouseup"}};var Hy;(function(e){e[e.RightClick=2]="RightClick"})(Hy||(Hy={}));class p$ extends ew{constructor(t){super(t,m$,su(t.event.target))}}p$.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Hy.RightClick?!1:(r==null||r({event:n}),!0)}}];const xb={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class lA extends ew{constructor(t){super(t,xb)}static setup(){return window.addEventListener(xb.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(xb.move.name,t)};function t(){}}}lA.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var Pd;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Pd||(Pd={}));var xp;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(xp||(xp={}));function g$(e){let{acceleration:t,activator:n=Pd.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:l=5,order:c=xp.TreeOrder,pointerCoordinates:h,scrollableAncestors:d,scrollableAncestorRects:g,delta:p,threshold:_}=e;const y=_$({delta:p,disabled:!o}),[w,S]=RH(),C=v.useRef({x:0,y:0}),k=v.useRef({x:0,y:0}),R=v.useMemo(()=>{switch(n){case Pd.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case Pd.DraggableRect:return i}},[n,i,h]),E=v.useRef(null),N=v.useCallback(()=>{const j=E.current;if(!j)return;const O=C.current.x*k.current.x,H=C.current.y*k.current.y;j.scrollBy(O,H)},[]),L=v.useMemo(()=>c===xp.TreeOrder?[...d].reverse():d,[c,d]);v.useEffect(()=>{if(!o||!d.length||!R){S();return}for(const j of L){if((r==null?void 0:r(j))===!1)continue;const O=d.indexOf(j),H=g[O];if(!H)continue;const{direction:Z,speed:I}=i$(j,H,R,t,_);for(const W of["x","y"])y[W][Z[W]]||(I[W]=0,Z[W]=0);if(I.x>0||I.y>0){S(),E.current=j,w(N,l),C.current=I,k.current=Z;return}}C.current={x:0,y:0},k.current={x:0,y:0},S()},[t,N,r,S,o,l,JSON.stringify(R),JSON.stringify(y),w,d,L,g,JSON.stringify(_)])}const v$={x:{[hr.Backward]:!1,[hr.Forward]:!1},y:{[hr.Backward]:!1,[hr.Forward]:!1}};function _$(e){let{delta:t,disabled:n}=e;const r=Iy(t);return kh(i=>{if(n||!r||!i)return v$;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[hr.Backward]:i.x[hr.Backward]||o.x===-1,[hr.Forward]:i.x[hr.Forward]||o.x===1},y:{[hr.Backward]:i.y[hr.Backward]||o.y===-1,[hr.Forward]:i.y[hr.Forward]||o.y===1}}},[n,t,r])}function b$(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return kh(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function y$(e,t){return v.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,r)}));return[...n,...o]},[]),[e,t])}var eh;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(eh||(eh={}));var $y;(function(e){e.Optimized="optimized"})($y||($y={}));const dE=new Map;function x$(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,l]=v.useState(null),{frequency:c,measure:h,strategy:d}=i,g=v.useRef(e),p=C(),_=Qd(p),y=v.useCallback(function(k){k===void 0&&(k=[]),!_.current&&l(R=>R===null?k:R.concat(k.filter(E=>!R.includes(E))))},[_]),w=v.useRef(null),S=kh(k=>{if(p&&!n)return dE;if(!k||k===dE||g.current!==e||o!=null){const R=new Map;for(let E of e){if(!E)continue;if(o&&o.length>0&&!o.includes(E.id)&&E.rect.current){R.set(E.id,E.rect.current);continue}const N=E.node.current,L=N?new Q0(h(N),N):null;E.rect.current=L,L&&R.set(E.id,L)}return R}return k},[e,o,n,p,h]);return v.useEffect(()=>{g.current=e},[e]),v.useEffect(()=>{p||y()},[n,p]),v.useEffect(()=>{o&&o.length>0&&l(null)},[JSON.stringify(o)]),v.useEffect(()=>{p||typeof c!="number"||w.current!==null||(w.current=setTimeout(()=>{y(),w.current=null},c))},[c,p,y,...r]),{droppableRects:S,measureDroppableContainers:y,measuringScheduled:o!=null};function C(){switch(d){case eh.Always:return!1;case eh.BeforeDragging:return n;default:return!n}}}function cA(e,t){return kh(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function w$(e,t){return cA(e,t)}function S$(e){let{callback:t,disabled:n}=e;const r=Y0(t),i=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return v.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function yg(e){let{callback:t,disabled:n}=e;const r=Y0(t),i=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return v.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function C$(e){return new Q0(ou(e),e)}function hE(e,t,n){t===void 0&&(t=C$);const[r,i]=v.useState(null);function o(){i(h=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=h??n)!=null?d:null}const g=t(e);return JSON.stringify(h)===JSON.stringify(g)?h:g})}const l=S$({callback(h){if(e)for(const d of h){const{type:g,target:p}=d;if(g==="childList"&&p instanceof HTMLElement&&p.contains(e)){o();break}}}}),c=yg({callback:o});return Is(()=>{o(),e?(c==null||c.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(c==null||c.disconnect(),l==null||l.disconnect())},[e]),r}function k$(e){const t=cA(e);return eA(e,t)}const fE=[];function E$(e){const t=v.useRef(e),n=kh(r=>e?r&&r!==fE&&e&&t.current&&e.parentNode===t.current.parentNode?r:Z0(e):fE,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function R$(e){const[t,n]=v.useState(null),r=v.useRef(e),i=v.useCallback(o=>{const l=bb(o.target);l&&n(c=>c?(c.set(l,Fy(l)),new Map(c)):null)},[]);return v.useEffect(()=>{const o=r.current;if(e!==o){l(o);const c=e.map(h=>{const d=bb(h);return d?(d.addEventListener("scroll",i,{passive:!0}),[d,Fy(d)]):null}).filter(h=>h!=null);n(c.length?new Map(c):null),r.current=e}return()=>{l(e),l(o)};function l(c){c.forEach(h=>{const d=bb(h);d==null||d.removeEventListener("scroll",i)})}},[i,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,l)=>Oc(o,l),ds):oA(e):ds,[e,t])}function mE(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const r=e!==ds;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?bp(e,n.current):ds}function T$(e){v.useEffect(()=>{if(!bg)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function N$(e,t){return v.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=l=>{o(l,t)},n},{}),[e,t])}function uA(e){return v.useMemo(()=>e?e$(e):null,[e])}const pE=[];function M$(e,t){t===void 0&&(t=ou);const[n]=e,r=uA(n?ai(n):null),[i,o]=v.useState(pE);function l(){o(()=>e.length?e.map(h=>iA(h)?r:new Q0(t(h),h)):pE)}const c=yg({callback:l});return Is(()=>{c==null||c.disconnect(),l(),e.forEach(h=>c==null?void 0:c.observe(h))},[e]),i}function A$(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ch(t)?t:e}function j$(e){let{measure:t}=e;const[n,r]=v.useState(null),i=v.useCallback(d=>{for(const{target:g}of d)if(Ch(g)){r(p=>{const _=t(g);return p?{...p,width:_.width,height:_.height}:_});break}},[t]),o=yg({callback:i}),l=v.useCallback(d=>{const g=A$(d);o==null||o.disconnect(),g&&(o==null||o.observe(g)),r(g?t(g):null)},[t,o]),[c,h]=_p(l);return v.useMemo(()=>({nodeRef:c,rect:n,setRef:h}),[n,c,h])}const D$=[{sensor:tw,options:{}},{sensor:J0,options:{}}],O$={current:{}},Vm={draggable:{measure:aE},droppable:{measure:aE,strategy:eh.WhileDragging,frequency:$y.Optimized},dragOverlay:{measure:ou}};class Id extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const L$={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Id,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yp},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Vm,measureDroppableContainers:yp,windowRect:null,measuringScheduled:!1},z$={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yp,draggableNodes:new Map,over:null,measureDroppableContainers:yp},xg=v.createContext(z$),dA=v.createContext(L$);function P$(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Id}}}function I$(e,t){switch(t.type){case or.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case or.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case or.DragEnd:case or.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case or.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Id(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case or.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const l=new Id(e.droppable.containers);return l.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:l}}}case or.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Id(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function B$(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=v.useContext(xg),o=Iy(r),l=Iy(n==null?void 0:n.id);return v.useEffect(()=>{if(!t&&!r&&o&&l!=null){if(!X0(o)||document.activeElement===o.target)return;const c=i.get(l);if(!c)return;const{activatorNode:h,node:d}=c;if(!h.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[h.current,d.current]){if(!g)continue;const p=MH(g);if(p){p.focus();break}}})}},[r,t,i,l,o]),null}function F$(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function H$(e){return v.useMemo(()=>({draggable:{...Vm.draggable,...e==null?void 0:e.draggable},droppable:{...Vm.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Vm.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function $$(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=v.useRef(!1),{x:l,y:c}=typeof i=="boolean"?{x:i,y:i}:i;Is(()=>{if(!l&&!c||!t){o.current=!1;return}if(o.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const g=n(d),p=eA(g,r);if(l||(p.x=0),c||(p.y=0),o.current=!0,Math.abs(p.x)>0||Math.abs(p.y)>0){const _=tA(d);_&&_.scrollBy({top:p.y,left:p.x})}},[t,l,c,r,n])}const hA=v.createContext({...ds,scaleX:1,scaleY:1});var da;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(da||(da={}));const U$=v.memo(function(t){var n,r,i,o;let{id:l,accessibility:c,autoScroll:h=!0,children:d,sensors:g=D$,collisionDetection:p=KH,measuring:_,modifiers:y,...w}=t;const S=v.useReducer(I$,void 0,P$),[C,k]=S,[R,E]=zH(),[N,L]=v.useState(da.Uninitialized),j=N===da.Initialized,{draggable:{active:O,nodes:H,translate:Z},droppable:{containers:I}}=C,W=O!=null?H.get(O):null,F=v.useRef({initial:null,translated:null}),$=v.useMemo(()=>{var Qt;return O!=null?{id:O,data:(Qt=W==null?void 0:W.data)!=null?Qt:O$,rect:F}:null},[O,W]),V=v.useRef(null),[q,D]=v.useState(null),[U,z]=v.useState(null),G=Qd(w,Object.values(w)),M=Eh("DndDescribedBy",l),B=v.useMemo(()=>I.getEnabled(),[I]),X=H$(_),{droppableRects:A,measureDroppableContainers:ie,measuringScheduled:J}=x$(B,{dragging:j,dependencies:[Z.x,Z.y],config:X.droppable}),ee=b$(H,O),re=v.useMemo(()=>U?By(U):null,[U]),ue=Un(),fe=w$(ee,X.draggable.measure);$$({activeNode:O!=null?H.get(O):null,config:ue.layoutShiftCompensation,initialRect:fe,measure:X.draggable.measure});const ge=hE(ee,X.draggable.measure,fe),Ce=hE(ee?ee.parentElement:null),Te=v.useRef({activatorEvent:null,active:null,activeNode:ee,collisionRect:null,collisions:null,droppableRects:A,draggableNodes:H,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),je=I.getNodeFor((n=Te.current.over)==null?void 0:n.id),Xe=j$({measure:X.dragOverlay.measure}),xt=(r=Xe.nodeRef.current)!=null?r:ee,Et=j?(i=Xe.rect)!=null?i:ge:null,me=!!(Xe.nodeRef.current&&Xe.rect),Fe=k$(me?null:ge),De=uA(xt?ai(xt):null),ft=E$(j?je??ee:null),at=M$(ft),it=F$(y,{transform:{x:Z.x-Fe.x,y:Z.y-Fe.y,scaleX:1,scaleY:1},activatorEvent:U,active:$,activeNodeRect:ge,containerNodeRect:Ce,draggingNodeRect:Et,over:Te.current.over,overlayNodeRect:Xe.rect,scrollableAncestors:ft,scrollableAncestorRects:at,windowRect:De}),hn=re?Oc(re,Z):null,Mt=R$(ft),Pn=mE(Mt),de=mE(Mt,[ge]),se=Oc(it,Pn),ye=Et?XH(Et,it):null,Ee=$&&ye?p({active:$,collisionRect:ye,droppableRects:A,droppableContainers:B,pointerCoordinates:hn}):null,qe=VH(Ee,"id"),[lt,Je]=v.useState(null),Ae=me?it:Oc(it,de),He=GH(Ae,(o=lt==null?void 0:lt.rect)!=null?o:null,ge),mt=v.useRef(null),Ve=v.useCallback((Qt,qt)=>{let{sensor:Ie,options:gt}=qt;if(V.current==null)return;const wt=H.get(V.current);if(!wt)return;const Rt=Qt.nativeEvent,Jt=new Ie({active:V.current,activeNode:wt,event:Rt,options:gt,context:Te,onAbort(_t){if(!H.get(_t))return;const{onDragAbort:ke}=G.current,Oe={id:_t};ke==null||ke(Oe),R({type:"onDragAbort",event:Oe})},onPending(_t,Sn,ke,Oe){if(!H.get(_t))return;const{onDragPending:ct}=G.current,mn={id:_t,constraint:Sn,initialCoordinates:ke,offset:Oe};ct==null||ct(mn),R({type:"onDragPending",event:mn})},onStart(_t){const Sn=V.current;if(Sn==null)return;const ke=H.get(Sn);if(!ke)return;const{onDragStart:Oe}=G.current,Tt={activatorEvent:Rt,active:{id:Sn,data:ke.data,rect:F}};ss.unstable_batchedUpdates(()=>{Oe==null||Oe(Tt),L(da.Initializing),k({type:or.DragStart,initialCoordinates:_t,active:Sn}),R({type:"onDragStart",event:Tt}),D(mt.current),z(Rt)})},onMove(_t){k({type:or.DragMove,coordinates:_t})},onEnd:vt(or.DragEnd),onCancel:vt(or.DragCancel)});mt.current=Jt;function vt(_t){return async function(){const{active:ke,collisions:Oe,over:Tt,scrollAdjustedTranslate:ct}=Te.current;let mn=null;if(ke&&ct){const{cancelDrop:bn}=G.current;mn={activatorEvent:Rt,active:ke,collisions:Oe,delta:ct,over:Tt},_t===or.DragEnd&&typeof bn=="function"&&await Promise.resolve(bn(mn))&&(_t=or.DragCancel)}V.current=null,ss.unstable_batchedUpdates(()=>{k({type:_t}),L(da.Uninitialized),Je(null),D(null),z(null),mt.current=null;const bn=_t===or.DragEnd?"onDragEnd":"onDragCancel";if(mn){const sn=G.current[bn];sn==null||sn(mn),R({type:bn,event:mn})}})}}},[H]),fn=v.useCallback((Qt,qt)=>(Ie,gt)=>{const wt=Ie.nativeEvent,Rt=H.get(gt);if(V.current!==null||!Rt||wt.dndKit||wt.defaultPrevented)return;const Jt={active:Rt};Qt(Ie,qt.options,Jt)===!0&&(wt.dndKit={capturedBy:qt.sensor},V.current=gt,Ve(Ie,qt))},[H,Ve]),rn=y$(g,fn);T$(g),Is(()=>{ge&&N===da.Initializing&&L(da.Initialized)},[ge,N]),v.useEffect(()=>{const{onDragMove:Qt}=G.current,{active:qt,activatorEvent:Ie,collisions:gt,over:wt}=Te.current;if(!qt||!Ie)return;const Rt={active:qt,activatorEvent:Ie,collisions:gt,delta:{x:se.x,y:se.y},over:wt};ss.unstable_batchedUpdates(()=>{Qt==null||Qt(Rt),R({type:"onDragMove",event:Rt})})},[se.x,se.y]),v.useEffect(()=>{const{active:Qt,activatorEvent:qt,collisions:Ie,droppableContainers:gt,scrollAdjustedTranslate:wt}=Te.current;if(!Qt||V.current==null||!qt||!wt)return;const{onDragOver:Rt}=G.current,Jt=gt.get(qe),vt=Jt&&Jt.rect.current?{id:Jt.id,rect:Jt.rect.current,data:Jt.data,disabled:Jt.disabled}:null,_t={active:Qt,activatorEvent:qt,collisions:Ie,delta:{x:wt.x,y:wt.y},over:vt};ss.unstable_batchedUpdates(()=>{Je(vt),Rt==null||Rt(_t),R({type:"onDragOver",event:_t})})},[qe]),Is(()=>{Te.current={activatorEvent:U,active:$,activeNode:ee,collisionRect:ye,collisions:Ee,droppableRects:A,draggableNodes:H,draggingNode:xt,draggingNodeRect:Et,droppableContainers:I,over:lt,scrollableAncestors:ft,scrollAdjustedTranslate:se},F.current={initial:Et,translated:ye}},[$,ee,Ee,ye,H,xt,Et,A,I,lt,ft,se]),g$({...ue,delta:Z,draggingRect:ye,pointerCoordinates:hn,scrollableAncestors:ft,scrollableAncestorRects:at});const et=v.useMemo(()=>({active:$,activeNode:ee,activeNodeRect:ge,activatorEvent:U,collisions:Ee,containerNodeRect:Ce,dragOverlay:Xe,draggableNodes:H,droppableContainers:I,droppableRects:A,over:lt,measureDroppableContainers:ie,scrollableAncestors:ft,scrollableAncestorRects:at,measuringConfiguration:X,measuringScheduled:J,windowRect:De}),[$,ee,ge,U,Ee,Ce,Xe,H,I,A,lt,ie,ft,at,X,J,De]),en=v.useMemo(()=>({activatorEvent:U,activators:rn,active:$,activeNodeRect:ge,ariaDescribedById:{draggable:M},dispatch:k,draggableNodes:H,over:lt,measureDroppableContainers:ie}),[U,rn,$,ge,k,M,H,lt,ie]);return we.createElement(JM.Provider,{value:E},we.createElement(xg.Provider,{value:en},we.createElement(dA.Provider,{value:et},we.createElement(hA.Provider,{value:He},d)),we.createElement(B$,{disabled:(c==null?void 0:c.restoreFocus)===!1})),we.createElement(BH,{...c,hiddenTextDescribedById:M}));function Un(){const Qt=(q==null?void 0:q.autoScrollEnabled)===!1,qt=typeof h=="object"?h.enabled===!1:h===!1,Ie=j&&!Qt&&!qt;return typeof h=="object"?{...h,enabled:Ie}:{enabled:Ie}}}),V$=v.createContext(null),gE="button",W$="Draggable";function q$(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=Eh(W$),{activators:l,activatorEvent:c,active:h,activeNodeRect:d,ariaDescribedById:g,draggableNodes:p,over:_}=v.useContext(xg),{role:y=gE,roleDescription:w="draggable",tabIndex:S=0}=i??{},C=(h==null?void 0:h.id)===t,k=v.useContext(C?hA:V$),[R,E]=_p(),[N,L]=_p(),j=N$(l,t),O=Qd(n);Is(()=>(p.set(t,{id:t,key:o,node:R,activatorNode:N,data:O}),()=>{const Z=p.get(t);Z&&Z.key===o&&p.delete(t)}),[p,t]);const H=v.useMemo(()=>({role:y,tabIndex:S,"aria-disabled":r,"aria-pressed":C&&y===gE?!0:void 0,"aria-roledescription":w,"aria-describedby":g.draggable}),[r,y,S,C,w,g.draggable]);return{active:h,activatorEvent:c,activeNodeRect:d,attributes:H,isDragging:C,listeners:r?void 0:j,node:R,over:_,setNodeRef:E,setActivatorNodeRef:L,transform:k}}function K$(){return v.useContext(dA)}const G$="Droppable",Y$={timeout:25};function X$(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=Eh(G$),{active:l,dispatch:c,over:h,measureDroppableContainers:d}=v.useContext(xg),g=v.useRef({disabled:n}),p=v.useRef(!1),_=v.useRef(null),y=v.useRef(null),{disabled:w,updateMeasurementsFor:S,timeout:C}={...Y$,...i},k=Qd(S??r),R=v.useCallback(()=>{if(!p.current){p.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{d(Array.isArray(k.current)?k.current:[k.current]),y.current=null},C)},[C]),E=yg({callback:R,disabled:w||!l}),N=v.useCallback((H,Z)=>{E&&(Z&&(E.unobserve(Z),p.current=!1),H&&E.observe(H))},[E]),[L,j]=_p(N),O=Qd(t);return v.useEffect(()=>{!E||!L.current||(E.disconnect(),p.current=!1,E.observe(L.current))},[L,E]),v.useEffect(()=>(c({type:or.RegisterDroppable,element:{id:r,key:o,disabled:n,node:L,rect:_,data:O}}),()=>c({type:or.UnregisterDroppable,key:o,id:r})),[r]),v.useEffect(()=>{n!==g.current.disabled&&(c({type:or.SetDroppableDisabled,id:r,key:o,disabled:n}),g.current.disabled=n)},[r,o,n,c]),{active:l,rect:_,isOver:(h==null?void 0:h.id)===r,node:L,over:h,setNodeRef:j}}function wg(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Z$(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function pm(e){return e!==null&&e>=0}function Q$(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function J$(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const fA=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=wg(t,r,n),l=t[i],c=o[i];return!c||!l?null:{x:c.left-l.left,y:c.top-l.top,scaleX:c.width/l.width,scaleY:c.height/l.height}},gm={scaleX:1,scaleY:1},eU=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:l}=e;const c=(t=o[n])!=null?t:r;if(!c)return null;if(i===n){const d=o[l];return d?{x:0,y:n<l?d.top+d.height-(c.top+c.height):d.top-c.top,...gm}:null}const h=tU(o,i,n);return i>n&&i<=l?{x:0,y:-c.height-h,...gm}:i<n&&i>=l?{x:0,y:c.height+h,...gm}:{x:0,y:0,...gm}};function tU(e,t,n){const r=e[t],i=e[t-1],o=e[t+1];return r?n<t?i?r.top-(i.top+i.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const mA="Sortable",pA=we.createContext({activeIndex:-1,containerId:mA,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:fA,disabled:{draggable:!1,droppable:!1}});function nU(e){let{children:t,id:n,items:r,strategy:i=fA,disabled:o=!1}=e;const{active:l,dragOverlay:c,droppableRects:h,over:d,measureDroppableContainers:g}=K$(),p=Eh(mA,n),_=c.rect!==null,y=v.useMemo(()=>r.map(j=>typeof j=="object"&&"id"in j?j.id:j),[r]),w=l!=null,S=l?y.indexOf(l.id):-1,C=d?y.indexOf(d.id):-1,k=v.useRef(y),R=!Q$(y,k.current),E=C!==-1&&S===-1||R,N=J$(o);Is(()=>{R&&w&&g(y)},[R,y,w,g]),v.useEffect(()=>{k.current=y},[y]);const L=v.useMemo(()=>({activeIndex:S,containerId:p,disabled:N,disableTransforms:E,items:y,overIndex:C,useDragOverlay:_,sortedRects:Z$(y,h),strategy:i}),[S,p,N.draggable,N.droppable,E,y,C,h,_,i]);return we.createElement(pA.Provider,{value:L},t)}const rU=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return wg(n,r,i).indexOf(t)},iU=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:l,previousItems:c,previousContainerId:h,transition:d}=e;return!d||!r||c!==o&&i===l?!1:n?!0:l!==i&&t===h},sU={duration:200,easing:"ease"},gA="transform",oU=Jd.Transition.toString({property:gA,duration:0,easing:"linear"}),aU={roleDescription:"sortable"};function lU(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,l]=v.useState(null),c=v.useRef(n);return Is(()=>{if(!t&&n!==c.current&&r.current){const h=i.current;if(h){const d=ou(r.current,{ignoreTransform:!0}),g={x:h.left-d.left,y:h.top-d.top,scaleX:h.width/d.width,scaleY:h.height/d.height};(g.x||g.y)&&l(g)}}n!==c.current&&(c.current=n)},[t,n,r,i]),v.useEffect(()=>{o&&l(null)},[o]),o}function cU(e){let{animateLayoutChanges:t=iU,attributes:n,disabled:r,data:i,getNewIndex:o=rU,id:l,strategy:c,resizeObserverConfig:h,transition:d=sU}=e;const{items:g,containerId:p,activeIndex:_,disabled:y,disableTransforms:w,sortedRects:S,overIndex:C,useDragOverlay:k,strategy:R}=v.useContext(pA),E=uU(r,y),N=g.indexOf(l),L=v.useMemo(()=>({sortable:{containerId:p,index:N,items:g},...i}),[p,i,N,g]),j=v.useMemo(()=>g.slice(g.indexOf(l)),[g,l]),{rect:O,node:H,isOver:Z,setNodeRef:I}=X$({id:l,data:L,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...h}}),{active:W,activatorEvent:F,activeNodeRect:$,attributes:V,setNodeRef:q,listeners:D,isDragging:U,over:z,setActivatorNodeRef:G,transform:M}=q$({id:l,data:L,attributes:{...aU,...n},disabled:E.draggable}),B=EH(I,q),X=!!W,A=X&&!w&&pm(_)&&pm(C),ie=!k&&U,J=ie&&A?M:null,re=A?J??(c??R)({rects:S,activeNodeRect:$,activeIndex:_,overIndex:C,index:N}):null,ue=pm(_)&&pm(C)?o({id:l,items:g,activeIndex:_,overIndex:C}):N,fe=W==null?void 0:W.id,ge=v.useRef({activeId:fe,items:g,newIndex:ue,containerId:p}),Ce=g!==ge.current.items,Te=t({active:W,containerId:p,isDragging:U,isSorting:X,id:l,index:N,items:g,newIndex:ge.current.newIndex,previousItems:ge.current.items,previousContainerId:ge.current.containerId,transition:d,wasDragging:ge.current.activeId!=null}),je=lU({disabled:!Te,index:N,node:H,rect:O});return v.useEffect(()=>{X&&ge.current.newIndex!==ue&&(ge.current.newIndex=ue),p!==ge.current.containerId&&(ge.current.containerId=p),g!==ge.current.items&&(ge.current.items=g)},[X,ue,p,g]),v.useEffect(()=>{if(fe===ge.current.activeId)return;if(fe!=null&&ge.current.activeId==null){ge.current.activeId=fe;return}const xt=setTimeout(()=>{ge.current.activeId=fe},50);return()=>clearTimeout(xt)},[fe]),{active:W,activeIndex:_,attributes:V,data:L,rect:O,index:N,newIndex:ue,items:g,isOver:Z,isSorting:X,isDragging:U,listeners:D,node:H,overIndex:C,over:z,setNodeRef:B,setActivatorNodeRef:G,setDroppableNodeRef:I,setDraggableNodeRef:q,transform:je??re,transition:Xe()};function Xe(){if(je||Ce&&ge.current.newIndex===N)return oU;if(!(ie&&!X0(F)||!d)&&(X||Te))return Jd.Transition.toString({...d,property:gA})}}function uU(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}Xt.Down,Xt.Right,Xt.Up,Xt.Left;const vE={idea:"border-amber-500/30 bg-amber-500/15 text-amber-700 dark:border-amber-500/40 dark:bg-amber-500/12 dark:text-amber-200",todo:"border-sky-500/30 bg-sky-500/15 text-sky-700 dark:border-sky-500/40 dark:bg-sky-500/12 dark:text-sky-200",progress:"border-indigo-500/30 bg-indigo-500/15 text-indigo-700 dark:border-indigo-500/40 dark:bg-indigo-500/12 dark:text-indigo-200",testing:"border-cyan-500/30 bg-cyan-500/15 text-cyan-700 dark:border-cyan-500/40 dark:bg-cyan-500/12 dark:text-cyan-200",done:"border-emerald-500/30 bg-emerald-500/15 text-emerald-700 dark:border-emerald-500/40 dark:bg-emerald-500/12 dark:text-emerald-200"};function _E(e,[t,n]){return Math.min(n,Math.max(t,e))}function nw(e){const t=e+"CollectionProvider",[n,r]=Co(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=S=>{const{scope:C,children:k}=S,R=we.useRef(null),E=we.useRef(new Map).current;return f.jsx(i,{scope:C,itemMap:E,collectionRef:R,children:k})};l.displayName=t;const c=e+"CollectionSlot",h=fl(c),d=we.forwardRef((S,C)=>{const{scope:k,children:R}=S,E=o(c,k),N=Zt(C,E.collectionRef);return f.jsx(h,{ref:N,children:R})});d.displayName=c;const g=e+"CollectionItemSlot",p="data-radix-collection-item",_=fl(g),y=we.forwardRef((S,C)=>{const{scope:k,children:R,...E}=S,N=we.useRef(null),L=Zt(C,N),j=o(g,k);return we.useEffect(()=>(j.itemMap.set(N,{ref:N,...E}),()=>void j.itemMap.delete(N))),f.jsx(_,{[p]:"",ref:L,children:R})});y.displayName=g;function w(S){const C=o(e+"CollectionConsumer",S);return we.useCallback(()=>{const R=C.collectionRef.current;if(!R)return[];const E=Array.from(R.querySelectorAll(`[${p}]`));return Array.from(C.itemMap.values()).sort((j,O)=>E.indexOf(j.ref.current)-E.indexOf(O.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:l,Slot:d,ItemSlot:y},w,r]}var dU=v.createContext(void 0);function rw(e){const t=v.useContext(dU);return e||t||"ltr"}function hU(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var fU=[" ","Enter","ArrowUp","ArrowDown"],mU=[" ","Enter"],gl="Select",[Sg,Cg,pU]=nw(gl),[au,soe]=Co(gl,[pU,Ea]),kg=Ea(),[gU,Ta]=au(gl),[vU,_U]=au(gl),vA=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:o,value:l,defaultValue:c,onValueChange:h,dir:d,name:g,autoComplete:p,disabled:_,required:y,form:w}=e,S=kg(t),[C,k]=v.useState(null),[R,E]=v.useState(null),[N,L]=v.useState(!1),j=rw(d),[O,H]=Ic({prop:r,defaultProp:i??!1,onChange:o,caller:gl}),[Z,I]=Ic({prop:l,defaultProp:c,onChange:h,caller:gl}),W=v.useRef(null),F=C?w||!!C.closest("form"):!0,[$,V]=v.useState(new Set),q=Array.from($).map(D=>D.props.value).join(";");return f.jsx(dg,{...S,children:f.jsxs(gU,{required:y,scope:t,trigger:C,onTriggerChange:k,valueNode:R,onValueNodeChange:E,valueNodeHasChildren:N,onValueNodeHasChildrenChange:L,contentId:go(),value:Z,onValueChange:I,open:O,onOpenChange:H,dir:j,triggerPointerDownPosRef:W,disabled:_,children:[f.jsx(Sg.Provider,{scope:t,children:f.jsx(vU,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(D=>{V(U=>new Set(U).add(D))},[]),onNativeOptionRemove:v.useCallback(D=>{V(U=>{const z=new Set(U);return z.delete(D),z})},[]),children:n})}),F?f.jsxs($A,{"aria-hidden":!0,required:y,tabIndex:-1,name:g,autoComplete:p,value:Z,onChange:D=>I(D.target.value),disabled:_,form:w,children:[Z===void 0?f.jsx("option",{value:""}):null,Array.from($)]},q):null]})})};vA.displayName=gl;var _A="SelectTrigger",bA=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,o=kg(n),l=Ta(_A,n),c=l.disabled||r,h=Zt(t,l.onTriggerChange),d=Cg(n),g=v.useRef("touch"),[p,_,y]=VA(S=>{const C=d().filter(E=>!E.disabled),k=C.find(E=>E.value===l.value),R=WA(C,S,k);R!==void 0&&l.onValueChange(R.value)}),w=S=>{c||(l.onOpenChange(!0),y()),S&&(l.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return f.jsx(xh,{asChild:!0,...o,children:f.jsx(Ot.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":UA(l.value)?"":void 0,...i,ref:h,onClick:Be(i.onClick,S=>{S.currentTarget.focus(),g.current!=="mouse"&&w(S)}),onPointerDown:Be(i.onPointerDown,S=>{g.current=S.pointerType;const C=S.target;C.hasPointerCapture(S.pointerId)&&C.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(w(S),S.preventDefault())}),onKeyDown:Be(i.onKeyDown,S=>{const C=p.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&_(S.key),!(C&&S.key===" ")&&fU.includes(S.key)&&(w(),S.preventDefault())})})})});bA.displayName=_A;var yA="SelectValue",xA=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:l="",...c}=e,h=Ta(yA,n),{onValueNodeHasChildrenChange:d}=h,g=o!==void 0,p=Zt(t,h.onValueNodeChange);return Pr(()=>{d(g)},[d,g]),f.jsx(Ot.span,{...c,ref:p,style:{pointerEvents:"none"},children:UA(h.value)?f.jsx(f.Fragment,{children:l}):o})});xA.displayName=yA;var bU="SelectIcon",wA=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return f.jsx(Ot.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});wA.displayName=bU;var yU="SelectPortal",SA=e=>f.jsx(eu,{asChild:!0,...e});SA.displayName=yU;var vl="SelectContent",CA=v.forwardRef((e,t)=>{const n=Ta(vl,e.__scopeSelect),[r,i]=v.useState();if(Pr(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?ss.createPortal(f.jsx(kA,{scope:e.__scopeSelect,children:f.jsx(Sg.Slot,{scope:e.__scopeSelect,children:f.jsx("div",{children:e.children})})}),o):null}return f.jsx(EA,{...e,ref:t})});CA.displayName=vl;var is=10,[kA,Na]=au(vl),xU="SelectContentImpl",wU=fl("SelectContent.RemoveScroll"),EA=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:l,side:c,sideOffset:h,align:d,alignOffset:g,arrowPadding:p,collisionBoundary:_,collisionPadding:y,sticky:w,hideWhenDetached:S,avoidCollisions:C,...k}=e,R=Ta(vl,n),[E,N]=v.useState(null),[L,j]=v.useState(null),O=Zt(t,re=>N(re)),[H,Z]=v.useState(null),[I,W]=v.useState(null),F=Cg(n),[$,V]=v.useState(!1),q=v.useRef(!1);v.useEffect(()=>{if(E)return eg(E)},[E]),Qp();const D=v.useCallback(re=>{const[ue,...fe]=F().map(Te=>Te.ref.current),[ge]=fe.slice(-1),Ce=document.activeElement;for(const Te of re)if(Te===Ce||(Te==null||Te.scrollIntoView({block:"nearest"}),Te===ue&&L&&(L.scrollTop=0),Te===ge&&L&&(L.scrollTop=L.scrollHeight),Te==null||Te.focus(),document.activeElement!==Ce))return},[F,L]),U=v.useCallback(()=>D([H,E]),[D,H,E]);v.useEffect(()=>{$&&U()},[$,U]);const{onOpenChange:z,triggerPointerDownPosRef:G}=R;v.useEffect(()=>{if(E){let re={x:0,y:0};const ue=ge=>{var Ce,Te;re={x:Math.abs(Math.round(ge.pageX)-(((Ce=G.current)==null?void 0:Ce.x)??0)),y:Math.abs(Math.round(ge.pageY)-(((Te=G.current)==null?void 0:Te.y)??0))}},fe=ge=>{re.x<=10&&re.y<=10?ge.preventDefault():E.contains(ge.target)||z(!1),document.removeEventListener("pointermove",ue),G.current=null};return G.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",fe,{capture:!0})}}},[E,z,G]),v.useEffect(()=>{const re=()=>z(!1);return window.addEventListener("blur",re),window.addEventListener("resize",re),()=>{window.removeEventListener("blur",re),window.removeEventListener("resize",re)}},[z]);const[M,B]=VA(re=>{const ue=F().filter(Ce=>!Ce.disabled),fe=ue.find(Ce=>Ce.ref.current===document.activeElement),ge=WA(ue,re,fe);ge&&setTimeout(()=>ge.ref.current.focus())}),X=v.useCallback((re,ue,fe)=>{const ge=!q.current&&!fe;(R.value!==void 0&&R.value===ue||ge)&&(Z(re),ge&&(q.current=!0))},[R.value]),A=v.useCallback(()=>E==null?void 0:E.focus(),[E]),ie=v.useCallback((re,ue,fe)=>{const ge=!q.current&&!fe;(R.value!==void 0&&R.value===ue||ge)&&W(re)},[R.value]),J=r==="popper"?Uy:RA,ee=J===Uy?{side:c,sideOffset:h,align:d,alignOffset:g,arrowPadding:p,collisionBoundary:_,collisionPadding:y,sticky:w,hideWhenDetached:S,avoidCollisions:C}:{};return f.jsx(kA,{scope:n,content:E,viewport:L,onViewportChange:j,itemRefCallback:X,selectedItem:H,onItemLeave:A,itemTextRefCallback:ie,focusSelectedItem:U,selectedItemText:I,position:r,isPositioned:$,searchRef:M,children:f.jsx(vh,{as:wU,allowPinchZoom:!0,children:f.jsx(gh,{asChild:!0,trapped:R.open,onMountAutoFocus:re=>{re.preventDefault()},onUnmountAutoFocus:Be(i,re=>{var ue;(ue=R.trigger)==null||ue.focus({preventScroll:!0}),re.preventDefault()}),children:f.jsx(Jc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:re=>re.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:f.jsx(J,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:re=>re.preventDefault(),...k,...ee,onPlaced:()=>V(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Be(k.onKeyDown,re=>{const ue=re.ctrlKey||re.altKey||re.metaKey;if(re.key==="Tab"&&re.preventDefault(),!ue&&re.key.length===1&&B(re.key),["ArrowUp","ArrowDown","Home","End"].includes(re.key)){let ge=F().filter(Ce=>!Ce.disabled).map(Ce=>Ce.ref.current);if(["ArrowUp","End"].includes(re.key)&&(ge=ge.slice().reverse()),["ArrowUp","ArrowDown"].includes(re.key)){const Ce=re.target,Te=ge.indexOf(Ce);ge=ge.slice(Te+1)}setTimeout(()=>D(ge)),re.preventDefault()}})})})})})})});EA.displayName=xU;var SU="SelectItemAlignedPosition",RA=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,o=Ta(vl,n),l=Na(vl,n),[c,h]=v.useState(null),[d,g]=v.useState(null),p=Zt(t,O=>g(O)),_=Cg(n),y=v.useRef(!1),w=v.useRef(!0),{viewport:S,selectedItem:C,selectedItemText:k,focusSelectedItem:R}=l,E=v.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&d&&S&&C&&k){const O=o.trigger.getBoundingClientRect(),H=d.getBoundingClientRect(),Z=o.valueNode.getBoundingClientRect(),I=k.getBoundingClientRect();if(o.dir!=="rtl"){const Ce=I.left-H.left,Te=Z.left-Ce,je=O.left-Te,Xe=O.width+je,xt=Math.max(Xe,H.width),Et=window.innerWidth-is,me=_E(Te,[is,Math.max(is,Et-xt)]);c.style.minWidth=Xe+"px",c.style.left=me+"px"}else{const Ce=H.right-I.right,Te=window.innerWidth-Z.right-Ce,je=window.innerWidth-O.right-Te,Xe=O.width+je,xt=Math.max(Xe,H.width),Et=window.innerWidth-is,me=_E(Te,[is,Math.max(is,Et-xt)]);c.style.minWidth=Xe+"px",c.style.right=me+"px"}const W=_(),F=window.innerHeight-is*2,$=S.scrollHeight,V=window.getComputedStyle(d),q=parseInt(V.borderTopWidth,10),D=parseInt(V.paddingTop,10),U=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),G=q+D+$+z+U,M=Math.min(C.offsetHeight*5,G),B=window.getComputedStyle(S),X=parseInt(B.paddingTop,10),A=parseInt(B.paddingBottom,10),ie=O.top+O.height/2-is,J=F-ie,ee=C.offsetHeight/2,re=C.offsetTop+ee,ue=q+D+re,fe=G-ue;if(ue<=ie){const Ce=W.length>0&&C===W[W.length-1].ref.current;c.style.bottom="0px";const Te=d.clientHeight-S.offsetTop-S.offsetHeight,je=Math.max(J,ee+(Ce?A:0)+Te+U),Xe=ue+je;c.style.height=Xe+"px"}else{const Ce=W.length>0&&C===W[0].ref.current;c.style.top="0px";const je=Math.max(ie,q+S.offsetTop+(Ce?X:0)+ee)+fe;c.style.height=je+"px",S.scrollTop=ue-ie+S.offsetTop}c.style.margin=`${is}px 0`,c.style.minHeight=M+"px",c.style.maxHeight=F+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[_,o.trigger,o.valueNode,c,d,S,C,k,o.dir,r]);Pr(()=>E(),[E]);const[N,L]=v.useState();Pr(()=>{d&&L(window.getComputedStyle(d).zIndex)},[d]);const j=v.useCallback(O=>{O&&w.current===!0&&(E(),R==null||R(),w.current=!1)},[E,R]);return f.jsx(kU,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:j,children:f.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:f.jsx(Ot.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});RA.displayName=SU;var CU="SelectPopperPosition",Uy=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=is,...o}=e,l=kg(n);return f.jsx(hg,{...l,...o,ref:t,align:r,collisionPadding:i,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)"}})});Uy.displayName=CU;var[kU,iw]=au(vl,{}),Vy="SelectViewport",TA=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,o=Na(Vy,n),l=iw(Vy,n),c=Zt(t,o.onViewportChange),h=v.useRef(0);return f.jsxs(f.Fragment,{children:[f.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:r}),f.jsx(Sg.Slot,{scope:n,children:f.jsx(Ot.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Be(i.onScroll,d=>{const g=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:_}=l;if(_!=null&&_.current&&p){const y=Math.abs(h.current-g.scrollTop);if(y>0){const w=window.innerHeight-is*2,S=parseFloat(p.style.minHeight),C=parseFloat(p.style.height),k=Math.max(S,C);if(k<w){const R=k+y,E=Math.min(w,R),N=R-E;p.style.height=E+"px",p.style.bottom==="0px"&&(g.scrollTop=N>0?N:0,p.style.justifyContent="flex-end")}}}h.current=g.scrollTop})})})]})});TA.displayName=Vy;var NA="SelectGroup",[EU,RU]=au(NA),MA=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=go();return f.jsx(EU,{scope:n,id:i,children:f.jsx(Ot.div,{role:"group","aria-labelledby":i,...r,ref:t})})});MA.displayName=NA;var AA="SelectLabel",jA=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=RU(AA,n);return f.jsx(Ot.div,{id:i.id,...r,ref:t})});jA.displayName=AA;var wp="SelectItem",[TU,DA]=au(wp),OA=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...l}=e,c=Ta(wp,n),h=Na(wp,n),d=c.value===r,[g,p]=v.useState(o??""),[_,y]=v.useState(!1),w=Zt(t,R=>{var E;return(E=h.itemRefCallback)==null?void 0:E.call(h,R,r,i)}),S=go(),C=v.useRef("touch"),k=()=>{i||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(TU,{scope:n,value:r,disabled:i,textId:S,isSelected:d,onItemTextChange:v.useCallback(R=>{p(E=>E||((R==null?void 0:R.textContent)??"").trim())},[]),children:f.jsx(Sg.ItemSlot,{scope:n,value:r,disabled:i,textValue:g,children:f.jsx(Ot.div,{role:"option","aria-labelledby":S,"data-highlighted":_?"":void 0,"aria-selected":d&&_,"data-state":d?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...l,ref:w,onFocus:Be(l.onFocus,()=>y(!0)),onBlur:Be(l.onBlur,()=>y(!1)),onClick:Be(l.onClick,()=>{C.current!=="mouse"&&k()}),onPointerUp:Be(l.onPointerUp,()=>{C.current==="mouse"&&k()}),onPointerDown:Be(l.onPointerDown,R=>{C.current=R.pointerType}),onPointerMove:Be(l.onPointerMove,R=>{var E;C.current=R.pointerType,i?(E=h.onItemLeave)==null||E.call(h):C.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Be(l.onPointerLeave,R=>{var E;R.currentTarget===document.activeElement&&((E=h.onItemLeave)==null||E.call(h))}),onKeyDown:Be(l.onKeyDown,R=>{var N;((N=h.searchRef)==null?void 0:N.current)!==""&&R.key===" "||(mU.includes(R.key)&&k(),R.key===" "&&R.preventDefault())})})})})});OA.displayName=wp;var Sd="SelectItemText",LA=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...o}=e,l=Ta(Sd,n),c=Na(Sd,n),h=DA(Sd,n),d=_U(Sd,n),[g,p]=v.useState(null),_=Zt(t,k=>p(k),h.onItemTextChange,k=>{var R;return(R=c.itemTextRefCallback)==null?void 0:R.call(c,k,h.value,h.disabled)}),y=g==null?void 0:g.textContent,w=v.useMemo(()=>f.jsx("option",{value:h.value,disabled:h.disabled,children:y},h.value),[h.disabled,h.value,y]),{onNativeOptionAdd:S,onNativeOptionRemove:C}=d;return Pr(()=>(S(w),()=>C(w)),[S,C,w]),f.jsxs(f.Fragment,{children:[f.jsx(Ot.span,{id:h.textId,...o,ref:_}),h.isSelected&&l.valueNode&&!l.valueNodeHasChildren?ss.createPortal(o.children,l.valueNode):null]})});LA.displayName=Sd;var zA="SelectItemIndicator",PA=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return DA(zA,n).isSelected?f.jsx(Ot.span,{"aria-hidden":!0,...r,ref:t}):null});PA.displayName=zA;var Wy="SelectScrollUpButton",IA=v.forwardRef((e,t)=>{const n=Na(Wy,e.__scopeSelect),r=iw(Wy,e.__scopeSelect),[i,o]=v.useState(!1),l=Zt(t,r.onScrollButtonChange);return Pr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=h.scrollTop>0;o(d)};const h=n.viewport;return c(),h.addEventListener("scroll",c),()=>h.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?f.jsx(FA,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:h}=n;c&&h&&(c.scrollTop=c.scrollTop-h.offsetHeight)}}):null});IA.displayName=Wy;var qy="SelectScrollDownButton",BA=v.forwardRef((e,t)=>{const n=Na(qy,e.__scopeSelect),r=iw(qy,e.__scopeSelect),[i,o]=v.useState(!1),l=Zt(t,r.onScrollButtonChange);return Pr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=h.scrollHeight-h.clientHeight,g=Math.ceil(h.scrollTop)<d;o(g)};const h=n.viewport;return c(),h.addEventListener("scroll",c),()=>h.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?f.jsx(FA,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:h}=n;c&&h&&(c.scrollTop=c.scrollTop+h.offsetHeight)}}):null});BA.displayName=qy;var FA=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,o=Na("SelectScrollButton",n),l=v.useRef(null),c=Cg(n),h=v.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return v.useEffect(()=>()=>h(),[h]),Pr(()=>{var g;const d=c().find(p=>p.ref.current===document.activeElement);(g=d==null?void 0:d.ref.current)==null||g.scrollIntoView({block:"nearest"})},[c]),f.jsx(Ot.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Be(i.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Be(i.onPointerMove,()=>{var d;(d=o.onItemLeave)==null||d.call(o),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Be(i.onPointerLeave,()=>{h()})})}),NU="SelectSeparator",HA=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f.jsx(Ot.div,{"aria-hidden":!0,...r,ref:t})});HA.displayName=NU;var Ky="SelectArrow",MU=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=kg(n),o=Ta(Ky,n),l=Na(Ky,n);return o.open&&l.position==="popper"?f.jsx(fg,{...i,...r,ref:t}):null});MU.displayName=Ky;var AU="SelectBubbleInput",$A=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=v.useRef(null),o=Zt(r,i),l=hU(t);return v.useEffect(()=>{const c=i.current;if(!c)return;const h=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(h,"value").set;if(l!==t&&g){const p=new Event("change",{bubbles:!0});g.call(c,t),c.dispatchEvent(p)}},[l,t]),f.jsx(Ot.select,{...n,style:{...vM,...n.style},ref:o,defaultValue:t})});$A.displayName=AU;function UA(e){return e===""||e===void 0}function VA(e){const t=ls(e),n=v.useRef(""),r=v.useRef(0),i=v.useCallback(l=>{const c=n.current+l;t(c),function h(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>h(""),1e3))}(c)},[t]),o=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function WA(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=jU(e,Math.max(o,0));i.length===1&&(l=l.filter(d=>d!==n));const h=l.find(d=>d.textValue.toLowerCase().startsWith(i.toLowerCase()));return h!==n?h:void 0}function jU(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var DU=vA,qA=bA,OU=xA,LU=wA,zU=SA,KA=CA,PU=TA,IU=MA,GA=jA,sw=OA,YA=LA,XA=PA,ZA=IA,QA=BA,JA=HA;const Er=DU,wb=IU,jr=OU,cr=v.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(qA,{ref:r,className:pe("flex h-9 w-full items-center justify-between gap-2 rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none transition-colors","placeholder:text-muted-foreground","focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50","[&>span]:line-clamp-1",e),...n,children:[t,f.jsx(LU,{asChild:!0,children:f.jsx(ng,{className:"h-4 w-4 shrink-0 opacity-50"})})]}));cr.displayName=qA.displayName;const ej=v.forwardRef(({className:e,...t},n)=>f.jsx(ZA,{ref:n,className:pe("flex cursor-default items-center justify-center py-1",e),...t,children:f.jsx(i8,{className:"h-4 w-4"})}));ej.displayName=ZA.displayName;const tj=v.forwardRef(({className:e,...t},n)=>f.jsx(QA,{ref:n,className:pe("flex cursor-default items-center justify-center py-1",e),...t,children:f.jsx(ng,{className:"h-4 w-4"})}));tj.displayName=QA.displayName;const ur=v.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>f.jsx(zU,{children:f.jsxs(KA,{ref:i,className:pe("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border bg-background text-foreground shadow-md backdrop-blur-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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",n==="popper"&&"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),position:n,...r,children:[f.jsx(ej,{}),f.jsx(PU,{className:pe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),f.jsx(tj,{})]})}));ur.displayName=KA.displayName;const BU=v.forwardRef(({className:e,...t},n)=>f.jsx(GA,{ref:n,className:pe("px-2 py-1.5 text-sm font-semibold",e),...t}));BU.displayName=GA.displayName;const Ht=v.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(sw,{ref:r,className:pe("relative flex w-full cursor-default select-none items-center rounded-md py-1.5 pl-2 pr-8 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(XA,{children:f.jsx(Wi,{className:"h-4 w-4"})})}),f.jsx(YA,{children:t})]}));Ht.displayName=sw.displayName;const Wm=v.forwardRef(({className:e,children:t,thumbnail:n,thumbnailAlt:r="",...i},o)=>f.jsxs(sw,{ref:o,className:pe("flex w-full cursor-default select-none items-center gap-2 rounded-md py-1.5 pl-2 pr-2 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...i,children:[f.jsx("div",{className:"min-w-0 flex-1 truncate",children:f.jsx(YA,{children:t})}),f.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n?f.jsx("img",{src:n,alt:r,className:"h-5 w-9 rounded object-cover opacity-90"}):null,f.jsx("span",{className:"flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(XA,{children:f.jsx(Wi,{className:"h-4 w-4"})})})]})]}));Wm.displayName="SelectItemWithThumbnail";const FU=v.forwardRef(({className:e,...t},n)=>f.jsx(JA,{ref:n,className:pe("-mx-1 my-1 h-px bg-border",e),...t}));FU.displayName=JA.displayName;var Sb="rovingFocusGroup.onEntryFocus",HU={bubbles:!1,cancelable:!0},Rh="RovingFocusGroup",[Gy,nj,$U]=nw(Rh),[UU,rj]=Co(Rh,[$U]),[VU,WU]=UU(Rh),ij=v.forwardRef((e,t)=>f.jsx(Gy.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Gy.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(qU,{...e,ref:t})})}));ij.displayName=Rh;var qU=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:h,onEntryFocus:d,preventScrollOnEntryFocus:g=!1,...p}=e,_=v.useRef(null),y=Zt(t,_),w=rw(o),[S,C]=Ic({prop:l,defaultProp:c??null,onChange:h,caller:Rh}),[k,R]=v.useState(!1),E=ls(d),N=nj(n),L=v.useRef(!1),[j,O]=v.useState(0);return v.useEffect(()=>{const H=_.current;if(H)return H.addEventListener(Sb,E),()=>H.removeEventListener(Sb,E)},[E]),f.jsx(VU,{scope:n,orientation:r,dir:w,loop:i,currentTabStopId:S,onItemFocus:v.useCallback(H=>C(H),[C]),onItemShiftTab:v.useCallback(()=>R(!0),[]),onFocusableItemAdd:v.useCallback(()=>O(H=>H+1),[]),onFocusableItemRemove:v.useCallback(()=>O(H=>H-1),[]),children:f.jsx(Ot.div,{tabIndex:k||j===0?-1:0,"data-orientation":r,...p,ref:y,style:{outline:"none",...e.style},onMouseDown:Be(e.onMouseDown,()=>{L.current=!0}),onFocus:Be(e.onFocus,H=>{const Z=!L.current;if(H.target===H.currentTarget&&Z&&!k){const I=new CustomEvent(Sb,HU);if(H.currentTarget.dispatchEvent(I),!I.defaultPrevented){const W=N().filter(D=>D.focusable),F=W.find(D=>D.active),$=W.find(D=>D.id===S),q=[F,$,...W].filter(Boolean).map(D=>D.ref.current);aj(q,g)}}L.current=!1}),onBlur:Be(e.onBlur,()=>R(!1))})})}),sj="RovingFocusGroupItem",oj=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:l,...c}=e,h=go(),d=o||h,g=WU(sj,n),p=g.currentTabStopId===d,_=nj(n),{onFocusableItemAdd:y,onFocusableItemRemove:w,currentTabStopId:S}=g;return v.useEffect(()=>{if(r)return y(),()=>w()},[r,y,w]),f.jsx(Gy.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:f.jsx(Ot.span,{tabIndex:p?0:-1,"data-orientation":g.orientation,...c,ref:t,onMouseDown:Be(e.onMouseDown,C=>{r?g.onItemFocus(d):C.preventDefault()}),onFocus:Be(e.onFocus,()=>g.onItemFocus(d)),onKeyDown:Be(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){g.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const k=YU(C,g.orientation,g.dir);if(k!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let E=_().filter(N=>N.focusable).map(N=>N.ref.current);if(k==="last")E.reverse();else if(k==="prev"||k==="next"){k==="prev"&&E.reverse();const N=E.indexOf(C.currentTarget);E=g.loop?XU(E,N+1):E.slice(N+1)}setTimeout(()=>aj(E))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:S!=null}):l})})});oj.displayName=sj;var KU={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function GU(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function YU(e,t,n){const r=GU(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return KU[r]}function aj(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function XU(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ZU=ij,QU=oj,Yy=["Enter"," "],JU=["ArrowDown","PageUp","Home"],lj=["ArrowUp","PageDown","End"],eV=[...JU,...lj],tV={ltr:[...Yy,"ArrowRight"],rtl:[...Yy,"ArrowLeft"]},nV={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Th="Menu",[th,rV,iV]=nw(Th),[Rl,cj]=Co(Th,[iV,Ea,rj]),Eg=Ea(),uj=rj(),[sV,Tl]=Rl(Th),[oV,Nh]=Rl(Th),dj=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:o,modal:l=!0}=e,c=Eg(t),[h,d]=v.useState(null),g=v.useRef(!1),p=ls(o),_=rw(i);return v.useEffect(()=>{const y=()=>{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",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),f.jsx(dg,{...c,children:f.jsx(sV,{scope:t,open:n,onOpenChange:p,content:h,onContentChange:d,children:f.jsx(oV,{scope:t,onClose:v.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:g,dir:_,modal:l,children:r})})})};dj.displayName=Th;var aV="MenuAnchor",ow=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Eg(n);return f.jsx(xh,{...i,...r,ref:t})});ow.displayName=aV;var aw="MenuPortal",[lV,hj]=Rl(aw,{forceMount:void 0}),fj=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=Tl(aw,t);return f.jsx(lV,{scope:t,forceMount:n,children:f.jsx(Xi,{present:n||o.open,children:f.jsx(eu,{asChild:!0,container:i,children:r})})})};fj.displayName=aw;var qi="MenuContent",[cV,lw]=Rl(qi),mj=v.forwardRef((e,t)=>{const n=hj(qi,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=Tl(qi,e.__scopeMenu),l=Nh(qi,e.__scopeMenu);return f.jsx(th.Provider,{scope:e.__scopeMenu,children:f.jsx(Xi,{present:r||o.open,children:f.jsx(th.Slot,{scope:e.__scopeMenu,children:l.modal?f.jsx(uV,{...i,ref:t}):f.jsx(dV,{...i,ref:t})})})})}),uV=v.forwardRef((e,t)=>{const n=Tl(qi,e.__scopeMenu),r=v.useRef(null),i=Zt(t,r);return v.useEffect(()=>{const o=r.current;if(o)return eg(o)},[]),f.jsx(cw,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Be(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),dV=v.forwardRef((e,t)=>{const n=Tl(qi,e.__scopeMenu);return f.jsx(cw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),hV=fl("MenuContent.ScrollLock"),cw=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:h,onEscapeKeyDown:d,onPointerDownOutside:g,onFocusOutside:p,onInteractOutside:_,onDismiss:y,disableOutsideScroll:w,...S}=e,C=Tl(qi,n),k=Nh(qi,n),R=Eg(n),E=uj(n),N=rV(n),[L,j]=v.useState(null),O=v.useRef(null),H=Zt(t,O,C.onContentChange),Z=v.useRef(0),I=v.useRef(""),W=v.useRef(0),F=v.useRef(null),$=v.useRef("right"),V=v.useRef(0),q=w?vh:v.Fragment,D=w?{as:hV,allowPinchZoom:!0}:void 0,U=G=>{var re,ue;const M=I.current+G,B=N().filter(fe=>!fe.disabled),X=document.activeElement,A=(re=B.find(fe=>fe.ref.current===X))==null?void 0:re.textValue,ie=B.map(fe=>fe.textValue),J=CV(ie,M,A),ee=(ue=B.find(fe=>fe.textValue===J))==null?void 0:ue.ref.current;(function fe(ge){I.current=ge,window.clearTimeout(Z.current),ge!==""&&(Z.current=window.setTimeout(()=>fe(""),1e3))})(M),ee&&setTimeout(()=>ee.focus())};v.useEffect(()=>()=>window.clearTimeout(Z.current),[]),Qp();const z=v.useCallback(G=>{var B,X;return $.current===((B=F.current)==null?void 0:B.side)&&EV(G,(X=F.current)==null?void 0:X.area)},[]);return f.jsx(cV,{scope:n,searchRef:I,onItemEnter:v.useCallback(G=>{z(G)&&G.preventDefault()},[z]),onItemLeave:v.useCallback(G=>{var M;z(G)||((M=O.current)==null||M.focus(),j(null))},[z]),onTriggerLeave:v.useCallback(G=>{z(G)&&G.preventDefault()},[z]),pointerGraceTimerRef:W,onPointerGraceIntentChange:v.useCallback(G=>{F.current=G},[]),children:f.jsx(q,{...D,children:f.jsx(gh,{asChild:!0,trapped:i,onMountAutoFocus:Be(o,G=>{var M;G.preventDefault(),(M=O.current)==null||M.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:f.jsx(Jc,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:g,onFocusOutside:p,onInteractOutside:_,onDismiss:y,children:f.jsx(ZU,{asChild:!0,...E,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:L,onCurrentTabStopIdChange:j,onEntryFocus:Be(h,G=>{k.isUsingKeyboardRef.current||G.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(hg,{role:"menu","aria-orientation":"vertical","data-state":Mj(C.open),"data-radix-menu-content":"",dir:k.dir,...R,...S,ref:H,style:{outline:"none",...S.style},onKeyDown:Be(S.onKeyDown,G=>{const B=G.target.closest("[data-radix-menu-content]")===G.currentTarget,X=G.ctrlKey||G.altKey||G.metaKey,A=G.key.length===1;B&&(G.key==="Tab"&&G.preventDefault(),!X&&A&&U(G.key));const ie=O.current;if(G.target!==ie||!eV.includes(G.key))return;G.preventDefault();const ee=N().filter(re=>!re.disabled).map(re=>re.ref.current);lj.includes(G.key)&&ee.reverse(),wV(ee)}),onBlur:Be(e.onBlur,G=>{G.currentTarget.contains(G.target)||(window.clearTimeout(Z.current),I.current="")}),onPointerMove:Be(e.onPointerMove,nh(G=>{const M=G.target,B=V.current!==G.clientX;if(G.currentTarget.contains(M)&&B){const X=G.clientX>V.current?"right":"left";$.current=X,V.current=G.clientX}}))})})})})})})});mj.displayName=qi;var fV="MenuGroup",uw=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Ot.div,{role:"group",...r,ref:t})});uw.displayName=fV;var mV="MenuLabel",pj=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Ot.div,{...r,ref:t})});pj.displayName=mV;var Sp="MenuItem",bE="menu.itemSelect",Rg=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,o=v.useRef(null),l=Nh(Sp,e.__scopeMenu),c=lw(Sp,e.__scopeMenu),h=Zt(t,o),d=v.useRef(!1),g=()=>{const p=o.current;if(!n&&p){const _=new CustomEvent(bE,{bubbles:!0,cancelable:!0});p.addEventListener(bE,y=>r==null?void 0:r(y),{once:!0}),a5(p,_),_.defaultPrevented?d.current=!1:l.onClose()}};return f.jsx(gj,{...i,ref:h,disabled:n,onClick:Be(e.onClick,g),onPointerDown:p=>{var _;(_=e.onPointerDown)==null||_.call(e,p),d.current=!0},onPointerUp:Be(e.onPointerUp,p=>{var _;d.current||(_=p.currentTarget)==null||_.click()}),onKeyDown:Be(e.onKeyDown,p=>{const _=c.searchRef.current!=="";n||_&&p.key===" "||Yy.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Rg.displayName=Sp;var gj=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,l=lw(Sp,n),c=uj(n),h=v.useRef(null),d=Zt(t,h),[g,p]=v.useState(!1),[_,y]=v.useState("");return v.useEffect(()=>{const w=h.current;w&&y((w.textContent??"").trim())},[o.children]),f.jsx(th.ItemSlot,{scope:n,disabled:r,textValue:i??_,children:f.jsx(QU,{asChild:!0,...c,focusable:!r,children:f.jsx(Ot.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:d,onPointerMove:Be(e.onPointerMove,nh(w=>{r?l.onItemLeave(w):(l.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Be(e.onPointerLeave,nh(w=>l.onItemLeave(w))),onFocus:Be(e.onFocus,()=>p(!0)),onBlur:Be(e.onBlur,()=>p(!1))})})})}),pV="MenuCheckboxItem",vj=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return f.jsx(wj,{scope:e.__scopeMenu,checked:n,children:f.jsx(Rg,{role:"menuitemcheckbox","aria-checked":Cp(n)?"mixed":n,...i,ref:t,"data-state":hw(n),onSelect:Be(i.onSelect,()=>r==null?void 0:r(Cp(n)?!0:!n),{checkForDefaultPrevented:!1})})})});vj.displayName=pV;var _j="MenuRadioGroup",[gV,vV]=Rl(_j,{value:void 0,onValueChange:()=>{}}),bj=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,o=ls(r);return f.jsx(gV,{scope:e.__scopeMenu,value:n,onValueChange:o,children:f.jsx(uw,{...i,ref:t})})});bj.displayName=_j;var yj="MenuRadioItem",xj=v.forwardRef((e,t)=>{const{value:n,...r}=e,i=vV(yj,e.__scopeMenu),o=n===i.value;return f.jsx(wj,{scope:e.__scopeMenu,checked:o,children:f.jsx(Rg,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":hw(o),onSelect:Be(r.onSelect,()=>{var l;return(l=i.onValueChange)==null?void 0:l.call(i,n)},{checkForDefaultPrevented:!1})})})});xj.displayName=yj;var dw="MenuItemIndicator",[wj,_V]=Rl(dw,{checked:!1}),Sj=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,o=_V(dw,n);return f.jsx(Xi,{present:r||Cp(o.checked)||o.checked===!0,children:f.jsx(Ot.span,{...i,ref:t,"data-state":hw(o.checked)})})});Sj.displayName=dw;var bV="MenuSeparator",Cj=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Ot.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Cj.displayName=bV;var yV="MenuArrow",kj=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Eg(n);return f.jsx(fg,{...i,...r,ref:t})});kj.displayName=yV;var xV="MenuSub",[ooe,Ej]=Rl(xV),Cd="MenuSubTrigger",Rj=v.forwardRef((e,t)=>{const n=Tl(Cd,e.__scopeMenu),r=Nh(Cd,e.__scopeMenu),i=Ej(Cd,e.__scopeMenu),o=lw(Cd,e.__scopeMenu),l=v.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:h}=o,d={__scopeMenu:e.__scopeMenu},g=v.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return v.useEffect(()=>g,[g]),v.useEffect(()=>{const p=c.current;return()=>{window.clearTimeout(p),h(null)}},[c,h]),f.jsx(ow,{asChild:!0,...d,children:f.jsx(gj,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Mj(n.open),...e,ref:y0(t,i.onTriggerChange),onClick:p=>{var _;(_=e.onClick)==null||_.call(e,p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Be(e.onPointerMove,nh(p=>{o.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(o.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),g()},100))})),onPointerLeave:Be(e.onPointerLeave,nh(p=>{var y,w;g();const _=(y=n.content)==null?void 0:y.getBoundingClientRect();if(_){const S=(w=n.content)==null?void 0:w.dataset.side,C=S==="right",k=C?-5:5,R=_[C?"left":"right"],E=_[C?"right":"left"];o.onPointerGraceIntentChange({area:[{x:p.clientX+k,y:p.clientY},{x:R,y:_.top},{x:E,y:_.top},{x:E,y:_.bottom},{x:R,y:_.bottom}],side:S}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(p),p.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Be(e.onKeyDown,p=>{var y;const _=o.searchRef.current!=="";e.disabled||_&&p.key===" "||tV[r.dir].includes(p.key)&&(n.onOpenChange(!0),(y=n.content)==null||y.focus(),p.preventDefault())})})})});Rj.displayName=Cd;var Tj="MenuSubContent",Nj=v.forwardRef((e,t)=>{const n=hj(qi,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=Tl(qi,e.__scopeMenu),l=Nh(qi,e.__scopeMenu),c=Ej(Tj,e.__scopeMenu),h=v.useRef(null),d=Zt(t,h);return f.jsx(th.Provider,{scope:e.__scopeMenu,children:f.jsx(Xi,{present:r||o.open,children:f.jsx(th.Slot,{scope:e.__scopeMenu,children:f.jsx(cw,{id:c.contentId,"aria-labelledby":c.triggerId,...i,ref:d,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:g=>{var p;l.isUsingKeyboardRef.current&&((p=h.current)==null||p.focus()),g.preventDefault()},onCloseAutoFocus:g=>g.preventDefault(),onFocusOutside:Be(e.onFocusOutside,g=>{g.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Be(e.onEscapeKeyDown,g=>{l.onClose(),g.preventDefault()}),onKeyDown:Be(e.onKeyDown,g=>{var y;const p=g.currentTarget.contains(g.target),_=nV[l.dir].includes(g.key);p&&_&&(o.onOpenChange(!1),(y=c.trigger)==null||y.focus(),g.preventDefault())})})})})})});Nj.displayName=Tj;function Mj(e){return e?"open":"closed"}function Cp(e){return e==="indeterminate"}function hw(e){return Cp(e)?"indeterminate":e?"checked":"unchecked"}function wV(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function SV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function CV(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=SV(e,Math.max(o,0));i.length===1&&(l=l.filter(d=>d!==n));const h=l.find(d=>d.toLowerCase().startsWith(i.toLowerCase()));return h!==n?h:void 0}function kV(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,l=t.length-1;o<t.length;l=o++){const c=t[o],h=t[l],d=c.x,g=c.y,p=h.x,_=h.y;g>r!=_>r&&n<(p-d)*(r-g)/(_-g)+d&&(i=!i)}return i}function EV(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return kV(n,t)}function nh(e){return t=>t.pointerType==="mouse"?e(t):void 0}var RV=dj,TV=ow,NV=fj,MV=mj,AV=uw,jV=pj,DV=Rg,OV=vj,LV=bj,zV=xj,PV=Sj,IV=Cj,BV=kj,FV=Rj,HV=Nj,fw="ContextMenu",[$V,aoe]=Co(fw,[cj]),Wr=cj(),[UV,Aj]=$V(fw),jj=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:o=!0}=e,[l,c]=v.useState(!1),h=Wr(t),d=ls(r),g=v.useCallback(p=>{c(p),d(p)},[d]);return f.jsx(UV,{scope:t,open:l,onOpenChange:g,modal:o,children:f.jsx(RV,{...h,dir:i,open:l,onOpenChange:g,modal:o,children:n})})};jj.displayName=fw;var Dj="ContextMenuTrigger",Oj=v.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,o=Aj(Dj,n),l=Wr(n),c=v.useRef({x:0,y:0}),h=v.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...c.current})}),d=v.useRef(0),g=v.useCallback(()=>window.clearTimeout(d.current),[]),p=_=>{c.current={x:_.clientX,y:_.clientY},o.onOpenChange(!0)};return v.useEffect(()=>g,[g]),v.useEffect(()=>void(r&&g()),[r,g]),f.jsxs(f.Fragment,{children:[f.jsx(TV,{...l,virtualRef:h}),f.jsx(Ot.span,{"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Be(e.onContextMenu,_=>{g(),p(_),_.preventDefault()}),onPointerDown:r?e.onPointerDown:Be(e.onPointerDown,vm(_=>{g(),d.current=window.setTimeout(()=>p(_),700)})),onPointerMove:r?e.onPointerMove:Be(e.onPointerMove,vm(g)),onPointerCancel:r?e.onPointerCancel:Be(e.onPointerCancel,vm(g)),onPointerUp:r?e.onPointerUp:Be(e.onPointerUp,vm(g))})]})});Oj.displayName=Dj;var VV="ContextMenuPortal",Lj=e=>{const{__scopeContextMenu:t,...n}=e,r=Wr(t);return f.jsx(NV,{...r,...n})};Lj.displayName=VV;var zj="ContextMenuContent",Pj=v.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Aj(zj,n),o=Wr(n),l=v.useRef(!1);return f.jsx(MV,{...o,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:c=>{var h;(h=e.onCloseAutoFocus)==null||h.call(e,c),!c.defaultPrevented&&l.current&&c.preventDefault(),l.current=!1},onInteractOutside:c=>{var h;(h=e.onInteractOutside)==null||h.call(e,c),!c.defaultPrevented&&!i.modal&&(l.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Pj.displayName=zj;var WV="ContextMenuGroup",qV=v.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(AV,{...i,...r,ref:t})});qV.displayName=WV;var KV="ContextMenuLabel",GV=v.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(jV,{...i,...r,ref:t})});GV.displayName=KV;var YV="ContextMenuItem",Ij=v.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(DV,{...i,...r,ref:t})});Ij.displayName=YV;var XV="ContextMenuCheckboxItem",ZV=v.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(OV,{...i,...r,ref:t})});ZV.displayName=XV;var QV="ContextMenuRadioGroup",JV=v.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(LV,{...i,...r,ref:t})});JV.displayName=QV;var eW="ContextMenuRadioItem",tW=v.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(zV,{...i,...r,ref:t})});tW.displayName=eW;var nW="ContextMenuItemIndicator",rW=v.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(PV,{...i,...r,ref:t})});rW.displayName=nW;var iW="ContextMenuSeparator",sW=v.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(IV,{...i,...r,ref:t})});sW.displayName=iW;var oW="ContextMenuArrow",aW=v.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(BV,{...i,...r,ref:t})});aW.displayName=oW;var lW="ContextMenuSubTrigger",cW=v.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(FV,{...i,...r,ref:t})});cW.displayName=lW;var uW="ContextMenuSubContent",dW=v.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Wr(n);return f.jsx(HV,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});dW.displayName=uW;function vm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var hW=jj,fW=Oj,mW=Lj,Bj=Pj,Fj=Ij;const Hj=hW,$j=fW,mw=v.forwardRef(({className:e,...t},n)=>f.jsx(mW,{children:f.jsx(Bj,{ref:n,className:pe("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg backdrop-blur-md outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...t})}));mw.displayName=Bj.displayName;const kp=v.forwardRef(({className:e,...t},n)=>f.jsx(Fj,{ref:n,className:pe("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));kp.displayName=Fj.displayName;function pw({open:e,onOpenChange:t,position:n,children:r}){return f.jsxs(qM,{open:e,onOpenChange:t,children:[f.jsx(dH,{style:n?{position:"fixed",left:n.x,top:n.y,width:0,height:0}:void 0}),f.jsx(KM,{children:f.jsx(V0,{side:"bottom",align:"start",sideOffset:4,onOpenAutoFocus:i=>i.preventDefault(),className:pe("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg backdrop-blur-md","animate-in fade-in-0 zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"),children:r})})]})}function rh({onSelect:e,className:t,children:n}){return f.jsx("button",{type:"button",className:pe("relative flex w-full cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium outline-hidden transition-colors","hover:bg-accent focus:bg-accent",t),onPointerDown:r=>{r.preventDefault(),e()},children:n})}function pW({onRemove:e,children:t,mobileMenuPosition:n,onMobileMenuClose:r,skipContextMenu:i}){return f.jsxs(f.Fragment,{children:[i?t:f.jsxs(Hj,{children:[f.jsx($j,{asChild:!0,children:t}),f.jsx(mw,{children:f.jsxs(kp,{onSelect:o=>{o.stopPropagation(),e()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[f.jsx(Gd,{className:"h-4 w-4"}),f.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})})]}),f.jsx(pw,{open:!!n,onOpenChange:o=>{o||r==null||r()},position:n??null,children:f.jsxs(rh,{onSelect:()=>{r==null||r(),e()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[f.jsx(Gd,{className:"h-4 w-4"}),f.jsx("span",{children:"Hide"})]})})]})}function gW({onRename:e,onDelete:t,children:n,mobileMenuPosition:r,onMobileMenuClose:i,skipContextMenu:o}){return f.jsxs(f.Fragment,{children:[o?n:f.jsxs(Hj,{children:[f.jsx($j,{asChild:!0,children:n}),f.jsxs(mw,{children:[f.jsxs(kp,{onSelect:l=>{l.stopPropagation(),e()},children:[f.jsx(Bc,{className:"h-4 w-4"}),f.jsx("span",{className:"text-xs font-medium",children:"Rename Feature"})]}),f.jsxs(kp,{onSelect:l=>{l.stopPropagation(),t()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[f.jsx(Gd,{className:"h-4 w-4"}),f.jsx("span",{className:"text-xs font-medium",children:"Delete Feature"})]})]})]}),f.jsxs(pw,{open:!!r,onOpenChange:l=>{l||i==null||i()},position:r??null,children:[f.jsxs(rh,{onSelect:()=>{i==null||i(),e()},children:[f.jsx(Bc,{className:"h-4 w-4"}),f.jsx("span",{children:"Rename Feature"})]}),f.jsxs(rh,{onSelect:()=>{i==null||i(),t()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[f.jsx(Gd,{className:"h-4 w-4"}),f.jsx("span",{children:"Delete Feature"})]})]})]})}function Mh(e){const[t,n]=v.useState(()=>typeof window>"u"?!1:window.matchMedia(e).matches);return v.useEffect(()=>{const r=window.matchMedia(e),i=()=>n(r.matches);return i(),r.addEventListener?(r.addEventListener("change",i),()=>r.removeEventListener("change",i)):(r.addListener(i),()=>r.removeListener(i))},[e]),t}function Uj({iconDataUrl:e,alt:t,className:n,fallback:r=null}){return e?f.jsx("img",{src:e,alt:t,className:pe("shrink-0 object-contain",n)}):f.jsx(f.Fragment,{children:r})}const yE=e=>{let t;const n=new Set,r=(d,g)=>{const p=typeof d=="function"?d(t):d;if(!Object.is(p,t)){const _=t;t=g??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(y=>y(t,_))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>h,subscribe:d=>(n.add(d),()=>n.delete(d))},h=t=e(r,i,c);return c},vW=e=>e?yE(e):yE,_W=e=>e;function bW(e,t=_W){const n=we.useSyncExternalStore(e.subscribe,we.useCallback(()=>t(e.getState()),[e,t]),we.useCallback(()=>t(e.getInitialState()),[e,t]));return we.useDebugValue(n),n}const yW=e=>{const t=vW(e),n=r=>bW(t,r);return Object.assign(n,t),n},Eo=e=>yW;function xW(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var o;const l=h=>h===null?null:JSON.parse(h,void 0),c=(o=n.getItem(i))!=null?o:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,o)=>n.setItem(i,JSON.stringify(o,void 0)),removeItem:i=>n.removeItem(i)}}const Xy=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Xy(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Xy(r)(n)}}}},wW=(e,t)=>(n,r,i)=>{let o={storage:xW(()=>window.localStorage),partialize:C=>C,version:0,merge:(C,k)=>({...k,...C}),...t},l=!1,c=0;const h=new Set,d=new Set;let g=o.storage;if(!g)return e((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...C)},r,i);const p=()=>{const C=o.partialize({...r()});return g.setItem(o.name,{state:C,version:o.version})},_=i.setState;i.setState=(C,k)=>(_(C,k),p());const y=e((...C)=>(n(...C),p()),r,i);i.getInitialState=()=>y;let w;const S=()=>{var C,k;if(!g)return;const R=++c;l=!1,h.forEach(N=>{var L;return N((L=r())!=null?L:y)});const E=((k=o.onRehydrateStorage)==null?void 0:k.call(o,(C=r())!=null?C:y))||void 0;return Xy(g.getItem.bind(g))(o.name).then(N=>{if(N)if(typeof N.version=="number"&&N.version!==o.version){if(o.migrate){const L=o.migrate(N.state,N.version);return L instanceof Promise?L.then(j=>[!0,j]):[!0,L]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,N.state];return[!1,void 0]}).then(N=>{var L;if(R!==c)return;const[j,O]=N;if(w=o.merge(O,(L=r())!=null?L:y),n(w,!0),j)return p()}).then(()=>{R===c&&(E==null||E(r(),void 0),w=r(),l=!0,d.forEach(N=>N(w)))}).catch(N=>{R===c&&(E==null||E(void 0,N))})};return i.persist={setOptions:C=>{o={...o,...C},C.storage&&(g=C.storage)},clearStorage:()=>{g==null||g.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:C=>(h.add(C),()=>{h.delete(C)}),onFinishHydration:C=>(d.add(C),()=>{d.delete(C)})},o.skipHydration||S(),w||y},Ro=wW,_n=Eo()(Ro(e=>({themePreference:"system",themeId:"default",customAppearance:"system",backgroundImage:null,backgroundOpacity:1,backgroundBlur:0,showProjectIconsInSidebar:!0,availableThemes:[],themeCssText:"",setThemePreference:t=>e({themePreference:t}),setThemeId:t=>e({themeId:t}),setCustomAppearance:t=>e({customAppearance:t}),setBackgroundImage:t=>e({backgroundImage:t}),setBackgroundOpacity:t=>e({backgroundOpacity:t}),setBackgroundBlur:t=>e({backgroundBlur:t}),setShowProjectIconsInSidebar:t=>e({showProjectIconsInSidebar:t}),setAvailableThemes:t=>e({availableThemes:t}),setThemeCssText:t=>e({themeCssText:t})}),{name:"theme-settings"})),Vj=8;function Zy(e,t){return!e.has(t)}function Cb(e,t,n){const r=e.map(l=>l.featureId),i=r.indexOf(t),o=r.indexOf(n);return i===-1||o===-1||i===o?null:wg(r,i,o)}function SW(e){return{activeFeatures:e.filter(t=>t.stage!=="done"),completedFeatures:e.filter(t=>t.stage==="done")}}function CW(e,t){return t?e:e.slice(0,Vj)}function kW(e,t){return e.map(n=>`feature:${n.featureId}`).filter(n=>!t.has(n))}function xE({feature:e,groupKey:t,collapsedSections:n,onToggleSection:r,renderChatRow:i,onNewLocalChat:o,onRenameFeature:l,onDeleteFeature:c,onSetFeatureBrowserState:h,onSetFeatureStage:d,kanbanStatusesEnabled:g=!0,showFeatureOverviewInSidebar:p=!1,activeOverviewFeatureId:_=null,onOpenFeatureOverview:y,showAllChats:w,onToggleShowAllChats:S,draggedFeatureId:C,draggedChatId:k,hoveredDropTarget:R,isTouchDevice:E,onFeatureDragStart:N,onFeatureDragEnd:L,onFeatureDrop:j,onChatDrop:O,onTouchDragMove:H,onTouchDragEnd:Z,onChatDragStart:I,onChatDragEnd:W}){const F=`feature:${e.featureId}`,$=Zy(n,F),V=k!==null,q=CW(e.chats,w),D=Math.max(0,e.chats.length-Vj),U=D>0,z=_===e.featureId,[G,M]=v.useState(null);function B(){r(F),h==null||h(e.featureId,$?"CLOSED":"OPEN")}const X=v.useRef(null),{touchRef:A,isDragging:ie,isArmed:J,dragPosition:ee}=q0({enabled:E,visualElementRef:X,onTap:B,onContextMenu:ge=>M(ge),onDragStart:()=>N(e.featureId),onDragMove:({x:ge,y:Ce,elementBelow:Te})=>H(ge,Ce,Te),onDragEnd:({x:ge,y:Ce,elementBelow:Te})=>Z(ge,Ce,Te)}),re=C===e.featureId||ie,ue=f.jsxs("div",{ref:X,"data-feature-drop-target":e.featureId,onDragOver:E?void 0:ge=>{if(C&&C!==e.featureId){ge.preventDefault();return}V&&ge.preventDefault()},onDrop:E?void 0:ge=>{if(ge.preventDefault(),C&&C!==e.featureId){j(C,e.featureId);return}k&&O(k,e.featureId)},className:pe("rounded-lg border border-border/60 bg-muted/10 transition-all duration-150 select-none",V&&!E&&"border-dashed hover:border-primary/60 hover:bg-primary/5",R===e.featureId&&"border-primary/60 bg-primary/5",J&&"scale-[1.03] shadow-md ring-2 ring-primary/50 bg-card",re&&!J&&"opacity-20 scale-[0.98]"),children:[f.jsxs("div",{ref:E?A:void 0,className:"flex items-center gap-2 px-2 py-1.5",children:[E?f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button","data-no-touch-drag":!0,onClick:B,className:"flex shrink-0 items-center",children:f.jsx(Vr,{className:pe("size-3 transition-transform",$&&"rotate-90")})}),f.jsx(ub,{className:"size-3.5 shrink-0 text-muted-foreground"}),f.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e.title})]}):f.jsxs("button",{type:"button",onClick:B,draggable:!0,"data-feature-drag-handle":e.featureId,onDragStart:()=>N(e.featureId),onDragEnd:L,className:"flex min-w-0 flex-1 basis-0 items-center gap-2 text-left",children:[f.jsx(Vr,{className:pe("size-3 transition-transform",$&&"rotate-90")}),f.jsx(ub,{className:"size-3.5 text-muted-foreground"}),f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:f.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e.title})}),f.jsx(os,{side:"right",sideOffset:4,children:e.title})]})]}),g?f.jsxs(Er,{value:e.stage,onValueChange:ge=>d==null?void 0:d(e.featureId,ge),children:[f.jsx(cr,{"data-no-touch-drag":!0,className:pe("h-7 w-auto min-w-[70px] shrink-0 items-center gap-1 rounded-full px-2 pr-1.5 text-[10px] font-semibold leading-none tracking-[0.04em] shadow-none focus:ring-0 focus:ring-offset-0 [&>span]:flex [&>span]:items-center [&>span]:leading-none [&>svg]:size-3 [&>svg]:shrink-0 [&>svg]:translate-y-0 [&>svg]:opacity-60",vE[e.stage]),children:f.jsx(jr,{children:rE[e.stage]})}),f.jsx(ur,{children:eH.map(ge=>f.jsx(Ht,{value:ge,className:pe("text-[11px] font-medium",ge===e.stage&&vE[ge]),children:rE[ge]},ge))})]}):null,o?f.jsx(Qe,{variant:"ghost",size:"icon",className:"h-6 w-6","data-no-touch-drag":!0,onClick:()=>o(t,e.featureId),title:"New chat in feature",children:f.jsx(q5,{className:"size-3.5"})}):null]}),$?f.jsxs("div",{className:"space-y-[2px] border-t border-border/50 p-1 pl-3",children:[p&&e.overviewRelativePath?f.jsxs("button",{type:"button",onClick:()=>y==null?void 0:y(e.featureId),className:pe("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors",z?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"),children:[f.jsx(j8,{className:"size-3.5 shrink-0"}),f.jsx("span",{className:"truncate",children:"overview.md"})]}):null,q.map(ge=>i(ge,{draggable:!0,onDragStart:Ce=>I(Ce.chatId),onDragEnd:W,isTouchDevice:E,onTouchDragMove:H,onTouchDragEnd:Z})),U?f.jsx("div",{className:"pt-1",children:f.jsx(Qe,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground",onClick:S,children:w?"Show less":`Show ${D} more`})}):null]}):null]}),fe=f.jsxs(XM,{position:ee,children:[f.jsx(ub,{className:"size-3.5 shrink-0 text-primary"}),f.jsx("span",{className:"text-sm font-medium truncate",children:e.title})]});return c?f.jsxs(f.Fragment,{children:[f.jsx(gW,{onRename:()=>l==null?void 0:l(e.featureId),onDelete:()=>c(e.featureId),mobileMenuPosition:G,onMobileMenuClose:()=>M(null),skipContextMenu:E,children:ue}),fe]}):f.jsxs(f.Fragment,{children:[ue,fe]})}function EW({group:e,collapsedSections:t,onToggleSection:n,renderChatRow:r,onNewLocalChat:i,onCreateFeature:o,onRenameFeature:l,onDeleteFeature:c,onSetProjectBrowserState:h,onSetProjectGeneralChatsBrowserState:d,onSetFeatureBrowserState:g,onSetFeatureStage:p,onSetChatFeature:_,onReorderFeatures:y,onRemoveProject:w,isConnected:S,startingLocalPath:C,folderGroupsEnabled:k=!0,showFeatureOverviewInSidebar:R=!1,kanbanStatusesEnabled:E=!0,activeOverviewFeatureId:N=null,onOpenFeatureOverview:L}){const j=_n(Ae=>Ae.showProjectIconsInSidebar),{groupKey:O,localPath:H,features:Z,generalChats:I}=e,{activeFeatures:W,completedFeatures:F}=v.useMemo(()=>SW(Z),[Z]),$=`project:${O}`,V=`general:${O}`,q=Zy(t,$),D=Z.length===0||Zy(t,V),[U,z]=v.useState(null),[G,M]=v.useState(null),[B,X]=v.useState(null),[A,ie]=v.useState(!1),[J,ee]=v.useState(!1),[re,ue]=v.useState({}),[fe,ge]=v.useState(null),Ce=Mh("(pointer: coarse)"),Te=k&&!A?I.slice(0,10):I,je=k&&I.length>10,{attributes:Xe,listeners:xt,setNodeRef:Et,setActivatorNodeRef:me,transform:Fe,transition:De,isDragging:ft}=cU({id:O}),at=v.useRef(null),it={transform:Jd.Translate.toString(Fe),transition:De};function hn(){n($),h==null||h(O,q?"CLOSED":"OPEN")}function Mt(){n(V),d==null||d(O,D?"CLOSED":"OPEN")}function Pn(Ae){ue(He=>({...He,[Ae]:!He[Ae]}))}function de(Ae){Ae.stopPropagation();for(const He of kW(Z,t))n(He);for(const He of Z)g==null||g(He.featureId,"CLOSED")}function se(Ae){if(!Ae)return null;const He=Ae.closest("[data-feature-drop-target]");return He?{type:"feature",featureId:He.getAttribute("data-feature-drop-target")}:Ae.closest(`[data-general-chats-drop-target="${O}"]`)?{type:"general"}:null}function ye(Ae,He,mt){const Ve=at.current;if(Ve){const rn=Ve.getBoundingClientRect(),et=60;He<rn.top+et?Ve.scrollBy(0,-6):He>rn.bottom-et&&Ve.scrollBy(0,6)}const fn=se(mt);X((fn==null?void 0:fn.type)==="feature"?fn.featureId:null)}function Ee(Ae,He,mt){const Ve=se(mt);if(G){if((Ve==null?void 0:Ve.type)==="feature"&&Ve.featureId!==G&&y){const fn=Cb(Z,G,Ve.featureId);fn&&y(O,fn)}M(null)}else U&&_&&((Ve==null?void 0:Ve.type)==="feature"?_(U,Ve.featureId):(Ve==null?void 0:Ve.type)==="general"&&_(U,null),z(null));X(null)}const qe=v.useRef(null),{touchRef:lt}=q0({enabled:Ce&&!!w,onTap:hn,onContextMenu:Ae=>ge(Ae)}),Je=f.jsxs("div",{ref:Ae=>{me(Ae),qe.current=Ae,Ce&&w&&lt(Ae)},className:pe("sticky top-0 bg-background dark:bg-card z-10 relative p-[10px] flex items-center justify-between cursor-grab active:cursor-grabbing select-none",ft&&"cursor-grabbing"),onClick:Ce?void 0:hn,...xt,children:[f.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[f.jsx("span",{className:"relative size-3.5 shrink-0 cursor-pointer",children:f.jsx(Vr,{className:pe("translate-y-[1px] size-3.5 shrink-0 text-slate-400 transition-transform duration-200",q&&"rotate-90")})}),j?f.jsx(Uj,{iconDataUrl:e.iconDataUrl,alt:`${e.title||vp(H)} icon`,className:"size-5",fallback:f.jsx("span",{className:"size-5 shrink-0","aria-hidden":"true"})}):null,f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:f.jsx("span",{className:"truncate max-w-[180px] whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.title||vp(H)})}),f.jsx(os,{side:"right",sideOffset:4,children:H})]})]}),f.jsxs("div",{className:"absolute right-2 flex items-center gap-1",children:[o?f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:f.jsx(Qe,{variant:"ghost",size:"icon",className:"h-5.5 w-5.5 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100","data-no-touch-drag":!0,onClick:Ae=>{Ae.stopPropagation(),o(O)},children:f.jsx(F5,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),f.jsx(os,{side:"right",sideOffset:4,children:"New feature"})]}):null,Z.length>0?f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:f.jsx(Qe,{variant:"ghost",size:"icon",className:"h-5.5 w-5.5 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100","data-no-touch-drag":!0,onClick:de,children:f.jsx(o8,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),f.jsx(os,{side:"right",sideOffset:4,children:"Close all feature folders"})]}):null,i?f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:f.jsx(Qe,{variant:"ghost",size:"icon",className:pe("h-5.5 w-5.5 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100",(!S||C===H)&&"opacity-50 cursor-not-allowed"),disabled:!S||C===H,"data-no-touch-drag":!0,onClick:Ae=>{Ae.stopPropagation(),i(O)},children:C===H?f.jsx(Lr,{className:"size-4 text-slate-500 dark:text-slate-400 animate-spin"}):f.jsx(q5,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),f.jsx(os,{side:"right",sideOffset:4,children:S?"New general chat":`Start ${Dn} to connect`})]}):null]})]});return f.jsxs("div",{ref:Ae=>{Et(Ae),at.current=(Ae==null?void 0:Ae.closest("[data-sidebar-scroll]"))??null},style:it,className:pe("group/section",ft&&"opacity-50 shadow-lg z-50 relative"),...Xe,children:[w?f.jsx(pW,{onRemove:()=>w(O),mobileMenuPosition:fe,onMobileMenuClose:()=>ge(null),skipContextMenu:Ce,children:Je}):Je,q?f.jsxs("div",{className:"mb-2 space-y-2",children:[k&&W.length>0?f.jsx("section",{className:"space-y-2 pl-6",children:W.map(Ae=>f.jsx(xE,{feature:Ae,groupKey:O,collapsedSections:t,onToggleSection:n,renderChatRow:r,onNewLocalChat:i,onRenameFeature:l,onDeleteFeature:c,onSetFeatureBrowserState:g,onSetFeatureStage:p,kanbanStatusesEnabled:E,showFeatureOverviewInSidebar:R,activeOverviewFeatureId:N,onOpenFeatureOverview:L,showAllChats:!!re[Ae.featureId],onToggleShowAllChats:()=>Pn(Ae.featureId),draggedFeatureId:G,draggedChatId:U,hoveredDropTarget:B,isTouchDevice:Ce,onFeatureDragStart:He=>M(He),onFeatureDragEnd:()=>M(null),onFeatureDrop:(He,mt)=>{const Ve=Cb(Z,He,mt);M(null),Ve&&(y==null||y(O,Ve))},onChatDrop:(He,mt)=>{_==null||_(He,mt),z(null)},onTouchDragMove:ye,onTouchDragEnd:Ee,onChatDragStart:He=>z(He),onChatDragEnd:()=>z(null)},Ae.featureId))}):null,k&&F.length>0?f.jsxs("section",{className:"pl-6",children:[f.jsxs("button",{type:"button",onClick:()=>ee(Ae=>!Ae),className:"flex w-full items-center gap-2 px-2 py-1 text-left text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:[f.jsx(Vr,{className:pe("size-3 transition-transform",J&&"rotate-90")}),f.jsx("span",{children:J?"Hide completed":"Show completed"}),f.jsx("span",{className:"ml-auto",children:F.length})]}),J?f.jsx("div",{className:"space-y-2 pt-1",children:F.map(Ae=>f.jsx(xE,{feature:Ae,groupKey:O,collapsedSections:t,onToggleSection:n,renderChatRow:r,onNewLocalChat:i,onRenameFeature:l,onDeleteFeature:c,onSetFeatureBrowserState:g,onSetFeatureStage:p,kanbanStatusesEnabled:E,showFeatureOverviewInSidebar:R,activeOverviewFeatureId:N,onOpenFeatureOverview:L,showAllChats:!!re[Ae.featureId],onToggleShowAllChats:()=>Pn(Ae.featureId),draggedFeatureId:G,draggedChatId:U,hoveredDropTarget:B,isTouchDevice:Ce,onFeatureDragStart:He=>M(He),onFeatureDragEnd:()=>M(null),onFeatureDrop:(He,mt)=>{const Ve=Cb(Z,He,mt);M(null),Ve&&(y==null||y(O,Ve))},onChatDrop:(He,mt)=>{_==null||_(He,mt),z(null)},onTouchDragMove:ye,onTouchDragEnd:Ee,onChatDragStart:He=>z(He),onChatDragEnd:()=>z(null)},Ae.featureId))}):null]}):null,I.length>0?f.jsxs("section",{"data-general-chats-drop-target":O,onDragOver:U&&!Ce?Ae=>Ae.preventDefault():void 0,onDrop:U&&!Ce&&_?Ae=>{Ae.preventDefault(),_(U,null),z(null)}:void 0,children:[k?f.jsxs("button",{type:"button",onClick:Mt,className:"flex w-full items-center gap-2 px-4 py-1 text-left text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:[f.jsx(Vr,{className:pe("size-3 transition-transform",D&&"rotate-90")}),f.jsx("span",{children:"General Chats"}),f.jsx("span",{className:"ml-auto",children:I.length})]}):null,!k||D?f.jsxs("div",{className:pe("space-y-[2px]",k?"pl-7":"pl-4"),children:[Te.map(Ae=>r(Ae,{draggable:!0,onDragStart:He=>z(He.chatId),onDragEnd:()=>z(null),isTouchDevice:Ce,onTouchDragMove:ye,onTouchDragEnd:Ee})),je?f.jsx("div",{className:"pt-1",children:f.jsx(Qe,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground",onClick:()=>ie(Ae=>!Ae),children:A?"Show less":`Show ${I.length-10} more`})}):null]}):null]}):null]}):null]})}function RW({projectGroups:e,collapsedSections:t,onToggleSection:n,onSetProjectBrowserState:r,onSetProjectGeneralChatsBrowserState:i,renderChatRow:o,onNewLocalChat:l,onCreateFeature:c,onRenameFeature:h,onDeleteFeature:d,onSetFeatureBrowserState:g,onSetFeatureStage:p,onSetChatFeature:_,onReorderFeatures:y,onRemoveProject:w,onReorderGroups:S,isConnected:C,startingLocalPath:k,folderGroupsEnabled:R=!0,showFeatureOverviewInSidebar:E=!1,kanbanStatusesEnabled:N=!0,activeOverviewFeatureId:L=null,onOpenFeatureOverview:j}){const O=FH(_b(tw,{activationConstraint:{distance:8}}),_b(lA,{activationConstraint:{delay:250,tolerance:5}}),_b(J0)),H=v.useMemo(()=>e.map(F=>F.groupKey),[e]),Z=v.useRef(null);function I(F){const $=F.active.id;t.has($)?Z.current=null:(Z.current=$,n($))}function W(F){const{active:$,over:V}=F;if(V&&$.id!==V.id&&S){const q=H.indexOf($.id),D=H.indexOf(V.id);q!==-1&&D!==-1&&S(wg(H,q,D))}if(Z.current){const q=Z.current;Z.current=null,requestAnimationFrame(()=>n(q))}}return f.jsx(U$,{sensors:O,collisionDetection:WH,onDragStart:I,onDragEnd:W,children:f.jsx(nU,{items:H,strategy:eU,children:e.map(F=>f.jsx(EW,{group:F,collapsedSections:t,onToggleSection:n,onSetProjectBrowserState:r,onSetProjectGeneralChatsBrowserState:i,renderChatRow:o,onNewLocalChat:l,onCreateFeature:c,onRenameFeature:h,onDeleteFeature:d,onSetFeatureBrowserState:g,onSetFeatureStage:p,onSetChatFeature:_,onReorderFeatures:y,onRemoveProject:w,onReorderGroups:S,isConnected:C,startingLocalPath:k,folderGroupsEnabled:R,showFeatureOverviewInSidebar:E,kanbanStatusesEnabled:N,activeOverviewFeatureId:L,onOpenFeatureOverview:j},F.groupKey))})})}const Wj=`${gg}provider-usage-collapsed`,qj=`${gg}provider-usage-mode`,TW=pa.map(e=>e.id),NW=["claude","codex"],Qy=Object.fromEntries(pa.map(e=>[e.id,e.label]));function wE(e){return e===null?"bg-muted":e>=90?"bg-red-500":e>=75?"bg-amber-500":"bg-emerald-500"}function kb(e){return e===null?"N/A":`${e.toFixed(1)}%`}function SE(e,t){if(t!=null&&t.trim())return`Resets ${t.trim()}`;if(e===null)return null;const n=Date.now();if(e<=n)return"Limit may have reset";const r=e-n,i=Math.ceil(r/6e4);return i<60?`Resets in ${i} min`:`Resets at ${new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}function MW(){try{return localStorage.getItem(Wj)==="true"}catch{return!1}}function AW(){try{return localStorage.getItem(qj)==="weekly"?"weekly":"session"}catch{return"session"}}function jW(e){try{localStorage.setItem(Wj,String(e))}catch{}}function DW(e){try{localStorage.setItem(qj,e)}catch{}}function CE(e){const{entry:t,mode:n,isPending:r,onRefreshProviderUsage:i,onOpenProviderLogin:o}=e,l=gp[t.provider],c=e.labelOverride??Qy[t.provider],h=t.availability==="unavailable",d=t.availability==="login_required",g=t.availability==="stale",p=t.provider==="cursor",_=e.percentOverride!==void 0?e.percentOverride:n==="weekly"?t.weeklyLimitUsedPercent??null:t.sessionLimitUsedPercent,y=_,w=p?null:n==="weekly"?SE(t.weeklyRateLimitResetAt??null,t.weeklyRateLimitResetLabel??null):SE(t.rateLimitResetAt,t.rateLimitResetLabel),S=[];d?S.push("Login required to fetch Cursor usage"):h?S.push("Usage data unavailable"):(e.bars?S.push("Cursor limit usage"):_!==null&&S.push(`${kb(_)} of ${n} limit used`),w&&S.push(w),g&&S.push("Data may be outdated"),S.length===0&&S.push("No usage data yet")),t.statusDetail&&S.push(t.statusDetail.replaceAll("_"," "));const C=!e.hideActions&&p&&d,k=p&&!e.hideActions&&h&&!d&&t.statusDetail!=="unsupported_platform";return f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:f.jsxs("div",{className:pe("flex flex-col",g&&"opacity-50"),children:[f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded-md",children:[f.jsx(l,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),f.jsx("span",{className:"text-[11px] text-muted-foreground w-11 shrink-0",children:c}),h&&!e.bars?f.jsx("span",{className:"text-[10px] text-muted-foreground/60 ml-auto",children:"N/A"}):e.bars?f.jsx("div",{className:"flex-1"}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden min-w-0",children:y!==null?f.jsx("div",{className:pe("h-full rounded-full transition-all",wE(y)),style:{width:`${Math.min(100,Math.max(0,y))}%`}}):null}),f.jsx("span",{className:"text-[10px] tabular-nums text-muted-foreground w-7 text-right shrink-0",children:kb(y)})]}),C?f.jsx("button",{type:"button",disabled:r,onClick:R=>{R.stopPropagation(),o==null||o("cursor")},className:"ml-auto rounded border border-border/70 px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-50",children:"Sign In"}):null,k?f.jsxs("button",{type:"button",disabled:r,onClick:R=>{R.stopPropagation(),i==null||i("cursor")},className:"flex items-center gap-1 rounded border border-border/70 px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-50",children:[r&&f.jsx(op,{className:"h-2 w-2 animate-spin"}),r?"Checking":"Refresh"]}):null]}),e.bars&&f.jsx("div",{className:"flex flex-col gap-1 pb-1",children:e.bars.map((R,E)=>f.jsxs("div",{className:"flex items-center gap-2 pl-7 pr-2",children:[f.jsx("span",{className:"text-[10px] text-muted-foreground w-12 shrink-0",children:R.label}),h?f.jsx("span",{className:"text-[10px] text-muted-foreground/60 ml-auto",children:"N/A"}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden min-w-0",children:R.percent!==null?f.jsx("div",{className:pe("h-full rounded-full transition-all",wE(R.percent)),style:{width:`${Math.min(100,Math.max(0,R.percent))}%`}}):null}),f.jsx("span",{className:"text-[10px] tabular-nums text-muted-foreground w-7 text-right shrink-0",children:kb(R.percent)})]})]},E))})]})}),f.jsx(os,{side:"right",className:"max-w-48",children:S.map((R,E)=>f.jsx("div",{className:"text-xs",children:R},E))})]})}function OW({providerUsage:e,visibleProviders:t=TW,onRefreshProviderUsage:n,onOpenProviderLogin:r}){const[i,o]=v.useState(MW),[l,c]=v.useState(AW),[h,d]=v.useState(null),g=()=>{o(_=>{const y=!_;return jW(y),y})},p=async()=>{d("all");try{await(n==null?void 0:n()),Ec("Usage checked successfully.")}catch{Ec("Failed to check usage.")}finally{d(_=>_==="all"?null:_)}};return f.jsxs("div",{className:"px-1 pb-1.5",children:[f.jsxs("div",{className:"flex items-center gap-2 px-2 pb-0.5",children:[f.jsxs("button",{type:"button",onClick:g,className:"flex min-w-0 flex-1 items-center gap-1 text-left group",children:[i?f.jsx(Vr,{className:"h-3 w-3 text-muted-foreground/40 group-hover:text-muted-foreground transition-colors"}):f.jsx(ng,{className:"h-3 w-3 text-muted-foreground/40 group-hover:text-muted-foreground transition-colors"}),f.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 font-medium group-hover:text-muted-foreground transition-colors",children:"Provider Usage"})]}),!i&&f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("button",{type:"button",onClick:p,disabled:h==="all",className:"shrink-0 rounded-md border border-border/70 bg-muted/40 p-1 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors disabled:opacity-50",title:"Refresh usages",children:f.jsx(op,{className:pe("h-3 w-3",h==="all"&&"animate-spin")})}),f.jsx("button",{type:"button",onClick:()=>{c(_=>{const y=_==="session"?"weekly":"session";return DW(y),y})},className:"shrink-0 rounded-md border border-border/70 bg-muted/40 px-2 py-0.5 text-[10px] uppercase tracking-wider text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",children:l==="session"?"Session":"Weekly"})]})]}),!i&&(l==="weekly"?NW:t).flatMap(_=>{const y=(e==null?void 0:e[_])??{provider:_,sessionLimitUsedPercent:null,apiLimitUsedPercent:null,rateLimitResetAt:null,rateLimitResetLabel:null,weeklyLimitUsedPercent:null,weeklyRateLimitResetAt:null,weeklyRateLimitResetLabel:null,statusDetail:null,availability:"unavailable",lastRequestedAt:null,updatedAt:null,warnings:[]},w=async C=>{d(C);try{await(n==null?void 0:n(C)),Ec(`${Qy[C]??"Provider"} usage checked successfully.`)}catch{Ec(`Failed to check ${Qy[C]??"provider"} usage.`)}finally{d(k=>k===C?null:k)}},S=C=>{d(C),Promise.resolve(r==null?void 0:r(C)).finally(()=>{d(k=>k===C?null:k)})};return _==="cursor"&&l==="session"?[f.jsx(CE,{entry:y,mode:l,isPending:h==="cursor",bars:[{label:"API",percent:y.apiLimitUsedPercent??null},{label:"Composer",percent:y.sessionLimitUsedPercent}],onRefreshProviderUsage:w,onOpenProviderLogin:S},"cursor")]:[f.jsx(CE,{entry:y,mode:l,isPending:h===_||h==="all",onRefreshProviderUsage:w,onOpenProviderLogin:S},_)]})]})}function LW(e){return e==="gpt-5-codex"?"gpt-5.3-codex":e??"gpt-5.4"}function zW(e){return e==="claude"||e==="codex"||e==="gemini"||e==="cursor"?e:"last_used"}function ol(e){var o,l;const t=(o=e==null?void 0:e.modelOptions)==null?void 0:o.reasoningEffort,n=eE(t)?t:eE(e==null?void 0:e.effort)?e.effort:DM.reasoningEffort,r=(e==null?void 0:e.model)??un("claude").defaultModel,i=JF(r,(l=e==null?void 0:e.modelOptions)==null?void 0:l.contextWindow);return{model:r,modelOptions:{reasoningEffort:r!=="opus"&&n==="max"?"high":n,...i?{contextWindow:i}:{}},planMode:!!(e!=null&&e.planMode)}}function al(e){var r,i;const t=Vi("codex"),n=(r=e==null?void 0:e.modelOptions)==null?void 0:r.reasoningEffort;return{model:LW((e==null?void 0:e.model)??un("codex").defaultModel),modelOptions:{reasoningEffort:tE(n)?n:tE(e==null?void 0:e.effort)?e.effort:t.reasoningEffort,fastMode:typeof((i=e==null?void 0:e.modelOptions)==null?void 0:i.fastMode)=="boolean"?e.modelOptions.fastMode:t.fastMode},planMode:!!(e!=null&&e.planMode)}}function Tc(e){var n;const t=Vi("gemini");return{model:(e==null?void 0:e.model)??un("gemini").defaultModel,modelOptions:{thinkingMode:GF((n=e==null?void 0:e.modelOptions)==null?void 0:n.thinkingMode)?e.modelOptions.thinkingMode:t.thinkingMode},planMode:!!(e!=null&&e.planMode)}}function ll(e){return e==null||e.modelOptions,{model:KF((e==null?void 0:e.model)??un("cursor").defaultModel),modelOptions:{...Vi("cursor")},planMode:!!(e!=null&&e.planMode)}}function PW(){return{claude:{model:un("claude").defaultModel,modelOptions:{...Vi("claude")},planMode:!1},codex:{model:un("codex").defaultModel,modelOptions:{...Vi("codex")},planMode:!1},gemini:{model:un("gemini").defaultModel,modelOptions:{...Vi("gemini")},planMode:!1},cursor:{model:un("cursor").defaultModel,modelOptions:{...Vi("cursor")},planMode:!1}}}function IW(e){return{claude:ol(e==null?void 0:e.claude),codex:al(e==null?void 0:e.codex),gemini:Tc(e==null?void 0:e.gemini),cursor:ll(e==null?void 0:e.cursor)}}function kE(e,t){if(t===void 0){console.info(`[chat-preferences] ${e}`);return}console.info(`[chat-preferences] ${e}`,t)}function Jy(e,t){if(e==="claude"){const r=t.claude;return{provider:"claude",model:r.model,modelOptions:{...r.modelOptions},planMode:r.planMode}}if(e==="gemini"){const r=t.gemini;return{provider:"gemini",model:r.model,modelOptions:{...r.modelOptions},planMode:r.planMode}}if(e==="cursor"){const r=t.cursor;return{provider:"cursor",model:r.model,modelOptions:{...r.modelOptions},planMode:r.planMode}}const n=t.codex;return{provider:"codex",model:n.model,modelOptions:{...n.modelOptions},planMode:n.planMode}}function BW(e,t,n,r){if((e==null?void 0:e.provider)==="claude"){const i=ol(e);return{provider:"claude",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}if((e==null?void 0:e.provider)==="codex"){const i=al(e);return{provider:"codex",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}if((e==null?void 0:e.provider)==="gemini"){const i=Tc(e);return{provider:"gemini",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}if((e==null?void 0:e.provider)==="cursor"){const i=ll(e);return{provider:"cursor",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}if(n==="claude"){const i=ol(r==null?void 0:r.claude);return{provider:"claude",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}if(n==="codex"){const i=al(r==null?void 0:r.codex);return{provider:"codex",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}if(n==="cursor"){const i=ll(r==null?void 0:r.cursor);return{provider:"cursor",model:i.model,modelOptions:i.modelOptions,planMode:i.planMode}}return Jy("claude",t)}function FW(e){const t=IW(e==null?void 0:e.providerDefaults);return{defaultProvider:zW(e==null?void 0:e.defaultProvider),providerDefaults:t,showProviderIconsInSideTray:(e==null?void 0:e.showProviderIconsInSideTray)===!0,composerState:BW(e==null?void 0:e.composerState,t,e==null?void 0:e.liveProvider,e==null?void 0:e.livePreferences)}}const Ii=Eo()(Ro(e=>({defaultProvider:"last_used",providerDefaults:PW(),showProviderIconsInSideTray:!1,composerState:{provider:"claude",model:un("claude").defaultModel,modelOptions:{...Vi("claude")},planMode:!1},setDefaultProvider:t=>e({defaultProvider:t}),setShowProviderIconsInSideTray:t=>e({showProviderIconsInSideTray:t}),setProviderDefaultModel:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:t==="claude"?ol({...r.providerDefaults.claude,model:n}):t==="gemini"?Tc({...r.providerDefaults.gemini,model:n}):t==="cursor"?ll({...r.providerDefaults.cursor,model:n}):al({...r.providerDefaults.codex,model:n})}})),setProviderDefaultModelOptions:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:t==="claude"?ol({...r.providerDefaults.claude,modelOptions:{...r.providerDefaults.claude.modelOptions,...n}}):t==="gemini"?Tc({...r.providerDefaults.gemini,modelOptions:{...r.providerDefaults.gemini.modelOptions,...n}}):t==="cursor"?ll({...r.providerDefaults.cursor,modelOptions:{...r.providerDefaults.cursor.modelOptions,...n}}):al({...r.providerDefaults.codex,modelOptions:{...r.providerDefaults.codex.modelOptions,...n}})}})),setProviderDefaultPlanMode:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:{...r.providerDefaults[t],planMode:n}}})),setComposerProvider:t=>e(n=>({composerState:{...n.composerState,provider:t}})),setComposerModel:t=>e(n=>n.composerState.provider==="claude"?{composerState:{provider:"claude",model:t,modelOptions:ol({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="gemini"?{composerState:{provider:"gemini",model:t,modelOptions:Tc({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="cursor"?{composerState:{provider:"cursor",model:t,modelOptions:ll({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}:{composerState:{provider:"codex",model:t,modelOptions:al({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}),setComposerModelOptions:t=>e(n=>n.composerState.provider==="claude"?{composerState:{provider:"claude",model:n.composerState.model,modelOptions:ol({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="gemini"?{composerState:{provider:"gemini",model:n.composerState.model,modelOptions:Tc({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="cursor"?{composerState:{provider:"cursor",model:n.composerState.model,modelOptions:ll({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}:{composerState:{provider:"codex",model:n.composerState.model,modelOptions:al({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}),setComposerPlanMode:t=>e(n=>({composerState:{...n.composerState,planMode:t}})),resetComposerFromProvider:t=>e(n=>({composerState:Jy(t,n.providerDefaults)})),initializeComposerForNewChat:()=>e(t=>{if(t.defaultProvider==="last_used")return kE("initializeComposerForNewChat:last_used",{defaultProvider:t.defaultProvider,composerState:t.composerState,providerDefaults:t.providerDefaults}),{composerState:{...t.composerState}};const n=Jy(t.defaultProvider,t.providerDefaults);return kE("initializeComposerForNewChat:explicit_default",{defaultProvider:t.defaultProvider,composerState:n,providerDefaults:t.providerDefaults}),{composerState:n}})}),{name:"chat-preferences",version:5,migrate:e=>FW(e)})),EE=Eo()(Ro(e=>({order:[],setOrder:t=>e({order:t})}),{name:"project-group-order"})),Ep=315,HW=240,$W=520;function UW(e){return typeof e=="object"&&e!==null}function Tg(e){return Number.isFinite(e)?Math.min($W,Math.max(HW,Math.round(e))):Ep}function VW(e){return UW(e)?{widthPx:Tg(typeof e.widthPx=="number"?e.widthPx:Ep)}:{widthPx:Ep}}const RE=Eo()(Ro(e=>({widthPx:Ep,setWidth:t=>e({widthPx:Tg(t)})}),{name:"left-sidebar-layout",version:1,migrate:VW}));function Kj(e,t){return e&&!t}function WW(e,t,n){if(Kj(e,t))return{width:`${Tg(n)}px`}}function qW({data:e,completedChatIds:t,activeChatId:n,activeOverviewFeatureId:r,connectionStatus:i,ready:o,open:l,collapsed:c,isDesktopViewport:h,showMobileOpenButton:d,desktopWidth:g,onOpen:p,onClose:_,onToggle:y,onExpand:w,toggleShortcut:S,onResizeDesktopWidth:C,onCreateChat:k,onCreateFeature:R,onRenameFeature:E,onDeleteFeature:N,onSetProjectBrowserState:L,onSetProjectGeneralChatsBrowserState:j,onSetFeatureBrowserState:O,onSetFeatureStage:H,onSetChatFeature:Z,onReorderFeatures:I,folderGroupsEnabled:W,showFeatureOverviewInSidebar:F,kanbanStatusesEnabled:$,onOpenFeatureOverview:V,onDeleteChat:q,onRemoveProject:D,onRefreshProviderUsage:U,onOpenProviderLogin:z,providerSettings:G,startingLocalPath:M,updateSnapshot:B,onInstallUpdate:X}){const A=oi(),ie=kl(),J=v.useRef(null),ee=v.useRef(null),re=v.useRef(0),ue=v.useRef(null),fe=v.useRef(null),ge=v.useRef({}),Ce=v.useRef({}),Te=v.useRef({}),[je,Xe]=v.useState(new Set),[xt,Et]=v.useState(!1),[me,Fe]=v.useState(null),[De,ft]=v.useState(()=>Date.now()),at=EE(ke=>ke.order),it=EE(ke=>ke.setOrder),hn=v.useMemo(()=>$0((G==null?void 0:G.settings)??sr).map(ke=>ke.id),[G==null?void 0:G.settings]),Mt=v.useMemo(()=>{if(at.length===0)return e.projectGroups;const ke=new Map(e.projectGroups.map(ct=>[ct.groupKey,ct])),Oe=at.filter(ct=>ke.has(ct)).map(ct=>ke.get(ct)),Tt=new Set(at);for(const ct of e.projectGroups)Tt.has(ct.groupKey)||Oe.push(ct);return Oe},[e.projectGroups,at]),Pn=v.useCallback(()=>{ie({pathname:"/",search:"?newProject=1"}),_()},[ie,_]),de=v.useMemo(()=>W?Mt:Mt.map(ke=>({...ke,features:[],generalChats:TE(ke)})),[W,Mt]),se=v.useCallback(ke=>it(ke),[it]),ye=v.useMemo(()=>de.reduce((ke,Oe)=>ke+TE(Oe).length,0),[de]),Ee=v.useCallback(ke=>{Xe(Oe=>{const Tt=new Set(Oe);return Tt.has(ke)?Tt.delete(ke):Tt.add(ke),Tt})},[]);v.useEffect(()=>{const ke=ge.current,Oe=Ce.current,Tt=Te.current;Xe(sn=>{const Kt=new Set([...sn].filter(Gt=>!Gt.startsWith("project:")&&!Gt.startsWith("general:")&&!Gt.startsWith("feature:")));for(const Gt of de)(ke[Gt.groupKey]??Gt.browserState)==="CLOSED"&&Kt.add(`project:${Gt.groupKey}`),(Oe[Gt.groupKey]??Gt.generalChatsBrowserState)==="CLOSED"&&Kt.add(`general:${Gt.groupKey}`);for(const Gt of de)for(const Mr of Gt.features)(Tt[Mr.featureId]??Mr.browserState)==="CLOSED"&&Kt.add(`feature:${Mr.featureId}`);return Kt});const ct={...ke};for(const sn of de)ct[sn.groupKey]===sn.browserState&&delete ct[sn.groupKey];ge.current=ct;const mn={...Oe};for(const sn of de)mn[sn.groupKey]===sn.generalChatsBrowserState&&delete mn[sn.groupKey];Ce.current=mn;const bn={...Tt};for(const sn of de)for(const Kt of sn.features)bn[Kt.featureId]===Kt.browserState&&delete bn[Kt.featureId];Te.current=bn},[de]);const qe=v.useCallback((ke,Oe)=>{ge.current={...ge.current,[ke]:Oe},L(ke,Oe)},[L]),lt=v.useCallback((ke,Oe)=>{Ce.current={...Ce.current,[ke]:Oe},j(ke,Oe)},[j]),Je=v.useCallback((ke,Oe)=>{Te.current={...Te.current,[ke]:Oe},O(ke,Oe)},[O]),Ae=v.useCallback(ke=>{ie(`/chat/${ke}`),l&&_()},[ie,_,l]),He=Ii(ke=>ke.showProviderIconsInSideTray),mt=v.useCallback((ke,Oe)=>f.jsx(kH,{chat:ke,activeChatId:n,nowMs:De,showProviderIcon:He,isCompleted:t.has(ke.chatId),onSelectChat:Ae,onDeleteChat:()=>q(ke),draggable:Oe==null?void 0:Oe.draggable,onDragStart:Oe==null?void 0:Oe.onDragStart,onDragEnd:Oe==null?void 0:Oe.onDragEnd,isTouchDevice:Oe==null?void 0:Oe.isTouchDevice,onTouchDragMove:Oe==null?void 0:Oe.onTouchDragMove,onTouchDragEnd:Oe==null?void 0:Oe.onTouchDragEnd},ke._id),[n,t,Ae,De,q,He]);v.useEffect(()=>{const ke=window.setInterval(()=>{ft(Date.now())},3e4);return()=>window.clearInterval(ke)},[]),v.useEffect(()=>{if(xt)return document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.body.style.cursor="",document.body.style.userSelect=""}},[xt]),v.useEffect(()=>()=>{fe.current!==null&&window.cancelAnimationFrame(fe.current)},[]),v.useEffect(()=>{!n||!ee.current||requestAnimationFrame(()=>{const ke=ee.current,Oe=ke==null?void 0:ke.querySelector(`[data-chat-id="${n}"]`);if(!Oe||!ke)return;const Tt=Oe.getBoundingClientRect(),ct=ke.getBoundingClientRect();if(Tt.top<ct.top+38){const mn=Tt.top-ct.top+ke.scrollTop;ke.scrollTo({top:mn-38,behavior:"smooth"})}else if(Tt.bottom>ct.bottom){const mn=Tt.top+Tt.height/2-ct.top+ke.scrollTop,bn=ke.clientHeight/2;ke.scrollTo({top:mn-bn,behavior:"smooth"})}})},[n,ye]);const Ve=ye>0,fn=A.pathname==="/",rn=A.pathname.startsWith("/settings"),et=fn||rn,en=i==="connecting"||!o,Un=en?"Connecting":i==="connected"?"Connected":"Disconnected",Qt=i==="connected"?"bg-emerald-500":"bg-amber-500",qt=(B==null?void 0:B.updateAvailable)===!0,Ie=B?B.latestVersion===`${B.currentVersion}-dev`:!1,gt=(B==null?void 0:B.status)==="updating"||(B==null?void 0:B.status)==="restart_pending",Rt=WW(h,c,me??g),Jt=Kj(h,c),vt=S&&S.length>0?`Toggle sidebar (${S[0]})`:"Toggle sidebar",_t=t.size>0,Sn=v.useCallback(ke=>{var mn;if(!Jt)return;ke.preventDefault(),Et(!0),re.current=((mn=J.current)==null?void 0:mn.getBoundingClientRect().left)??0,Fe(g);const Oe=bn=>{ue.current=Tg(bn-re.current),fe.current===null&&(fe.current=window.requestAnimationFrame(()=>{fe.current=null,ue.current!==null&&Fe(ue.current)}))};Oe(ke.clientX);const Tt=bn=>{Oe(bn.clientX)},ct=()=>{Et(!1),fe.current!==null&&(window.cancelAnimationFrame(fe.current),fe.current=null);const bn=ue.current??g;ue.current=null,Fe(null),C(bn),window.removeEventListener("pointermove",Tt),window.removeEventListener("pointerup",ct),window.removeEventListener("pointercancel",ct)};window.addEventListener("pointermove",Tt),window.addEventListener("pointerup",ct),window.addEventListener("pointercancel",ct)},[g,C,Jt]);return f.jsxs(f.Fragment,{children:[!l&&d&&f.jsx("div",{className:pe("fixed top-2 left-2.5 z-50 md:hidden","flex items-center gap-1 flex-shrink-0","bg-background/80 dark:bg-card/40 backdrop-blur-lg border border-border rounded-[20px] p-1"),children:f.jsxs(Qe,{variant:"ghost",size:"icon",className:"relative",onClick:p,children:[f.jsx(ky,{className:"h-5 w-5"}),_t&&f.jsx("span",{className:"absolute top-0.5 right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background"})]})}),c&&et&&f.jsx("div",{className:"hidden md:flex fixed left-0 top-0 h-full z-40 items-start pt-4 pl-5 border-l border-border/0",children:f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs("div",{className:"relative",children:[f.jsx(Ld,{className:"size-6 text-logo"}),_t&&f.jsx("span",{className:"absolute -top-0.5 -right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background"})]}),f.jsx(Qe,{variant:"ghost",size:"icon",onClick:w,title:"Expand sidebar",children:f.jsx(Ey,{className:"h-5 w-5"})})]})}),f.jsxs("div",{ref:J,"data-sidebar":"open",className:pe("fixed inset-0 z-50 bg-background dark:bg-card backdrop-blur-2xl flex flex-col h-[100dvh] select-none","md:relative md:inset-auto md:bg-background md:dark:bg-card md:backdrop-blur-none md:flex-none md:mr-0 md:h-[calc(100dvh-16px)] md:my-2 md:ml-2 md:border md:border-border md:rounded-2xl",l?"flex":"hidden md:flex",c&&"md:hidden"),style:Rt,children:[Jt?f.jsx("div",{role:"separator","aria-label":"Resize sidebar","aria-orientation":"vertical",className:pe("group/sidebar-resize hidden md:flex absolute top-0 right-0 z-20 h-full w-3 translate-x-1/2 cursor-col-resize items-center justify-center",xt&&"after:bg-logo/70"),onPointerDown:Sn,children:f.jsx("span",{className:pe("h-14 w-px rounded-full bg-border/80 opacity-0 transition-opacity group-hover/sidebar-resize:opacity-100",xt&&"bg-logo/70 opacity-100")})}):null,f.jsxs("div",{className:"relative pl-2.5 md:pl-3 pr-[7px] h-[64px] max-h-[64px] md:h-[55px] md:max-h-[55px] border-b flex items-center justify-between",children:[f.jsxs("div",{className:pe("flex items-center gap-1 flex-shrink-0 z-10","bg-background/80 dark:bg-card/40 backdrop-blur-lg border border-border rounded-[20px] p-1","md:bg-transparent md:dark:bg-transparent md:backdrop-blur-none md:border-transparent md:p-0 md:rounded-none"),children:[f.jsxs(Qe,{variant:"ghost",size:"icon",className:"relative md:hidden",onClick:()=>y(h),children:[f.jsx(ky,{className:"h-5 w-5"}),_t&&f.jsx("span",{className:"absolute top-0.5 right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background"})]}),f.jsxs("button",{type:"button",onClick:()=>y(h),title:vt,"aria-label":vt,className:"group/sidebar-collapse hidden md:flex relative items-center justify-center h-5 w-5",children:[f.jsx(Ld,{className:"absolute inset-0.5 h-4 w-4 sm:h-5 sm:w-5 text-logo transition-all duration-200 ease-out opacity-100 scale-100 group-hover/sidebar-collapse:opacity-0 group-hover/sidebar-collapse:scale-0"}),f.jsx(Ey,{className:"absolute inset-0 h-4 w-4 sm:h-6 sm:w-6 text-slate-500 dark:text-slate-400 transition-all duration-200 ease-out opacity-0 scale-0 group-hover/sidebar-collapse:opacity-100 group-hover/sidebar-collapse:scale-80 hover:opacity-50"})]})]}),f.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 md:hidden",children:f.jsx(Ld,{className:"h-6 w-6 text-logo"})}),f.jsxs("div",{className:"flex items-center z-10",children:[Ie?f.jsx("span",{className:"mr-1 inline-flex items-center rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] font-bold tracking-wider text-muted-foreground",title:"Development build",children:"DEV"}):qt?f.jsxs(Qe,{variant:"outline",size:"sm",className:"rounded-full !h-auto mr-1 py-0.5 px-2 bg-logo/20 hover:bg-logo text-logo border-logo/20 hover:text-foreground hover:border-logo/20 text-[11px] font-bold tracking-wider",onClick:X,disabled:gt,title:B!=null&&B.latestVersion?`Update to ${B.latestVersion}`:"Update Kaizen",children:[gt?f.jsx(Lr,{className:"mr-1.5 h-3 w-3 animate-spin"}):null,"UPDATE"]}):null,f.jsx(Qe,{variant:"ghost",size:"icon",onClick:Pn,className:"size-10 rounded-lg",title:"Add project",children:f.jsx(F5,{className:"size-5"})})]})]}),f.jsx("div",{ref:ee,"data-sidebar-scroll":!0,className:"flex-1 min-h-0 overflow-y-auto scrollbar-hide",style:{WebkitOverflowScrolling:"touch"},children:f.jsxs("div",{className:"p-[7px]",children:[!Ve&&en?f.jsx("div",{className:"space-y-5 px-1 pt-3",children:[0,1,2].map(ke=>f.jsxs("div",{className:"space-y-2 animate-pulse",children:[f.jsx("div",{className:"h-4 w-28 rounded bg-muted"}),f.jsx("div",{className:"space-y-1",children:[0,1,2].map(Oe=>f.jsxs("div",{className:"flex items-center gap-2 rounded-md px-3 py-2",children:[f.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-muted"}),f.jsx("div",{className:pe("h-3.5 rounded bg-muted",Oe===0?"w-32":Oe===1?"w-40":"w-28")})]},Oe))})]},ke))}):null,!Ve&&!en&&e.projectGroups.length===0?f.jsx("p",{className:"text-sm text-slate-400 p-2 mt-6 text-center",children:"No conversations yet"}):null,f.jsx(RW,{projectGroups:de,onReorderGroups:se,collapsedSections:je,onToggleSection:Ee,onSetProjectBrowserState:qe,onSetProjectGeneralChatsBrowserState:lt,onSetFeatureBrowserState:Je,renderChatRow:mt,onNewLocalChat:k,onCreateFeature:W?R:void 0,onRenameFeature:E,onDeleteFeature:N,onSetFeatureStage:$?H:void 0,onSetChatFeature:Z,onReorderFeatures:I,onRemoveProject:D,isConnected:i==="connected",startingLocalPath:M,folderGroupsEnabled:W,showFeatureOverviewInSidebar:F,kanbanStatusesEnabled:$,activeOverviewFeatureId:r,onOpenFeatureOverview:V})]})}),f.jsxs("div",{className:"border-t border-border p-2",children:[f.jsx(OW,{providerUsage:e.providerUsage,visibleProviders:hn,onRefreshProviderUsage:U,onOpenProviderLogin:z}),f.jsx("button",{type:"button",onClick:()=>{ie("/settings/general"),_()},className:pe("w-full rounded-xl rounded-t-md border px-3 py-2 text-left transition-colors",rn?"bg-muted border-border":"border-border/0 hover:bg-muted hover:border-border active:bg-muted/80"),children:f.jsxs("div",{className:"flex items- justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(x9,{className:"h-4 w-4 text-muted-foreground"}),f.jsx("span",{className:"text-sm",children:"Settings"})]}),f.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[f.jsx("span",{children:Un}),en?f.jsx(Lr,{className:"h-2 w-2 animate-spin"}):f.jsx("span",{className:pe("h-2 w-2 rounded-full",Qt)})]})]})})]})]})]})}function TE(e){return[...e.features.flatMap(t=>t.chats),...e.generalChats]}const Gj={submitChatMessage:"Submit Chat Message",toggleProjectsSidebar:"Toggle Projects Sidebar",toggleEmbeddedTerminal:"Toggle Embedded Terminal",toggleRightSidebar:"Toggle Right Sidebar",openInFinder:"Open In Finder",openInEditor:"Open In Editor",addSplitTerminal:"Add Split Terminal"};function Eb(e){return(e??[]).join(", ")}function Xa(e){return e.split(",").map(t=>t.trim()).map(t=>t.toLowerCase()).filter(Boolean)}const KW=new Map([["cmd","meta"],["meta","meta"],["ctrl","ctrl"],["control","ctrl"],["alt","alt"],["option","alt"],["shift","shift"]]);function GW(e,t){const n=YW(e);return n?t.key.toLowerCase()===n.key&&t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&t.shiftKey===n.shift:!1}function il(e,t,n){return((e==null?void 0:e.bindings[t])??ks[t]).some(i=>GW(i,n))}function gw(e){return{bindings:{submitChatMessage:(e==null?void 0:e.bindings.submitChatMessage)??ks.submitChatMessage,toggleProjectsSidebar:(e==null?void 0:e.bindings.toggleProjectsSidebar)??ks.toggleProjectsSidebar,toggleEmbeddedTerminal:(e==null?void 0:e.bindings.toggleEmbeddedTerminal)??ks.toggleEmbeddedTerminal,toggleRightSidebar:(e==null?void 0:e.bindings.toggleRightSidebar)??ks.toggleRightSidebar,openInFinder:(e==null?void 0:e.bindings.openInFinder)??ks.openInFinder,openInEditor:(e==null?void 0:e.bindings.openInEditor)??ks.openInEditor,addSplitTerminal:(e==null?void 0:e.bindings.addSplitTerminal)??ks.addSplitTerminal},warning:(e==null?void 0:e.warning)??null,filePathDisplay:(e==null?void 0:e.filePathDisplay)??""}}function YW(e){const t=e.split("+").map(r=>r.trim()).filter(Boolean);if(t.length===0)return null;const n={key:"",ctrl:!1,meta:!1,alt:!1,shift:!1};for(const r of t){const i=r.toLowerCase(),o=KW.get(i);if(o==="ctrl"){n.ctrl=!0;continue}if(o==="meta"){n.meta=!0;continue}if(o==="alt"){n.alt=!0;continue}if(o==="shift"){n.shift=!0;continue}if(n.key)return null;n.key=i}return n.key?n:null}function XW(e){if(!e||typeof e!="object")return!1;const t=e;if(t.isContentEditable===!0)return!0;if(typeof t.tagName=="string"){const n=t.tagName.toLowerCase();if(n==="input"||n==="textarea"||n==="select")return!0}return typeof t.closest=="function"?!!t.closest('input, textarea, select, [contenteditable], [contenteditable="true"]'):!1}function Yj(){const[e,t]=v.useState(()=>{if(typeof window>"u")return!1;const n=navigator.standalone===!0,r=window.matchMedia("(display-mode: standalone)").matches;return n||r});return v.useEffect(()=>{const n=window.matchMedia("(display-mode: standalone)"),r=i=>{t(i.matches||navigator.standalone===!0)};return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const ZW=Eo()(Ro((e,t)=>({drafts:{},setDraft:(n,r)=>e(i=>{if(!r){const{[n]:o,...l}=i.drafts;return{drafts:l}}return{drafts:{...i.drafts,[n]:r}}}),clearDraft:n=>e(r=>{const{[n]:i,...o}=r.drafts;return{drafts:o}}),getDraft:n=>t().drafts[n]??""}),{name:"chat-input-drafts"}));async function QW(e){const t=await new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{if(typeof i.result=="string"){n(i.result);return}r(new Error("Failed to read image attachment"))},i.onerror=()=>r(i.error??new Error("Failed to read image attachment")),i.readAsDataURL(e)});return{type:"image",name:e.name,mimeType:e.type,sizeBytes:e.size,dataUrl:t}}function NE(e,t){if(t===void 0){console.info(`[ChatInput] ${e}`);return}console.info(`[ChatInput] ${e}`,t)}function ho(e,t,n,r,i){return e==="claude"?t.provider==="claude"?{provider:"claude",model:r??t.model,modelOptions:{...t.modelOptions},planMode:i??t.planMode}:{provider:"claude",model:r??n.claude.model,modelOptions:{...n.claude.modelOptions},planMode:i??n.claude.planMode}:e==="gemini"?t.provider==="gemini"?{provider:"gemini",model:r??t.model,modelOptions:{...t.modelOptions},planMode:i??t.planMode}:{provider:"gemini",model:r??n.gemini.model,modelOptions:{...n.gemini.modelOptions},planMode:i??n.gemini.planMode}:e==="cursor"?t.provider==="cursor"?{provider:"cursor",model:r??t.model,modelOptions:{...t.modelOptions},planMode:i??t.planMode}:{provider:"cursor",model:r??n.cursor.model,modelOptions:{...n.cursor.modelOptions},planMode:i??n.cursor.planMode}:t.provider==="codex"?{provider:"codex",model:r??t.model,modelOptions:{...t.modelOptions},planMode:i??t.planMode}:{provider:"codex",model:r??n.codex.model,modelOptions:{...n.codex.modelOptions},planMode:i??n.codex.planMode}}function JW(e,t,n,r){return r&&e.key==="Enter"?!1:il(t,"submitChatMessage",e)&&!n&&!e.isComposing}function eq(e){if(!e.providerLocked)return{composerPlanMode:e.planMode,lockedComposerState:e.lockedComposerState};const t=e.lockedComposerState??ho(e.selectedProvider,e.composerState,e.providerDefaults);return{composerPlanMode:e.composerState.planMode,lockedComposerState:{...t,planMode:e.planMode}}}const tq=v.forwardRef(function({onSubmit:t,onCancel:n,disabled:r,canCancel:i,chatId:o,activeProvider:l,activeModel:c,activePlanMode:h,availableProviders:d,keybindings:g},p){const{getDraft:_,setDraft:y,clearDraft:w}=ZW(),{composerState:S,providerDefaults:C,setComposerModel:k,setComposerModelOptions:R,setComposerPlanMode:E,resetComposerFromProvider:N}=Ii(),[L,j]=v.useState(()=>o?_(o):""),[O,H]=v.useState([]),[Z,I]=v.useState(null),[W,F]=v.useState(!1),$=v.useRef(null),V=v.useRef(null),q=Yj(),D=Mh("(pointer: coarse)"),[U,z]=v.useState(()=>l?ho(l,S,C,c,h):null),G=l!==null,M=!G&&d.length===0,B=G?U??ho(l,S,C,c,h):S,X=G?l:S.provider,A=d.find(me=>me.id===X)??un(X),ie=(A==null?void 0:A.supportsPlanMode)??!1,J=r||M,ee=v.useCallback(()=>{const me=$.current;me&&(me.style.height="auto",me.style.height=`${me.scrollHeight}px`)},[]),re=v.useCallback(me=>{if($.current=me,!!p){if(typeof p=="function"){p(me);return}p.current=me}},[p]);v.useEffect(()=>{ee()},[L,ee]),v.useEffect(()=>(window.addEventListener("resize",ee),()=>window.removeEventListener("resize",ee)),[ee]),v.useEffect(()=>{var me;(me=$.current)==null||me.focus()},[o]),v.useEffect(()=>()=>{for(const me of O)URL.revokeObjectURL(me.previewUrl)},[O]),v.useEffect(()=>{if(l===null){z(null);return}z(ho(l,S,C,c,h))},[c,h,l,o,S,C]),v.useEffect(()=>{G||d.length!==0&&(d.some(me=>me.id===S.provider)||N(d[0].id))},[d,S.provider,G,N]),v.useEffect(()=>{NE("resolved provider state",{chatId:o??null,activeProvider:l,composerProvider:S.provider,composerModel:S.model,effectiveProvider:B.provider,effectiveModel:B.model,selectedProvider:X,providerLocked:G,lockedComposerProvider:(U==null?void 0:U.provider)??null})},[l,o,S.model,S.provider,U==null?void 0:U.provider,G,B.model,B.provider,X]);function ue(me){if(G){z(Fe=>{const De=Fe??ho(X,S,C);return De.provider==="claude"?{...De,modelOptions:{...De.modelOptions,reasoningEffort:me}}:De.provider==="gemini"?De:{...De,modelOptions:{...De.modelOptions,reasoningEffort:me}}});return}if(X==="claude"){R({reasoningEffort:me});return}R({reasoningEffort:me})}function fe(me){if(G){z(Fe=>{const De=Fe??ho(X,S,C);return De.provider!=="gemini"?De:{...De,modelOptions:{...De.modelOptions,thinkingMode:me}}});return}X==="gemini"&&R({thinkingMode:me})}function ge(me){if(G){z(Fe=>{const De=Fe??ho(X,S,C);return De.provider!=="claude"?De:{...De,modelOptions:{...De.modelOptions,contextWindow:me}}});return}X==="claude"&&R({contextWindow:me})}function Ce(me){const Fe=eq({providerLocked:G,planMode:me,selectedProvider:X,composerState:S,providerDefaults:C,lockedComposerState:U});Fe.lockedComposerState!==U&&z(Fe.lockedComposerState),Fe.composerPlanMode!==S.planMode&&E(Fe.composerPlanMode)}function Te(){Ce(!B.planMode)}async function je(){if(J||!L.trim()&&O.length===0)return;const me=L,Fe=O;let De;B.provider==="claude"?De={claude:{...B.modelOptions}}:B.provider==="gemini"?De={gemini:{...B.modelOptions}}:De={codex:{...B.modelOptions}};const ft={provider:X,model:B.model,modelOptions:De,planMode:ie?B.planMode:!1};NE("submit settings",{chatId:o??null,activeProvider:l,composerProvider:B.provider,submitOptions:ft}),j(""),I(null),o&&w(o),$.current&&($.current.style.height="auto");try{await t({text:me.trim(),attachments:Fe.length?await Promise.all(Fe.map(at=>QW(at.file))):void 0},ft);for(const at of Fe)URL.revokeObjectURL(at.previewUrl);H([])}catch(at){console.error("[ChatInput] Submit failed:",at),j(me),o&&y(o,me)}}const Xe=v.useCallback(me=>{if(J)return;const Fe=me.filter(De=>De.type.startsWith("image/"));if(Fe.length===0){I("Only PNG, JPEG, WEBP, and GIF images are supported.");return}H(De=>{const ft=[...De];let at=null;for(const it of Fe){if(!pp.includes(it.type)){at=`Unsupported image type: ${it.type||"unknown"}`;continue}if(it.size<=0||it.size>OM){at=`${it.name} is empty or larger than 10 MB.`;continue}if(ft.length>=mp){at=`You can attach up to ${mp} images per message.`;break}ft.push({id:Od(),file:it,name:it.name||"image",mimeType:it.type,sizeBytes:it.size,previewUrl:URL.createObjectURL(it)})}return I(at),ft})},[J]),xt=v.useCallback(me=>{H(Fe=>{const De=Fe.find(ft=>ft.id===me);return De&&URL.revokeObjectURL(De.previewUrl),Fe.filter(ft=>ft.id!==me)}),I(null)},[]);function Et(me){if(me.key==="Tab"&&!me.shiftKey){me.preventDefault(),U9($.current,document);return}if(me.key==="Tab"&&me.shiftKey&&ie){me.preventDefault(),Te();return}if(me.key==="Escape"&&i){me.preventDefault(),n==null||n();return}JW(me.nativeEvent,g,i,D)&&(me.preventDefault(),je())}return f.jsxs("div",{className:pe("p-3 pt-0 px-2 md:px-3 md:pb-2 flex flex-col items-center",q&&"px-3"),style:q?{paddingBottom:"var(--app-composer-bottom-padding)"}:void 0,children:[f.jsxs("div",{className:"flex flex-col items-center relative z-10 w-full max-w-[840px] mx-auto",children:[f.jsxs("div",{className:pe("w-full border dark:bg-card/40 bg-background/95 backdrop-blur-lg border-border rounded-[29px] px-2 pb-2 transition-colors relative z-10",W&&"border-foreground/40 bg-muted/30"),onDragEnter:me=>{r||!me.dataTransfer.types.includes("Files")||(me.preventDefault(),F(!0))},onDragOver:me=>{r||!me.dataTransfer.types.includes("Files")||(me.preventDefault(),me.dataTransfer.dropEffect="copy",F(!0))},onDragLeave:me=>{if(!me.dataTransfer.types.includes("Files"))return;me.preventDefault();const Fe=me.relatedTarget;Fe instanceof Node&&me.currentTarget.contains(Fe)||F(!1)},onDrop:me=>{var Fe;r||!me.dataTransfer.types.includes("Files")||(me.preventDefault(),F(!1),Xe(Array.from(me.dataTransfer.files)),(Fe=$.current)==null||Fe.focus())},children:[f.jsx("input",{ref:V,type:"file",accept:pp.join(","),multiple:!0,className:"hidden",onChange:me=>{Xe(Array.from(me.target.files??[])),me.target.value=""}}),O.length?f.jsx("div",{className:"grid grid-cols-2 gap-2 px-2 pt-2 sm:grid-cols-3",children:O.map(me=>f.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border/80 bg-background/80",children:[f.jsx("img",{src:me.previewUrl,alt:me.name,className:"h-28 w-full object-cover"}),f.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 px-2 py-1.5",children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:"truncate text-xs text-foreground",children:me.name}),f.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[Math.max(1,Math.round(me.sizeBytes/1024))," KB"]})]}),f.jsx(Qe,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>xt(me.id),disabled:J,children:f.jsx(_o,{className:"h-3.5 w-3.5"})})]})]},me.id))}):null,f.jsxs("div",{className:"flex items-end gap-2",children:[f.jsx(Qe,{type:"button",variant:"ghost",size:"icon",className:"mt-1.5 md:mt-0 md:mb-1 h-10 w-10 shrink-0 rounded-full",disabled:J||i,onClick:()=>{var me;return(me=V.current)==null?void 0:me.click()},children:f.jsx(W5,{className:"h-4.5 w-4.5"})}),f.jsx(bh,{ref:re,placeholder:"Build something...",value:L,autoFocus:!0,[R0]:"",rows:1,onChange:me=>{j(me.target.value),o&&y(o,me.target.value),ee()},onPaste:me=>{const Fe=Array.from(me.clipboardData.files);Fe.some(De=>De.type.startsWith("image/"))&&(me.preventDefault(),Xe(Fe))},onKeyDown:Et,disabled:J,className:"flex-1 text-base py-2 md:py-3.75 px-1 md:px-2 resize-none max-h-[200px] outline-none bg-transparent border-0 shadow-none"}),f.jsx(Qe,{type:"button",onPointerDown:me=>{me.preventDefault(),i?n==null||n():!J&&(L.trim()||O.length>0)&&je()},disabled:!i&&(J||!L.trim()&&O.length===0),size:"icon",className:"flex-shrink-0 bg-slate-600 text-white dark:bg-white dark:text-slate-900 rounded-full cursor-pointer h-10 w-10 md:h-11 md:w-11 md:mb-0.5 -mr-0.5 md:mr-0 touch-manipulation disabled:bg-white/60 disabled:text-slate-700",children:i?f.jsx("div",{className:"w-3 h-3 md:w-4 md:h-4 rounded-xs bg-current"}):f.jsx(WB,{className:"h-5 w-5 md:h-6 md:w-6"})})]})]}),f.jsxs("div",{className:pe("border-x border-b border-t-0 border-border rounded-b-[20px] px-3 py-1.5 transition-colors relative z-20 -mt-[1px] flex-shrink-0 shadow-sm","dark:bg-card/40 bg-background/95 backdrop-blur-lg",W&&"border-foreground/40 bg-muted/30"),children:[f.jsx("div",{className:"absolute top-0 left-0 right-0 h-[1px] bg-background"}),f.jsx(wd,{availableProviders:d,selectedProvider:X,disabled:J,providerLocked:G,model:B.model,modelOptions:B.modelOptions,onProviderChange:me=>{G||N(me)},onModelChange:(me,Fe)=>{if(G){z(De=>({...De??ho(X,S,C),model:Fe}));return}k(Fe)},onClaudeReasoningEffortChange:me=>ue(me),onClaudeContextWindowChange:me=>ge(me),onCodexReasoningEffortChange:me=>ue(me),onGeminiThinkingModeChange:me=>fe(me),onCodexFastModeChange:me=>{if(G){z(Fe=>{const De=Fe??ho(X,S,C);return De.provider!=="codex"?De:{...De,modelOptions:{...De.modelOptions,fastMode:me}}});return}R({fastMode:me})},planMode:B.planMode,onPlanModeChange:Ce,includePlanMode:ie,className:"w-full relative z-10"}),M?f.jsx("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"No active providers are available. Re-enable one in Settings."}):null]})]}),Z?f.jsx("div",{className:"max-w-[840px] mx-auto mt-2 px-2 text-xs text-destructive relative z-10",children:Z}):null]})}),nq=v.memo(tq);function ME({label:e,isCurrent:t,icon:n,onClick:r,className:i}){return f.jsxs("button",{onClick:r,className:pe("w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left text-sm transition-colors hover:bg-muted",i),children:[f.jsx("span",{className:"flex-shrink-0 w-4 flex items-center justify-center",children:n??(t?f.jsx(Wi,{className:"h-3.5 w-3.5 text-muted-foreground"}):null)}),f.jsx("span",{className:"flex-1 min-w-0 truncate",children:e}),t&&f.jsx("span",{className:"flex-shrink-0 text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded-full border border-border",children:"current"})]})}function rq({projectId:e,socket:t}){const[n,r]=v.useState({phase:"loading"}),[i,o]=v.useState(!1),[l,c]=v.useState(""),h=v.useDeferredValue(l),[d,g]=v.useTransition(),p=v.useRef(null),_=v.useCallback(async()=>{try{const R=await t.command({type:"git.getBranches",projectId:e});if(!R.isRepo){r({phase:"not-a-repo"});return}r({phase:"ready",currentBranch:R.currentBranch,branches:R.branches})}catch(R){r({phase:"error",message:R instanceof Error?R.message:String(R)})}},[e,t]);v.useEffect(()=>{_()},[_]),v.useEffect(()=>{i&&(c(""),_())},[i,_]),v.useEffect(()=>{if(i&&n.phase==="ready"){const R=setTimeout(()=>{var E;return(E=p.current)==null?void 0:E.focus()},50);return()=>clearTimeout(R)}},[i,n.phase]);function y(R){n.phase!=="ready"||R===n.currentBranch||(o(!1),g(async()=>{try{await t.command({type:"git.switchBranch",projectId:e,branchName:R}),await _()}catch(E){r({phase:"error",message:E instanceof Error?E.message:String(E)})}}))}function w(R){R.trim()&&(o(!1),g(async()=>{try{await t.command({type:"git.createBranch",projectId:e,branchName:R.trim(),checkout:!0}),await _()}catch(E){r({phase:"error",message:E instanceof Error?E.message:String(E)})}}))}if(n.phase==="not-a-repo")return null;const S=n.phase==="ready"?n.branches.filter(R=>R.toLowerCase().includes(h.toLowerCase())):[],C=n.phase==="ready"&&n.branches.some(R=>R===h.trim()),k=h.trim().length>0&&!C;return f.jsxs(GM,{open:i,onOpenChange:o,children:[f.jsx(YM,{asChild:!0,children:f.jsxs(Qe,{variant:"ghost",size:"icon",className:pe("h-10 w-auto max-w-[180px] gap-1.5 rounded-lg border border-border/0 px-3 text-sm text-muted-foreground",n.phase==="error"&&"text-destructive"),children:[d?f.jsx(Lr,{className:"h-4.5 w-4.5 flex-shrink-0 animate-spin"}):f.jsx(H8,{className:"h-4.5 w-4.5 flex-shrink-0"}),n.phase==="ready"&&f.jsx("span",{className:"truncate",children:n.currentBranch??"HEAD detached"}),n.phase==="error"&&f.jsx("span",{className:"truncate",children:"git error"})]})}),f.jsxs(W0,{align:"end",className:"w-64 p-0 overflow-hidden",children:[f.jsx("div",{className:"border-b border-border",children:f.jsx("input",{ref:p,value:l,onChange:R=>c(R.target.value),placeholder:"Search or create branch...",className:"w-full px-3 py-2 text-sm bg-transparent outline-none placeholder:text-muted-foreground",onKeyDown:R=>{R.key==="Enter"&&k&&w(l)}})}),f.jsxs("div",{className:"max-h-[220px] overflow-y-auto p-1",children:[n.phase==="loading"&&f.jsx("div",{className:"flex items-center justify-center py-6 text-muted-foreground",children:f.jsx(Lr,{className:"h-4 w-4 animate-spin"})}),n.phase==="error"&&f.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:n.message}),n.phase==="ready"&&f.jsxs(f.Fragment,{children:[S.length===0&&!k&&f.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No branches match"}),S.map(R=>f.jsx(ME,{label:R,isCurrent:R===n.currentBranch,onClick:()=>y(R)},R)),k&&f.jsx(ME,{label:`Create branch "${h.trim()}"`,icon:f.jsx(C0,{className:"h-3.5 w-3.5 text-muted-foreground"}),onClick:()=>w(l),className:"text-muted-foreground border-t border-border/50 mt-1 pt-2 rounded-none"})]})]})]})]})}const vw=v.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:pe("bg-card text-card-foreground",e),...t}));vw.displayName="Card";const Xj=v.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:pe("flex flex-col space-y-1.5 p-2",e),...t}));Xj.displayName="CardHeader";const iq=v.forwardRef(({className:e,...t},n)=>f.jsx("h3",{ref:n,className:pe("text-2xl font-semibold leading-none tracking-tight",e),...t}));iq.displayName="CardTitle";const sq=v.forwardRef(({className:e,...t},n)=>f.jsx("p",{ref:n,className:pe("text-sm text-muted-foreground",e),...t}));sq.displayName="CardDescription";const _w=v.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:pe("p-6 pt-0",e),...t}));_w.displayName="CardContent";const oq=v.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:pe("flex items-center p-6 pt-0",e),...t}));oq.displayName="CardFooter";function aq({sidebarCollapsed:e,hasCompletedChats:t=!1,onOpenSidebar:n,onExpandSidebar:r,usage:i,localPath:o,embeddedTerminalVisible:l=!1,onToggleEmbeddedTerminal:c,rightSidebarVisible:h=!1,onToggleRightSidebar:d,onOpenExternal:g,editorLabel:p="Editor",projectId:_,socket:y,finderShortcut:w,editorShortcut:S,terminalShortcut:C,rightSidebarShortcut:k}){const R=N=>N==null?"Unavailable":`${Math.round(N)}%`,E=i!=null&&i.warnings.includes("context_critical")||i!=null&&i.warnings.includes("rate_critical")?"text-amber-300 bg-amber-500/10":i!=null&&i.warnings.includes("context_warning")||i!=null&&i.warnings.includes("rate_warning")?"text-amber-100 bg-amber-500/5":"text-muted-foreground bg-background/70";return f.jsx(Xj,{className:pe("absolute top-0 md:top-2 left-0 right-0 z-10 px-2.5 border-border/0 md:pb-0 flex items-center justify-center",e?"md:px-2.5 md:pr-4":"md:px-4 md:pr-4"," bg-gradient-to-b from-background"),children:f.jsxs("div",{className:"relative flex items-center gap-2 w-full",children:[f.jsxs("div",{className:pe("flex items-center gap-1 flex-shrink-0","bg-background/80 dark:bg-card/40 backdrop-blur-lg border border-border rounded-[20px] p-1",!e&&"md:bg-transparent md:dark:bg-transparent md:backdrop-blur-none md:border-transparent md:p-0"),children:[f.jsxs(Qe,{variant:"ghost",size:"icon",className:"relative md:hidden",onClick:n,children:[f.jsx(ky,{className:"h-5 w-5"}),t&&f.jsx("span",{className:"absolute top-0.5 right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background"})]}),e&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"relative flex items-center justify-center w-[40px] h-[40px]",children:[f.jsx(Ld,{className:"h-4 w-4 sm:h-5 sm:w-5 ml-1 hidden md:block"}),t&&f.jsx("span",{className:"absolute top-1.5 right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background hidden md:block"})]}),f.jsx(Qe,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:r,title:"Expand sidebar",children:f.jsx(Ey,{className:"size-4.5"})})]})]}),f.jsx("div",{className:"flex-1 min-w-0"}),f.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 bg-background/80 dark:bg-card/40 backdrop-blur-lg border border-border rounded-[20px] p-1",children:[_?f.jsxs("div",{className:"hidden md:flex items-center gap-1 mr-1",children:[f.jsxs(Ms,{children:[(i==null?void 0:i.contextUsedPercent)!==null&&(i==null?void 0:i.contextUsedPercent)!==void 0?f.jsx(As,{asChild:!0,children:f.jsxs("div",{className:pe("px-2.5 py-1 rounded-lg text-[14px] font-medium",E),children:["Context: ",R(i.contextUsedPercent)]})}):null,f.jsx(os,{side:"bottom",children:(i==null?void 0:i.contextWindowTokens)!==null&&(i==null?void 0:i.contextWindowTokens)!==void 0&&(i==null?void 0:i.threadTokens)!==null&&(i==null?void 0:i.threadTokens)!==void 0?`${Math.round(i.threadTokens).toLocaleString()} of ${Math.round(i.contextWindowTokens).toLocaleString()} tokens`:"Context window unavailable for this chat yet"})]}),((i==null?void 0:i.sessionLimitUsedPercent)??0)>=75?f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:f.jsxs("div",{className:pe("px-2.5 py-1 rounded-lg border text-[11px] font-medium",E),children:["Session: ",R(i==null?void 0:i.sessionLimitUsedPercent)]})}),f.jsx(os,{side:"bottom",children:i!=null&&i.rateLimitResetAt?`Resets ${new Date(i.rateLimitResetAt).toLocaleString()}`:"No reset time available yet"})]}):null]}):null,_?f.jsx(rq,{projectId:_,socket:y}):null,o&&(g||c)&&f.jsxs(f.Fragment,{children:[g?f.jsxs(yd,{children:[f.jsx(xd,{asChild:!0,children:f.jsx(Qe,{variant:"ghost",size:"icon",onClick:()=>g("open_finder"),title:"Open in Finder",className:"border border-border/0",children:f.jsx(B5,{className:"h-4.5 w-4.5"})})}),f.jsx(Rc,{side:"bottom",shortcut:w})]}):null,c?f.jsxs(yd,{children:[f.jsx(xd,{asChild:!0,children:f.jsx(Qe,{variant:"ghost",size:"icon",onClick:c,className:pe("border border-border/0",l&&"text-white"),children:f.jsx(k0,{className:"h-4.5 w-4.5"})})}),f.jsx(Rc,{side:"bottom",shortcut:C})]}):null,g?f.jsxs(yd,{children:[f.jsx(xd,{asChild:!0,children:f.jsx(Qe,{variant:"ghost",size:"icon",onClick:()=>g("open_editor"),title:`Open in ${p}`,className:"border border-border/0",children:f.jsx(Cy,{className:"h-4.5 w-4.5"})})}),f.jsx(Rc,{side:"bottom",shortcut:S})]}):null]}),d?f.jsxs(yd,{children:[f.jsx(xd,{asChild:!0,children:f.jsx(Qe,{variant:"ghost",size:"icon",onClick:d,className:pe("border border-border/0",h&&"text-white"),children:f.jsx(h9,{className:"h-4.5 w-4.5"})})}),f.jsx(Rc,{side:"bottom",shortcut:k})]}):null]})]})})}function AE({onClose:e,className:t}){return f.jsx("div",{className:pe("h-full min-h-0 bg-background md:min-w-[300px] md:border-l md:border-border",t),children:f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[f.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[f.jsx("div",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:"Diffs"}),f.jsx("button",{type:"button","aria-label":"Close right sidebar",onClick:e,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:f.jsx(_o,{className:"h-4 w-4"})})]}),f.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-center",children:f.jsx("p",{className:"text-sm text-muted-foreground",children:"diffs coming soon"})})]})})}function lq(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function cq(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function uq(e){return e/100*window.innerHeight}function dq(e){return e/100*window.innerWidth}function hq(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function kd({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,o]=hq(n);switch(o){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=cq(t,i);break}case"em":{r=lq(t,i);break}case"vh":{r=uq(i);break}case"vw":{r=dq(i);break}}return r}function si(e){return parseFloat(e.toFixed(3))}function Uc({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,i)=>(r+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function ex(e){const{panels:t}=e,n=Uc({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:i,panelConstraints:o}=r;let l=0;if(o.collapsedSize!==void 0){const g=kd({groupSize:n,panelElement:i,styleProp:o.collapsedSize});l=si(g/n*100)}let c;if(o.defaultSize!==void 0){const g=kd({groupSize:n,panelElement:i,styleProp:o.defaultSize});c=si(g/n*100)}let h=0;if(o.minSize!==void 0){const g=kd({groupSize:n,panelElement:i,styleProp:o.minSize});h=si(g/n*100)}let d=100;if(o.maxSize!==void 0){const g=kd({groupSize:n,panelElement:i,styleProp:o.maxSize});d=si(g/n*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:l,collapsible:o.collapsible===!0,defaultSize:c,disabled:o.disabled,minSize:h,maxSize:d,panelId:r.id}})}function dn(e,t="Assertion error"){if(!e)throw Error(t)}function tx(e,t){return Array.from(t).sort(e==="horizontal"?fq:mq)}function fq(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function mq(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Zj(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Qj(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function pq({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let i,o=Number.MAX_VALUE;for(const l of t){const{x:c,y:h}=Qj(r,l),d=e==="horizontal"?c:h;d<o&&(o=d,i=l)}return dn(i,"No rect found"),i}let _m;function gq(){return _m===void 0&&(typeof matchMedia=="function"?_m=!!matchMedia("(pointer:coarse)").matches:_m=!1),_m}function Jj(e){const{element:t,orientation:n,panels:r,separators:i}=e,o=tx(n,Array.from(t.children).filter(Zj).map(w=>({element:w}))).map(({element:w})=>w),l=[];let c=!1,h=!1,d=-1,g=-1,p=0,_,y=[];{let w=-1;for(const S of o)S.hasAttribute("data-panel")&&(w++,S.hasAttribute("data-disabled")||(p++,d===-1&&(d=w),g=w))}if(p>1){let w=-1;for(const S of o)if(S.hasAttribute("data-panel")){w++;const C=r.find(k=>k.element===S);if(C){if(_){const k=_.element.getBoundingClientRect(),R=S.getBoundingClientRect();let E;if(h){const N=n==="horizontal"?new DOMRect(k.right,k.top,0,k.height):new DOMRect(k.left,k.bottom,k.width,0),L=n==="horizontal"?new DOMRect(R.left,R.top,0,R.height):new DOMRect(R.left,R.top,R.width,0);switch(y.length){case 0:{E=[N,L];break}case 1:{const j=y[0],O=pq({orientation:n,rects:[k,R],targetRect:j.element.getBoundingClientRect()});E=[j,O===k?L:N];break}default:{E=y;break}}}else y.length?E=y:E=[n==="horizontal"?new DOMRect(k.right,R.top,R.left-k.right,R.height):new DOMRect(R.left,k.bottom,R.width,R.top-k.bottom)];for(const N of E){let L="width"in N?N:N.element.getBoundingClientRect();const j=gq()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(L.width<j){const H=j-L.width;L=new DOMRect(L.x-H/2,L.y,L.width+H,L.height)}if(L.height<j){const H=j-L.height;L=new DOMRect(L.x,L.y-H/2,L.width,L.height+H)}const O=w<=d||w>g;!c&&!O&&l.push({group:e,groupSize:Uc({group:e}),panels:[_,C],separator:"width"in N?void 0:N,rect:L}),c=!1}}h=!1,_=C,y=[]}}else if(S.hasAttribute("data-separator")){S.ariaDisabled!==null&&(c=!0);const C=i.find(k=>k.element===S);C?y.push(C):(_=void 0,y=[])}else h=!0}return l}var ma,vN;let eD=(vN=class{constructor(){Hk(this,ma,{})}addListener(t,n){const r=sd(this,ma)[t];return r===void 0?sd(this,ma)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=sd(this,ma)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let i=!1,o=null;const l=Array.from(r);for(let c=0;c<l.length;c++){const h=l[c];try{h.call(null,n)}catch(d){o===null&&(i=!0,o=d)}}if(i)throw o}}removeAllListeners(){$k(this,ma,{})}removeListener(t,n){const r=sd(this,ma)[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}},ma=new WeakMap,vN),js=new Map;const tD=new eD;function vq(e){js=new Map(js),js.delete(e)}function jE(e,t){for(const[n]of js)if(n.id===e)return n}function _a(e,t){for(const[n,r]of js)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Nl(){return js}function bw(e,t){return tD.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function xo(e,t){const n=js.get(e);js=new Map(js),js.set(e,t),tD.emit("groupChange",{group:e,prev:n,next:t})}function _q(e,t,n){let r,i={x:1/0,y:1/0};for(const o of t){const l=Qj(n,o.rect);switch(e){case"horizontal":{l.x<=i.x&&(r=o,i=l);break}case"vertical":{l.y<=i.y&&(r=o,i=l);break}}}return r?{distance:i,hitRegion:r}:void 0}function bq(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function yq(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:LE(e),b:LE(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();dn(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:OE(DE(n.a)),b:OE(DE(n.b))};if(i.a===i.b){const o=r.childNodes,l={a:n.a.at(-1),b:n.b.at(-1)};let c=o.length;for(;c--;){const h=o[c];if(h===l.a)return 1;if(h===l.b)return-1}}return Math.sign(i.a-i.b)}const xq=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function wq(e){const t=getComputedStyle(nD(e)??e).display;return t==="flex"||t==="inline-flex"}function Sq(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||wq(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||xq.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function DE(e){let t=e.length;for(;t--;){const n=e[t];if(dn(n,"Missing node"),Sq(n))return n}return null}function OE(e){return e&&Number(getComputedStyle(e).zIndex)||0}function LE(e){const t=[];for(;e;)t.push(e),e=nD(e);return t}function nD(e){const{parentNode:t}=e;return bq(t)?t.host:t}function Cq(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function kq({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Zj(n)||n.contains(e)||e.contains(n))return!0;if(yq(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Cq(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function yw(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const o=Jj(i),l=_q(i.orientation,o,{x:e.clientX,y:e.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&kq({groupElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:e.target})&&n.push(l.hitRegion)}),n}function Eq(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function $r(e,t,n=0){return Math.abs(si(e)-si(t))<=n}function Es(e,t){return $r(e,t)?0:e>t?1:-1}function Nc({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:i=0,collapsible:o,disabled:l,maxSize:c=100,minSize:h=0}=t;if(l&&!e)return n;if(Es(r,h)<0)if(o){const d=(i+h)/2;Es(r,d)<0?r=i:r=h}else r=h;return r=Math.min(c,r),r=si(r),r}function ih({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:o}){if($r(e,0))return t;const l=o==="imperative-api",c=Object.values(t),h=Object.values(i),d=[...c],[g,p]=r;dn(g!=null,"Invalid first pivot index"),dn(p!=null,"Invalid second pivot index");let _=0;switch(o){case"keyboard":{{const S=e<0?p:g,C=n[S];dn(C,`Panel constraints not found for index ${S}`);const{collapsedSize:k=0,collapsible:R,minSize:E=0}=C;if(R){const N=c[S];if(dn(N!=null,`Previous layout not found for panel index ${S}`),$r(N,k)){const L=E-N;Es(L,Math.abs(e))>0&&(e=e<0?0-L:L)}}}{const S=e<0?g:p,C=n[S];dn(C,`No panel constraints found for index ${S}`);const{collapsedSize:k=0,collapsible:R,minSize:E=0}=C;if(R){const N=c[S];if(dn(N!=null,`Previous layout not found for panel index ${S}`),$r(N,E)){const L=N-k;Es(L,Math.abs(e))>0&&(e=e<0?0-L:L)}}}break}default:{const S=e<0?p:g,C=n[S];dn(C,`Panel constraints not found for index ${S}`);const k=c[S],{collapsible:R,collapsedSize:E,minSize:N}=C;if(R&&Es(k,N)<0)if(e>0){const L=N-E,j=L/2,O=k+e;Es(O,N)<0&&(e=Es(e,j)<=0?0:L)}else{const L=N-E,j=100-L/2,O=k-e;Es(O,N)<0&&(e=Es(100+e,j)>0?0:-L)}break}}{const S=e<0?1:-1;let C=e<0?p:g,k=0;for(;;){const E=c[C];dn(E!=null,`Previous layout not found for panel index ${C}`);const N=Nc({overrideDisabledPanels:l,panelConstraints:n[C],prevSize:E,size:100})-E;if(k+=N,C+=S,C<0||C>=n.length)break}const R=Math.min(Math.abs(e),Math.abs(k));e=e<0?0-R:R}{let S=e<0?g:p;for(;S>=0&&S<n.length;){const C=Math.abs(e)-Math.abs(_),k=c[S];dn(k!=null,`Previous layout not found for panel index ${S}`);const R=k-C,E=Nc({overrideDisabledPanels:l,panelConstraints:n[S],prevSize:k,size:R});if(!$r(k,E)&&(_+=k-E,d[S]=E,_.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?S--:S++}}if(Eq(h,d))return i;{const S=e<0?p:g,C=c[S];dn(C!=null,`Previous layout not found for panel index ${S}`);const k=C+_,R=Nc({overrideDisabledPanels:l,panelConstraints:n[S],prevSize:C,size:k});if(d[S]=R,!$r(R,k)){let E=k-R,N=e<0?p:g;for(;N>=0&&N<n.length;){const L=d[N];dn(L!=null,`Previous layout not found for panel index ${N}`);const j=L+E,O=Nc({overrideDisabledPanels:l,panelConstraints:n[N],prevSize:L,size:j});if($r(L,O)||(E-=O-L,d[N]=O),$r(E,0))break;e>0?N--:N++}}}const y=Object.values(d).reduce((S,C)=>C+S,0);if(!$r(y,100,.1))return i;const w=Object.keys(i);return d.reduce((S,C,k)=>(S[w[k]]=C,S),{})}function _l(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Es(e[n],t[n])!==0)return!1;return!0}function bl({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],i=r.reduce((c,h)=>c+h,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(c=>`${c}%`).join(", ")}`);if(!$r(i,100)&&r.length>0)for(let c=0;c<t.length;c++){const h=r[c];dn(h!=null,`No layout data found for index ${c}`);const d=100/i*h;r[c]=d}let o=0;for(let c=0;c<t.length;c++){const h=n[c];dn(h!=null,`No layout data found for index ${c}`);const d=r[c];dn(d!=null,`No layout data found for index ${c}`);const g=Nc({overrideDisabledPanels:!0,panelConstraints:t[c],prevSize:h,size:d});d!=g&&(o+=d-g,r[c]=g)}if(!$r(o,0))for(let c=0;c<t.length;c++){const h=r[c];dn(h!=null,`No layout data found for index ${c}`);const d=h+o,g=Nc({overrideDisabledPanels:!0,panelConstraints:t[c],prevSize:h,size:d});if(h!==g&&(o-=g-h,r[c]=g,$r(o,0)))break}const l=Object.keys(e);return r.reduce((c,h,d)=>(c[l[d]]=h,c),{})}function rD({groupId:e,panelId:t}){const n=()=>{const c=Nl();for(const[h,{defaultLayoutDeferred:d,derivedPanelConstraints:g,layout:p,groupSize:_,separatorToPanels:y}]of c)if(h.id===e)return{defaultLayoutDeferred:d,derivedPanelConstraints:g,group:h,groupSize:_,layout:p,separatorToPanels:y};throw Error(`Group ${e} not found`)},r=()=>{const c=n().derivedPanelConstraints.find(h=>h.panelId===t);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const c=n().group.panels.find(h=>h.id===t);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},o=()=>{const c=n().layout[t];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},l=c=>{const h=o();if(c===h)return;const{defaultLayoutDeferred:d,derivedPanelConstraints:g,group:p,groupSize:_,layout:y,separatorToPanels:w}=n(),S=p.panels.findIndex(E=>E.id===t),C=S===p.panels.length-1,k=ih({delta:C?h-c:c-h,initialLayout:y,panelConstraints:g,pivotIndices:C?[S-1,S]:[S,S+1],prevLayout:y,trigger:"imperative-api"}),R=bl({layout:k,panelConstraints:g});_l(y,R)||xo(p,{defaultLayoutDeferred:d,derivedPanelConstraints:g,groupSize:_,layout:R,separatorToPanels:w})};return{collapse:()=>{const{collapsible:c,collapsedSize:h}=r(),{mutableValues:d}=i(),g=o();c&&g!==h&&(d.expandToSize=g,l(h))},expand:()=>{const{collapsible:c,collapsedSize:h,minSize:d}=r(),{mutableValues:g}=i(),p=o();if(c&&p===h){let _=g.expandToSize??d;_===0&&(_=1),l(_)}},getSize:()=>{const{group:c}=n(),h=o(),{element:d}=i(),g=c.orientation==="horizontal"?d.offsetWidth:d.offsetHeight;return{asPercentage:h,inPixels:g}},isCollapsed:()=>{const{collapsible:c,collapsedSize:h}=r(),d=o();return c&&$r(h,d)},resize:c=>{const{group:h}=n(),{element:d}=i(),g=Uc({group:h}),p=kd({groupSize:g,panelElement:d,styleProp:c}),_=si(p/g*100);l(_)}}}function zE(e){if(e.defaultPrevented)return;const t=Nl();yw(e,t).forEach(n=>{if(n.separator){const r=n.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(r){const i=r.panelConstraints.defaultSize,o=rD({groupId:n.group.id,panelId:r.id});o&&i!==void 0&&(o.resize(i),e.preventDefault())}}})}function qm(e){const t=Nl();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function iD({groupId:e}){const t=()=>{const n=Nl();for(const[r,i]of n)if(r.id===e)return{group:r,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:o,groupSize:l,layout:c,separatorToPanels:h}=t(),d=bl({layout:n,panelConstraints:i});return r?c:(_l(c,d)||xo(o,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:h}),d)}}}function Za(e,t){const n=qm(e),r=_a(n.id,!0),i=n.separators.find(g=>g.element===e);dn(i,"Matching separator not found");const o=r.separatorToPanels.get(i);dn(o,"Matching panels not found");const l=o.map(g=>n.panels.indexOf(g)),c=iD({groupId:n.id}).getLayout(),h=ih({delta:t,initialLayout:c,panelConstraints:r.derivedPanelConstraints,pivotIndices:l,prevLayout:c,trigger:"keyboard"}),d=bl({layout:h,panelConstraints:r.derivedPanelConstraints});_l(c,d)||xo(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:d,separatorToPanels:r.separatorToPanels})}function PE(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=qm(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Za(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Za(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Za(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Za(t,-5);break}case"End":{e.preventDefault(),Za(t,100);break}case"Enter":{e.preventDefault();const r=qm(t),i=_a(r.id,!0),{derivedPanelConstraints:o,layout:l,separatorToPanels:c}=i,h=r.separators.find(_=>_.element===t);dn(h,"Matching separator not found");const d=c.get(h);dn(d,"Matching panels not found");const g=d[0],p=o.find(_=>_.panelId===g.id);if(dn(p,"Panel metadata not found"),p.collapsible){const _=l[g.id],y=p.collapsedSize===_?r.mutableState.expandedPanelSizes[g.id]??p.minSize:p.collapsedSize;Za(t,y-_)}break}case"F6":{e.preventDefault();const r=qm(t).separators.map(l=>l.element),i=Array.from(r).findIndex(l=>l===e.currentTarget);dn(i!==null,"Index not found");const o=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[o].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),Za(t,-100);break}}}let Lc={cursorFlags:0,state:"inactive"};const xw=new eD;function yl(){return Lc}function Rq(e){return xw.addListener("change",e)}function Tq(e){const t=Lc,n={...Lc};n.cursorFlags=e,Lc=n,xw.emit("change",{prev:t,next:n})}function zc(e){const t=Lc;Lc=e,xw.emit("change",{prev:t,next:e})}function IE(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Nl(),n=yw(e,t),r=new Map;let i=!1;n.forEach(o=>{o.separator&&(i||(i=!0,o.separator.element.focus({preventScroll:!0})));const l=t.get(o.group);l&&r.set(o.group,l.layout)}),zc({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const Nq=e=>e,Rb=()=>{},sD=1,oD=2,aD=4,lD=8,BE=3,FE=12;let bm;function HE(){return bm===void 0&&(bm=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(bm=!0)),bm}function Mq({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(o=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{r++;break}case"vertical":{i++;break}}})}if(!(r===0&&i===0)){switch(n){case"active":{if(e&&HE()){const o=(e&sD)!==0,l=(e&oD)!==0,c=(e&aD)!==0,h=(e&lD)!==0;if(o)return c?"se-resize":h?"ne-resize":"e-resize";if(l)return c?"sw-resize":h?"nw-resize":"w-resize";if(c)return"s-resize";if(h)return"n-resize"}break}}return HE()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}const $E=new WeakMap;function ww(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=$E.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=yl();switch(r.state){case"active":case"hover":{const i=Mq({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(l=>l.group),state:r.state}),o=`*, *:hover {cursor: ${i} !important; }`;if(t===o)return;t=o,i?n.cssRules.length===0?n.insertRule(o):n.replaceSync(o):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}$E.set(e,{prevStyle:t,styleSheet:n})}function cD({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:o,prevCursorFlags:l}){let c=0;n.forEach(d=>{const{group:g,groupSize:p}=d,{orientation:_,panels:y}=g,{disableCursor:w}=g.mutableState;let S=0;o?_==="horizontal"?S=(t.clientX-o.x)/p*100:S=(t.clientY-o.y)/p*100:_==="horizontal"?S=t.clientX<0?-100:100:S=t.clientY<0?-100:100;const C=r.get(g),k=i.get(g);if(!C||!k)return;const{defaultLayoutDeferred:R,derivedPanelConstraints:E,groupSize:N,layout:L,separatorToPanels:j}=k;if(E&&L&&j){const O=ih({delta:S,initialLayout:C,panelConstraints:E,pivotIndices:d.panels.map(H=>y.indexOf(H)),prevLayout:L,trigger:"mouse-or-touch"});if(_l(O,L)){if(S!==0&&!w)switch(_){case"horizontal":{c|=S<0?sD:oD;break}case"vertical":{c|=S<0?aD:lD;break}}}else xo(d.group,{defaultLayoutDeferred:R,derivedPanelConstraints:E,groupSize:N,layout:O,separatorToPanels:j})}});let h=0;t.movementX===0?h|=l&BE:h|=c&BE,t.movementY===0?h|=l&FE:h|=c&FE,Tq(h),ww(e)}function UE(e){const t=Nl(),n=yl();switch(n.state){case"active":cD({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function VE(e){var r,i;if(e.defaultPrevented)return;const t=yl(),n=Nl();switch(t.state){case"active":{if(e.buttons===0){zc({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{const l=_a(o.group.id,!0);xo(o.group,l)});return}for(const o of t.hitRegions)if(o.separator){const{element:l}=o.separator;(r=l.hasPointerCapture)!=null&&r.call(l,e.pointerId)||((i=l.setPointerCapture)==null||i.call(l,e.pointerId))}cD({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=yw(e,n);o.length===0?t.state!=="inactive"&&zc({cursorFlags:0,state:"inactive"}):zc({cursorFlags:0,hitRegions:o,state:"hover"}),ww(e.currentTarget);break}}}function WE(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(yl().state){case"hover":zc({cursorFlags:0,state:"inactive"})}}function qE(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=yl();switch(t.state){case"active":zc({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(ww(e.currentTarget),t.hitRegions.forEach(n=>{const r=_a(n.group.id,!0);xo(n.group,r)}),e.preventDefault())}}function KE(e){let t=0,n=0;const r={};for(const o of e)if(o.defaultSize!==void 0){t++;const l=si(o.defaultSize);n+=l,r[o.panelId]=l}else r[o.panelId]=void 0;const i=e.length-t;if(i!==0){const o=si((100-n)/i);for(const l of e)l.defaultSize===void 0&&(r[l.panelId]=o)}return r}function Aq(e,t,n){if(!n[0])return;const r=e.panels.find(h=>h.element===t);if(!r||!r.onResize)return;const i=Uc({group:e}),o=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,l=r.mutableValues.prevSize,c={asPercentage:si(o/i*100),inPixels:o};r.mutableValues.prevSize=c,r.onResize(c,r.id,l)}function jq(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Dq({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,o=0,l=!1;const c=new Map,h=[];for(const p of e.panels){const _=r[p.id]??0;switch(p.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{l=!0;const y=_/100*n,w=si(y/t*100);c.set(p.id,w),i+=w;break}case"preserve-relative-size":default:{h.push(p.id),o+=_;break}}}if(!l||h.length===0)return r;const d=100-i,g={...r};if(c.forEach((p,_)=>{g[_]=p}),o>0)for(const p of h){const _=r[p]??0;g[p]=si(_/o*d)}else{const p=si(d/h.length);for(const _ of h)g[_]=p}return g}function Oq(e,t){const n=e.map(i=>i.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!r.includes(i))return!1;return!0}const gc=new Map;function Lq(e){let t=!0;dn(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,o=new n(w=>{for(const S of w){const{borderBoxSize:C,target:k}=S;if(k===e.element){if(t){const R=Uc({group:e});if(R===0)return;const E=_a(e.id);if(!E)return;const N=ex(e),L=E.defaultLayoutDeferred?KE(N):E.layout,j=Dq({group:e,nextGroupSize:R,prevGroupSize:E.groupSize,prevLayout:L}),O=bl({layout:j,panelConstraints:N});if(!E.defaultLayoutDeferred&&_l(E.layout,O)&&jq(E.derivedPanelConstraints,N)&&E.groupSize===R)return;xo(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:N,groupSize:R,layout:O,separatorToPanels:E.separatorToPanels})}}else Aq(e,k,C)}});o.observe(e.element),e.panels.forEach(w=>{dn(!r.has(w.id),`Panel ids must be unique; id "${w.id}" was used more than once`),r.add(w.id),w.onResize&&o.observe(w.element)});const l=Uc({group:e}),c=ex(e),h=e.panels.map(({id:w})=>w).join(",");let d=e.mutableState.defaultLayout;d&&(Oq(e.panels,d)||(d=void 0));const g=e.mutableState.layouts[h]??d??KE(c),p=bl({layout:g,panelConstraints:c}),_=e.element.ownerDocument;gc.set(_,(gc.get(_)??0)+1);const y=new Map;return Jj(e).forEach(w=>{w.separator&&y.set(w.separator,w.panels)}),xo(e,{defaultLayoutDeferred:l===0,derivedPanelConstraints:c,groupSize:l,layout:p,separatorToPanels:y}),e.separators.forEach(w=>{dn(!i.has(w.id),`Separator ids must be unique; id "${w.id}" was used more than once`),i.add(w.id),w.element.addEventListener("keydown",PE)}),gc.get(_)===1&&(_.addEventListener("dblclick",zE,!0),_.addEventListener("pointerdown",IE,!0),_.addEventListener("pointerleave",UE),_.addEventListener("pointermove",VE),_.addEventListener("pointerout",WE),_.addEventListener("pointerup",qE,!0)),function(){t=!1,gc.set(_,Math.max(0,(gc.get(_)??0)-1)),vq(e),e.separators.forEach(w=>{w.element.removeEventListener("keydown",PE)}),gc.get(_)||(_.removeEventListener("dblclick",zE,!0),_.removeEventListener("pointerdown",IE,!0),_.removeEventListener("pointerleave",UE),_.removeEventListener("pointermove",VE),_.removeEventListener("pointerout",WE),_.removeEventListener("pointerup",qE,!0)),o.disconnect()}}function zq(){const[e,t]=v.useState({}),n=v.useCallback(()=>t({}),[]);return[e,n]}function Sw(e){const t=v.useId();return`${e??t}`}const Ml=typeof window<"u"?v.useLayoutEffect:v.useEffect;function Bd(e){const t=v.useRef(e);return Ml(()=>{t.current=e},[e]),v.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function Cw(...e){return Bd(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function kw(e){const t=v.useRef({...e});return Ml(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const uD=v.createContext(null);function Pq(e,t){const n=v.useRef({getLayout:()=>({}),setLayout:Nq});v.useImperativeHandle(t,()=>n.current,[]),Ml(()=>{Object.assign(n.current,iD({groupId:e}))})}function dD({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:o,groupRef:l,id:c,onLayoutChange:h,onLayoutChanged:d,orientation:g="horizontal",resizeTargetMinimumSize:p={coarse:20,fine:10},style:_,...y}){const w=v.useRef({onLayoutChange:{},onLayoutChanged:{}}),S=Bd(W=>{_l(w.current.onLayoutChange,W)||(w.current.onLayoutChange=W,h==null||h(W))}),C=Bd(W=>{_l(w.current.onLayoutChanged,W)||(w.current.onLayoutChanged=W,d==null||d(W))}),k=Sw(c),R=v.useRef(null),[E,N]=zq(),L=v.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:p,separators:[]}),j=Cw(R,o);Pq(k,l);const O=Bd((W,F)=>{const $=yl(),V=jE(W),q=_a(W);if(q){let D=!1;switch($.state){case"active":{D=$.hitRegions.some(U=>U.group===V);break}}return{flexGrow:q.layout[F]??1,pointerEvents:D?"none":void 0}}if(n!=null&&n[F])return{flexGrow:n==null?void 0:n[F]}}),H=kw({defaultLayout:n,disableCursor:r}),Z=v.useMemo(()=>({get disableCursor(){return!!H.disableCursor},getPanelStyles:O,id:k,orientation:g,registerPanel:W=>{const F=L.current;return F.panels=tx(g,[...F.panels,W]),N(),()=>{F.panels=F.panels.filter($=>$!==W),N()}},registerSeparator:W=>{const F=L.current;return F.separators=tx(g,[...F.separators,W]),N(),()=>{F.separators=F.separators.filter($=>$!==W),N()}},togglePanelDisabled:(W,F)=>{const $=L.current.panels.find(D=>D.id===W);$&&($.panelConstraints.disabled=F);const V=jE(k),q=_a(k);V&&q&&xo(V,{...q,derivedPanelConstraints:ex(V)})},toggleSeparatorDisabled:(W,F)=>{const $=L.current.separators.find(V=>V.id===W);$&&($.disabled=F)}}),[O,k,N,g,H]),I=v.useRef(null);return Ml(()=>{const W=R.current;if(W===null)return;const F=L.current;let $;if(H.defaultLayout!==void 0&&Object.keys(H.defaultLayout).length===F.panels.length){$={};for(const M of F.panels){const B=H.defaultLayout[M.id];B!==void 0&&($[M.id]=B)}}const V={disabled:!!i,element:W,id:k,mutableState:{defaultLayout:$,disableCursor:!!H.disableCursor,expandedPanelSizes:L.current.lastExpandedPanelSizes,layouts:L.current.layouts},orientation:g,panels:F.panels,resizeTargetMinimumSize:F.resizeTargetMinimumSize,separators:F.separators};I.current=V;const q=Lq(V),{defaultLayoutDeferred:D,derivedPanelConstraints:U,layout:z}=_a(V.id,!0);!D&&U.length>0&&(S(z),C(z));const G=bw(k,M=>{const{defaultLayoutDeferred:B,derivedPanelConstraints:X,layout:A}=M.next;if(B||X.length===0)return;const ie=V.panels.map(({id:ee})=>ee).join(",");V.mutableState.layouts[ie]=A,X.forEach(ee=>{if(ee.collapsible){const{layout:re}=M.prev??{};if(re){const ue=$r(ee.collapsedSize,A[ee.panelId]),fe=$r(ee.collapsedSize,re[ee.panelId]);ue&&!fe&&(V.mutableState.expandedPanelSizes[ee.panelId]=re[ee.panelId])}}});const J=yl().state!=="active";S(A),J&&C(A)});return()=>{I.current=null,q(),G()}},[i,k,C,S,g,E,H]),v.useEffect(()=>{const W=I.current;W&&(W.mutableState.defaultLayout=n,W.mutableState.disableCursor=!!r)}),f.jsx(uD.Provider,{value:Z,children:f.jsx("div",{...y,className:t,"data-group":!0,"data-testid":k,id:k,ref:j,style:{height:"100%",width:"100%",overflow:"hidden",..._,display:"flex",flexDirection:g==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:g==="horizontal"?"pan-y":"pan-x"},children:e})})}dD.displayName="Group";function Ew(){const e=v.useContext(uD);return dn(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Iq(e,t){const{id:n}=Ew(),r=v.useRef({collapse:Rb,expand:Rb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Rb});v.useImperativeHandle(t,()=>r.current,[]),Ml(()=>{Object.assign(r.current,rD({groupId:n,panelId:e}))})}function hD({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,disabled:o,elementRef:l,groupResizeBehavior:c="preserve-relative-size",id:h,maxSize:d="100%",minSize:g="0%",onResize:p,panelRef:_,style:y,...w}){const S=!!h,C=Sw(h),k=kw({disabled:o}),R=v.useRef(null),E=Cw(R,l),{getPanelStyles:N,id:L,orientation:j,registerPanel:O,togglePanelDisabled:H}=Ew(),Z=p!==null,I=Bd((V,q,D)=>{p==null||p(V,h,D)});Ml(()=>{const V=R.current;if(V!==null){const q={element:V,id:C,idIsStable:S,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:Z?I:void 0,panelConstraints:{groupResizeBehavior:c,collapsedSize:n,collapsible:r,defaultSize:i,disabled:k.disabled,maxSize:d,minSize:g}};return O(q)}},[c,n,r,i,Z,C,S,d,g,I,O,k]),v.useEffect(()=>{H(C,!!o)},[o,C,H]),Iq(C,_);const W=()=>{const V=N(L,C);if(V)return JSON.stringify(V)},F=v.useSyncExternalStore(V=>bw(L,V),W,W);let $;return F?$=JSON.parse(F):i?$={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:$={flexGrow:1},f.jsx("div",{...w,"data-disabled":o||void 0,"data-panel":!0,"data-testid":C,id:C,ref:E,style:{...Bq,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...$},children:f.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...y,touchAction:j==="horizontal"?"pan-y":"pan-x"},children:e})})}hD.displayName="Panel";const Bq={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Fq({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,o;const l=e[n],c=t.find(h=>h.panelId===n);if(c){const h=c.maxSize,d=c.collapsible?c.collapsedSize:c.minSize,g=[r,r+1];o=bl({layout:ih({delta:d-l,initialLayout:e,panelConstraints:t,pivotIndices:g,prevLayout:e}),panelConstraints:t})[n],i=bl({layout:ih({delta:h-l,initialLayout:e,panelConstraints:t,pivotIndices:g,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:o,valueNow:l}}function fD({children:e,className:t,disabled:n,elementRef:r,id:i,style:o,...l}){const c=Sw(i),h=kw({disabled:n}),[d,g]=v.useState({}),[p,_]=v.useState("inactive"),y=v.useRef(null),w=Cw(y,r),{disableCursor:S,id:C,orientation:k,registerSeparator:R,toggleSeparatorDisabled:E}=Ew(),N=k==="horizontal"?"vertical":"horizontal";Ml(()=>{const j=y.current;if(j!==null){const O={disabled:h.disabled,element:j,id:c},H=R(O),Z=Rq(W=>{_(W.next.state!=="inactive"&&W.next.hitRegions.some(F=>F.separator===O)?W.next.state:"inactive")}),I=bw(C,W=>{const{derivedPanelConstraints:F,layout:$,separatorToPanels:V}=W.next,q=V.get(O);if(q){const D=q[0],U=q.indexOf(D);g(Fq({layout:$,panelConstraints:F,panelId:D.id,panelIndex:U}))}});return()=>{Z(),I(),H()}}},[C,c,R,h]),v.useEffect(()=>{E(c,!!n)},[n,c,E]);let L;return n&&!S&&(L="not-allowed"),f.jsx("div",{...l,"aria-controls":d.valueControls,"aria-disabled":n||void 0,"aria-orientation":N,"aria-valuemax":d.valueMax,"aria-valuemin":d.valueMin,"aria-valuenow":d.valueNow,children:e,className:t,"data-separator":n?"disabled":p,"data-testid":c,id:c,ref:w,role:"separator",style:{flexBasis:"auto",cursor:L,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}fD.displayName="Separator";const Fd=({className:e,...t})=>f.jsx(dD,{className:pe("flex h-full w-full",e),...t}),mo=e=>f.jsx(hD,{...e}),Hd=({withHandle:e,orientation:t,disabled:n,className:r,...i})=>f.jsx(fD,{disabled:n,className:pe("relative flex items-center justify-center bg-transparent focus-visible:outline-none",t==="vertical"?"h-2 w-full -my-1 cursor-row-resize before:absolute before:inset-x-0 before:top-1/2 before:h-0.5 before:-translate-y-1/2 before:bg-border":"h-full w-2 -mx-1 cursor-col-resize before:absolute before:inset-y-0 before:left-1/2 before:w-px before:-translate-x-1/2 before:bg-border",r),...i,children:f.jsx("span",{className:"sr-only",children:t==="vertical"?"Resize rows":"Resize columns"})});/**
519
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
520
+ * @license MIT
521
+ *
522
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
523
+ * @license MIT
524
+ *
525
+ * Originally forked from (with the author's permission):
526
+ * Fabrice Bellard's javascript vt100 for jslinux:
527
+ * http://bellard.org/jslinux/
528
+ * Copyright (c) 2011 Fabrice Bellard
529
+ */var fr=0,mr=0,pr=0,On=0,Or;(e=>{function t(i,o,l,c){return c!==void 0?`#${Qa(i)}${Qa(o)}${Qa(l)}${Qa(c)}`:`#${Qa(i)}${Qa(o)}${Qa(l)}`}e.toCss=t;function n(i,o,l,c=255){return(i<<24|o<<16|l<<8|c)>>>0}e.toRgba=n;function r(i,o,l,c){return{css:e.toCss(i,o,l,c),rgba:e.toRgba(i,o,l,c)}}e.toColor=r})(Or||(Or={}));var Hq;(e=>{function t(h,d){if(On=(d.rgba&255)/255,On===1)return{css:d.css,rgba:d.rgba};let g=d.rgba>>24&255,p=d.rgba>>16&255,_=d.rgba>>8&255,y=h.rgba>>24&255,w=h.rgba>>16&255,S=h.rgba>>8&255;fr=y+Math.round((g-y)*On),mr=w+Math.round((p-w)*On),pr=S+Math.round((_-S)*On);let C=Or.toCss(fr,mr,pr),k=Or.toRgba(fr,mr,pr);return{css:C,rgba:k}}e.blend=t;function n(h){return(h.rgba&255)===255}e.isOpaque=n;function r(h,d,g){let p=Km.ensureContrastRatio(h.rgba,d.rgba,g);if(p)return Or.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=r;function i(h){let d=(h.rgba|255)>>>0;return[fr,mr,pr]=Km.toChannels(d),{css:Or.toCss(fr,mr,pr),rgba:d}}e.opaque=i;function o(h,d){return On=Math.round(d*255),[fr,mr,pr]=Km.toChannels(h.rgba),{css:Or.toCss(fr,mr,pr,On),rgba:Or.toRgba(fr,mr,pr,On)}}e.opacity=o;function l(h,d){return On=h.rgba&255,o(h,On*d/255)}e.multiplyOpacity=l;function c(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=c})(Hq||(Hq={}));var Rr;(e=>{let t,n;try{let i=document.createElement("canvas");i.width=1,i.height=1;let o=i.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return fr=parseInt(i.slice(1,2).repeat(2),16),mr=parseInt(i.slice(2,3).repeat(2),16),pr=parseInt(i.slice(3,4).repeat(2),16),Or.toColor(fr,mr,pr);case 5:return fr=parseInt(i.slice(1,2).repeat(2),16),mr=parseInt(i.slice(2,3).repeat(2),16),pr=parseInt(i.slice(3,4).repeat(2),16),On=parseInt(i.slice(4,5).repeat(2),16),Or.toColor(fr,mr,pr,On);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let o=i.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 fr=parseInt(o[1]),mr=parseInt(o[2]),pr=parseInt(o[3]),On=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Or.toColor(fr,mr,pr,On);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[fr,mr,pr,On]=t.getImageData(0,0,1,1).data,On!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Or.toRgba(fr,mr,pr,On),css:i}}e.toColor=r})(Rr||(Rr={}));var Fr;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,i,o){let l=r/255,c=i/255,h=o/255,d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),g=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return d*.2126+g*.7152+p*.0722}e.relativeLuminance2=n})(Fr||(Fr={}));var Km;(e=>{function t(l,c){if(On=(c&255)/255,On===1)return c;let h=c>>24&255,d=c>>16&255,g=c>>8&255,p=l>>24&255,_=l>>16&255,y=l>>8&255;return fr=p+Math.round((h-p)*On),mr=_+Math.round((d-_)*On),pr=y+Math.round((g-y)*On),Or.toRgba(fr,mr,pr)}e.blend=t;function n(l,c,h){let d=Fr.relativeLuminance(l>>8),g=Fr.relativeLuminance(c>>8);if(lo(d,g)<h){if(g<d){let y=r(l,c,h),w=lo(d,Fr.relativeLuminance(y>>8));if(w<h){let S=i(l,c,h),C=lo(d,Fr.relativeLuminance(S>>8));return w>C?y:S}return y}let p=i(l,c,h),_=lo(d,Fr.relativeLuminance(p>>8));if(_<h){let y=r(l,c,h),w=lo(d,Fr.relativeLuminance(y>>8));return _>w?p:y}return p}}e.ensureContrastRatio=n;function r(l,c,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,_=c>>24&255,y=c>>16&255,w=c>>8&255,S=lo(Fr.relativeLuminance2(_,y,w),Fr.relativeLuminance2(d,g,p));for(;S<h&&(_>0||y>0||w>0);)_-=Math.max(0,Math.ceil(_*.1)),y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=lo(Fr.relativeLuminance2(_,y,w),Fr.relativeLuminance2(d,g,p));return(_<<24|y<<16|w<<8|255)>>>0}e.reduceLuminance=r;function i(l,c,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,_=c>>24&255,y=c>>16&255,w=c>>8&255,S=lo(Fr.relativeLuminance2(_,y,w),Fr.relativeLuminance2(d,g,p));for(;S<h&&(_<255||y<255||w<255);)_=Math.min(255,_+Math.ceil((255-_)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=lo(Fr.relativeLuminance2(_,y,w),Fr.relativeLuminance2(d,g,p));return(_<<24|y<<16|w<<8|255)>>>0}e.increaseLuminance=i;function o(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=o})(Km||(Km={}));function Qa(e){let t=e.toString(16);return t.length<2?"0"+t:t}function lo(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var $q=Object.freeze((()=>{let e=[Rr.toColor("#2e3436"),Rr.toColor("#cc0000"),Rr.toColor("#4e9a06"),Rr.toColor("#c4a000"),Rr.toColor("#3465a4"),Rr.toColor("#75507b"),Rr.toColor("#06989a"),Rr.toColor("#d3d7cf"),Rr.toColor("#555753"),Rr.toColor("#ef2929"),Rr.toColor("#8ae234"),Rr.toColor("#fce94f"),Rr.toColor("#729fcf"),Rr.toColor("#ad7fa8"),Rr.toColor("#34e2e2"),Rr.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],o=t[n%6];e.push({css:Or.toCss(r,i,o),rgba:Or.toRgba(r,i,o)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Or.toCss(r,r,r),rgba:Or.toRgba(r,r,r)})}return e})());function GE(e,t,n){return Math.max(t,Math.min(e,n))}function Uq(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var mD=class{constructor(t){this._buffer=t}serialize(t,n){let r=this._buffer.getNullCell(),i=this._buffer.getNullCell(),o=r,l=t.start.y,c=t.end.y,h=t.start.x,d=t.end.x;this._beforeSerialize(c-l,l,c);for(let g=l;g<=c;g++){let p=this._buffer.getLine(g);if(p){let _=g===t.start.y?h:0,y=g===t.end.y?d:p.length;for(let w=_;w<y;w++){let S=p.getCell(w,o===r?i:r);if(!S){console.warn(`Can't get cell at row=${g}, col=${w}`);continue}this._nextCell(S,o,g,w),o=S}}this._rowEnd(g,g===c)}return this._afterSerialize(),this._serializeString(n)}_nextCell(t,n,r,i){}_rowEnd(t,n){}_beforeSerialize(t,n,r){}_afterSerialize(){}_serializeString(t){return""}};function pD(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function fo(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function gD(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var Vq=class extends mD{constructor(t,n){super(t),this._terminal=n,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(t,n,r){this._allRows=new Array(t),this._lastContentCursorRow=n,this._lastCursorRow=n,this._firstRow=n}_rowEnd(t,n){var i;this._nullCellCount>0&&!fo(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let r="";if(!n){t-this._firstRow>=this._terminal.rows&&((i=this._buffer.getLine(this._cursorStyleRow))==null||i.getCell(this._cursorStyleCol,this._backgroundCell));let o=this._buffer.getLine(t),l=this._buffer.getLine(t+1);if(!l.isWrapped)r=`\r
530
+ `,this._lastCursorRow=t+1,this._lastCursorCol=0;else{r="";let c=o.getCell(o.length-1,this._thisRowLastChar),h=o.getCell(o.length-2,this._thisRowLastSecondChar),d=l.getCell(0,this._nextRowFirstChar),g=d.getWidth()>1,p=!1;(d.getChars()&&g?this._nullCellCount<=1:this._nullCellCount<=0)&&((c.getChars()||c.getWidth()===0)&&fo(c,d)&&(p=!0),g&&(h.getChars()||h.getWidth()===0)&&fo(c,d)&&fo(h,d)&&(p=!0)),p||(r="-".repeat(this._nullCellCount+1),r+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(r+="\x1B[A",r+=`\x1B[${o.length-this._nullCellCount}C`,r+=`\x1B[${this._nullCellCount}X`,r+=`\x1B[${o.length-this._nullCellCount}D`,r+="\x1B[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=r,this._currentRow="",this._nullCellCount=0}_diffStyle(t,n){let r=[],i=!pD(t,n),o=!fo(t,n),l=!gD(t,n);if(i||o||l)if(t.isAttributeDefault())n.isAttributeDefault()||r.push(0);else{if(i){let c=t.getFgColor();t.isFgRGB()?r.push(38,2,c>>>16&255,c>>>8&255,c&255):t.isFgPalette()?c>=16?r.push(38,5,c):r.push(c&8?90+(c&7):30+(c&7)):r.push(39)}if(o){let c=t.getBgColor();t.isBgRGB()?r.push(48,2,c>>>16&255,c>>>8&255,c&255):t.isBgPalette()?c>=16?r.push(48,5,c):r.push(c&8?100+(c&7):40+(c&7)):r.push(49)}l&&(t.isInverse()!==n.isInverse()&&r.push(t.isInverse()?7:27),t.isBold()!==n.isBold()&&r.push(t.isBold()?1:22),t.isUnderline()!==n.isUnderline()&&r.push(t.isUnderline()?4:24),t.isOverline()!==n.isOverline()&&r.push(t.isOverline()?53:55),t.isBlink()!==n.isBlink()&&r.push(t.isBlink()?5:25),t.isInvisible()!==n.isInvisible()&&r.push(t.isInvisible()?8:28),t.isItalic()!==n.isItalic()&&r.push(t.isItalic()?3:23),t.isDim()!==n.isDim()&&r.push(t.isDim()?2:22),t.isStrikethrough()!==n.isStrikethrough()&&r.push(t.isStrikethrough()?9:29))}return r}_nextCell(t,n,r,i){if(t.getWidth()===0)return;let o=t.getChars()==="",l=this._diffStyle(t,this._cursorStyle);if(o?!fo(this._cursorStyle,t):l.length>0){this._nullCellCount>0&&(fo(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=i,this._currentRow+=`\x1B[${l.join(";")}m`;let c=this._buffer.getLine(r);c!==void 0&&(c.getCell(i,this._cursorStyle),this._cursorStyleRow=r,this._cursorStyleCol=i)}o?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(fo(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=i+t.getWidth())}_serializeString(t){let n=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(n=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let r="";for(let l=0;l<n;l++)r+=this._allRows[l],l+1<n&&(r+=this._allRowSeparators[l]);if(!t){let l=this._buffer.baseY+this._buffer.cursorY,c=this._buffer.cursorX,h=l!==this._lastCursorRow||c!==this._lastCursorCol,d=g=>{g>0?r+=`\x1B[${g}C`:g<0&&(r+=`\x1B[${-g}D`)};h&&((g=>{g>0?r+=`\x1B[${g}B`:g<0&&(r+=`\x1B[${-g}A`)})(l-this._lastCursorRow),d(c-this._lastCursorCol))}let i=this._terminal._core._inputHandler._curAttrData,o=this._diffStyle(i,this._cursorStyle);return o.length>0&&(r+=`\x1B[${o.join(";")}m`),r}},Wq=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,n,r){let i=n.length,o=r===void 0?i:GE(r+t.rows,0,i);return this._serializeBufferByRange(t,n,{start:i-o,end:i-1},!1)}_serializeBufferByRange(t,n,r,i){return new Vq(n,t).serialize({start:{x:0,y:typeof r.start=="number"?r.start:r.start.line},end:{x:t.cols,y:typeof r.end=="number"?r.end:r.end.line}},i)}_serializeBufferAsHTML(t,n){var h;let r=t.buffer.active,i=new qq(r,t,n),o=n.onlySelection??!1,l=n.range;if(l)return i.serialize({start:{x:l.startCol,y:(l.startLine,l.startLine)},end:{x:t.cols,y:(l.endLine,l.endLine)}});if(!o){let d=r.length,g=n.scrollback,p=g===void 0?d:GE(g+t.rows,0,d);return i.serialize({start:{x:0,y:d-p},end:{x:t.cols,y:d-1}})}let c=(h=this._terminal)==null?void 0:h.getSelectionPosition();return c!==void 0?i.serialize({start:{x:c.start.x,y:c.start.y},end:{x:c.end.x,y:c.end.y}}):""}_serializeModes(t){let n="",r=t.modes;if(r.applicationCursorKeysMode&&(n+="\x1B[?1h"),r.applicationKeypadMode&&(n+="\x1B[?66h"),r.bracketedPasteMode&&(n+="\x1B[?2004h"),r.insertMode&&(n+="\x1B[4h"),r.originMode&&(n+="\x1B[?6h"),r.reverseWraparoundMode&&(n+="\x1B[?45h"),r.sendFocusMode&&(n+="\x1B[?1004h"),r.wraparoundMode===!1&&(n+="\x1B[?7l"),r.mouseTrackingMode!=="none")switch(r.mouseTrackingMode){case"x10":n+="\x1B[?9h";break;case"vt200":n+="\x1B[?1000h";break;case"drag":n+="\x1B[?1002h";break;case"any":n+="\x1B[?1003h";break}return n}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let n=t!=null&&t.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,t.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,t==null?void 0:t.scrollback);if(!(t!=null&&t.excludeAltBuffer)&&this._terminal.buffer.active.type==="alternate"){let r=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);n+=`\x1B[?1049h\x1B[H${r}`}return t!=null&&t.excludeModes||(n+=this._serializeModes(this._terminal)),n}serializeAsHTML(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,t||{})}dispose(){}},qq=class extends mD{constructor(t,n,r){super(t),this._terminal=n,this._options=r,this._currentRow="",this._htmlContent="",n._core._themeService?this._ansiColors=n._core._themeService.colors.ansi:this._ansiColors=$q}_padStart(t,n,r){return n=n>>0,r=r??" ",t.length>n?t:(n-=t.length,n>r.length&&(r+=r.repeat(n/r.length)),r.slice(0,n)+t)}_beforeSerialize(t,n,r){var c,h;this._htmlContent+="<html><body><!--StartFragment--><pre>";let i="#000000",o="#ffffff";(this._options.includeGlobalBackground??!1)&&(i=((c=this._terminal.options.theme)==null?void 0:c.foreground)??"#ffffff",o=((h=this._terminal.options.theme)==null?void 0:h.background)??"#000000");let l=[];l.push("color: "+i+";"),l.push("background-color: "+o+";"),l.push("font-family: "+this._terminal.options.fontFamily+";"),l.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+l.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(t,n){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(t,n){let r=n?t.getFgColor():t.getBgColor();if(n?t.isFgRGB():t.isBgRGB())return"#"+[r>>16&255,r>>8&255,r&255].map(i=>this._padStart(i.toString(16),2,"0")).join("");if(n?t.isFgPalette():t.isBgPalette())return this._ansiColors[r].css}_diffStyle(t,n){let r=[],i=!pD(t,n),o=!fo(t,n),l=!gD(t,n);if(i||o||l){let c=this._getHexColor(t,!0);c&&r.push("color: "+c+";");let h=this._getHexColor(t,!1);return h&&r.push("background-color: "+h+";"),t.isInverse()&&r.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&r.push("font-weight: bold;"),t.isUnderline()&&t.isOverline()?r.push("text-decoration: overline underline;"):t.isUnderline()?r.push("text-decoration: underline;"):t.isOverline()&&r.push("text-decoration: overline;"),t.isBlink()&&r.push("text-decoration: blink;"),t.isInvisible()&&r.push("visibility: hidden;"),t.isItalic()&&r.push("font-style: italic;"),t.isDim()&&r.push("opacity: 0.5;"),t.isStrikethrough()&&r.push("text-decoration: line-through;"),r}}_nextCell(t,n,r,i){if(t.getWidth()===0)return;let o=t.getChars()==="",l=this._diffStyle(t,n);l&&(this._currentRow+=l.length===0?"</span><span>":"</span><span style='"+l.join(" ")+"'>"),o?this._currentRow+=" ":this._currentRow+=Uq(t.getChars())}_serializeString(){return this._htmlContent}};/**
531
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
532
+ * @license MIT
533
+ *
534
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
535
+ * @license MIT
536
+ *
537
+ * Originally forked from (with the author's permission):
538
+ * Fabrice Bellard's javascript vt100 for jslinux:
539
+ * http://bellard.org/jslinux/
540
+ * Copyright (c) 2011 Fabrice Bellard
541
+ */var Kq=class{constructor(t,n,r,i={}){this._terminal=t,this._regex=n,this._handler=r,this._options=i}provideLinks(t,n){let r=Yq.computeLink(t,this._regex,this._terminal,this._handler);n(this._addCallbacks(r))}_addCallbacks(t){return t.map(n=>(n.leave=this._options.leave,n.hover=(r,i)=>{if(this._options.hover){let{range:o}=n;this._options.hover(r,i,o)}},n))}};function Gq(e){try{let t=new URL(e),n=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(n.toLocaleLowerCase())}catch{return!1}}var Yq=class Gm{static computeLink(t,n,r,i){let o=new RegExp(n.source,(n.flags||"")+"g"),[l,c]=Gm._getWindowedLineStrings(t-1,r),h=l.join(""),d,g=[];for(;d=o.exec(h);){let p=d[0];if(!Gq(p))continue;let[_,y]=Gm._mapStrIdx(r,c,0,d.index),[w,S]=Gm._mapStrIdx(r,_,y,p.length);if(_===-1||y===-1||w===-1||S===-1)continue;let C={start:{x:y+1,y:_+1},end:{x:S,y:w+1}};g.push({range:C,text:p,activate:i})}return g}static _getWindowedLineStrings(t,n){let r,i=t,o=t,l=0,c="",h=[];if(r=n.buffer.active.getLine(t)){let d=r.translateToString(!0);if(r.isWrapped&&d[0]!==" "){for(l=0;(r=n.buffer.active.getLine(--i))&&l<2048&&(c=r.translateToString(!0),l+=c.length,h.push(c),!(!r.isWrapped||c.indexOf(" ")!==-1)););h.reverse()}for(h.push(d),l=0;(r=n.buffer.active.getLine(++o))&&r.isWrapped&&l<2048&&(c=r.translateToString(!0),l+=c.length,h.push(c),c.indexOf(" ")===-1););}return[h,i]}static _mapStrIdx(t,n,r,i){let o=t.buffer.active,l=o.getNullCell(),c=r;for(;i;){let h=o.getLine(n);if(!h)return[-1,-1];for(let d=c;d<h.length;++d){h.getCell(d,l);let g=l.getChars();if(l.getWidth()&&(i-=g.length||1,d===h.length-1&&g==="")){let p=o.getLine(n+1);p&&p.isWrapped&&(p.getCell(0,l),l.getWidth()===2&&(i+=1))}if(i<0)return[n,d]}n++,c=0}return[n,c]}},Xq=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Zq(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var Qq=class{constructor(t=Zq,n={}){this._handler=t,this._options=n}activate(t){this._terminal=t;let n=this._options,r=n.urlRegex||Xq;this._linkProvider=this._terminal.registerLinkProvider(new Kq(this._terminal,r,this._handler,n))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
542
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
543
+ * @license MIT
544
+ *
545
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
546
+ * @license MIT
547
+ *
548
+ * Originally forked from (with the author's permission):
549
+ * Fabrice Bellard's javascript vt100 for jslinux:
550
+ * http://bellard.org/jslinux/
551
+ * Copyright (c) 2011 Fabrice Bellard
552
+ */var vD=Object.defineProperty,Jq=Object.getOwnPropertyDescriptor,eK=(e,t)=>{for(var n in t)vD(e,n,{get:t[n],enumerable:!0})},zn=(e,t,n,r)=>{for(var i=r>1?void 0:r?Jq(t,n):t,o=e.length-1,l;o>=0;o--)(l=e[o])&&(i=(r?l(t,n,i):l(i))||i);return r&&i&&vD(t,n,i),i},ze=(e,t)=>(n,r)=>t(n,r,e),YE="Terminal input",nx={get:()=>YE,set:e=>YE=e},XE="Too much output to announce, navigate to rows manually to read",rx={get:()=>XE,set:e=>XE=e};function tK(e){return e.replace(/\r?\n/g,"\r")}function nK(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function rK(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function iK(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");_D(i,t,n,r)}}function _D(e,t,n,r){e=tK(e),e=nK(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function bD(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,o=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function ZE(e,t,n,r,i){bD(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function ha(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Ng(e,t=0,n=e.length){let r="";for(let i=t;i<n;++i){let o=e[i];o>65535?(o-=65536,r+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):r+=String.fromCharCode(o)}return r}var sK=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let o=e.charCodeAt(i++);56320<=o&&o<=57343?t[r++]=(this._interim-55296)*1024+o-56320+65536:(t[r++]=this._interim,t[r++]=o),this._interim=0}for(let o=i;o<n;++o){let l=e.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=n)return this._interim=l,r;let c=e.charCodeAt(o);56320<=c&&c<=57343?t[r++]=(l-55296)*1024+c-56320+65536:(t[r++]=l,t[r++]=c);continue}l!==65279&&(t[r++]=l)}return r}},oK=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,o,l,c,h=0,d=0;if(this.interim[0]){let _=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let w=0,S;for(;(S=this.interim[++w]&63)&&w<4;)y<<=6,y|=S;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,k=C-w;for(;d<k;){if(d>=n)return 0;if(S=e[d++],(S&192)!==128){d--,_=!0;break}else this.interim[w++]=S,y<<=6,y|=S&63}_||(C===2?y<128?d--:t[r++]=y:C===3?y<2048||y>=55296&&y<=57343||y===65279||(t[r++]=y):y<65536||y>1114111||(t[r++]=y)),this.interim.fill(0)}let g=n-4,p=d;for(;p<n;){for(;p<g&&!((i=e[p])&128)&&!((o=e[p+1])&128)&&!((l=e[p+2])&128)&&!((c=e[p+3])&128);)t[r++]=i,t[r++]=o,t[r++]=l,t[r++]=c,p+=4;if(i=e[p++],i<128)t[r++]=i;else if((i&224)===192){if(p>=n)return this.interim[0]=i,r;if(o=e[p++],(o&192)!==128){p--;continue}if(h=(i&31)<<6|o&63,h<128){p--;continue}t[r++]=h}else if((i&240)===224){if(p>=n)return this.interim[0]=i,r;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=n)return this.interim[0]=i,this.interim[1]=o,r;if(l=e[p++],(l&192)!==128){p--;continue}if(h=(i&15)<<12|(o&63)<<6|l&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[r++]=h}else if((i&248)===240){if(p>=n)return this.interim[0]=i,r;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=n)return this.interim[0]=i,this.interim[1]=o,r;if(l=e[p++],(l&192)!==128){p--;continue}if(p>=n)return this.interim[0]=i,this.interim[1]=o,this.interim[2]=l,r;if(c=e[p++],(c&192)!==128){p--;continue}if(h=(i&7)<<18|(o&63)<<12|(l&63)<<6|c&63,h<65536||h>1114111)continue;t[r++]=h}}return r}},yD="",ga=" ",Ah=class xD{constructor(){this.fg=0,this.bg=0,this.extended=new Rp}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 xD;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}},Rp=class wD{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}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 wD(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ki=class SD extends Ah{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Rp,this.combinedData=""}static fromCharData(t){let n=new SD;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ha(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 n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(r-55296)*1024+i-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},QE="di$target",ix="di$dependencies",Tb=new Map;function aK(e){return e[ix]||[]}function br(e){if(Tb.has(e))return Tb.get(e);let t=function(n,r,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");lK(t,n,i)};return t._id=e,Tb.set(e,t),t}function lK(e,t,n){t[QE]===t?t[ix].push({id:e,index:n}):(t[ix]=[{id:e,index:n}],t[QE]=t)}var qr=br("BufferService"),CD=br("CoreMouseService"),Al=br("CoreService"),cK=br("CharsetService"),Rw=br("InstantiationService"),kD=br("LogService"),Kr=br("OptionsService"),ED=br("OscLinkService"),uK=br("UnicodeService"),jh=br("DecorationService"),sx=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var g;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,o=new Ki,l=n.getTrimmedLength(),c=-1,h=-1,d=!1;for(let p=0;p<l;p++)if(!(h===-1&&!n.hasContent(p))){if(n.loadCell(p,o),o.hasExtendedAttrs()&&o.extended.urlId)if(h===-1){h=p,c=o.extended.urlId;continue}else d=o.extended.urlId!==c;else h!==-1&&(d=!0);if(d||h!==-1&&p===l-1){let _=(g=this._oscLinkService.getLinkData(c))==null?void 0:g.uri;if(_){let y={start:{x:h+1,y:e},end:{x:p+(!d&&p===l-1?1:0),y:e}},w=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let S=new URL(_);["http:","https:"].includes(S.protocol)||(w=!0)}catch{w=!0}w||r.push({text:_,range:y,activate:(S,C)=>i?i.activate(S,C,y):dK(S,C),hover:(S,C)=>{var k;return(k=i==null?void 0:i.hover)==null?void 0:k.call(i,S,C,y)},leave:(S,C)=>{var k;return(k=i==null?void 0:i.leave)==null?void 0:k.call(i,S,C,y)}})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=p,c=o.extended.urlId):(h=-1,c=-1)}}t(r)}};sx=zn([ze(0,qr),ze(1,Kr),ze(2,ED)],sx);function dK(e,t){if(confirm(`Do you want to navigate to ${t}?
553
+
554
+ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Mg=br("CharSizeService"),To=br("CoreBrowserService"),Tw=br("MouseService"),No=br("RenderService"),hK=br("SelectionService"),RD=br("CharacterJoinerService"),lu=br("ThemeService"),TD=br("LinkProviderService"),fK=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?JE.isErrorNoTelemetry(e)?new JE(e.message+`
555
+
556
+ `+e.stack):new Error(e.message+`
557
+
558
+ `+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)}},mK=new fK;function Ym(e){pK(e)||mK.onUnexpectedError(e)}var ox="Canceled";function pK(e){return e instanceof gK?!0:e instanceof Error&&e.name===ox&&e.message===ox}var gK=class extends Error{constructor(){super(ox),this.name=this.message}};function vK(e){return new Error(`Illegal argument: ${e}`)}var JE=class ax extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof ax)return t;let n=new ax;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},lx=class ND extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,ND.prototype)}};function gi(e,t=0){return e[e.length-(1+t)]}var _K;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function r(o){return o>0}e.isGreaterThan=r;function i(o){return o===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(_K||(_K={}));function bK(e,t){let n=this,r=!1,i;return function(){return r||(r=!0,t||(i=e.apply(n,arguments))),i}}var MD;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(N){yield N}e.single=i;function o(N){return t(N)?N:i(N)}e.wrap=o;function l(N){return N||n}e.from=l;function*c(N){for(let L=N.length-1;L>=0;L--)yield N[L]}e.reverse=c;function h(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=h;function d(N){return N[Symbol.iterator]().next().value}e.first=d;function g(N,L){let j=0;for(let O of N)if(L(O,j++))return!0;return!1}e.some=g;function p(N,L){for(let j of N)if(L(j))return j}e.find=p;function*_(N,L){for(let j of N)L(j)&&(yield j)}e.filter=_;function*y(N,L){let j=0;for(let O of N)yield L(O,j++)}e.map=y;function*w(N,L){let j=0;for(let O of N)yield*L(O,j++)}e.flatMap=w;function*S(...N){for(let L of N)yield*L}e.concat=S;function C(N,L,j){let O=j;for(let H of N)O=L(O,H);return O}e.reduce=C;function*k(N,L,j=N.length){for(L<0&&(L+=N.length),j<0?j+=N.length:j>N.length&&(j=N.length);L<j;L++)yield N[L]}e.slice=k;function R(N,L=Number.POSITIVE_INFINITY){let j=[];if(L===0)return[j,N];let O=N[Symbol.iterator]();for(let H=0;H<L;H++){let Z=O.next();if(Z.done)return[j,e.empty()];j.push(Z.value)}return[j,{[Symbol.iterator](){return O}}]}e.consume=R;async function E(N){let L=[];for await(let j of N)L.push(j);return Promise.resolve(L)}e.asyncToArray=E})(MD||(MD={}));function xl(e){if(MD.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}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 yK(...e){return Rn(()=>xl(e))}function Rn(e){return{dispose:bK(()=>{e()})}}var AD=class jD{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{xl(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?jD.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)}};AD.DISABLE_DISPOSED_WARNING=!1;var ba=AD,kt=class{constructor(){this._store=new ba,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)}};kt.None=Object.freeze({dispose(){}});var Vc=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}},po=typeof window=="object"?window:globalThis,cx=class ux{constructor(t){this.element=t,this.next=ux.Undefined,this.prev=ux.Undefined}};cx.Undefined=new cx(void 0);var Tn=cx,eR=class{constructor(){this._first=Tn.Undefined,this._last=Tn.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Tn.Undefined}clear(){let e=this._first;for(;e!==Tn.Undefined;){let t=e.next;e.prev=Tn.Undefined,e.next=Tn.Undefined,e=t}this._first=Tn.Undefined,this._last=Tn.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Tn(e);if(this._first===Tn.Undefined)this._first=n,this._last=n;else if(t){let i=this._last;this._last=n,n.prev=i,i.next=n}else{let i=this._first;this._first=n,n.next=i,i.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Tn.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Tn.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Tn.Undefined&&e.next!==Tn.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Tn.Undefined&&e.next===Tn.Undefined?(this._first=Tn.Undefined,this._last=Tn.Undefined):e.next===Tn.Undefined?(this._last=this._last.prev,this._last.next=Tn.Undefined):e.prev===Tn.Undefined&&(this._first=this._first.next,this._first.prev=Tn.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Tn.Undefined;)yield e.element,e=e.next}},xK=globalThis.performance&&typeof globalThis.performance.now=="function",wK=class DD{static create(t){return new DD(t)}constructor(t){this._now=xK&&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}},Nr;(e=>{e.None=()=>kt.None;function t(F,$){return p(F,()=>{},0,void 0,!0,void 0,$)}e.defer=t;function n(F){return($,V=null,q)=>{let D=!1,U;return U=F(z=>{if(!D)return U?U.dispose():D=!0,$.call(V,z)},null,q),D&&U.dispose(),U}}e.once=n;function r(F,$,V){return d((q,D=null,U)=>F(z=>q.call(D,$(z)),null,U),V)}e.map=r;function i(F,$,V){return d((q,D=null,U)=>F(z=>{$(z),q.call(D,z)},null,U),V)}e.forEach=i;function o(F,$,V){return d((q,D=null,U)=>F(z=>$(z)&&q.call(D,z),null,U),V)}e.filter=o;function l(F){return F}e.signal=l;function c(...F){return($,V=null,q)=>{let D=yK(...F.map(U=>U(z=>$.call(V,z))));return g(D,q)}}e.any=c;function h(F,$,V,q){let D=V;return r(F,U=>(D=$(D,U),D),q)}e.reduce=h;function d(F,$){let V,q={onWillAddFirstListener(){V=F(D.fire,D)},onDidRemoveLastListener(){V==null||V.dispose()}},D=new Me(q);return $==null||$.add(D),D.event}function g(F,$){return $ instanceof Array?$.push(F):$&&$.add(F),F}function p(F,$,V=100,q=!1,D=!1,U,z){let G,M,B,X=0,A,ie={leakWarningThreshold:U,onWillAddFirstListener(){G=F(ee=>{X++,M=$(M,ee),q&&!B&&(J.fire(M),M=void 0),A=()=>{let re=M;M=void 0,B=void 0,(!q||X>1)&&J.fire(re),X=0},typeof V=="number"?(clearTimeout(B),B=setTimeout(A,V)):B===void 0&&(B=0,queueMicrotask(A))})},onWillRemoveListener(){D&&X>0&&(A==null||A())},onDidRemoveLastListener(){A=void 0,G.dispose()}},J=new Me(ie);return z==null||z.add(J),J.event}e.debounce=p;function _(F,$=0,V){return e.debounce(F,(q,D)=>q?(q.push(D),q):[D],$,void 0,!0,void 0,V)}e.accumulate=_;function y(F,$=(q,D)=>q===D,V){let q=!0,D;return o(F,U=>{let z=q||!$(U,D);return q=!1,D=U,z},V)}e.latch=y;function w(F,$,V){return[e.filter(F,$,V),e.filter(F,q=>!$(q),V)]}e.split=w;function S(F,$=!1,V=[],q){let D=V.slice(),U=F(M=>{D?D.push(M):G.fire(M)});q&&q.add(U);let z=()=>{D==null||D.forEach(M=>G.fire(M)),D=null},G=new Me({onWillAddFirstListener(){U||(U=F(M=>G.fire(M)),q&&q.add(U))},onDidAddFirstListener(){D&&($?setTimeout(z):z())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return q&&q.add(G),G.event}e.buffer=S;function C(F,$){return(V,q,D)=>{let U=$(new R);return F(function(z){let G=U.evaluate(z);G!==k&&V.call(q,G)},void 0,D)}}e.chain=C;let k=Symbol("HaltChainable");class R{constructor(){this.steps=[]}map($){return this.steps.push($),this}forEach($){return this.steps.push(V=>($(V),V)),this}filter($){return this.steps.push(V=>$(V)?V:k),this}reduce($,V){let q=V;return this.steps.push(D=>(q=$(q,D),q)),this}latch($=(V,q)=>V===q){let V=!0,q;return this.steps.push(D=>{let U=V||!$(D,q);return V=!1,q=D,U?D:k}),this}evaluate($){for(let V of this.steps)if($=V($),$===k)break;return $}}function E(F,$,V=q=>q){let q=(...G)=>z.fire(V(...G)),D=()=>F.on($,q),U=()=>F.removeListener($,q),z=new Me({onWillAddFirstListener:D,onDidRemoveLastListener:U});return z.event}e.fromNodeEventEmitter=E;function N(F,$,V=q=>q){let q=(...G)=>z.fire(V(...G)),D=()=>F.addEventListener($,q),U=()=>F.removeEventListener($,q),z=new Me({onWillAddFirstListener:D,onDidRemoveLastListener:U});return z.event}e.fromDOMEventEmitter=N;function L(F){return new Promise($=>n(F)($))}e.toPromise=L;function j(F){let $=new Me;return F.then(V=>{$.fire(V)},()=>{$.fire(void 0)}).finally(()=>{$.dispose()}),$.event}e.fromPromise=j;function O(F,$){return F(V=>$.fire(V))}e.forward=O;function H(F,$,V){return $(V),F(q=>$(q))}e.runAndSubscribe=H;class Z{constructor($,V){this._observable=$,this._counter=0,this._hasChanged=!1;let q={onWillAddFirstListener:()=>{$.addObserver(this)},onDidRemoveLastListener:()=>{$.removeObserver(this)}};this.emitter=new Me(q),V&&V.add(this.emitter)}beginUpdate($){this._counter++}handlePossibleChange($){}handleChange($,V){this._hasChanged=!0}endUpdate($){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function I(F,$){return new Z(F,$).emitter.event}e.fromObservable=I;function W(F){return($,V,q)=>{let D=0,U=!1,z={beginUpdate(){D++},endUpdate(){D--,D===0&&(F.reportChanges(),U&&(U=!1,$.call(V)))},handlePossibleChange(){},handleChange(){U=!0}};F.addObserver(z),F.reportChanges();let G={dispose(){F.removeObserver(z)}};return q instanceof ba?q.add(G):Array.isArray(q)&&q.push(G),G}}e.fromObservableLight=W})(Nr||(Nr={}));var dx=class hx{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${hx._idPool++}`,hx.all.add(this)}start(t){this._stopWatch=new wK,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}}};dx.all=new Set,dx._idPool=0;var SK=dx,CK=-1,OD=class LD{constructor(t,n,r=(LD._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let i=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[o,l]=this.getMostFrequentStack(),c=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${l}):`;console.warn(c),console.warn(o);let h=new RK(c,o);this._errorHandler(h)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,i]of this._stacks)(!t||n<i)&&(t=[r,i],n=i);return t}};OD._idPool=1;var kK=OD,EK=class zD{constructor(t){this.value=t}static create(){let t=new Error;return new zD(t.stack??"")}print(){console.warn(this.value.split(`
559
+ `).slice(2).join(`
560
+ `))}},RK=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},TK=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},NK=0,Nb=class{constructor(e){this.value=e,this.id=NK++}},MK=2,AK,Me=class{constructor(e){var t,n,r,i;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new kK((e==null?void 0:e.onListenerError)??Ym,((n=this._options)==null?void 0:n.leakWarningThreshold)??CK):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new SK(this._options._profName):void 0,this._deliveryQueue=(i=this._options)==null?void 0:i.deliveryQueue}dispose(){var e,t,n,r;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),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var l,c,h,d,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 _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],y=new TK(`${p}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Ym)(y),kt.None}if(this._disposed)return kt.None;t&&(e=e.bind(t));let r=new Nb(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=EK.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Nb?(this._deliveryQueue??(this._deliveryQueue=new jK),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(c=this._options)==null?void 0:c.onWillAddFirstListener)==null||h.call(c,this),this._listeners=r,(g=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||g.call(d,this)),this._size++;let o=Rn(()=>{i==null||i(),this._removeListener(r)});return n instanceof ba?n.add(o):Array.isArray(n)&&n.push(o),o}),this._event}_removeListener(e){var i,o,l,c;if((o=(i=this._options)==null?void 0:i.onWillRemoveListener)==null||o.call(i,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(c=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||c.call(l,this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-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[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*MK<=t.length){let h=0;for(let d=0;d<t.length;d++)t[d]?t[h++]=t[d]:r&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){var r;if(!e)return;let n=((r=this._options)==null?void 0:r.onListenerError)||Ym;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}_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,n,r,i;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof Nb)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(i=this._perfMon)==null||i.stop()}hasListeners(){return this._size>0}},jK=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},fx=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Me,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Me,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};fx.INSTANCE=new fx;var Nw=fx;function DK(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Nw.INSTANCE.onDidChangeZoomLevel;function OK(e){return Nw.INSTANCE.getZoomFactor(e)}Nw.INSTANCE.onDidChangeFullscreen;var cu=typeof navigator=="object"?navigator.userAgent:"",mx=cu.indexOf("Firefox")>=0,LK=cu.indexOf("AppleWebKit")>=0,Mw=cu.indexOf("Chrome")>=0,zK=!Mw&&cu.indexOf("Safari")>=0;cu.indexOf("Electron/")>=0;cu.indexOf("Android")>=0;var Mb=!1;if(typeof po.matchMedia=="function"){let e=po.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=po.matchMedia("(display-mode: fullscreen)");Mb=e.matches,DK(po,e,({matches:n})=>{Mb&&t.matches||(Mb=n)})}var Mc="en",px=!1,gx=!1,Xm=!1,PD=!1,ym,Zm=Mc,tR=Mc,PK,rs,dl=globalThis,Tr,_N;typeof dl.vscode<"u"&&typeof dl.vscode.process<"u"?Tr=dl.vscode.process:typeof process<"u"&&typeof((_N=process==null?void 0:process.versions)==null?void 0:_N.node)=="string"&&(Tr=process);var bN,IK=typeof((bN=Tr==null?void 0:Tr.versions)==null?void 0:bN.electron)=="string",BK=IK&&(Tr==null?void 0:Tr.type)==="renderer",yN;if(typeof Tr=="object"){px=Tr.platform==="win32",gx=Tr.platform==="darwin",Xm=Tr.platform==="linux",Xm&&Tr.env.SNAP&&Tr.env.SNAP_REVISION,Tr.env.CI||Tr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ym=Mc,Zm=Mc;let e=Tr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ym=t.userLocale,tR=t.osLocale,Zm=t.resolvedLanguage||Mc,PK=(yN=t.languagePack)==null?void 0:yN.translationsConfigFile}catch{}PD=!0}else typeof navigator=="object"&&!BK?(rs=navigator.userAgent,px=rs.indexOf("Windows")>=0,gx=rs.indexOf("Macintosh")>=0,(rs.indexOf("Macintosh")>=0||rs.indexOf("iPad")>=0||rs.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Xm=rs.indexOf("Linux")>=0,(rs==null?void 0:rs.indexOf("Mobi"))>=0,Zm=globalThis._VSCODE_NLS_LANGUAGE||Mc,ym=navigator.language.toLowerCase(),tR=ym):console.error("Unable to resolve platform.");var ID=px,zs=gx,FK=Xm,nR=PD,Bs=rs,sa=Zm,HK;(e=>{function t(){return sa}e.value=t;function n(){return sa.length===2?sa==="en":sa.length>=3?sa[0]==="e"&&sa[1]==="n"&&sa[2]==="-":!1}e.isDefaultVariant=n;function r(){return sa==="en"}e.isDefault=r})(HK||(HK={}));var $K=typeof dl.postMessage=="function"&&!dl.importScripts;(()=>{if($K){let e=[];dl.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,i=e.length;r<i;r++){let o=e[r];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),o.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),dl.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var UK=!!(Bs&&Bs.indexOf("Chrome")>=0);Bs&&Bs.indexOf("Firefox")>=0;!UK&&Bs&&Bs.indexOf("Safari")>=0;Bs&&Bs.indexOf("Edg/")>=0;Bs&&Bs.indexOf("Android")>=0;var vc=typeof navigator=="object"?navigator:{};nR||document.queryCommandSupported&&document.queryCommandSupported("copy")||vc&&vc.clipboard&&vc.clipboard.writeText,nR||vc&&vc.clipboard&&vc.clipboard.readText;var Aw=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}},Ab=new Aw,rR=new Aw,iR=new Aw,VK=new Array(230),BD;(e=>{function t(c){return Ab.keyCodeToStr(c)}e.toString=t;function n(c){return Ab.strToKeyCode(c)}e.fromString=n;function r(c){return rR.keyCodeToStr(c)}e.toUserSettingsUS=r;function i(c){return iR.keyCodeToStr(c)}e.toUserSettingsGeneral=i;function o(c){return rR.strToKeyCode(c)||iR.strToKeyCode(c)}e.fromUserSettings=o;function l(c){if(c>=98&&c<=113)return null;switch(c){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ab.keyCodeToStr(c)}e.toElectronAccelerator=l})(BD||(BD={}));var WK=class FD{constructor(t,n,r,i,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=i,this.keyCode=o}equals(t){return t instanceof FD&&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",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",i=this.metaKey?"1":"0";return`K${t}${n}${r}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new qK([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},qK=class{constructor(e){if(e.length===0)throw vK("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;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 KK(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return BD.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(mx)switch(t){case 59:return 85;case 60:if(FK)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(zs)return 57;break}else if(LK&&(zs&&t===93||!zs&&t===92))return 57;return VK[t]||0}var GK=zs?256:2048,YK=512,XK=1024,ZK=zs?2048:256,sR=class{constructor(e){var n;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=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=KK(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|=GK),this.altKey&&(t|=YK),this.shiftKey&&(t|=XK),this.metaKey&&(t|=ZK),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new WK(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},oR=new WeakMap;function QK(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var JK=class{static getSameOriginWindowChain(e){let t=oR.get(e);if(!t){t=[],oR.set(e,t);let n=e,r;do r=QK(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let o of i){let l=o.window.deref();if(n+=(l==null?void 0:l.scrollY)??0,r+=(l==null?void 0:l.scrollX)??0,l===t||!o.iframeElement)break;let c=o.iframeElement.getBoundingClientRect();n+=c.top,r+=c.left}return{top:n,left:r}}},xm=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 n=JK.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},aR=class{constructor(e,t=0,n=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(Mw){let o=navigator.userAgent.match(/Chrome\/(\d+)/);r=(o?parseInt(o[1]):123)<=122}if(e){let o=e,l=e,c=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")r?this.deltaY=o.wheelDeltaY/(120*c):this.deltaY=o.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?mx&&!zs?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")zK&&ID?this.deltaX=-(o.wheelDeltaX/120):r?this.deltaX=o.wheelDeltaX/(120*c):this.deltaX=o.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?mx&&!zs?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*c):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},HD=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),eG;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof tG?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Nr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:HD})})(eG||(eG={}));var tG=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?HD:(this._emitter||(this._emitter=new Me),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},jw=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 lx("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new lx("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},nG=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,n=globalThis){if(this.isDisposed)throw new lx("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Rn(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},rG;(e=>{async function t(r){let i,o=await Promise.all(r.map(l=>l.then(c=>c,c=>{i||(i=c)})));if(typeof i<"u")throw i;return o}e.settled=t;function n(r){return new Promise(async(i,o)=>{try{await r(i,o)}catch(l){o(l)}})}e.withAsyncBody=n})(rG||(rG={}));var lR=class Pi{static fromArray(t){return new Pi(n=>{n.emitMany(t)})}static fromPromise(t){return new Pi(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Pi(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Pi(async n=>{await Promise.all(t.map(async r=>{for await(let i of r)n.emitOne(i)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Me,queueMicrotask(async()=>{let r={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(r)),this.resolve()}catch(i){this.reject(i)}finally{r.emitOne=void 0,r.emitMany=void 0,r.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 Nr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new Pi(async r=>{for await(let i of t)r.emitOne(n(i))})}map(t){return Pi.map(this,t)}static filter(t,n){return new Pi(async r=>{for await(let i of t)n(i)&&r.emitOne(i)})}filter(t){return Pi.filter(this,t)}static coalesce(t){return Pi.filter(t,n=>!!n)}coalesce(){return Pi.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Pi.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())}};lR.EMPTY=lR.fromArray([]);var{getWindow:Ds,getWindowId:iG,onDidRegisterWindow:sG}=function(){let e=new Map,t={window:po,disposables:new ba};e.set(po.vscodeWindowId,t);let n=new Me,r=new Me,i=new Me;function o(l,c){return(typeof l=="number"?e.get(l):void 0)??(c?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(l){if(e.has(l.vscodeWindowId))return kt.None;let c=new ba,h={window:l,disposables:c.add(new ba)};return e.set(l.vscodeWindowId,h),c.add(Rn(()=>{e.delete(l.vscodeWindowId),r.fire(l)})),c.add(ot(l,dr.BEFORE_UNLOAD,()=>{i.fire(l)})),n.fire(h),c},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(l){return l.vscodeWindowId},hasWindow(l){return e.has(l)},getWindowById:o,getWindow(l){var d;let c=l;if((d=c==null?void 0:c.ownerDocument)!=null&&d.defaultView)return c.ownerDocument.defaultView.window;let h=l;return h!=null&&h.view?h.view.window:po},getDocument(l){return Ds(l).document}}}(),oG=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!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 ot(e,t,n,r){return new oG(e,t,n,r)}var cR=function(e,t,n,r){return ot(e,t,n,r)},Dw,aG=class extends nG{constructor(e){super(),this.defaultTarget=e&&Ds(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},uR=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){Ym(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=o=>{n.set(o,!1);let l=e.get(o)??[];for(t.set(o,l),e.set(o,[]),r.set(o,!0);l.length>0;)l.sort(uR.sort),l.shift().execute();r.set(o,!1)};Dw=(o,l,c=0)=>{let h=iG(o),d=new uR(l,c),g=e.get(h);return g||(g=[],e.set(h,g)),g.push(d),n.get(h)||(n.set(h,!0),o.requestAnimationFrame(()=>i(h))),d}})();function lG(e){let t=e.getBoundingClientRect(),n=Ds(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var dr={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"},cG=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=ni(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=ni(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=ni(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=ni(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=ni(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=ni(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=ni(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=ni(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=ni(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=ni(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=ni(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=ni(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=ni(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=ni(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 ni(e){return typeof e=="number"?`${e}px`:e}function $d(e){return new cG(e)}var $D=class{constructor(){this._hooks=new ba,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 n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let o=e;try{e.setPointerCapture(t),this._hooks.add(Rn(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Ds(e)}this._hooks.add(ot(o,dr.POINTER_MOVE,l=>{if(l.buttons!==n){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(ot(o,dr.POINTER_UP,l=>this.stopMonitoring(!0)))}};function uG(e,t,n){let r=null,i=null;if(typeof n.value=="function"?(r="value",i=n.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",i=n.get),!i)throw new Error("not supported");let o=`$memoize$${t}`;n[r]=function(...l){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,l)}),this[o]}}var Ss;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ss||(Ss={}));var Ed=class Dr extends kt{constructor(){super(),this.dispatched=!1,this.targets=new eR,this.ignoreTargets=new eR,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Nr.runAndSubscribe(sG,({window:t,disposables:n})=>{n.add(ot(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(ot(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(ot(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:po,disposables:this._store}))}static addTarget(t){if(!Dr.isTouchDevice())return kt.None;Dr.INSTANCE||(Dr.INSTANCE=new Dr);let n=Dr.INSTANCE.targets.push(t);return Rn(n)}static ignoreTarget(t){if(!Dr.isTouchDevice())return kt.None;Dr.INSTANCE||(Dr.INSTANCE=new Dr);let n=Dr.INSTANCE.ignoreTargets.push(t);return Rn(n)}static isTouchDevice(){return"ontouchstart"in po||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,i=t.targetTouches.length;r<i;r++){let o=t.targetTouches.item(r);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let l=this.newGestureEvent(Ss.Start,o.target);l.pageX=o.pageX,l.pageY=o.pageY,this.dispatchEvent(l)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let o=0,l=n.changedTouches.length;o<l;o++){let c=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(c.identifier))){console.warn("move of an UNKNOWN touch",c);continue}let h=this.activeTouches[c.identifier],d=Date.now()-h.initialTimeStamp;if(d<Dr.HOLD_DELAY&&Math.abs(h.initialPageX-gi(h.rollingPageX))<30&&Math.abs(h.initialPageY-gi(h.rollingPageY))<30){let g=this.newGestureEvent(Ss.Tap,h.initialTarget);g.pageX=gi(h.rollingPageX),g.pageY=gi(h.rollingPageY),this.dispatchEvent(g)}else if(d>=Dr.HOLD_DELAY&&Math.abs(h.initialPageX-gi(h.rollingPageX))<30&&Math.abs(h.initialPageY-gi(h.rollingPageY))<30){let g=this.newGestureEvent(Ss.Contextmenu,h.initialTarget);g.pageX=gi(h.rollingPageX),g.pageY=gi(h.rollingPageY),this.dispatchEvent(g)}else if(i===1){let g=gi(h.rollingPageX),p=gi(h.rollingPageY),_=gi(h.rollingTimestamps)-h.rollingTimestamps[0],y=g-h.rollingPageX[0],w=p-h.rollingPageY[0],S=[...this.targets].filter(C=>h.initialTarget instanceof Node&&C.contains(h.initialTarget));this.inertia(t,S,r,Math.abs(y)/_,y>0?1:-1,g,Math.abs(w)/_,w>0?1:-1,p)}this.dispatchEvent(this.newGestureEvent(Ss.End,h.initialTarget)),delete this.activeTouches[c.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===Ss.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>Dr.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Ss.Change||t.type===Ss.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let i=0,o=t.initialTarget;for(;o&&o!==r;)i++,o=o.parentElement;n.push([i,r])}n.sort((r,i)=>r[0]-i[0]);for(let[r,i]of n)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,o,l,c,h,d){this.handle=Dw(t,()=>{let g=Date.now(),p=g-r,_=0,y=0,w=!0;i+=Dr.SCROLL_FRICTION*p,c+=Dr.SCROLL_FRICTION*p,i>0&&(w=!1,_=o*i*p),c>0&&(w=!1,y=h*c*p);let S=this.newGestureEvent(Ss.Change);S.translationX=_,S.translationY=y,n.forEach(C=>C.dispatchEvent(S)),w||this.inertia(t,n,g,i,o,l+_,c,h,d+y)})}onTouchMove(t){let n=Date.now();for(let r=0,i=t.changedTouches.length;r<i;r++){let o=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let l=this.activeTouches[o.identifier],c=this.newGestureEvent(Ss.Change,l.initialTarget);c.translationX=o.pageX-gi(l.rollingPageX),c.translationY=o.pageY-gi(l.rollingPageY),c.pageX=o.pageX,c.pageY=o.pageY,this.dispatchEvent(c),l.rollingPageX.length>3&&(l.rollingPageX.shift(),l.rollingPageY.shift(),l.rollingTimestamps.shift()),l.rollingPageX.push(o.pageX),l.rollingPageY.push(o.pageY),l.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Ed.SCROLL_FRICTION=-.005,Ed.HOLD_DELAY=700,Ed.CLEAR_TAP_COUNT_TIME=400,zn([uG],Ed,"isTouchDevice",1);var dG=Ed,Ow=class extends kt{onclick(e,t){this._register(ot(e,dr.CLICK,n=>t(new xm(Ds(e),n))))}onmousedown(e,t){this._register(ot(e,dr.MOUSE_DOWN,n=>t(new xm(Ds(e),n))))}onmouseover(e,t){this._register(ot(e,dr.MOUSE_OVER,n=>t(new xm(Ds(e),n))))}onmouseleave(e,t){this._register(ot(e,dr.MOUSE_LEAVE,n=>t(new xm(Ds(e),n))))}onkeydown(e,t){this._register(ot(e,dr.KEY_DOWN,n=>t(new sR(n))))}onkeyup(e,t){this._register(ot(e,dr.KEY_UP,n=>t(new sR(n))))}oninput(e,t){this._register(ot(e,dr.INPUT,t))}onblur(e,t){this._register(ot(e,dr.BLUR,t))}onfocus(e,t){this._register(ot(e,dr.FOCUS,t))}onchange(e,t){this._register(ot(e,dr.CHANGE,t))}ignoreGesture(e){return dG.ignoreTarget(e)}},dR=11,hG=class extends Ow{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=dR+"px",this.domNode.style.height=dR+"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 $D),this._register(cR(this.bgDomNode,dr.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(cR(this.domNode,dr.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new aG),this._pointerdownScheduleRepeatTimer=this._register(new jw)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ds(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},fG=class vx{constructor(t,n,r,i,o,l,c){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,i=i|0,o=o|0,l=l|0,c=c|0),this.rawScrollLeft=i,this.rawScrollTop=c,n<0&&(n=0),i+n>r&&(i=r-n),i<0&&(i=0),o<0&&(o=0),c+o>l&&(c=l-o),c<0&&(c=0),this.width=n,this.scrollWidth=r,this.scrollLeft=i,this.height=o,this.scrollHeight=l,this.scrollTop=c}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,n){return new vx(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new vx(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,n){let r=this.width!==t.width,i=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,l=this.height!==t.height,c=this.scrollHeight!==t.scrollHeight,h=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,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:r,scrollWidthChanged:i,scrollLeftChanged:o,heightChanged:l,scrollHeightChanged:c,scrollTopChanged:h}}},mG=class extends kt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Me),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new fG(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 r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.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 n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new fR(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=fR.start(this._state,n,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 n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},hR=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function jb(e,t){let n=t-e;return function(r){return e+n*vG(r)}}function pG(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var fR=class _x{constructor(t,n,r,i){this.from=t,this.to=n,this.duration=i,this.startTime=r,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,n,r){if(Math.abs(t-n)>2.5*r){let i,o;return t<n?(i=t+.75*r,o=n-.75*r):(i=t-.75*r,o=n+.75*r),pG(jb(t,i),jb(o,n),.33)}return jb(t,n)}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 n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),i=this.scrollTop(n);return new hR(r,i,!1)}return new hR(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return _x.start(t,n,r)}static start(t,n,r){r=r+10;let i=Date.now()-10;return new _x(t,n,i,r)}};function gG(e){return Math.pow(e,3)}function vG(e){return 1-gG(1-e)}var _G=class extends kt{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new jw)}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":"")))}},bG=140,UD=class extends Ow{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 _G(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new $D),this._shouldRender=!0,this.domNode=$d(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(ot(this.domNode.domNode,dr.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new hG(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=$d(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(ot(this.slider.domNode,dr.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.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,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let i=lG(this.domNode.domNode);t=e.pageX-i.left,n=e.pageY-i.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{let o=this._sliderOrthogonalPointerPosition(i),l=Math.abs(o-n);if(ID&&l>bG){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let c=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(c))},()=>{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()}},VD=class bx{constructor(t,n,r,i,o,l){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=o,this._scrollPosition=l,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new bx(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,i,o){let l=Math.max(0,r-t),c=Math.max(0,l-2*n),h=i>0&&i>r;if(!h)return{computedAvailableSize:Math.round(l),computedIsNeeded:h,computedSliderSize:Math.round(c),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(r*c/i))),g=(c-d)/(i-r),p=o*g;return{computedAvailableSize:Math.round(l),computedIsNeeded:h,computedSliderSize:Math.round(d),computedSliderRatio:g,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let t=bx._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 n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},yG=class extends UD{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new VD(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.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}},xG=class extends UD{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new VD(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.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}},wG=500,mR=50,SG=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},yx=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,n=0,r=1,i=this._rear;do{let o=i===this._front?t:Math.pow(2,-r);if(t-=o,n+=this._memory[i].score*o,i===this._front)break;i=(this._capacity+i-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(Mw){let n=Ds(t.browserEvent),r=OK(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let i=null,o=new SG(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(i=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,i)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let i=Math.abs(t.deltaX),o=Math.abs(t.deltaY),l=Math.abs(n.deltaX),c=Math.abs(n.deltaY),h=Math.max(Math.min(i,l),1),d=Math.max(Math.min(o,c),1),g=Math.max(i,l),p=Math.max(o,c);g%h===0&&p%d===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};yx.INSTANCE=new yx;var CG=yx,kG=class extends Ow{constructor(e,t,n){super(),this._onScroll=this._register(new Me),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Me),this.onWillScroll=this._onWillScroll.event,this._options=RG(t),this._scrollable=n,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let r={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new xG(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new yG(this._scrollable,this._options,r)),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=$d(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=$d(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=$d(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,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new jw),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=xl(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,zs&&(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 aR(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=xl(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new aR(n))};this._mouseWheelToDispose.push(ot(this._listenOnDomNode,dr.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=CG.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,l=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+o===0?l=o=0:Math.abs(o)>=Math.abs(l)?l=0:o=0),this._options.flipAxes&&([o,l]=[l,o]);let c=!zs&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||c)&&!l&&(l=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),d={};if(o){let g=mR*o,p=h.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(d,p)}if(l){let g=mR*l,p=h.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(d,p)}d=this._scrollable.validateScrollPosition(d),(h.scrollLeft!==d.scrollLeft||h.scrollTop!==d.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(d):this._scrollable.setScrollPositionNow(d),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(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,n=e.scrollLeft>0,r=n?" left":"",i=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${i}${r}`)}}_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(),wG)}},EG=class extends kG{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function RG(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,zs&&(t.className+=" mac"),t}var xx=class extends kt{constructor(e,t,n,r,i,o,l,c){super(),this._bufferService=n,this._optionsService=l,this._renderService=c,this._onRequestScrollLines=this._register(new Me),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let h=this._register(new mG({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>Dw(r.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new EG(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Nr.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Rn(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Rn(()=>this._styleElement.remove())),this._register(Nr.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(`
561
+ `)})),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(d=>this._handleScroll(d)))}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),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};xx=zn([ze(2,qr),ze(3,To),ze(4,CD),ze(5,lu),ze(6,Kr),ze(7,No)],xx);var wx=class extends kt{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,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(Rn(()=>{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 r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.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 n=e.options.x??0;return n&&n>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 n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*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()}};wx=zn([ze(1,qr),ze(2,To),ze(3,jh),ze(4,No)],wx);var TG=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,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},xs={full:0,left:0,center:0,right:0},oa={full:0,left:0,center:0,right:0},ud={full:0,left:0,center:0,right:0},Tp=class extends kt{constructor(e,t,n,r,i,o,l,c){var d;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._themeService=l,this._coreBrowserService=c,this._colorZoneStore=new TG,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(),(d=this._viewportElement.parentElement)==null||d.insertBefore(this._canvas,this._viewportElement),this._register(Rn(()=>{var g;return(g=this._canvas)==null?void 0:g.remove()}));let h=this._canvas.getContext("2d");if(h)this._ctx=h;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);oa.full=this._canvas.width,oa.left=e,oa.center=t,oa.right=e,this._refreshDrawHeightConstants(),ud.full=1,ud.left=1,ud.center=1+oa.left,ud.right=1+oa.left+oa.center}_refreshDrawHeightConstants(){xs.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);xs.left=t,xs.center=t,xs.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*xs.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*xs.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*xs.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*xs.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(ud[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-xs[e.position||"full"]/2),oa[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+xs[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}))}};Tp=zn([ze(2,qr),ze(3,jh),ze(4,No),ze(5,Kr),ze(6,lu),ze(7,To)],Tp);var xe;(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=`
562
+ `,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=""))(xe||(xe={}));var Qm;(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="Ÿ"))(Qm||(Qm={}));var WD;(e=>e.ST=`${xe.ESC}\\`)(WD||(WD={}));var Sx=class{constructor(e,t,n,r,i,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,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 n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!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,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${xe.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),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"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=i+"px",this._textarea.style.top=r+"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)}}};Sx=zn([ze(2,qr),ze(3,Kr),ze(4,Al),ze(5,No)],Sx);var gr=0,vr=0,_r=0,Ln=0,pR={css:"#00000000",rgba:0},Jn;(e=>{function t(i,o,l,c){return c!==void 0?`#${Ja(i)}${Ja(o)}${Ja(l)}${Ja(c)}`:`#${Ja(i)}${Ja(o)}${Ja(l)}`}e.toCss=t;function n(i,o,l,c=255){return(i<<24|o<<16|l<<8|c)>>>0}e.toRgba=n;function r(i,o,l,c){return{css:e.toCss(i,o,l,c),rgba:e.toRgba(i,o,l,c)}}e.toColor=r})(Jn||(Jn={}));var wn;(e=>{function t(h,d){if(Ln=(d.rgba&255)/255,Ln===1)return{css:d.css,rgba:d.rgba};let g=d.rgba>>24&255,p=d.rgba>>16&255,_=d.rgba>>8&255,y=h.rgba>>24&255,w=h.rgba>>16&255,S=h.rgba>>8&255;gr=y+Math.round((g-y)*Ln),vr=w+Math.round((p-w)*Ln),_r=S+Math.round((_-S)*Ln);let C=Jn.toCss(gr,vr,_r),k=Jn.toRgba(gr,vr,_r);return{css:C,rgba:k}}e.blend=t;function n(h){return(h.rgba&255)===255}e.isOpaque=n;function r(h,d,g){let p=Jm.ensureContrastRatio(h.rgba,d.rgba,g);if(p)return Jn.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=r;function i(h){let d=(h.rgba|255)>>>0;return[gr,vr,_r]=Jm.toChannels(d),{css:Jn.toCss(gr,vr,_r),rgba:d}}e.opaque=i;function o(h,d){return Ln=Math.round(d*255),[gr,vr,_r]=Jm.toChannels(h.rgba),{css:Jn.toCss(gr,vr,_r,Ln),rgba:Jn.toRgba(gr,vr,_r,Ln)}}e.opacity=o;function l(h,d){return Ln=h.rgba&255,o(h,Ln*d/255)}e.multiplyOpacity=l;function c(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=c})(wn||(wn={}));var Nn;(e=>{let t,n;try{let i=document.createElement("canvas");i.width=1,i.height=1;let o=i.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return gr=parseInt(i.slice(1,2).repeat(2),16),vr=parseInt(i.slice(2,3).repeat(2),16),_r=parseInt(i.slice(3,4).repeat(2),16),Jn.toColor(gr,vr,_r);case 5:return gr=parseInt(i.slice(1,2).repeat(2),16),vr=parseInt(i.slice(2,3).repeat(2),16),_r=parseInt(i.slice(3,4).repeat(2),16),Ln=parseInt(i.slice(4,5).repeat(2),16),Jn.toColor(gr,vr,_r,Ln);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let o=i.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 gr=parseInt(o[1]),vr=parseInt(o[2]),_r=parseInt(o[3]),Ln=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Jn.toColor(gr,vr,_r,Ln);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[gr,vr,_r,Ln]=t.getImageData(0,0,1,1).data,Ln!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Jn.toRgba(gr,vr,_r,Ln),css:i}}e.toColor=r})(Nn||(Nn={}));var Hr;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,i,o){let l=r/255,c=i/255,h=o/255,d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),g=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return d*.2126+g*.7152+p*.0722}e.relativeLuminance2=n})(Hr||(Hr={}));var Jm;(e=>{function t(l,c){if(Ln=(c&255)/255,Ln===1)return c;let h=c>>24&255,d=c>>16&255,g=c>>8&255,p=l>>24&255,_=l>>16&255,y=l>>8&255;return gr=p+Math.round((h-p)*Ln),vr=_+Math.round((d-_)*Ln),_r=y+Math.round((g-y)*Ln),Jn.toRgba(gr,vr,_r)}e.blend=t;function n(l,c,h){let d=Hr.relativeLuminance(l>>8),g=Hr.relativeLuminance(c>>8);if(co(d,g)<h){if(g<d){let y=r(l,c,h),w=co(d,Hr.relativeLuminance(y>>8));if(w<h){let S=i(l,c,h),C=co(d,Hr.relativeLuminance(S>>8));return w>C?y:S}return y}let p=i(l,c,h),_=co(d,Hr.relativeLuminance(p>>8));if(_<h){let y=r(l,c,h),w=co(d,Hr.relativeLuminance(y>>8));return _>w?p:y}return p}}e.ensureContrastRatio=n;function r(l,c,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,_=c>>24&255,y=c>>16&255,w=c>>8&255,S=co(Hr.relativeLuminance2(_,y,w),Hr.relativeLuminance2(d,g,p));for(;S<h&&(_>0||y>0||w>0);)_-=Math.max(0,Math.ceil(_*.1)),y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=co(Hr.relativeLuminance2(_,y,w),Hr.relativeLuminance2(d,g,p));return(_<<24|y<<16|w<<8|255)>>>0}e.reduceLuminance=r;function i(l,c,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,_=c>>24&255,y=c>>16&255,w=c>>8&255,S=co(Hr.relativeLuminance2(_,y,w),Hr.relativeLuminance2(d,g,p));for(;S<h&&(_<255||y<255||w<255);)_=Math.min(255,_+Math.ceil((255-_)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=co(Hr.relativeLuminance2(_,y,w),Hr.relativeLuminance2(d,g,p));return(_<<24|y<<16|w<<8|255)>>>0}e.increaseLuminance=i;function o(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=o})(Jm||(Jm={}));function Ja(e){let t=e.toString(16);return t.length<2?"0"+t:t}function co(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var NG=class extends Ah{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}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()]}},Np=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ki}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 n=[],r=t.translateToString(!0),i=0,o=0,l=0,c=t.getFg(0),h=t.getBg(0);for(let d=0;d<t.getTrimmedLength();d++)if(t.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==c||this._workCell.bg!==h){if(d-i>1){let g=this._getJoinedRanges(r,l,o,t,i);for(let p=0;p<g.length;p++)n.push(g[p])}i=d,l=o,c=this._workCell.fg,h=this._workCell.bg}o+=this._workCell.getChars().length||ga.length}if(this._bufferService.cols-i>1){let d=this._getJoinedRanges(r,l,o,t,i);for(let g=0;g<d.length;g++)n.push(d[g])}return n}_getJoinedRanges(e,t,n,r,i){let o=e.substring(t,n),l=[];try{l=this._characterJoiners[0].handler(o)}catch(c){console.error(c)}for(let c=1;c<this._characterJoiners.length;c++)try{let h=this._characterJoiners[c].handler(o);for(let d=0;d<h.length;d++)Np._mergeRanges(l,h[d])}catch(h){console.error(h)}return this._stringRangesToCellRanges(l,r,i),l}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,o=0,l=e[r];if(l){for(let c=n;c<this._bufferService.cols;c++){let h=t.getWidth(c),d=t.getString(c).length||ga.length;if(h!==0){if(!i&&l[0]<=o&&(l[0]=c,i=!0),l[1]<=o){if(l[1]=c,l=e[++r],!l)break;l[0]<=o?(l[0]=c,i=!0):i=!1}o+=d}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Np=zn([ze(0,qr)],Np);function MG(e){return 57508<=e&&e<=57558}function AG(e){return 9472<=e&&e<=9631}function jG(e){return MG(e)||AG(e)}function DG(){return{css:{canvas:wm(),cell:wm()},device:{canvas:wm(),cell:wm(),char:{width:0,height:0,left:0,top:0}}}}function wm(){return{width:0,height:0}}var Cx=class{constructor(e,t,n,r,i,o,l){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=o,this._themeService=l,this._workCell=new Ki,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,o,l,c,h,d,g){let p=[],_=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<o+1&&(w=o+1);let S,C=0,k="",R=0,E=0,N=0,L=0,j=!1,O=0,H=!1,Z=0,I=0,W=[],F=d!==-1&&g!==-1;for(let $=0;$<w;$++){e.loadCell($,this._workCell);let V=this._workCell.getWidth();if(V===0)continue;let q=!1,D=$>=I,U=$,z=this._workCell;if(_.length>0&&$===_[0][0]&&D){let je=_.shift(),Xe=this._isCellInSelection(je[0],t);for(R=je[0]+1;R<je[1];R++)D&&(D=Xe===this._isCellInSelection(R,t));D&&(D=!n||o<je[0]||o>=je[1]),D?(q=!0,z=new NG(this._workCell,e.translateToString(!0,je[0],je[1]),je[1]-je[0]),U=je[1]-1,V=z.getWidth()):I=je[1]}let G=this._isCellInSelection($,t),M=n&&$===o,B=F&&$>=d&&$<=g,X=!1;this._decorationService.forEachDecorationAtCell($,t,void 0,je=>{X=!0});let A=z.getChars()||ga;if(A===" "&&(z.isUnderline()||z.isOverline())&&(A=" "),Z=V*c-h.get(A,z.isBold(),z.isItalic()),!S)S=this._document.createElement("span");else if(C&&(G&&H||!G&&!H&&z.bg===E)&&(G&&H&&y.selectionForeground||z.fg===N)&&z.extended.ext===L&&B===j&&Z===O&&!M&&!q&&!X&&D){z.isInvisible()?k+=ga:k+=A,C++;continue}else C&&(S.textContent=k),S=this._document.createElement("span"),C=0,k="";if(E=z.bg,N=z.fg,L=z.extended.ext,j=B,O=Z,H=G,q&&o>=$&&o<=U&&(o=$),!this._coreService.isCursorHidden&&M&&this._coreService.isCursorInitialized){if(W.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&W.push("xterm-cursor-blink"),W.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){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(z.isBold()&&W.push("xterm-bold"),z.isItalic()&&W.push("xterm-italic"),z.isDim()&&W.push("xterm-dim"),z.isInvisible()?k=ga:k=z.getChars()||ga,z.isUnderline()&&(W.push(`xterm-underline-${z.extended.underlineStyle}`),k===" "&&(k=" "),!z.isUnderlineColorDefault()))if(z.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${Ah.toColorRGB(z.getUnderlineColor()).join(",")})`;else{let je=z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&z.isBold()&&je<8&&(je+=8),S.style.textDecorationColor=y.ansi[je].css}z.isOverline()&&(W.push("xterm-overline"),k===" "&&(k=" ")),z.isStrikethrough()&&W.push("xterm-strikethrough"),B&&(S.style.textDecoration="underline");let ie=z.getFgColor(),J=z.getFgColorMode(),ee=z.getBgColor(),re=z.getBgColorMode(),ue=!!z.isInverse();if(ue){let je=ie;ie=ee,ee=je;let Xe=J;J=re,re=Xe}let fe,ge,Ce=!1;this._decorationService.forEachDecorationAtCell($,t,void 0,je=>{je.options.layer!=="top"&&Ce||(je.backgroundColorRGB&&(re=50331648,ee=je.backgroundColorRGB.rgba>>8&16777215,fe=je.backgroundColorRGB),je.foregroundColorRGB&&(J=50331648,ie=je.foregroundColorRGB.rgba>>8&16777215,ge=je.foregroundColorRGB),Ce=je.options.layer==="top")}),!Ce&&G&&(fe=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,ee=fe.rgba>>8&16777215,re=50331648,Ce=!0,y.selectionForeground&&(J=50331648,ie=y.selectionForeground.rgba>>8&16777215,ge=y.selectionForeground)),Ce&&W.push("xterm-decoration-top");let Te;switch(re){case 16777216:case 33554432:Te=y.ansi[ee],W.push(`xterm-bg-${ee}`);break;case 50331648:Te=Jn.toColor(ee>>16,ee>>8&255,ee&255),this._addStyle(S,`background-color:#${gR((ee>>>0).toString(16),"0",6)}`);break;case 0:default:ue?(Te=y.foreground,W.push("xterm-bg-257")):Te=y.background}switch(fe||z.isDim()&&(fe=wn.multiplyOpacity(Te,.5)),J){case 16777216:case 33554432:z.isBold()&&ie<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ie+=8),this._applyMinimumContrast(S,Te,y.ansi[ie],z,fe,void 0)||W.push(`xterm-fg-${ie}`);break;case 50331648:let je=Jn.toColor(ie>>16&255,ie>>8&255,ie&255);this._applyMinimumContrast(S,Te,je,z,fe,ge)||this._addStyle(S,`color:#${gR(ie.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(S,Te,y.foreground,z,fe,ge)||ue&&W.push("xterm-fg-257")}W.length&&(S.className=W.join(" "),W.length=0),!M&&!q&&!X&&D?C++:S.textContent=k,Z!==this.defaultSpacing&&(S.style.letterSpacing=`${Z}px`),p.push(S),$=U}return S&&C&&(S.textContent=k),p}_applyMinimumContrast(e,t,n,r,i,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||jG(r.getCode()))return!1;let l=this._getContrastCache(r),c;if(!i&&!o&&(c=l.getColor(t.rgba,n.rgba)),c===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);c=wn.ensureContrastRatio(i||t,o||n,h),l.setColor((i||t).rgba,(o||n).rgba,c??null)}return c?(this._addStyle(e,`color:${c.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 n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};Cx=zn([ze(1,RD),ze(2,Kr),ze(3,To),ze(4,Al),ze(5,jh),ze(6,lu)],Cx);function gR(e,t,n){for(;e.length<n;)e=t+e;return e}var OG=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 n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.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=[n,r,i,o],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),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,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let l=this._measure(e,0);return l>0&&(this._flat[r]=l),l}let i=e;t&&(i+="B"),n&&(i+="I");let o=this._holey.get(i);if(o===void 0){let l=0;t&&(l|=1),n&&(l|=2),o=this._measure(e,l),o>0&&this._holey.set(i,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},LG=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,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,o=t[1]-i,l=n[1]-i,c=Math.max(o,0),h=Math.min(l,e.rows-1);if(c>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=l,this.viewportCappedStartRow=c,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function zG(){return new LG}var Db="xterm-dom-renderer-owner-",Li="xterm-rows",Sm="xterm-fg-",vR="xterm-bg-",dd="xterm-focus",Cm="xterm-selection",PG=1,kx=class extends kt{constructor(e,t,n,r,i,o,l,c,h,d,g,p,_,y){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=o,this._linkifier2=l,this._charSizeService=h,this._optionsService=d,this._bufferService=g,this._coreService=p,this._coreBrowserService=_,this._themeService=y,this._terminalClass=PG++,this._rowElements=[],this._selectionRenderModel=zG(),this.onRequestRedraw=this._register(new Me).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Li),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(Cm),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=DG(),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=c.createInstance(Cx,document),this._element.classList.add(Db+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(Rn(()=>{this._element.classList.remove(Db+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new OG(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 n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Li} 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} .${Li} { 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} .${Li} .xterm-dim { color: ${wn.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 n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Li}.${dd} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Li}.${dd} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Li}.${dd} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Li} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Li} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Li} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Li} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Li} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Cm} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Cm} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Cm} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,l]of e.ansi.entries())t+=`${this._terminalSelector} .${Sm}${o} { color: ${l.css}; }${this._terminalSelector} .${Sm}${o}.xterm-dim { color: ${wn.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${vR}${o} { background-color: ${l.css}; }`;t+=`${this._terminalSelector} .${Sm}257 { color: ${wn.opaque(e.background).css}; }${this._terminalSelector} .${Sm}257.xterm-dim { color: ${wn.multiplyOpacity(wn.opaque(e.background),.5).css}; }${this._terminalSelector} .${vR}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 n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}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(dd),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(dd),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,c=this._document.createDocumentFragment();if(n){let h=e[0]>t[0];c.appendChild(this._createSelectionElement(o,h?t[0]:e[0],h?e[0]:t[0],l-o+1))}else{let h=r===o?e[0]:0,d=o===i?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(o,h,d));let g=l-o-1;if(c.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),o!==l){let p=i===l?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(l,0,p))}}this._selectionContainer.appendChild(c)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(n-t);return o+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-o),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${o}px`,i.style.width=`${l}px`,i}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 n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,c=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){let d=h+n.ydisp,g=this._rowElements[h],p=n.lines.get(d);if(!g||!p)break;g.replaceChildren(...this._rowFactory.createRow(p,d,d===r,l,c,i,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Db}${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,n,r,i,o){n<0&&(e=0),r<0&&(t=0);let l=this._bufferService.rows-1;n=Math.max(Math.min(n,l),0),r=Math.max(Math.min(r,l),0),i=Math.min(i,this._bufferService.cols);let c=this._bufferService.buffer,h=c.ybase+c.y,d=Math.min(c.x,i-1),g=this._optionsService.rawOptions.cursorBlink,p=this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=n;y<=r;++y){let w=y+c.ydisp,S=this._rowElements[y],C=c.lines.get(w);if(!S||!C)break;S.replaceChildren(...this._rowFactory.createRow(C,w,w===h,p,_,d,g,this.dimensions.css.cell.width,this._widthCache,o?y===n?e:0:-1,o?(y===r?t:i)-1:-1))}}};kx=zn([ze(7,Rw),ze(8,Mg),ze(9,Kr),ze(10,qr),ze(11,Al),ze(12,To),ze(13,lu)],kx);var Ex=class extends kt{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Me),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new BG(this._optionsService))}catch{this._measureStrategy=this._register(new IG(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())}};Ex=zn([ze(2,Kr)],Ex);var qD=class extends kt{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)}},IG=class extends qD{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},BG=class extends qD{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}},FG=class extends kt{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new HG(this._window)),this._onDprChange=this._register(new Me),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Me),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Nr.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ot(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ot(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}},HG=class extends kt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Vc),this._onDprChange=this._register(new Me),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Rn(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ot(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)}},$G=class extends kt{constructor(){super(),this.linkProviders=[],this._register(Rn(()=>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 Lw(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),o=parseInt(i.getPropertyValue("padding-left")),l=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-r.left-o,t.clientY-r.top-l]}function UG(e,t,n,r,i,o,l,c,h){if(!o)return;let d=Lw(e,t,n);if(d)return d[0]=Math.ceil((d[0]+(h?l/2:0))/l),d[1]=Math.ceil(d[1]/c),d[0]=Math.min(Math.max(d[0],1),r+(h?1:0)),d[1]=Math.min(Math.max(d[1],1),i),d}var Rx=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return UG(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=Lw(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Rx=zn([ze(0,No),ze(1,Mg)],Rx);var VG=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,n){this._rowCount=n,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=[]}},KD={};eK(KD,{getSafariVersion:()=>qG,isChromeOS:()=>ZD,isFirefox:()=>GD,isIpad:()=>KG,isIphone:()=>GG,isLegacyEdge:()=>WG,isLinux:()=>zw,isMac:()=>Mp,isNode:()=>Ag,isSafari:()=>YD,isWindows:()=>XD});var Ag=typeof process<"u"&&"title"in process,Dh=Ag?"node":navigator.userAgent,Oh=Ag?"node":navigator.platform,GD=Dh.includes("Firefox"),WG=Dh.includes("Edge"),YD=/^((?!chrome|android).)*safari/i.test(Dh);function qG(){if(!YD)return 0;let e=Dh.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Mp=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Oh),KG=Oh==="iPad",GG=Oh==="iPhone",XD=["Windows","Win16","Win32","WinCE"].includes(Oh),zw=Oh.indexOf("Linux")>=0,ZD=/\bCrOS\b/.test(Dh),QD=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,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},YG=class extends QD{_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())}}},XG=class extends QD{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Ap=!Ag&&"requestIdleCallback"in window?XG:YG,ZG=class{constructor(){this._queue=new Ap}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Tx=class extends kt{constructor(e,t,n,r,i,o,l,c,h){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=c,this._renderer=this._register(new Vc),this._pausedResizeTask=new ZG,this._observerDisposable=this._register(new Vc),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 Me),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Me),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Me),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Me),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new VG((d,g)=>this._renderRows(d,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new QG(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Rn(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>{var d;return(d=this._renderer.value)==null?void 0:d.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(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=Rn(()=>n.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,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(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 n;return(n=this._renderer.value)==null?void 0:n.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,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Tx=zn([ze(2,Kr),ze(3,Mg),ze(4,Al),ze(5,jh),ze(6,qr),ze(7,To),ze(8,lu)],Tx);var QG=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,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 JG(e,t,n,r){let i=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return nY(i,o,e,t,n,r)+jg(o,t,n,r)+rY(i,o,e,t,n,r);let l;if(o===t)return l=i>e?"D":"C",oh(Math.abs(i-e),sh(l,r));l=o>t?"D":"C";let c=Math.abs(o-t),h=tY(o>t?e:i,n)+(c-1)*n.cols+1+eY(o>t?i:e);return oh(h,sh(l,r))}function eY(e,t){return e-1}function tY(e,t){return t.cols-e}function nY(e,t,n,r,i,o){return jg(t,r,i,o).length===0?"":oh(e4(e,t,e,t-wl(t,i),!1,i).length,sh("D",o))}function jg(e,t,n,r){let i=e-wl(e,n),o=t-wl(t,n),l=Math.abs(i-o)-iY(e,t,n);return oh(l,sh(JD(e,t),r))}function rY(e,t,n,r,i,o){let l;jg(t,r,i,o).length>0?l=r-wl(r,i):l=t;let c=r,h=sY(e,t,n,r,i,o);return oh(e4(e,l,n,c,h==="C",i).length,sh(h,o))}function iY(e,t,n){var l;let r=0,i=e-wl(e,n),o=t-wl(t,n);for(let c=0;c<Math.abs(i-o);c++){let h=JD(e,t)==="A"?-1:1;(l=n.buffer.lines.get(i+h*c))!=null&&l.isWrapped&&r++}return r}function wl(e,t){let n=0,r=t.buffer.lines.get(e),i=r==null?void 0:r.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r==null?void 0:r.isWrapped;return n}function sY(e,t,n,r,i,o){let l;return jg(n,r,i,o).length>0?l=r-wl(r,i):l=t,e<n&&l<=r||e>=n&&l<r?"C":"D"}function JD(e,t){return e>t?"A":"B"}function e4(e,t,n,r,i,o){let l=e,c=t,h="";for(;(l!==n||c!==r)&&c>=0&&c<o.buffer.lines.length;)l+=i?1:-1,i&&l>o.cols-1?(h+=o.buffer.translateBufferLineToString(c,!1,e,l),l=0,e=0,c++):!i&&l<0&&(h+=o.buffer.translateBufferLineToString(c,!1,0,e+1),l=o.cols-1,e=l,c--);return h+o.buffer.translateBufferLineToString(c,!1,e,l)}function sh(e,t){let n=t?"O":"[";return xe.ESC+n+e}function oh(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var oY=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 _R(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 Ob=50,aY=15,lY=50,cY=500,uY=" ",dY=new RegExp(uY,"g"),Nx=class extends kt{constructor(e,t,n,r,i,o,l,c,h){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=o,this._optionsService=l,this._renderService=c,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ki,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Me),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Me),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Me),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Me),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new oY(this._bufferService),this._activeSelectionMode=0,this._register(Rn(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.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 n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let i=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let l=e[1];l<=t[1];l++){let c=n.translateBufferLineToString(l,!0,i,o);r.push(c)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let o=e[1]+1;o<=t[1]-1;o++){let l=n.lines.get(o),c=n.translateBufferLineToString(o,!0);l!=null&&l.isWrapped?r[r.length-1]+=c:r.push(c)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),l=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?r[r.length-1]+=l:r.push(l)}}return r.map(i=>i.replace(dY," ")).join(XD?`\r
563
+ `:`
564
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),zw&&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),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,o;let n=(o=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:o.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=_R(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,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=Lw(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Ob),Ob),t/=Ob,t/Math.abs(t)+Math.round(t*(aY-1)))}shouldForceSelection(e){return Mp?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(),lY)}_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&&!(Mp&&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 n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.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<cY&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=JG(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);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,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,o=i.lines.get(e[1]);if(!o)return;let l=i.translateBufferLineToString(e[1],!1),c=this._convertViewportColToCharacterIndex(o,e[0]),h=c,d=e[0]-c,g=0,p=0,_=0,y=0;if(l.charAt(c)===" "){for(;c>0&&l.charAt(c-1)===" ";)c--;for(;h<l.length&&l.charAt(h+1)===" ";)h++}else{let C=e[0],k=e[0];o.getWidth(C)===0&&(g++,C--),o.getWidth(k)===2&&(p++,k++);let R=o.getString(k).length;for(R>1&&(y+=R-1,h+=R-1);C>0&&c>0&&!this._isCharWordSeparator(o.loadCell(C-1,this._workCell));){o.loadCell(C-1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,C--):E>1&&(_+=E-1,c-=E-1),c--,C--}for(;k<o.length&&h+1<l.length&&!this._isCharWordSeparator(o.loadCell(k+1,this._workCell));){o.loadCell(k+1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===2?(p++,k++):E>1&&(y+=E-1,h+=E-1),h++,k++}}h++;let w=c+d-g+_,S=Math.min(this._bufferService.cols,h-c+g+p-_-y);if(!(!t&&l.slice(c,h).trim()==="")){if(n&&w===0&&o.getCodePoint(0)!==32){let C=i.lines.get(e[1]-1);if(C&&o.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){let R=this._bufferService.cols-k.start;w-=R,S+=R}}}if(r&&w+S===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let C=i.lines.get(e[1]+1);if(C!=null&&C.isWrapped&&C.getCodePoint(0)!==32){let k=this._getWordAt([0,e[1]+1],!1,!1,!0);k&&(S+=k.length)}}return{start:w,length:S}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={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=_R(n,this._bufferService.cols)}};Nx=zn([ze(3,qr),ze(4,Al),ze(5,Tw),ze(6,Kr),ze(7,No),ze(8,To)],Nx);var bR=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},yR=class{constructor(){this._color=new bR,this._css=new bR}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},rr=Object.freeze((()=>{let e=[Nn.toColor("#2e3436"),Nn.toColor("#cc0000"),Nn.toColor("#4e9a06"),Nn.toColor("#c4a000"),Nn.toColor("#3465a4"),Nn.toColor("#75507b"),Nn.toColor("#06989a"),Nn.toColor("#d3d7cf"),Nn.toColor("#555753"),Nn.toColor("#ef2929"),Nn.toColor("#8ae234"),Nn.toColor("#fce94f"),Nn.toColor("#729fcf"),Nn.toColor("#ad7fa8"),Nn.toColor("#34e2e2"),Nn.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],o=t[n%6];e.push({css:Jn.toCss(r,i,o),rgba:Jn.toRgba(r,i,o)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Jn.toCss(r,r,r),rgba:Jn.toRgba(r,r,r)})}return e})()),tl=Nn.toColor("#ffffff"),Rd=Nn.toColor("#000000"),xR=Nn.toColor("#ffffff"),wR=Rd,hd={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},hY=tl,Mx=class extends kt{constructor(e){super(),this._optionsService=e,this._contrastCache=new yR,this._halfContrastCache=new yR,this._onChangeColors=this._register(new Me),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:tl,background:Rd,cursor:xR,cursorAccent:wR,selectionForeground:void 0,selectionBackgroundTransparent:hd,selectionBackgroundOpaque:wn.blend(Rd,hd),selectionInactiveBackgroundTransparent:hd,selectionInactiveBackgroundOpaque:wn.blend(Rd,hd),scrollbarSliderBackground:wn.opacity(tl,.2),scrollbarSliderHoverBackground:wn.opacity(tl,.4),scrollbarSliderActiveBackground:wn.opacity(tl,.5),overviewRulerBorder:tl,ansi:rr.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=cn(e.foreground,tl),t.background=cn(e.background,Rd),t.cursor=wn.blend(t.background,cn(e.cursor,xR)),t.cursorAccent=wn.blend(t.background,cn(e.cursorAccent,wR)),t.selectionBackgroundTransparent=cn(e.selectionBackground,hd),t.selectionBackgroundOpaque=wn.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=cn(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=wn.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?cn(e.selectionForeground,pR):void 0,t.selectionForeground===pR&&(t.selectionForeground=void 0),wn.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=wn.opacity(t.selectionBackgroundTransparent,.3)),wn.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=wn.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=cn(e.scrollbarSliderBackground,wn.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=cn(e.scrollbarSliderHoverBackground,wn.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=cn(e.scrollbarSliderActiveBackground,wn.opacity(t.foreground,.5)),t.overviewRulerBorder=cn(e.overviewRulerBorder,hY),t.ansi=rr.slice(),t.ansi[0]=cn(e.black,rr[0]),t.ansi[1]=cn(e.red,rr[1]),t.ansi[2]=cn(e.green,rr[2]),t.ansi[3]=cn(e.yellow,rr[3]),t.ansi[4]=cn(e.blue,rr[4]),t.ansi[5]=cn(e.magenta,rr[5]),t.ansi[6]=cn(e.cyan,rr[6]),t.ansi[7]=cn(e.white,rr[7]),t.ansi[8]=cn(e.brightBlack,rr[8]),t.ansi[9]=cn(e.brightRed,rr[9]),t.ansi[10]=cn(e.brightGreen,rr[10]),t.ansi[11]=cn(e.brightYellow,rr[11]),t.ansi[12]=cn(e.brightBlue,rr[12]),t.ansi[13]=cn(e.brightMagenta,rr[13]),t.ansi[14]=cn(e.brightCyan,rr[14]),t.ansi[15]=cn(e.brightWhite,rr[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=cn(e.extendedAnsi[r],rr[r+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()}}};Mx=zn([ze(0,Kr)],Mx);function cn(e,t){if(e!==void 0)try{return Nn.toColor(e)}catch{}return t}var fY=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},mY=class{constructor(){this._services=new fY,this._services.set(Rw,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=aK(e).sort((o,l)=>o.index-l.index),r=[];for(let o of n){let l=this._services.get(o.id);if(!l)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);r.push(l)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},pY={trace:0,debug:1,info:2,warn:3,error:4,off:5},gY="xterm.js: ",Ax=class extends kt{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=pY[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,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":gY)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Ax=zn([ze(0,Kr)],Ax);var SR=class extends kt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Me),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Me),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Me),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 n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];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,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let i=t-1;i>=0;i--)this.set(e+i+n,this.get(e+i));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},St=3,Zn=Object.freeze(new Ah),km=0,Lb=2,Td=class t4{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*St);let i=n||Ki.fromCharData([0,yD,1,0]);for(let o=0;o<t;++o)this.setCell(o,i);this.length=t}get(t){let n=this._data[t*St+0],r=n&2097151;return[this._data[t*St+1],n&2097152?this._combined[t]:r?ha(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*St+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*St+0]=t|2097152|n[2]<<22):this._data[t*St+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*St+0]>>22}hasWidth(t){return this._data[t*St+0]&12582912}getFg(t){return this._data[t*St+1]}getBg(t){return this._data[t*St+2]}hasContent(t){return this._data[t*St+0]&4194303}getCodePoint(t){let n=this._data[t*St+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*St+0]&2097152}getString(t){let n=this._data[t*St+0];return n&2097152?this._combined[t]:n&2097151?ha(n&2097151):""}isProtected(t){return this._data[t*St+2]&536870912}loadCell(t,n){return km=t*St,n.content=this._data[km+0],n.fg=this._data[km+1],n.bg=this._data[km+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*St+0]=n.content,this._data[t*St+1]=n.fg,this._data[t*St+2]=n.bg}setCellFromCodepoint(t,n,r,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*St+0]=n|r<<22,this._data[t*St+1]=i.fg,this._data[t*St+2]=i.bg}addCodepointToCell(t,n,r){let i=this._data[t*St+0];i&2097152?this._combined[t]+=ha(n):i&2097151?(this._combined[t]=ha(i&2097151)+ha(n),i&=-2097152,i|=2097152):i=n|1<<22,r&&(i&=-12582913,i|=r<<22),this._data[t*St+0]=i}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let i=new Ki;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,i));for(let o=0;o<n;++o)this.setCell(t+o,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let i=new Ki;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,i));for(let o=this.length-n;o<this.length;++o)this.setCell(o,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*Lb<this._data.buffer.byteLength;let r=t*St;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let i=new Uint32Array(r);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,n)}else{this._data=this._data.subarray(0,r);let i=Object.keys(this._combined);for(let l=0;l<i.length;l++){let c=parseInt(i[l],10);c>=t&&delete this._combined[c]}let o=Object.keys(this._extendedAttrs);for(let l=0;l<o.length;l++){let c=parseInt(o[l],10);c>=t&&delete this._extendedAttrs[c]}}return this.length=t,r*4*Lb<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Lb<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,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 n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new t4(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*St+0]&4194303)return t+(this._data[t*St+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*St+0]&4194303||this._data[t*St+2]&50331648)return t+(this._data[t*St+0]>>22);return 0}copyCellsFrom(t,n,r,i,o){let l=t._data;if(o)for(let h=i-1;h>=0;h--){for(let d=0;d<St;d++)this._data[(r+h)*St+d]=l[(n+h)*St+d];l[(n+h)*St+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[n+h])}else for(let h=0;h<i;h++){for(let d=0;d<St;d++)this._data[(r+h)*St+d]=l[(n+h)*St+d];l[(n+h)*St+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[n+h])}let c=Object.keys(t._combined);for(let h=0;h<c.length;h++){let d=parseInt(c[h],10);d>=n&&(this._combined[d-n+r]=t._combined[d])}}translateToString(t,n,r,i){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),i&&(i.length=0);let o="";for(;n<r;){let l=this._data[n*St+0],c=l&2097151,h=l&2097152?this._combined[n]:c?ha(c):ga;if(o+=h,i)for(let d=0;d<h.length;++d)i.push(n);n+=l>>22||1}return i&&i.push(n),o}};function vY(e,t,n,r,i,o){let l=[];for(let c=0;c<e.length-1;c++){let h=c,d=e.get(++h);if(!d.isWrapped)continue;let g=[e.get(c)];for(;h<e.length&&d.isWrapped;)g.push(d),d=e.get(++h);if(!o&&r>=c&&r<h){c+=g.length-1;continue}let p=0,_=ah(g,p,t),y=1,w=0;for(;y<g.length;){let C=ah(g,y,t),k=C-w,R=n-_,E=Math.min(k,R);g[p].copyCellsFrom(g[y],w,_,E,!1),_+=E,_===n&&(p++,_=0),w+=E,w===C&&(y++,w=0),_===0&&p!==0&&g[p-1].getWidth(n-1)===2&&(g[p].copyCellsFrom(g[p-1],n-1,_++,1,!1),g[p-1].setCell(n-1,i))}g[p].replaceCells(_,n,i);let S=0;for(let C=g.length-1;C>0&&(C>p||g[C].getTrimmedLength()===0);C--)S++;S>0&&(l.push(c+g.length-S),l.push(S)),c+=g.length-1}return l}function _Y(e,t){let n=[],r=0,i=t[r],o=0;for(let l=0;l<e.length;l++)if(i===l){let c=t[++r];e.onDeleteEmitter.fire({index:l-o,amount:c}),l+=c-1,o+=c,i=t[++r]}else n.push(l);return{layout:n,countRemoved:o}}function bY(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function yY(e,t,n){let r=[],i=e.map((h,d)=>ah(e,d,t)).reduce((h,d)=>h+d),o=0,l=0,c=0;for(;c<i;){if(i-c<n){r.push(i-c);break}o+=n;let h=ah(e,l,t);o>h&&(o-=h,l++);let d=e[l].getWidth(o-1)===2;d&&o--;let g=d?n-1:n;r.push(g),c+=g}return r}function ah(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var n4=class r4{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=r4._nextId++,this._onDispose=this.register(new Me),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),xl(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};n4._nextId=1;var xY=n4,ar={},nl=ar.B;ar[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ar.A={"#":"£"};ar.B=void 0;ar[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ar.C=ar[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ar.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ar.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ar.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ar.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ar.E=ar[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ar.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ar.H=ar[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ar["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var CR=4294967295,kR=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Zn.clone(),this.savedCharset=nl,this.markers=[],this._nullCell=Ki.fromCharData([0,yD,1,0]),this._whitespaceCell=Ki.fromCharData([0,ga,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Ap,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new SR(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 Rp),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 Rp),this._whitespaceCell}getBlankLine(e,t){return new Td(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>CR?CR:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Zn);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 SR(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Zn),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let l=0;l<this.lines.length;l++)r+=+this.lines.get(l).resize(e,n);let o=0;if(this._rows<t)for(let l=this._rows;l<t;l++)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 Td(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new Td(e,n)));else for(let l=this._rows;l>t;l--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let l=this.lines.length-i;l>0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=i}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++)r+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.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 n=this._optionsService.rawOptions.reflowCursorLine,r=vY(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Zn),n);if(r.length>0){let i=_Y(this.lines,r);bY(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Zn),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Td(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Zn),i=[],o=0;for(let l=this.lines.length-1;l>=0;l--){let c=this.lines.get(l);if(!c||!c.isWrapped&&c.getTrimmedLength()<=e)continue;let h=[c];for(;c.isWrapped&&l>0;)c=this.lines.get(--l),h.unshift(c);if(!n){let E=this.ybase+this.y;if(E>=l&&E<l+h.length)continue}let d=h[h.length-1].getTrimmedLength(),g=yY(h,this._cols,e),p=g.length-h.length,_;this.ybase===0&&this.y!==this.lines.length-1?_=Math.max(0,this.y-this.lines.maxLength+p):_=Math.max(0,this.lines.length-this.lines.maxLength+p);let y=[];for(let E=0;E<p;E++){let N=this.getBlankLine(Zn,!0);y.push(N)}y.length>0&&(i.push({start:l+h.length+o,newLines:y}),o+=y.length),h.push(...y);let w=g.length-1,S=g[w];S===0&&(w--,S=g[w]);let C=h.length-p-1,k=d;for(;C>=0;){let E=Math.min(k,S);if(h[w]===void 0)break;if(h[w].copyCellsFrom(h[C],k-E,S-E,E,!0),S-=E,S===0&&(w--,S=g[w]),k-=E,k===0){C--;let N=Math.max(C,0);k=ah(h,N,this._cols)}}for(let E=0;E<h.length;E++)g[E]<e&&h[E].setCell(g[E],r);let R=p-_;for(;R-- >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(i.length>0){let l=[],c=[];for(let S=0;S<this.lines.length;S++)c.push(this.lines.get(S));let h=this.lines.length,d=h-1,g=0,p=i[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let _=0;for(let S=Math.min(this.lines.maxLength-1,h+o-1);S>=0;S--)if(p&&p.start>d+_){for(let C=p.newLines.length-1;C>=0;C--)this.lines.set(S--,p.newLines[C]);S++,l.push({index:d+1,amount:p.newLines.length}),_+=p.newLines.length,p=i[++g]}else this.lines.set(S,c[d--]);let y=0;for(let S=l.length-1;S>=0;S--)l[S].index+=y,this.lines.onInsertEmitter.fire(l[S]),y+=l[S].amount;let w=Math.max(0,h+o-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}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 xY(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},wY=class extends kt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Me),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 kR(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new kR(!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)}},i4=2,s4=1,jx=class extends kt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Me),this.onResize=this._onResize.event,this._onScroll=this._register(new Me),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,i4),this.rows=Math.max(e.rawOptions.rows||0,s4),this.buffers=this._register(new wY(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let l=n.lines.isFull;o===n.lines.length-1?l?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(o+1,0,r.clone()),l?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let l=o-i+1;n.lines.shiftElements(i+1,l-1,-1),n.lines.set(o,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};jx=zn([ze(0,Kr)],jx);var _c={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:Mp,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},SY=["normal","bold","100","200","300","400","500","600","700","800","900"],CY=class extends kt{constructor(e){super(),this._onOptionChange=this._register(new Me),this.onOptionChange=this._onOptionChange.event;let t={..._c};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Rn(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in _c))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in _c))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=_c[e]),!kY(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=_c[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=SY.includes(t)?t:_c[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 kY(e){return e==="block"||e==="underline"||e==="bar"}function Nd(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&Nd(e[r],t-1);return n}var ER=Object.freeze({insertMode:!1}),RR=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Dx=class extends kt{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Me),this.onData=this._onData.event,this._onUserInput=this._register(new Me),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Me),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Me),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Nd(ER),this.decPrivateModes=Nd(RR)}reset(){this.modes=Nd(ER),this.decPrivateModes=Nd(RR)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.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))}};Dx=zn([ze(0,qr),ze(1,kD),ze(2,Kr)],Dx);var TR={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 zb(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Pb=String.fromCharCode,NR={DEFAULT:e=>{let t=[zb(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Pb(t[0])}${Pb(t[1])}${Pb(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${zb(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${zb(e,!0)};${e.x};${e.y}${t}`}},Ox=class extends kt{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Me),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(TR))this.addProtocol(r,TR[r]);for(let r of Object.keys(NR))this.addEncoding(r,NR[r]);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,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_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,n){if(n){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)}};Ox=zn([ze(0,qr),ze(1,Al),ze(2,Kr)],Ox);var Ib=[[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]],EY=[[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]],ir;function RY(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var TY=class{constructor(){if(this.version="6",!ir){ir=new Uint8Array(65536),ir.fill(1),ir[0]=0,ir.fill(0,1,32),ir.fill(0,127,160),ir.fill(2,4352,4448),ir[9001]=2,ir[9002]=2,ir.fill(2,11904,42192),ir[12351]=1,ir.fill(2,44032,55204),ir.fill(2,63744,64256),ir.fill(2,65040,65050),ir.fill(2,65072,65136),ir.fill(2,65280,65377),ir.fill(2,65504,65511);for(let e=0;e<Ib.length;++e)ir.fill(0,Ib[e][0],Ib[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ir[e]:RY(e,EY)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let i=cl.extractWidth(t);i===0?r=!1:i>n&&(n=i)}return cl.createPropertyValue(0,n,r)}},cl=class ep{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Me,this.onChange=this._onChange.event;let t=new TY;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,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?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 n=0,r=0,i=t.length;for(let o=0;o<i;++o){let l=t.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=i)return n+this.wcwidth(l);let d=t.charCodeAt(o);56320<=d&&d<=57343?l=(l-55296)*1024+d-56320+65536:n+=this.wcwidth(d)}let c=this.charProperties(l,r),h=ep.extractWidth(c);ep.extractShouldJoin(c)&&(h-=ep.extractWidth(r)),n+=h,r=c}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},NY=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 MR(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var fd=2147483647,MY=256,o4=class Lx{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>MY)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new Lx;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let i=t[r];if(Array.isArray(i))for(let o=0;o<i.length;++o)n.addSubParam(i[o]);else n.addParam(i)}return n}clone(){let t=new Lx(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 n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,i))}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>fd?fd: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>fd?fd:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&(t[n]=this._subParams.slice(r,i))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[n-1];r[n-1]=~i?Math.min(i*10+t,fd):t}},md=[],AY=class{constructor(){this._state=0,this._active=md,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 n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,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=md}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=md,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||md,!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,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Ng(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}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 n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=md,this._id=-1,this._state=0}}},vi=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Ng(e,t,n),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(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},pd=[],jY=class{constructor(){this._handlers=Object.create(null),this._active=pd,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=pd}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,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=pd,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||pd,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ng(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=pd,this._ident=0}},Md=new o4;Md.addParam(0);var AR=class{constructor(e){this._handler=e,this._data="",this._params=Md,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Md,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Ng(e,t,n),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(n=>(this._params=Md,this._data="",this._hitLimit=!1,n));return this._params=Md,this._data="",this._hitLimit=!1,t}},DY=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},$i=160,OY=function(){let e=new DY(4095),t=Array.apply(null,Array(256)).map((c,h)=>h),n=(c,h)=>t.slice(c,h),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let o=n(0,14),l;e.setDefault(1,0),e.addMany(r,0,2,0);for(l in o)e.addMany([24,26,153,154],l,3,0),e.addMany(n(128,144),l,3,0),e.addMany(n(144,152),l,3,0),e.add(156,l,0,0),e.add(27,l,11,1),e.add(157,l,4,8),e.addMany([152,158,159],l,0,7),e.add(155,l,11,3),e.add(144,l,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add($i,0,2,0),e.add($i,8,5,8),e.add($i,6,0,6),e.add($i,11,0,11),e.add($i,13,13,13),e}(),LY=class extends kt{constructor(e=OY){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 o4,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},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(Rn(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new AY),this._dcsParser=this._register(new jY),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>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 i=0;i<e.intermediates.length;++i){let o=e.intermediates.charCodeAt(i);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}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 n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,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 n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,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,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,o=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let c=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&h>-1){for(;h>=0&&(l=c[h](this._params),l!==!0);h--)if(l instanceof Promise)return this._parseStack.handlerPos=h,l}this._parseStack.handlers=[];break;case 4:if(n===!1&&h>-1){for(;h>=0&&(l=c[h](),l!==!0);h--)if(l instanceof Promise)return this._parseStack.handlerPos=h,l}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(r!==24&&r!==26,n),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],l=this._oscParser.end(r!==24&&r!==26,n),l)return l;r===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 c=o;c<t;++c){switch(r=e[c],i=this._transitions.table[this.currentState<<8|(r<160?r:$i)],i>>4){case 2:for(let _=c+1;;++_){if(_>=t||(r=e[_])<32||r>126&&r<$i){this._printHandler(e,c,_),c=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<$i){this._printHandler(e,c,_),c=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<$i){this._printHandler(e,c,_),c=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<$i){this._printHandler(e,c,_),c=_-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:c,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let h=this._csiHandlers[this._collect<<8|r],d=h?h.length-1:-1;for(;d>=0&&(l=h[d](this._params),l!==!0);d--)if(l instanceof Promise)return this._preserveStack(3,h,d,i,c),l;d<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++c<t&&(r=e[c])>47&&r<60);c--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let g=this._escHandlers[this._collect<<8|r],p=g?g.length-1:-1;for(;p>=0&&(l=g[p](),l!==!0);p--)if(l instanceof Promise)return this._preserveStack(4,g,p,i,c),l;p<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let _=c+1;;++_)if(_>=t||(r=e[_])===24||r===26||r===27||r>127&&r<$i){this._dcsParser.put(e,c,_),c=_-1;break}break;case 14:if(l=this._dcsParser.unhook(r!==24&&r!==26),l)return this._preserveStack(6,[],0,i,c),l;r===27&&(i|=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 _=c+1;;_++)if(_>=t||(r=e[_])<32||r>127&&r<$i){this._oscParser.put(e,c,_),c=_-1;break}break;case 6:if(l=this._oscParser.end(r!==24&&r!==26),l)return this._preserveStack(5,[],0,i,c),l;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},zY=/^([\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})$/,PY=/^[\da-f]+$/;function jR(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=zY.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),PY.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let i=0;i<3;++i){let o=parseInt(t.slice(n*i,n*i+n),16);r[i]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return r}}function Bb(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function IY(e,t=16){let[n,r,i]=e;return`rgb:${Bb(n,t)}/${Bb(r,t)}/${Bb(i,t)}`}var BY={"(":0,")":1,"*":2,"+":3,"-":1,".":2},aa=131072,DR=10;function OR(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 LR=5e3,zR=0,FY=class extends kt{constructor(e,t,n,r,i,o,l,c,h=new LY){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=o,this._coreMouseService=l,this._unicodeService=c,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new sK,this._utf8Decoder=new oK,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Zn.clone(),this._eraseAttrDataInternal=Zn.clone(),this._onRequestBell=this._register(new Me),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Me),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Me),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Me),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Me),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Me),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Me),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Me),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Me),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Me),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Me),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Me),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Me),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 zx(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:g.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,g,p)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:g,data:p})}),this._parser.setDcsHandlerFallback((d,g,p)=>{g==="HOOK"&&(p=p.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:g,payload:p})}),this._parser.setPrintHandler((d,g,p)=>this.print(d,g,p)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(xe.BEL,()=>this.bell()),this._parser.setExecuteHandler(xe.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(xe.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(xe.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(xe.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(xe.BS,()=>this.backspace()),this._parser.setExecuteHandler(xe.HT,()=>this.tab()),this._parser.setExecuteHandler(xe.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(xe.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Qm.IND,()=>this.index()),this._parser.setExecuteHandler(Qm.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Qm.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new vi(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new vi(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new vi(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new vi(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new vi(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new vi(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new vi(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new vi(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new vi(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new vi(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new vi(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new vi(d=>this.restoreCursorColor(d))),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 d in ar)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(d=>(this._logService.error("Parsing error: ",d),d)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new AR((d,g)=>this.requestStatusString(d,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),LR))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${LR} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,o=0,l=this._parseStack.paused;if(l){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>aa&&(o=this._parseStack.position+aa)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,d=>String.fromCharCode(d)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(d=>d.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<aa&&(this._parseBuffer=new Uint32Array(Math.min(e.length,aa))),l||this._dirtyRowTracker.clearRange(),e.length>aa)for(let d=o;d<e.length;d+=aa){let g=d+aa<e.length?d+aa:e.length,p=typeof e=="string"?this._stringDecoder.decode(e.substring(d,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(d,g),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,p))return this._preserveStack(r,i,p,d),this._logSlowResolvingAsync(n),n}else if(!l){let d=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,d))return this._preserveStack(r,i,d,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let c=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(c,this._bufferService.rows-1)})}print(e,t,n){let r,i,o=this._charsetService.charset,l=this._optionsService.rawOptions.screenReaderMode,c=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,d=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&&n-t>0&&p.getWidth(this._activeBuffer.x-1)===2&&p.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let _=this._parser.precedingJoinState;for(let y=t;y<n;++y){if(r=e[y],r<127&&o){let k=o[String.fromCharCode(r)];k&&(r=k.charCodeAt(0))}let w=this._unicodeService.charProperties(r,_);i=cl.extractWidth(w);let S=cl.extractShouldJoin(w),C=S?cl.extractWidth(_):0;if(_=w,l&&this._onA11yChar.fire(ha(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-C>c){if(h){let k=p,R=this._activeBuffer.x-C;for(this._activeBuffer.x=C,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),C>0&&p instanceof Td&&p.copyCellsFrom(k,R,0,C,!1);R<c;)k.setCellFromCodepoint(R++,0,1,g)}else if(this._activeBuffer.x=c-1,i===2)continue}if(S&&this._activeBuffer.x){let k=p.getWidth(this._activeBuffer.x-1)?1:2;p.addCodepointToCell(this._activeBuffer.x-k,r,i);for(let R=i-C;--R>=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(d&&(p.insertCells(this._activeBuffer.x,i-C,this._activeBuffer.getNullCell(g)),p.getWidth(c-1)===2&&p.setCellFromCodepoint(c-1,0,1,g)),p.setCellFromCodepoint(this._activeBuffer.x++,r,i,g),i>0)for(;--i;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=_,this._activeBuffer.x<c&&n-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,n=>OR(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new AR(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new vi(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,n,r=!1,i=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,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 n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,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 n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,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}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(Zn));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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=e.params[0]||1,r=cl.extractWidth(t),i=this._activeBuffer.x-r,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),l=new Uint32Array(o.length*n),c=0;for(let d=0;d<o.length;){let g=o.codePointAt(d)||0;l[c++]=g,d+=g>65535?2:1}let h=c;for(let d=1;d<n;++d)l.copyWithin(h,0,c),h+=c;return this.print(l,0,h),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(xe.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(xe.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(xe.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(xe.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(xe.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,nl),this._charsetService.setgCharset(1,nl),this._charsetService.setgCharset(2,nl),this._charsetService.setgCharset(3,nl);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||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:o}=this._coreMouseService,l=this._coreService,{buffers:c,cols:h}=this._bufferService,{active:d,alt:g}=c,p=this._optionsService.rawOptions,_=(S,C)=>(l.triggerDataEvent(`${xe.ESC}[${t?"":"?"}${S};${C}$y`),!0),y=S=>S?1:2,w=e.params[0];return t?w===2?_(w,4):w===4?_(w,y(l.modes.insertMode)):w===12?_(w,3):w===20?_(w,y(p.convertEol)):_(w,0):w===1?_(w,y(r.applicationCursorKeys)):w===3?_(w,p.windowOptions.setWinLines?h===80?2:h===132?1:0:0):w===6?_(w,y(r.origin)):w===7?_(w,y(r.wraparound)):w===8?_(w,3):w===9?_(w,y(i==="X10")):w===12?_(w,y(p.cursorBlink)):w===25?_(w,y(!l.isCursorHidden)):w===45?_(w,y(r.reverseWraparound)):w===66?_(w,y(r.applicationKeypad)):w===67?_(w,4):w===1e3?_(w,y(i==="VT200")):w===1002?_(w,y(i==="DRAG")):w===1003?_(w,y(i==="ANY")):w===1004?_(w,y(r.sendFocus)):w===1005?_(w,4):w===1006?_(w,y(o==="SGR")):w===1015?_(w,4):w===1016?_(w,y(o==="SGR_PIXELS")):w===1048?_(w,1):w===47||w===1047||w===1049?_(w,y(d===g)):w===2004?_(w,y(r.bracketedPasteMode)):w===2026?_(w,y(r.synchronizedOutput)):_(w,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Ah.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,o=0;do{if(r[o+i]=e.params[t+o],e.hasSubParams(t+o)){let l=e.getSubParams(t+o),c=0;do r[1]===5&&(i=1),r[o+c+1+i]=l[c];while(++c<l.length&&c+o+1+i<r.length);break}if(r[1]===5&&o+i>=2||r[1]===2&&o+i>=5)break;r[1]&&(i=1)}while(++o+t<e.length&&o+i<r.length);for(let l=2;l<r.length;++l)r[l]===-1&&(r[l]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[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=Zn.fg,e.bg=Zn.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,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=Zn.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Zn.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=Zn.fg&16777215,r.bg&=-67108864,r.bg|=Zn.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${xe.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${xe.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${xe.ESC}[?${t};${n}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=Zn.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 n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!OR(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(`${xe.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>DR&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>DR&&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=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),i=n.shift();if(/^\d+$/.exec(r)){let o=parseInt(r);if(PR(o))if(i==="?")t.push({type:0,index:o});else{let l=jR(i);l&&t.push({type:1,index:o,color:l})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,i=n.findIndex(o=>o.startsWith("id="));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,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 n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=jR(n[r]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}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=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let i=parseInt(n[r]);PR(i)&&t.push({type:2,index:i})}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,nl),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(BY[e[0]],ar[e[1]]||nl),!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=Zn.clone(),this._eraseAttrDataInternal=Zn.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 Ki;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 n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=l=>(this._coreService.triggerDataEvent(`${xe.ESC}${l}${xe.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},zx=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&&(zR=e,e=t,t=zR),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};zx=zn([ze(0,qr)],zx);function PR(e){return 0<=e&&e<256}var HY=5e7,IR=12,$Y=50,UY=class extends kt{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 Me),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 n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>HY)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 n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],i=this._action(r,t);if(i){let l=c=>performance.now()-n>=IR?setTimeout(()=>this._innerWrite(0,c)):this._innerWrite(n,c);i.catch(c=>(queueMicrotask(()=>{throw c}),Promise.resolve(!1))).then(l);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=IR)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>$Y&&(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()}},Px=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 c=t.addMarker(t.ybase+t.y),h={data:e,id:this._nextId++,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(h,c)),this._dataByLinkId.set(h.id,h),h.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let o=t.addMarker(t.ybase+t.y),l={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}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 n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Px=zn([ze(0,qr)],Px);var BR=!1,VY=class extends kt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Vc),this._onBinary=this._register(new Me),this.onBinary=this._onBinary.event,this._onData=this._register(new Me),this.onData=this._onData.event,this._onLineFeed=this._register(new Me),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Me),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Me),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Me),this._instantiationService=new mY,this.optionsService=this._register(new CY(e)),this._instantiationService.setService(Kr,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(jx)),this._instantiationService.setService(qr,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Ax)),this._instantiationService.setService(kD,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Dx)),this._instantiationService.setService(Al,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Ox)),this._instantiationService.setService(CD,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(cl)),this._instantiationService.setService(uK,this.unicodeService),this._charsetService=this._instantiationService.createInstance(NY),this._instantiationService.setService(cK,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Px),this._instantiationService.setService(ED,this._oscLinkService),this._inputHandler=this._register(new FY(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Nr.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Nr.forward(this._bufferService.onResize,this._onResize)),this._register(Nr.forward(this.coreService.onData,this._onData)),this._register(Nr.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 UY((t,n)=>this._inputHandler.parse(t,n))),this._register(Nr.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Me),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&&!BR&&(this._logService.warn("writeSync is unreliable and will be removed soon."),BR=!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,i4),t=Math.max(t,s4),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(MR.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(MR(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Rn(()=>{for(let t of e)t.dispose()})}}},WY={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 qY(e,t,n,r){var l;let i={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?i.key=xe.ESC+"OA":i.key=xe.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=xe.ESC+"OD":i.key=xe.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=xe.ESC+"OC":i.key=xe.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=xe.ESC+"OB":i.key=xe.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":xe.DEL,e.altKey&&(i.key=xe.ESC+i.key);break;case 9:if(e.shiftKey){i.key=xe.ESC+"[Z";break}i.key=xe.HT,i.cancel=!0;break;case 13:i.key=e.altKey?xe.ESC+xe.CR:xe.CR,i.cancel=!0;break;case 27:i.key=xe.ESC,e.altKey&&(i.key=xe.ESC+xe.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;o?i.key=xe.ESC+"[1;"+(o+1)+"D":t?i.key=xe.ESC+"OD":i.key=xe.ESC+"[D";break;case 39:if(e.metaKey)break;o?i.key=xe.ESC+"[1;"+(o+1)+"C":t?i.key=xe.ESC+"OC":i.key=xe.ESC+"[C";break;case 38:if(e.metaKey)break;o?i.key=xe.ESC+"[1;"+(o+1)+"A":t?i.key=xe.ESC+"OA":i.key=xe.ESC+"[A";break;case 40:if(e.metaKey)break;o?i.key=xe.ESC+"[1;"+(o+1)+"B":t?i.key=xe.ESC+"OB":i.key=xe.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=xe.ESC+"[2~");break;case 46:o?i.key=xe.ESC+"[3;"+(o+1)+"~":i.key=xe.ESC+"[3~";break;case 36:o?i.key=xe.ESC+"[1;"+(o+1)+"H":t?i.key=xe.ESC+"OH":i.key=xe.ESC+"[H";break;case 35:o?i.key=xe.ESC+"[1;"+(o+1)+"F":t?i.key=xe.ESC+"OF":i.key=xe.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=xe.ESC+"[5;"+(o+1)+"~":i.key=xe.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=xe.ESC+"[6;"+(o+1)+"~":i.key=xe.ESC+"[6~";break;case 112:o?i.key=xe.ESC+"[1;"+(o+1)+"P":i.key=xe.ESC+"OP";break;case 113:o?i.key=xe.ESC+"[1;"+(o+1)+"Q":i.key=xe.ESC+"OQ";break;case 114:o?i.key=xe.ESC+"[1;"+(o+1)+"R":i.key=xe.ESC+"OR";break;case 115:o?i.key=xe.ESC+"[1;"+(o+1)+"S":i.key=xe.ESC+"OS";break;case 116:o?i.key=xe.ESC+"[15;"+(o+1)+"~":i.key=xe.ESC+"[15~";break;case 117:o?i.key=xe.ESC+"[17;"+(o+1)+"~":i.key=xe.ESC+"[17~";break;case 118:o?i.key=xe.ESC+"[18;"+(o+1)+"~":i.key=xe.ESC+"[18~";break;case 119:o?i.key=xe.ESC+"[19;"+(o+1)+"~":i.key=xe.ESC+"[19~";break;case 120:o?i.key=xe.ESC+"[20;"+(o+1)+"~":i.key=xe.ESC+"[20~";break;case 121:o?i.key=xe.ESC+"[21;"+(o+1)+"~":i.key=xe.ESC+"[21~";break;case 122:o?i.key=xe.ESC+"[23;"+(o+1)+"~":i.key=xe.ESC+"[23~";break;case 123:o?i.key=xe.ESC+"[24;"+(o+1)+"~":i.key=xe.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=xe.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=xe.DEL:e.keyCode===219?i.key=xe.ESC:e.keyCode===220?i.key=xe.FS:e.keyCode===221&&(i.key=xe.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let c=(l=WY[e.keyCode])==null?void 0:l[e.shiftKey?1:0];if(c)i.key=xe.ESC+c;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,d=String.fromCharCode(h);e.shiftKey&&(d=d.toUpperCase()),i.key=xe.ESC+d}else if(e.keyCode===32)i.key=xe.ESC+(e.ctrlKey?xe.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),i.key=xe.ESC+h,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=xe.US),e.key==="@"&&(i.key=xe.NUL));break}return i}var Hn=0,KY=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Ap,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Ap,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((i,o)=>this._getKey(i)-this._getKey(o)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,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||(Hn=this._search(t),Hn===-1)||this._getKey(this._array[Hn])!==t)return!1;do if(this._array[Hn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Hn),!0;while(++Hn<this._array.length&&this._getKey(this._array[Hn])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,o)=>i-o),t=0,n=new Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,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&&(Hn=this._search(e),!(Hn<0||Hn>=this._array.length)&&this._getKey(this._array[Hn])===e))do yield this._array[Hn];while(++Hn<this._array.length&&this._getKey(this._array[Hn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Hn=this._search(e),!(Hn<0||Hn>=this._array.length)&&this._getKey(this._array[Hn])===e))do t(this._array[Hn]);while(++Hn<this._array.length&&this._getKey(this._array[Hn])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Fb=0,FR=0,GY=class extends kt{constructor(){super(),this._decorations=new KY(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new Me),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Me),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Rn(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new YY(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.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,n){let r=0,i=0;for(let o of this._decorations.getKeyIterator(t))r=o.options.x??0,i=r+(o.options.width??1),e>=r&&e<i&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,i=>{Fb=i.options.x??0,FR=Fb+(i.options.width??1),e>=Fb&&e<FR&&(!n||(i.options.layer??"bottom")===n)&&r(i)})}},YY=class extends ba{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Me),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Me),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=Nn.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Nn.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},XY=1e3,ZY=class{constructor(e,t=XY){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,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 r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=r-this._lastRefreshMs,o=this._debounceThresholdMS-i;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)}},HR=20,jp=class extends kt{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.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=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new ZY(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(`
565
+ `))),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(ot(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Rn(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<HR+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
566
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===HR+1&&(this._liveRegion.textContent+=rx.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 n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let o=n.lines.get(n.ydisp+i),l=[],c=(o==null?void 0:o.translateToString(!0,void 0,void 0,l))||"",h=(n.ydisp+i+1).toString(),d=this._rowElements[i];d&&(c.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=c,this._rowColumns.set(d,l)),d.setAttribute("aria-posinset",h),d.setAttribute("aria-setsize",r),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],i=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===o||e.relatedTarget!==r)return;let l,c;if(t===0?(l=n,c=this._rowElements.pop(),this._rowContainer.removeChild(c)):(l=this._rowElements.shift(),c=n,this._rowContainer.removeChild(l)),l.removeEventListener("focus",this._topBoundaryFocusListener),c.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}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 c;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},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,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 r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((c=r.textContent)==null?void 0:c.length)??0}),!this._rowContainer.contains(n.node))return;let i=({node:h,offset:d})=>{let g=h instanceof Text?h.parentNode:h,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 _=this._rowColumns.get(g);if(!_)return console.warn("columns is null. Race condition?"),null;let y=d<_.length?_[d]:_.slice(-1)[0]+1;return y>=this._terminal.cols&&(++p,y=0),{row:p,column:y}},o=i(t),l=i(n);if(!(!o||!l)){if(o.row>l.row||o.row===l.row&&o.column>=l.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(l.row-o.row)*this._terminal.cols-o.column+l.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 i,o;e.style.transform="";let t=e.getBoundingClientRect().width,n=(o=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:o[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};jp=zn([ze(1,Rw),ze(2,To),ze(3,No)],jp);var Ix=class extends kt{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Me),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Me),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Rn(()=>{var o;xl(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(ot(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ot(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ot(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ot(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 n=e.composedPath();for(let r=0;r<n.length;r++){let i=n[r];if(i.classList.contains("xterm"))break;if(i.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 r,i;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(o=>{o==null||o.forEach(l=>{l.link.dispose&&l.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[o,l]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(o)&&(n=this._checkLinkProviderResult(o,e,n)):l.provideLinks(e.y,c=>{var d,g;if(this._isMouseOut)return;let h=c==null?void 0:c.map(p=>({link:p}));(d=this._activeProviderReplies)==null||d.set(o,h),n=this._checkLinkProviderResult(o,e,n),((g=this._activeProviderReplies)==null?void 0:g.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let o=0;o<i.length;o++){let l=i[o],c=l.link.range.start.y<e?0:l.link.range.start.x,h=l.link.range.end.y>e?this._bufferService.cols:l.link.range.end.x;for(let d=c;d<=h;d++){if(n.has(d)){i.splice(o--,1);break}n.add(d)}}}}_checkLinkProviderResult(e,t,n){var o;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(i=!0);if(!i&&r){let l=r.find(c=>this._linkAtPosition(c.link,t));l&&(n=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let l=0;l<this._activeProviderReplies.size;l++){let c=(o=this._activeProviderReplies.get(l))==null?void 0:o.find(h=>this._linkAtPosition(h.link,t));if(c){n=!0,this._handleNewLink(c);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&QY(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,xl(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 n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,i,o;(r=this._currentLink)!=null&&r.state&&((o=(i=this._currentLink)==null?void 0:i.state)==null?void 0:o.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(r,i),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.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(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.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(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};Ix=zn([ze(1,Tw),ze(2,No),ze(3,qr),ze(4,TD)],Ix);function QY(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 JY=class extends VY{constructor(e={}){super(e),this._linkifier=this._register(new Vc),this.browser=KD,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Vc),this._onCursorMove=this._register(new Me),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Me),this.onKey=this._onKey.event,this._onRender=this._register(new Me),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Me),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Me),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Me),this.onBell=this._onBell.event,this._onFocus=this._register(new Me),this._onBlur=this._register(new Me),this._onA11yCharEmitter=this._register(new Me),this._onA11yTabEmitter=this._register(new Me),this._onWillOpen=this._register(new Me),this._setup(),this._decorationService=this._instantiationService.createInstance(GY),this._instantiationService.setService(jh,this._decorationService),this._linkProviderService=this._instantiationService.createInstance($G),this._instantiationService.setService(TD,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(sx)),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(Nr.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Nr.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Nr.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Nr.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Rn(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.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 n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let i=wn.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${xe.ESC}]${r};${IY(i)}${WD.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Jn.toColor(...t.color));else{let o=n;this._themeService.modifyColors(l=>l[o]=Jn.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(jp,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(xe.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(xe.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 n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*i,l=this.buffer.y*this._renderService.dimensions.css.cell.height,c=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=c+"px",this.textarea.style.top=l+"px",this.textarea.style.width=o+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(ot(this.element,"copy",t=>{this.hasSelection()&&rK(t,this._selectionService)}));let e=t=>iK(t,this.textarea,this.coreService,this.optionsService);this._register(ot(this.textarea,"paste",e)),this._register(ot(this.element,"paste",e)),GD?this._register(ot(this.element,"mousedown",t=>{t.button===2&&ZE(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ot(this.element,"contextmenu",t=>{ZE(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),zw&&this._register(ot(this.element,"auxclick",t=>{t.button===1&&bD(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ot(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ot(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ot(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ot(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ot(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ot(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ot(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;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"),((i=this.element)==null?void 0:i.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(ot(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 n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",nx.get()),ZD||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",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(FG,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(To,this._coreBrowserService),this._register(ot(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(ot(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Ex,this._document,this._helperContainer),this._instantiationService.setService(Mg,this._charSizeService),this._themeService=this._instantiationService.createInstance(Mx),this._instantiationService.setService(lu,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Np),this._instantiationService.setService(RD,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Tx,this.rows,this.screenElement)),this._instantiationService.setService(No,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(Sx,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Rx),this._instantiationService.setService(Tw,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Ix,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(xx,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(Nx,this.element,this.screenElement,r)),this._instantiationService.setService(hK,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(Nr.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(wx,this.screenElement)),this._register(ot(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(jp,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Tp,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Tp,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(kx,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){var d,g,p,_,y;let l=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!l)return!1;let c,h;switch(o.overrideType||o.type){case"mousemove":h=32,o.buttons===void 0?(c=3,o.button!==void 0&&(c=o.button<3?o.button:3)):c=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":h=0,c=o.button<3?o.button:3;break;case"mousedown":h=1,c=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,(_=(p=(g=(d=e._renderService)==null?void 0:d.dimensions)==null?void 0:g.device)==null?void 0:p.cell)==null?void 0:_.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;h=w<0?0:1,c=4;break;default:return!1}return h===void 0||c===void 0||c>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:c,action:h,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(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?r.mousemove||(t.addEventListener("mousemove",i.mousemove),r.mousemove=i.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),o&16?r.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),r.wheel=i.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),o&2?r.mouseup||(r.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),o&4?r.mousedrag||(r.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(ot(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(o)})),this._register(ot(t,"wheel",o=>{var l,c,h,d,g;if(!r.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,(d=(h=(c=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:c.device)==null?void 0:h.cell)==null?void 0:d.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(o,!0);let p=xe.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 n;(n=this._renderService)==null||n.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){_D(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,n){this._selectionService.setSelection(e,t,n)}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 n;(n=this._selectionService)==null||n.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 n=qY(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.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((n.key===xe.ETX||n.key===xe.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=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"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(eX(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 n;(n=this._charSizeService)==null||n.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(Zn));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(xe.ESC+"[I"):this.coreService.triggerDataEvent(xe.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${xe.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${xe.ESC}[6;${i};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function eX(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var tX=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;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)}},nX=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 Ki)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},$R=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 nX(t)}getNullCell(){return new Ki}},rX=class extends kt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Me),this.onBufferChange=this._onBufferChange.event,this._normal=new $R(this._core.buffers.normal,"normal"),this._alternate=new $R(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)}},iX=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.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)}},sX=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}},oX=["cols","rows"],ws=0,aX=class extends kt{constructor(e){super(),this._core=this._register(new JY(e)),this._addonManager=this._register(new tX),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,i)=>{this._checkReadonlyOptions(r),this._core.options[r]=i};for(let r in this._core.options){let i={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,i)}}_checkReadonlyOptions(e){if(oX.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 iX(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new sX(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 rX(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,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}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
567
+ `,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 nx.get()},set promptLabel(e){nx.set(e)},get tooMuchOutput(){return rx.get()},set tooMuchOutput(e){rx.set(e)}}}_verifyIntegers(...e){for(ws of e)if(ws===1/0||isNaN(ws)||ws%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(ws of e)if(ws&&(ws===1/0||isNaN(ws)||ws%1!==0||ws<0))throw new Error("This API only accepts positive integers")}};const UR="lever-theme",Hb="20260329-handoff",lX={light:`/manifest.webmanifest?v=${Hb}`,dark:`/manifest-dark.webmanifest?v=${Hb}`,custom:`/manifest-dark.webmanifest?v=${Hb}`},a4=v.createContext(void 0),cX=e=>e==="light"||e==="dark"||e==="system"||e==="custom",sl=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",VR=(e,t)=>{if(typeof document>"u")return;let n;e==="custom"?n=t==="system"||!t?sl():t:n=e==="system"?sl():e,document.documentElement.classList.toggle("dark",n==="dark")},WR=e=>{if(typeof document>"u")return;document.documentElement.style.colorScheme=e;const t=document.querySelector('meta[name="theme-color"]');if(t){const i=getComputedStyle(document.body).backgroundColor;i&&i!=="rgba(0, 0, 0, 0)"&&i!=="transparent"&&t.setAttribute("content",i)}const n=document.querySelector('link[rel="manifest"]#app-manifest'),r=lX[e];n&&n.getAttribute("href")!==r&&n.setAttribute("href",r)};function uX({children:e}){const t=_n(p=>p.themePreference),n=_n(p=>p.setThemePreference),r=_n(p=>p.themeId),i=_n(p=>p.customAppearance),o=_n(p=>p.backgroundImage),l=_n(p=>p.backgroundOpacity),c=_n(p=>p.backgroundBlur),h=_n(p=>p.themeCssText);v.useEffect(()=>{if(typeof window>"u")return;const p=window.localStorage.getItem(UR);cX(p)&&(_n.getState().themePreference==="system"&&p!=="system"&&n(p),window.localStorage.removeItem(UR))},[]),v.useEffect(()=>{VR(t,i);const p=t==="custom"?i==="system"?sl():i:t==="system"?sl():t;WR(p)},[t,i]),v.useEffect(()=>{if(t!=="system"&&(t!=="custom"||i!=="system"))return;const p=window.matchMedia("(prefers-color-scheme: dark)"),_=()=>{VR(t,i),WR(sl())};return p.addEventListener?(p.addEventListener("change",_),()=>p.removeEventListener("change",_)):(p.addListener(_),()=>p.removeListener(_))},[t,i]),v.useEffect(()=>{if(typeof document>"u")return;let p=document.getElementById("kaizen-theme-registry-styles");p||(p=document.createElement("style"),p.id="kaizen-theme-registry-styles",document.head.appendChild(p)),p.textContent=h},[h]),v.useEffect(()=>{typeof document>"u"||(t==="custom"?document.documentElement.setAttribute("data-theme",r):document.documentElement.removeAttribute("data-theme"))},[t,r]),v.useEffect(()=>{if(typeof document>"u")return;let p=document.getElementById("kaizen-custom-theme-styles");p||(p=document.createElement("style"),p.id="kaizen-custom-theme-styles",document.head.appendChild(p));const _=t==="custom"&&o&&o.trim()!=="",y=[];if(_){const w=c?c*2:0;y.push(`
568
+ body {
569
+ background-image: none !important;
570
+ background-color: transparent !important;
571
+ }
572
+ body::before {
573
+ content: "";
574
+ position: fixed;
575
+ top: -${w}px;
576
+ left: -${w}px;
577
+ right: -${w}px;
578
+ bottom: -${w}px;
579
+ background-image: url("${o}");
580
+ background-size: cover;
581
+ background-position: center;
582
+ filter: blur(${c}px);
583
+ z-index: -2;
584
+ pointer-events: none;
585
+ }
586
+ body::after {
587
+ content: "";
588
+ position: fixed;
589
+ inset: 0;
590
+ background-color: hsl(var(--background) / ${l});
591
+ z-index: -1;
592
+ pointer-events: none;
593
+ }
594
+ #root {
595
+ background-color: transparent !important;
596
+ }
597
+ :root {
598
+ --color-background: transparent !important;
599
+ --color-card: hsl(var(--card) / 0.15) !important;
600
+ --color-popover: hsl(var(--popover) / 0.8) !important;
601
+ --color-muted: hsl(var(--muted) / 0.25) !important;
602
+ }
603
+ .kaizen-terminal, .xterm-viewport, .xterm-screen {
604
+ background-color: transparent !important;
605
+ }
606
+ `)}else y.push(`
607
+ body {
608
+ background-image: none !important;
609
+ }
610
+ body::before {
611
+ display: none;
612
+ }
613
+ #root {
614
+ background-color: transparent;
615
+ }
616
+ `);p.textContent=y.join(`
617
+ `)},[t,o,l,c]);const d=p=>{n(p)},g=v.useMemo(()=>{const p=t==="custom"?i==="system"?sl():i:t==="system"?sl():t;return{theme:t,resolvedTheme:p,setTheme:d}},[t,i,n]);return f.jsx(a4.Provider,{value:g,children:e})}function l4(){const e=v.useContext(a4);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const dX={foreground:"#0f172a",background:"transparent",cursor:"#000000",cursorAccent:"#ffffff",selectionBackground:"rgba(221,228,236,0.55)",selectionInactiveBackground:"rgba(221,228,236,0.38)",black:"#0f172a",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#94a3b8",brightBlack:"#475569",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#eab308",brightBlue:"#3b82f6",brightMagenta:"#a855f7",brightCyan:"#06b6d4",brightWhite:"#e2e8f0"},hX={foreground:"#f8fafc",background:"transparent",cursor:"#ffffff",cursorAccent:"#000000",selectionBackground:"rgba(248,250,252,0.28)",selectionInactiveBackground:"rgba(248,250,252,0.18)",black:"#0f172a",red:"#f87171",green:"#4ade80",yellow:"#facc15",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#cbd5e1",brightBlack:"#64748b",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde047",brightBlue:"#93c5fd",brightMagenta:"#d8b4fe",brightCyan:"#67e8f9",brightWhite:"#f8fafc"};function c4(e){return{cols:Math.max(1,e.cols||80),rows:Math.max(1,e.rows||24)}}function u4(e,t){var w,S,C,k,R;const n=e.element,r=(k=(C=(S=(w=e._core)==null?void 0:w._renderService)==null?void 0:S.dimensions)==null?void 0:C.css)==null?void 0:k.cell,i=(r==null?void 0:r.width)??0,o=(r==null?void 0:r.height)??0;if(!n||!Number.isFinite(i)||!Number.isFinite(o)||i<=0||o<=0)return null;const l=t.getBoundingClientRect(),c=window.getComputedStyle(t),h=window.getComputedStyle(n),d=e.options.scrollback===0?0:((R=e.options.overviewRuler)==null?void 0:R.width)??14,g=parseFloat(c.paddingLeft)+parseFloat(c.paddingRight)+parseFloat(h.paddingLeft)+parseFloat(h.paddingRight),p=parseFloat(c.paddingTop)+parseFloat(c.paddingBottom)+parseFloat(h.paddingTop)+parseFloat(h.paddingBottom),_=Math.max(0,l.width-g-d-1),y=Math.max(0,l.height-p);return{cols:Math.max(2,Math.floor(_/i)),rows:Math.max(1,Math.floor(y/o))}}function Em(e){e.refresh(0,Math.max(0,e.rows-1))}function Rm(e,t,n,r,i){const o=u4(e,t)??c4(e);return n.current&&n.current.cols===o.cols&&n.current.rows===o.rows||(e.resize(o.cols,o.rows),n.current=o,r&&i(o.cols,o.rows)),o}function fX({projectId:e,terminalId:t,socket:n,scrollback:r,connectionStatus:i,clearVersion:o=0,focusRequestVersion:l=0,onPathChange:c}){const{resolvedTheme:h}=l4(),d=v.useRef(null),g=v.useRef(null),p=v.useRef(null),_=v.useRef(!1),y=v.useRef(0),w=v.useRef(null),S=v.useRef(null),[C,k]=v.useState(null),[R,E]=v.useState(null),N=h==="dark"?hX:dX,L=(O,H)=>{n.command({type:"terminal.resize",terminalId:t,cols:O,rows:H}).catch(()=>{})},j=()=>{const O=()=>{const H=g.current,Z=d.current;!H||!Z||!_.current||Rm(H,Z,S,!0,L)};requestAnimationFrame(()=>{O(),setTimeout(O,0)})};return v.useEffect(()=>{const O=new aX({scrollback:r,cursorBlink:!0,cursorStyle:"bar",cursorWidth:1,lineHeight:1.1,convertEol:!1,allowTransparency:!0,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:13,theme:N}),H=new Wq;O.loadAddon(H),O.loadAddon(new Qq),g.current=O;const Z=d.current;Z&&(O.open(Z),p.current&&O.write(p.current),Rm(O,Z,S,!1,()=>{}),Em(O),j());const I=O.onData($=>{n.command({type:"terminal.input",terminalId:t,data:$}).catch(V=>{E(V instanceof Error?V.message:String(V))})}),W=O.onResize(({cols:$,rows:V})=>{if(!_.current)return;const q={cols:$,rows:V};S.current&&S.current.cols===$&&S.current.rows===V||(S.current=q,L($,V))}),F=new ResizeObserver(()=>{const $=g.current,V=d.current;!$||!V||Rm($,V,S,_.current,(q,D)=>{n.command({type:"terminal.resize",terminalId:t,cols:q,rows:D}).catch(()=>{})})});return Z&&F.observe(Z),()=>{F.disconnect(),W.dispose(),I.dispose(),p.current=H.serialize(),O.dispose(),g.current=null}},[r,n,t,N]),v.useEffect(()=>{const O=g.current;O&&(O.options.scrollback=r)},[r]),v.useEffect(()=>{const O=g.current;O&&(O.options.theme=N,Em(O))},[N]),v.useEffect(()=>{if(l===0)return;const O=g.current;O&&requestAnimationFrame(()=>{O.focus()})},[l]),v.useEffect(()=>{if(o===0)return;const O=g.current;O&&(_.current=!1,y.current+=1,w.current=null,p.current=null,k(null),E(null),O.reset(),Em(O),n.command({type:"terminal.close",terminalId:t}).catch(H=>{E(H instanceof Error?H.message:String(H))}))},[o,n,t]),v.useEffect(()=>{c==null||c((C==null?void 0:C.cwd)??null)},[C==null?void 0:C.cwd,c]),v.useEffect(()=>{const O=I=>{const W=g.current;if(!W)return;const F=JSON.stringify({cwd:I.cwd,shell:I.shell,cols:I.cols,rows:I.rows,scrollback:I.scrollback,status:I.status,exitCode:I.exitCode,serializedState:I.serializedState});if(w.current===F){k({cwd:I.cwd,shell:I.shell,status:I.status,exitCode:I.exitCode}),p.current=I.serializedState||null;return}w.current=F,k({cwd:I.cwd,shell:I.shell,status:I.status,exitCode:I.exitCode}),p.current=I.serializedState||null,W.options.scrollback=I.scrollback,W.reset(),I.serializedState&&W.write(I.serializedState),Em(W)},H=()=>{const I=g.current,W=d.current;if(!I||!W)return;const F=u4(I,W)??c4(I);I.resize(F.cols,F.rows),S.current=F,n.command({type:"terminal.create",projectId:e,terminalId:t,cols:F.cols,rows:F.rows,scrollback:r}).then($=>{_.current=!0,E(null),$&&O($),j()}).catch($=>{E($ instanceof Error?$.message:String($))})},Z=()=>{const I=++y.current,W=()=>{if(y.current!==I)return;const F=g.current,$=d.current;if(!F||!$)return;Rm(F,$,S,!1,()=>{});const V=$.getBoundingClientRect();if(V.width<=0||V.height<=0){requestAnimationFrame(W);return}H()};requestAnimationFrame(()=>{requestAnimationFrame(W)})};return Z(),n.subscribeTerminal(t,{onSnapshot:I=>{if(!I){_.current=!1,w.current=null,i==="connected"&&Z();return}_.current=!0,E(null),O(I),j()},onEvent:I=>{const W=g.current;if(W){if(I.type==="terminal.output"){W.write(I.data);return}I.type==="terminal.exit"&&k(F=>({cwd:(F==null?void 0:F.cwd)??"",shell:(F==null?void 0:F.shell)??"",status:"exited",exitCode:I.exitCode}))}}})},[i,e,r,n,t]),f.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden pb-4",children:[f.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 overflow-hidden px-3 py-1",children:f.jsx("div",{ref:d,className:"kaizen-terminal min-h-0 min-w-0 flex-1 overflow-hidden w-full"})}),R?f.jsxs("div",{className:"px-3 py-1 text-xs text-destructive",children:["Terminal error: ",R]}):null]})}const mX=24;function d4(e){return e+mX}function pX(e,t){return Math.max(1,e)*d4(t)}function $b({projectId:e,layout:t,socket:n,connectionStatus:r,scrollback:i,minColumnWidth:o,maximized:l=!1,focusRequestVersion:c=0,splitTerminalShortcut:h,onToggleMaximized:d,onAddTerminal:g,onRemoveTerminal:p,onTerminalLayout:_}){const y=v.useRef(null),w=v.useRef({}),S=v.useRef([]),[C,k]=v.useState(0),[R,E]=v.useState({}),[N,L]=v.useState({});v.useLayoutEffect(()=>{const W=y.current;if(!W)return;const F=()=>{k(W.getBoundingClientRect().width)},$=new ResizeObserver(F);return $.observe(W),F(),()=>$.disconnect()},[]);const j=t.terminals.length,O=d4(o),H=pX(j,o),Z=Math.max(C,H),I=v.useMemo(()=>t.terminals.map(W=>W.id).join(":"),[t.terminals]);return v.useLayoutEffect(()=>{const W=S.current,F=t.terminals.map(q=>q.id),$=F.find(q=>!W.includes(q));if(S.current=F,!$||W.length===0)return;const V=w.current[$];V&&V.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[t.terminals]),f.jsx("div",{className:"flex h-full min-h-0 flex-col",children:f.jsx("div",{ref:y,className:"min-h-0 flex-1 overflow-x-auto overflow-y-hidden",children:f.jsx("div",{className:"h-full min-h-0",style:{width:Z||"100%"},children:f.jsx(Fd,{orientation:"horizontal",className:"h-full min-h-0",onLayoutChanged:W=>_(e,t.terminals.map(F=>W[F.id]??F.size)),children:t.terminals.map((W,F)=>f.jsxs(v.Fragment,{children:[f.jsx(mo,{id:W.id,defaultSize:`${W.size}%`,minSize:`${O}px`,className:"min-h-0 overflow-hidden",style:{minWidth:O},children:f.jsxs("div",{ref:$=>{w.current[W.id]=$},className:"flex h-full min-h-0 min-w-0 flex-col border-r border-border bg-transparent last:border-r-0",style:{minWidth:O},children:[f.jsxs("div",{className:"flex items-center gap-2 px-3 pr-2 pt-2 pb-1",children:[f.jsx("div",{className:"min-w-0 flex-1 text-left",children:f.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f.jsx("div",{className:"shrink-0 text-sm font-medium",children:"Terminal"}),f.jsx("div",{className:"min-w-0 truncate text-xs text-muted-foreground",children:R[W.id]??""})]})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(Qe,{variant:"ghost",size:"icon-sm",className:"md:hidden","aria-label":"Send Ctrl+C",onClick:()=>{n.command({type:"terminal.input",terminalId:W.id,data:""}).catch(()=>{})},title:"Send Ctrl+C",children:f.jsx(D9,{className:"size-3.5"})}),f.jsx(Qe,{variant:"ghost",size:"icon-sm","aria-label":"Clear terminal",onClick:()=>L($=>({...$,[W.id]:($[W.id]??0)+1})),children:f.jsx(S8,{className:"size-3.5"})}),f.jsxs(yd,{children:[f.jsx(xd,{asChild:!0,children:f.jsx(Qe,{variant:"ghost",size:"icon-sm","aria-label":"Add terminal to the right",onClick:()=>g(e,W.id),children:f.jsx(C0,{className:"size-3.5"})})}),f.jsx(Rc,{side:"bottom",shortcut:h})]}),d?f.jsx(Qe,{variant:"ghost",size:"icon-sm","aria-label":l?"Restore terminal size":"Maximize terminal",onClick:d,children:l?f.jsx(s9,{className:"size-3.5"}):f.jsx(J8,{className:"size-3.5"})}):null,f.jsx(Qe,{variant:"ghost",size:"icon-sm","aria-label":"Archive terminal",onClick:()=>p(e,W.id),children:f.jsx(_o,{className:"size-3.5"})})]})]}),f.jsx(fX,{projectId:e,terminalId:W.id,socket:n,scrollback:i,connectionStatus:r,clearVersion:N[W.id]??0,focusRequestVersion:F===0?c:0,onPathChange:$=>E(V=>V[W.id]===$?V:{...V,[W.id]:$})})]})}),F<t.terminals.length-1?f.jsx(Hd,{withHandle:!0,orientation:"horizontal"}):null]},W.id))},I)})})})}function qR(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function gX(e){var r;if(!e)return null;const t=e.trim();if(!t||/^(https?:|mailto:|ftp:|file:)/i.test(t)||!t.startsWith("/"))return null;const n=/^(?<path>\/.+?)#L(?<line>\d+)(?:C(?<column>\d+))?$/.exec(t);return(r=n==null?void 0:n.groups)!=null&&r.path?{path:n.groups.path,line:qR(n.groups.line),column:qR(n.groups.column)}:{path:t}}function Ub(e,t){if(!e)return"";if(t){const n=t.endsWith("/")?t:`${t}/`;if(e.startsWith(n))return e.slice(n.length);if(e===t)return""}return e.replace(/^\/home\/user\/workspace\//,"")}const Pw=()=>{},h4=v.createContext(Pw);function vX({children:e,onOpenLocalLink:t}){return f.jsx(h4.Provider,{value:t??Pw,children:e})}const Bx={Task:sp,TaskOutput:sp,Bash:k0,Glob:db,Grep:db,ExitPlanMode:L2,Read:O8,Edit:T8,Write:M8,NotebookEdit:Bc,WebFetch:PB,TodoWrite:QB,WebSearch:db,KillShell:A9,AskUserQuestion:$5,Skill:$n,EnterPlanMode:L2},f4=z9;function m4(e){return Bx[e]?Bx[e]:f4}function Mo({children:e,className:t}){return f.jsx("div",{className:pe("flex gap-3 justify-start items-center",t),children:e})}function _X({children:e,className:t}){return f.jsx("div",{className:pe("flex items-center gap-1.5 text-xs",t),children:e})}function wo({children:e,className:t}){return f.jsx("span",{className:pe("font-medium text-foreground/80",t),children:e})}function bX({children:e}){return f.jsx("span",{className:"text-muted-foreground",children:e})}function Lh({children:e,expandedContent:t,defaultExpanded:n=!1}){const[r,i]=v.useState(n);return f.jsxs("div",{className:"flex flex-col w-full",children:[f.jsxs("button",{onClick:()=>i(!r),className:`group/expandable-row cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${r?"":"hover:opacity-60 transition-opacity"}`,children:[f.jsx("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:e}),f.jsx(Vr,{className:`h-4.5 w-4.5 text-muted-icon translate-y-[0.5px] transition-all duration-200 opacity-0 group-hover/expandable-row:opacity-100 ${r?"rotate-90 opacity-100":""}`})]}),r&&t]})}function Vb({label:e,children:t,copyText:n}){const[r,i]=v.useState(!1),o=n??Dp(t),l=v.useCallback(async()=>{await navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),2e3)},[o]);return f.jsxs("div",{children:[f.jsx("span",{className:"font-medium text-muted-foreground",children:e}),f.jsxs("div",{className:"relative group/codeblock",children:[f.jsx("pre",{className:"my-1 text-xs font-mono whitespace-no-wrap break-all bg-muted border border-border rounded-lg p-2 max-h-64 overflow-auto w-full",children:t}),f.jsx(Qe,{variant:"ghost",size:"icon",className:pe("absolute top-[4px] right-[4px] z-10 h-6.5 w-6.5 rounded-sm text-muted-foreground opacity-0 group-hover/codeblock:opacity-100 transition-opacity",!r&&"hover:text-foreground",r&&"hover:!bg-transparent hover:!border-transparent"),onClick:l,children:r?f.jsx(Wi,{className:"h-3.5 w-3.5 text-green-400"}):f.jsx(ul,{className:"h-4 w-4"})})]})]})}function p4({children:e,icon:t,className:n}){return f.jsxs("span",{className:pe("inline-flex items-center gap-1 px-2 py-1 bg-muted border border-border rounded-full",n),children:[t&&f.jsx(t,{className:"h-3 w-3 text-muted-foreground"}),e]})}function zh({children:e,className:t}){return f.jsxs("div",{className:pe("grid grid-cols-[auto_1fr] gap-2 min-w-0",t),children:[f.jsx("div",{className:" min-w-5 flex flex-col relative items-center justify-center",children:f.jsx("div",{className:"min-h-full w-[1px] bg-muted-foreground/20"})}),f.jsx("div",{className:"-ml-[1px] min-w-0 overflow-hidden",children:e})]})}function Dp(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(Array.isArray(e))return e.map(Dp).join("");if(e&&typeof e=="object"&&"props"in e){const t=e.props;return Dp(t.children)}return""}function KR(e,t){return v.isValidElement(e)?v.cloneElement(e,{className:pe(e.props.className,t)}):e}const yX={h1:({children:e})=>f.jsx("h1",{className:"text-[20px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h2:({children:e})=>f.jsx("h2",{className:"text-[18px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h3:({children:e})=>f.jsx("h3",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h4:({children:e})=>f.jsx("h4",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h5:({children:e})=>f.jsx("h5",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h6:({children:e})=>f.jsx("h6",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),pre:({children:e,...t})=>{const[n,r]=v.useState(!1),i=Dp(e),o=async()=>{await navigator.clipboard.writeText(i),r(!0),setTimeout(()=>r(!1),2e3)};return f.jsxs("div",{className:"relative overflow-x-auto max-w-full min-w-0 no-code-highlight group/pre",children:[f.jsx("pre",{className:"min-w-0 rounded-xl py-2.5 px-3.5 [.no-pre-highlight_&]:bg-background",...t,children:e}),f.jsx(Qe,{variant:"ghost",size:"icon",className:pe("absolute top-[35px] -translate-y-[50%] -translate-x-[1px] rounded-md right-1.5 h-8 w-8 text-muted-foreground opacity-0 group-hover/pre:opacity-100 transition-opacity",!n&&"hover:text-foreground",n&&"hover:!bg-transparent hover:!border-transparent"),onClick:o,children:n?f.jsx(Wi,{className:"h-4 w-4 text-green-400"}):f.jsx(ul,{className:"h-4 w-4"})})]})},code:({children:e,className:t,...n})=>t?f.jsx("code",{className:"block text-xs whitespace-pre",...n,children:e}):f.jsx("code",{className:"break-all px-1 bg-border/60 dark:[.no-pre-highlight_&]:bg-background dark:[.text-pretty_&]:bg-neutral [.no-code-highlight_&]:!bg-transparent py-0.5 rounded text-sm whitespace-wrap",...n,children:e}),table:({children:e,...t})=>f.jsx("div",{className:"border border-border rounded-xl overflow-x-auto",children:f.jsx("table",{className:"table-auto min-w-full divide-y divide-border bg-background",...t,children:e})}),tbody:({children:e,...t})=>f.jsx("tbody",{className:"divide-y divide-border",...t,children:e}),th:({children:e,...t})=>f.jsx("th",{className:"text-left text-xs uppercase text-muted-foreground tracking-wider p-2 pl-0 first:pl-3 bg-muted dark:bg-card [&_*]:font-semibold",...t,children:e}),td:({children:e,...t})=>f.jsx("td",{className:"text-left p-2 pl-0 first:pl-3 [&_*]:font-normal ",...t,children:e}),p:({children:e,...t})=>f.jsx("p",{className:"break-words mt-5 mb-3 first:mt-0 last:mb-0",...t,children:e}),blockquote:({children:e,...t})=>(()=>{const n=v.Children.toArray(e),r=n[0];r!==void 0&&(n[0]=KR(r,"mt-0"));const i=n.length-1,o=n[i];return o!==void 0&&(n[i]=KR(o,"mb-0")),f.jsx("blockquote",{className:"my-2 mt-5 mb-3 first:mt-0 last:mb-0 border-l-2 border-border/80 pl-2 text-muted-foreground",...t,children:n})})(),a:({children:e,...t})=>f.jsx("a",{className:"transition-all underline decoration-2 text-logo decoration-logo/50 hover:text-logo/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40 ",target:"_blank",rel:"noopener noreferrer",...t,children:e})};function uu(e){return{...yX,a:({children:t,href:n,onClick:r,...i})=>{const o=(e==null?void 0:e.onOpenLocalLink)??v.useContext(h4),l=gX(n);return f.jsx("a",{className:"transition-all underline decoration-2 text-logo decoration-logo/50 hover:text-logo/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40 ",href:n,target:l?void 0:"_blank",rel:l?void 0:"noopener noreferrer",onClick:c=>{r==null||r(c),!(c.defaultPrevented||!l||o===Pw)&&(c.preventDefault(),o(l))},...i,children:t})}}}const xX={connecting:"Connecting...",acquiring_sandbox:"Booting...",initializing:"Initializing...",starting:"Starting...",running:"Running...",waiting_for_user:"Waiting...",failed:"Failed"};function wX({status:e}){const t=(e?xX[e]:void 0)||"Processing...",n=e==="failed";return f.jsx(Mo,{className:"ml-[1px]",children:f.jsxs(_X,{children:[n?f.jsx(_o,{className:"size-4.5 text-red-500"}):f.jsx(Lr,{className:"size-4.5 animate-spin text-muted-icon"}),f.jsx(_g,{className:"ml-[1px] text-sm",shimmerWidth:44,children:t})]})})}const Dg=v.forwardRef(({className:e,children:t,...n},r)=>f.jsx("div",{ref:r,className:pe("relative overflow-y-auto overscroll-contain touch-pan-y scrollbar-hide",e),style:{WebkitOverflowScrolling:"touch"},...n,children:t}));Dg.displayName="ScrollArea";function g4(e){return e==="localhost"||e==="127.0.0.1"||e==="::1"}const Og=20,Fx=50,v4=30;function _4(e){return Number.isFinite(e)?Math.min(Fx,Math.max(Og,e)):v4}function SX(){return{isVisible:!1,size:Og}}function Tm(e,t){return e[t]??SX()}function CX(e){return!e||typeof e!="object"?{projects:{}}:{projects:Object.fromEntries(Object.entries(e.projects??{}).map(([r,i])=>[r,{isVisible:!1,size:_4(i.size??v4)}]))}}const Ud=Eo()(Ro(e=>({projects:{},toggleVisibility:t=>e(n=>({projects:{...n.projects,[t]:{...Tm(n.projects,t),isVisible:!Tm(n.projects,t).isVisible}}})),setVisibility:(t,n)=>e(r=>({projects:{...r.projects,[t]:{...Tm(r.projects,t),isVisible:n}}})),setSize:(t,n)=>e(r=>({projects:{...r.projects,[t]:{...Tm(r.projects,t),size:_4(n)}}})),clearProject:t=>e(n=>{const{[t]:r,...i}=n.projects;return{projects:i}})}),{name:"right-sidebar-layouts",version:2,migrate:CX})),kX={isVisible:!1,size:Og},Iw=[60,40];function EX(){return{isVisible:!1,mainSizes:[...Iw],terminals:[],nextTerminalIndex:0}}function RX(e,t){return e[t]??EX()}function Wb(e){if(e.length===0)return[];const t=e.reduce((n,r)=>n+Math.max(r,0),0);return!Number.isFinite(t)||t<=0?Array.from({length:e.length},()=>100/e.length):e.map(n=>Math.max(n,0)/t*100)}function TX(e){let t=e,n="";do n=String.fromCharCode(65+t%26)+n,t=Math.floor(t/26)-1;while(t>=0);return`Terminal ${n}`}function NX(e){if(e.length===0)return e;const t=e.length+1;return e.map(n=>({...n,size:n.size*e.length/t}))}function bc(e,t,n){return{...e,[t]:n(RX(e,t))}}const ua=Eo()(Ro(e=>({projects:{},addTerminal:(t,n)=>e(r=>({projects:bc(r.projects,t,i=>{var h,d;const o=NX(i.terminals),l={id:((d=(h=globalThis.crypto)==null?void 0:h.randomUUID)==null?void 0:d.call(h))??`terminal-${Date.now()}-${i.nextTerminalIndex}`,title:TX(i.nextTerminalIndex),size:100/(o.length+1)},c=n?Math.max(o.findIndex(g=>g.id===n)+1,0):o.length;return{...i,isVisible:!0,nextTerminalIndex:i.nextTerminalIndex+1,terminals:[...o.slice(0,c),l,...o.slice(c)]}})})),removeTerminal:(t,n)=>e(r=>({projects:bc(r.projects,t,i=>{const o=i.terminals.filter(c=>c.id!==n);if(o.length===0)return{...i,isVisible:!1,terminals:[]};const l=Wb(o.map(c=>c.size));return{...i,terminals:o.map((c,h)=>({...c,size:l[h]??100/o.length}))}})})),toggleVisibility:t=>e(n=>({projects:bc(n.projects,t,r=>({...r,isVisible:r.terminals.length>0?!r.isVisible:!1}))})),resetMainSizes:t=>e(n=>({projects:bc(n.projects,t,r=>({...r,mainSizes:[...Iw]}))})),setMainSizes:(t,n)=>e(r=>{if(n.length!==2)return r;const i=Wb(n);return{projects:bc(r.projects,t,o=>({...o,mainSizes:i}))}}),setTerminalSizes:(t,n)=>e(r=>({projects:bc(r.projects,t,i=>{if(n.length!==i.terminals.length)return i;const o=Wb(n);return{...i,terminals:i.terminals.map((l,c)=>({...l,size:o[c]??l.size}))}})})),clearProject:t=>e(n=>{const{[t]:r,...i}=n.projects;return{projects:i}})}),{name:"terminal-layouts",version:1})),MX={isVisible:!1,mainSizes:[...Iw],terminals:[],nextTerminalIndex:0},Op=1e4,Hx=500,$x=5e4,Lp=450,Ux=250,Vx=900,Wx="cursor";function qx(e){switch(e){case"vscode":return"code {path}";case"windsurf":return"windsurf {path}";case"custom":return"cursor {path}";case"cursor":default:return"cursor {path}"}}function AX(e){switch(e){case"vscode":return"VS Code";case"windsurf":return"Windsurf";case"custom":return"Custom";case"cursor":default:return"Cursor"}}function GR(e){return Number.isFinite(e)?Math.min($x,Math.max(Hx,Math.round(e))):Op}function YR(e){return Number.isFinite(e)?Math.min(Vx,Math.max(Ux,Math.round(e))):Lp}function XR(e){switch(e){case"vscode":case"windsurf":case"custom":case"cursor":return e;default:return Wx}}function qb(e,t){const n=e==null?void 0:e.trim();return n&&n.length>0?n:qx(t)}const Bi=Eo()(Ro(e=>({scrollbackLines:Op,minColumnWidth:Lp,editorPreset:Wx,editorCommandTemplate:qx(Wx),setScrollbackLines:t=>e({scrollbackLines:GR(t)}),setMinColumnWidth:t=>e({minColumnWidth:YR(t)}),setEditorPreset:t=>e(n=>{const r=XR(t);return{editorPreset:r,editorCommandTemplate:r==="custom"?qb(n.editorCommandTemplate,r):qx(r)}}),setEditorCommandTemplate:t=>e(n=>({editorCommandTemplate:qb(t,n.editorPreset)}))}),{name:"terminal-preferences",version:3,migrate:e=>{const t=e,n=XR(t==null?void 0:t.editorPreset);return{scrollbackLines:GR((t==null?void 0:t.scrollbackLines)??Op),minColumnWidth:YR((t==null?void 0:t.minColumnWidth)??Lp),editorPreset:n,editorCommandTemplate:qb(t==null?void 0:t.editorCommandTemplate,n)}}})),jX=35;function DX(e,t){return!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0?0:e*(t/100)}function OX(e,t){const n=DX(e,t);return n>=0&&n<jX}const Ac=350,LX=[.4,0,.2,1],zX=8,ZR=1e-6;function PX(e,t,n){const r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function IX(e,t,n){const r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function BX(e,t,n){const r=1-e;return 3*r*r*t+6*r*e*(n-t)+3*e*e*(1-n)}function FX(e,t,n){let r=e;for(let i=0;i<zX;i+=1){const o=PX(r,t,n)-e;if(Math.abs(o)<ZR)return r;const l=BX(r,t,n);if(Math.abs(l)<ZR)break;r-=o/l}return r}function HX(e){if(e<=0)return 0;if(e>=1)return 1;const[t,n,r,i]=LX,o=FX(e,t,r);return IX(o,n,i)}function b4(e,t,n){const r=HX(n);return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r]}function $X({projectId:e,shouldRenderRightSidebarLayout:t,showRightSidebar:n,rightSidebarSize:r}){const i=v.useRef(null),o=v.useRef(null),l=v.useRef(null),c=v.useRef(null),h=v.useRef(null),d=v.useRef(!1),g=v.useRef(null),p=v.useRef(!1),_=v.useRef(!1);return v.useEffect(()=>()=>{c.current!==null&&window.cancelAnimationFrame(c.current),h.current!==null&&window.clearTimeout(h.current)},[]),v.useLayoutEffect(()=>{var O,H,Z,I,W,F;if(!t){c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null),h.current!==null&&(window.clearTimeout(h.current),h.current=null),d.current=!1;return}const y=i.current;if(!y)return;c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null),h.current!==null&&(window.clearTimeout(h.current),h.current=null);const w=g.current,S=w!==null&&w!==e,C=n&&!_.current,k=!p.current,R=n?[100-r,r]:[100,0],E=S||k&&n,N=C||k?[100,0]:[y.getLayout().workspace??R[0],y.getLayout().rightSidebar??R[1]];if(g.current=e,p.current=t,_.current=n,E||Math.abs(N[0]-R[0])<.1&&Math.abs(N[1]-R[1])<.1){y.setLayout({workspace:R[0],rightSidebar:R[1]}),(O=o.current)==null||O.setAttribute("data-right-sidebar-open",n?"true":"false"),(H=l.current)==null||H.setAttribute("data-right-sidebar-open",n?"true":"false"),(Z=l.current)==null||Z.setAttribute("data-right-sidebar-animated","false");return}d.current=!0,(I=o.current)==null||I.setAttribute("data-right-sidebar-open",n?"true":"false"),(W=l.current)==null||W.setAttribute("data-right-sidebar-open",n?"true":"false"),(F=l.current)==null||F.setAttribute("data-right-sidebar-animated","true"),y.setLayout({workspace:N[0],rightSidebar:N[1]});const L=performance.now(),j=$=>{const V=Math.min(1,($-L)/Ac),q=b4(N,R,V);if(y.setLayout({workspace:q[0],rightSidebar:q[1]}),V<1){c.current=window.requestAnimationFrame(j);return}y.setLayout({workspace:R[0],rightSidebar:R[1]}),c.current=null,h.current=window.setTimeout(()=>{d.current=!1,h.current=null},0)};c.current=window.requestAnimationFrame(j)},[e,r,t,n]),v.useEffect(()=>{t||(p.current=!1,_.current=!1)},[t]),{isAnimating:d,panelGroupRef:i,sidebarPanelRef:o,sidebarVisualRef:l}}function UX(e){const t=e.previousProjectId!==null&&e.previousProjectId!==e.projectId,n=e.previousProjectId===null&&e.projectId!==null;return!t&&!n&&e.showTerminalPane&&!e.wasTerminalVisible}function VX({previousProjectId:e,projectId:t,previousShouldRenderTerminalLayout:n,previousShowTerminalPane:r,showTerminalPane:i,terminalLayout:o,liveLayout:l}){const c=e!==null&&e!==t,h=i&&!r,d=!n,g=e===null&&t!==null,p=i?o.mainSizes:[100,0];return{currentLayout:h||d?[100,0]:l,shouldSkipAnimation:c||g&&d,targetLayout:p}}function WX({chatInputRef:e,projectId:t,shouldRenderTerminalLayout:n,showTerminalPane:r,terminalLayout:i}){const o=v.useRef(null),l=v.useRef(null),c=v.useRef(null),h=v.useRef(null),d=v.useRef(null),g=v.useRef(!1),p=v.useRef(null),_=v.useRef(!1),y=v.useRef(!1),w=v.useRef(!1),[S,C]=v.useState(0);return v.useEffect(()=>{var E;const k=p.current,R=w.current;UX({previousProjectId:k,projectId:t,showTerminalPane:r,wasTerminalVisible:R})&&C(N=>N+1),k!==null&&k===t&&!r&&R&&((E=e.current)==null||E.focus({preventScroll:!0})),w.current=r,p.current=t},[e,t,r]),v.useEffect(()=>()=>{h.current!==null&&window.cancelAnimationFrame(h.current),d.current!==null&&window.clearTimeout(d.current)},[]),v.useLayoutEffect(()=>{var H,Z,I,W,F,$;if(!n){h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null),g.current=!1;return}const k=o.current;if(!k)return;h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null);const R=p.current,{currentLayout:E,shouldSkipAnimation:N,targetLayout:L}=VX({previousProjectId:R,projectId:t,previousShouldRenderTerminalLayout:_.current,previousShowTerminalPane:y.current,showTerminalPane:r,terminalLayout:i,liveLayout:[k.getLayout().chat??i.mainSizes[0],k.getLayout().terminal??i.mainSizes[1]]});if(_.current=n,y.current=r,N||Math.abs(E[0]-L[0])<.1&&Math.abs(E[1]-L[1])<.1){k.setLayout({chat:L[0],terminal:L[1]}),(H=l.current)==null||H.setAttribute("data-terminal-open",r?"true":"false"),(Z=c.current)==null||Z.setAttribute("data-terminal-open",r?"true":"false"),(I=c.current)==null||I.setAttribute("data-terminal-animated","false");return}g.current=!0,(W=l.current)==null||W.setAttribute("data-terminal-open",r?"true":"false"),(F=c.current)==null||F.setAttribute("data-terminal-open",r?"true":"false"),($=c.current)==null||$.setAttribute("data-terminal-animated","true"),k.setLayout({chat:E[0],terminal:E[1]});const j=performance.now(),O=V=>{const q=Math.min(1,(V-j)/Ac),D=b4(E,L,q);if(k.setLayout({chat:D[0],terminal:D[1]}),q<1){h.current=window.requestAnimationFrame(O);return}k.setLayout({chat:L[0],terminal:L[1]}),h.current=null,d.current=window.setTimeout(()=>{g.current=!1,d.current=null},0)};h.current=window.requestAnimationFrame(O)},[t,n,r,i.mainSizes]),v.useEffect(()=>{n||(_.current=!1,y.current=!1)},[n]),{isAnimating:g,mainPanelGroupRef:o,terminalFocusRequestVersion:S,terminalPanelRef:l,terminalVisualRef:c}}const yi=Eo()(Ro(e=>({folderGroupsEnabled:!1,showFeatureOverviewInSidebar:!0,kanbanStatusesEnabled:!0,commitProjectMetadataDirectory:!0,setFolderGroupsEnabled:t=>e({folderGroupsEnabled:t}),setShowFeatureOverviewInSidebar:t=>e({showFeatureOverviewInSidebar:t}),setKanbanStatusesEnabled:t=>e({kanbanStatusesEnabled:t}),setCommitProjectMetadataDirectory:t=>e({commitProjectMetadataDirectory:t})}),{name:"feature-settings"}));function Nm(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function qX(e){if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}}function KX(e,t){const n=qX(t);switch(e.toolKind){case"ask_user_question":{const i=Nm(n),o=Nm(i==null?void 0:i.answers)??(i||{});return{answers:Object.fromEntries(Object.entries(o).map(([l,c])=>Array.isArray(c)?[l,c.map(h=>String(h))]:c&&typeof c=="object"&&Array.isArray(c.answers)?[l,c.answers.map(h=>String(h))]:c==null||c===""?[l,[]]:[l,[String(c)]])),...(i==null?void 0:i.discarded)===!0?{discarded:!0}:{}}}case"exit_plan_mode":{const i=Nm(n);return{confirmed:typeof(i==null?void 0:i.confirmed)=="boolean"?i.confirmed:void 0,clearContext:typeof(i==null?void 0:i.clearContext)=="boolean"?i.clearContext:void 0,message:typeof(i==null?void 0:i.message)=="string"?i.message:void 0,...(i==null?void 0:i.discarded)===!0?{discarded:!0}:{}}}case"read_file":if(typeof n=="string")return n;const r=Nm(n);return{content:typeof(r==null?void 0:r.content)=="string"?r.content:JSON.stringify(n,null,2)};default:return n}}function y4(e){return new Date(e).toISOString()}function zi(e){return{id:e._id,messageId:e.messageId,timestamp:y4(e.createdAt),hidden:e.hidden}}function GX(e){return{id:e._id,messageId:e.messageId,hidden:e.hidden,kind:"tool",toolKind:e.tool.toolKind,toolName:e.tool.toolName,toolId:e.tool.toolId,input:e.tool.input,timestamp:y4(e.createdAt)}}function YX(e){if(e.debugRaw)try{return JSON.parse(e.debugRaw).tool_use_result}catch{return}}function XX(e){if(e!=null&&e.length)return e.map(t=>({...t,previewUrl:`/attachments/${t.relativePath.split("/").map(encodeURIComponent).join("/")}`}))}function QR(e,t){const n=e.at(-1);if((n==null?void 0:n.kind)===t.kind&&n.hidden===t.hidden&&n.messageId===t.messageId){n.text+=t.text;return}e.push(t)}function ZX(e){const t=new Map,n=[];for(const r of e)switch(r.kind){case"user_prompt":n.push({...zi(r),kind:"user_prompt",content:r.content,attachments:XX(r.attachments)});break;case"system_init":n.push({...zi(r),kind:"system_init",provider:r.provider,model:r.model,tools:r.tools,agents:r.agents,slashCommands:r.slashCommands,mcpServers:r.mcpServers,debugRaw:r.debugRaw});break;case"account_info":n.push({...zi(r),kind:"account_info",accountInfo:r.accountInfo});break;case"assistant_text":QR(n,{...zi(r),kind:"assistant_text",text:r.text});break;case"assistant_thought":QR(n,{...zi(r),kind:"assistant_thought",text:r.text});break;case"tool_call":{const i=GX(r);t.set(r.tool.toolId,{hydrated:i,normalized:r.tool}),n.push(i);break}case"tool_result":{const i=t.get(r.toolId);if(i){const o=i.normalized.toolKind==="ask_user_question"||i.normalized.toolKind==="exit_plan_mode"?YX(r)??r.content:r.content;i.hydrated.result=KX(i.normalized,o),i.hydrated.rawResult=o,i.hydrated.isError=r.isError}break}case"result":n.push({...zi(r),kind:"result",success:!r.isError,cancelled:r.subtype==="cancelled",result:r.result,durationMs:r.durationMs,costUsd:r.costUsd});break;case"status":n.push({...zi(r),kind:"status",status:r.status});break;case"compact_boundary":n.push({...zi(r),kind:"compact_boundary"});break;case"compact_summary":n.push({...zi(r),kind:"compact_summary",summary:r.summary});break;case"context_cleared":n.push({...zi(r),kind:"context_cleared"});break;case"interrupted":n.push({...zi(r),kind:"interrupted"});break;default:n.push({...zi(r),kind:"unknown",json:JSON.stringify(r,null,2)});break}return n}const QX=["AskUserQuestion","ExitPlanMode","TodoWrite"],JX=new Set(["TodoWrite"]);function eZ(e,t){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.kind!=="tool")continue;const i=r;if(i.toolName===t&&!i.result)return i.id}return null}function tZ(e,t){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.kind!=="tool")continue;const i=r;if(i.toolName===t)return i.id}return null}function nZ(e){const t={};for(const n of QX)t[n]=JX.has(n)?tZ(e,n):eZ(e,n);return t}function rZ(e){return e==="starting"||e==="running"||e==="waiting_for_user"}function Kb(e){return e==="starting"||e==="running"||e==="waiting_for_user"}const iZ=25e3,sZ=15e3,oZ=4e3;class aZ{constructor(t){tr(this,"url");tr(this,"ws",null);tr(this,"started",!1);tr(this,"reconnectTimer",null);tr(this,"reconnectDelayMs",750);tr(this,"subscriptions",new Map);tr(this,"pending",new Map);tr(this,"outboundQueue",[]);tr(this,"statusListeners",new Set);tr(this,"heartbeatTimer",null);tr(this,"pingTimeoutTimer",null);tr(this,"pingPromise",null);tr(this,"lastOpenAt",0);tr(this,"lastMessageAt",0);tr(this,"reconnectImmediatelyOnClose",!1);tr(this,"handleWindowFocus",()=>{this.ensureHealthyConnection()});tr(this,"handleVisibilityChange",()=>{if(document.visibilityState==="visible"){this.startHeartbeat(),this.ensureHealthyConnection();return}this.stopHeartbeat()});tr(this,"handleOnline",()=>{this.ensureHealthyConnection()});this.url=t}start(){this.started||(this.started=!0,window.addEventListener("focus",this.handleWindowFocus),window.addEventListener("online",this.handleOnline),document.addEventListener("visibilitychange",this.handleVisibilityChange),this.connect())}dispose(){var t;this.started=!1,this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopHeartbeat(),this.clearPingState(),window.removeEventListener("focus",this.handleWindowFocus),window.removeEventListener("online",this.handleOnline),document.removeEventListener("visibilitychange",this.handleVisibilityChange),(t=this.ws)==null||t.close(),this.ws=null;for(const n of this.pending.values())n.reject(new Error("Socket disposed"));this.pending.clear()}onStatus(t){return this.statusListeners.add(t),t(this.getStatus()),()=>{this.statusListeners.delete(t)}}subscribe(t,n,r){const i=Od();return this.subscriptions.set(i,{topic:t,listener:n,eventListener:r}),this.enqueue({v:1,type:"subscribe",id:i,topic:t}),()=>{this.subscriptions.delete(i),this.enqueue({v:1,type:"unsubscribe",id:i})}}subscribeTerminal(t,n){const r=Od(),i={type:"terminal",terminalId:t};return this.subscriptions.set(r,{topic:i,listener:n.onSnapshot,eventListener:n.onEvent}),this.enqueue({v:1,type:"subscribe",id:r,topic:i}),()=>{this.subscriptions.delete(r),this.enqueue({v:1,type:"unsubscribe",id:r})}}command(t){const n=Od(),r={v:1,type:"command",id:n,command:t};return new Promise((i,o)=>{this.pending.set(n,{resolve:i,reject:o}),this.enqueue(r)})}ensureHealthyConnection(){return!this.ws||this.ws.readyState===WebSocket.CLOSED||this.ws.readyState===WebSocket.CLOSING?(this.reconnectNow(),Promise.resolve()):this.ws.readyState===WebSocket.CONNECTING||!this.isConnectionStale()?Promise.resolve():this.sendPing()}connect(){if(!this.started)return;this.emitStatus("connecting");const t=new WebSocket(this.url);this.ws=t,t.addEventListener("open",()=>{if(this.ws===t){this.reconnectDelayMs=750,this.reconnectImmediatelyOnClose=!1,this.lastOpenAt=Date.now(),this.lastMessageAt=this.lastOpenAt,this.emitStatus("connected"),this.startHeartbeat();for(const[n,r]of this.subscriptions.entries())this.sendNow({v:1,type:"subscribe",id:n,topic:r.topic},t);for(;this.outboundQueue.length>0;){const n=this.outboundQueue.shift();n&&this.sendNow(n,t)}}}),t.addEventListener("message",n=>{var i;if(this.ws!==t)return;this.lastMessageAt=Date.now();let r;try{r=JSON.parse(String(n.data))}catch{return}if(r.type==="snapshot"){const o=this.subscriptions.get(r.id);o==null||o.listener(r.snapshot.data);return}if(r.type==="event"){const o=this.subscriptions.get(r.id);(i=o==null?void 0:o.eventListener)==null||i.call(o,r.event);return}if(r.type==="ack"){const o=this.pending.get(r.id);if(!o)return;this.pending.delete(r.id),o.resolve(r.result);return}if(r.type==="error"){if(!r.id){console.error(BF,r.message);return}const o=this.pending.get(r.id);if(!o)return;this.pending.delete(r.id),o.reject(new Error(r.message))}}),t.addEventListener("close",()=>{if(this.ws!==t||!this.started)return;const n=this.reconnectImmediatelyOnClose;this.reconnectImmediatelyOnClose=!1,this.stopHeartbeat(),this.clearPingState(),this.emitStatus("disconnected");for(const r of this.pending.values())r.reject(new Error("Disconnected"));if(this.pending.clear(),n){this.connect();return}this.scheduleReconnect()})}scheduleReconnect(){this.reconnectTimer===null&&(this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect(),this.reconnectDelayMs=Math.min(this.reconnectDelayMs*2,5e3)},this.reconnectDelayMs))}getStatus(){var t,n;return((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN?"connected":((n=this.ws)==null?void 0:n.readyState)===WebSocket.CONNECTING?"connecting":"disconnected"}emitStatus(t){for(const n of this.statusListeners)n(t)}isConnectionStale(){const t=Math.max(this.lastMessageAt,this.lastOpenAt);return t>0&&Date.now()-t>=iZ}sendPing(){if(this.pingPromise)return this.pingPromise;const t=this.command({type:"system.ping"}).then(()=>{this.clearPingState()}).catch(n=>{throw this.clearPingState(),this.reconnectNow(),n});return this.pingTimeoutTimer=window.setTimeout(()=>{this.clearPingState(),this.reconnectNow()},oZ),this.pingPromise=t,t}reconnectNow(){if(this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),!this.ws||this.ws.readyState===WebSocket.CLOSED){this.connect();return}this.ws.readyState!==WebSocket.CONNECTING&&(this.reconnectImmediatelyOnClose=!0,this.ws.close())}startHeartbeat(){document.visibilityState==="visible"&&this.heartbeatTimer===null&&(this.heartbeatTimer=window.setInterval(()=>{var t;if(document.visibilityState!=="visible"){this.stopHeartbeat();return}((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN&&this.ensureHealthyConnection()},sZ))}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}clearPingState(){this.pingTimeoutTimer!==null&&(window.clearTimeout(this.pingTimeoutTimer),this.pingTimeoutTimer=null),this.pingPromise=null}enqueue(t){var n;if(((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN){this.sendNow(t,this.ws);return}this.outboundQueue.push(t)}sendNow(t,n){if(n.readyState!==WebSocket.OPEN){this.outboundQueue.unshift(t);return}n.send(JSON.stringify(t))}}function lZ(e,t){var r;const n=e.find(i=>lh(i).some(o=>o.chatId===t));return n?((r=lh(n).find(i=>i.chatId!==t))==null?void 0:r.chatId)??null:null}function JR(e,t){var n;return((n=e.find(r=>lh(r).some(i=>i.chatId===t)))==null?void 0:n.groupKey)??null}function cZ(e,t){for(const n of e){const r=lh(n).find(i=>i.chatId===t);if(r)return r}return null}function uZ(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function dZ(){const e=v.useRef(null);return e.current||(e.current=new aZ(uZ())),v.useEffect(()=>{const t=e.current;return t==null||t.start(),()=>{t==null||t.dispose()}},[]),e.current}function Ad(e,t){if(t===void 0){console.info(`[useKaizenState] ${e}`);return}console.info(`[useKaizenState] ${e}`,t)}function x4(e){return e<24}function hZ(e){return Math.max(136,Math.round(e+24))}function fZ(e,t){return e==="awaiting_disconnect"&&t==="disconnected"?"awaiting_reconnect":e==="awaiting_reconnect"&&t==="connected"?"clear_phase":"none"}const w4=8e3;function mZ(e,t,n){return e==="awaiting_reconnect"&&t==="disconnected"&&n>=w4}const Bw=`${gg}ui-update-restart`;function Gb(){return window.sessionStorage.getItem(Bw)}function eT(e){window.sessionStorage.setItem(Bw,e)}function Mm(){window.sessionStorage.removeItem(Bw)}function pZ(e){const t=e.selectedProjectId??e.sidebarProjectId??null;return t?{kind:"project_id",projectId:t}:e.fallbackLocalProjectPath?{kind:"local_path",localPath:e.fallbackLocalProjectPath}:null}function gZ(e,t){return!e||!t?null:e.runtime.chatId!==t?(Ad("stale snapshot masked",{routeChatId:t,snapshotChatId:e.runtime.chatId,snapshotProvider:e.runtime.provider}),null):e}function vZ(e){var gu,Aa,Wh;const{activeChatId:t,activeOverviewFeatureId:n}=e,r=kl(),i=dZ(),o=K9(),[l,c]=v.useState({projectGroups:[]}),[h,d]=v.useState(null),[g,p]=v.useState(null),[_,y]=v.useState(null),[w,S]=v.useState(null),[C,k]=v.useState(null),[R,E]=v.useState(null),[N,L]=v.useState(null),[j,O]=v.useState("connecting"),[H,Z]=v.useState(!1),[I,W]=v.useState(!1),[F,$]=v.useState(!1),[V,q]=v.useState(null),[D,U]=v.useState(!1),[z,G]=v.useState(!1),[M,B]=v.useState(148),[X,A]=v.useState(!0),[ie,J]=v.useState(null),[ee,re]=v.useState(null),[ue,fe]=v.useState(null),[ge,Ce]=v.useState(null),[Te,je]=v.useState(!1),Xe=yi(Y=>Y.folderGroupsEnabled),xt=yi(Y=>Y.showFeatureOverviewInSidebar),Et=yi(Y=>Y.kanbanStatusesEnabled),me=AX(Bi(Y=>Y.editorPreset)),Fe=v.useRef(null),De=v.useRef(null),ft=Ud(Y=>Y.setVisibility),[at,it]=v.useState(new Set),hn=v.useRef(new Map),Mt=v.useRef(t),Pn=v.useRef(typeof document<"u"?document.visibilityState==="visible":!0),de=v.useRef(!1),se=v.useRef(null),ye=v.useRef(new Map);v.useEffect(()=>i.onStatus(O),[i]),v.useEffect(()=>{Mt.current=t},[t]),v.useEffect(()=>{function Y(){const ne=document.visibilityState==="visible";if(Pn.current=ne,ne){const Se=Mt.current;Se&&it($e=>{if(!$e.has(Se))return $e;const It=new Set($e);return It.delete(Se),It})}}return document.addEventListener("visibilitychange",Y),()=>document.removeEventListener("visibilitychange",Y)},[]),v.useEffect(()=>i.subscribe({type:"sidebar"},Y=>{const ne=new Map;for(const Cn of Y.projectGroups)for(const xr of[...Cn.generalChats,...Cn.features.flatMap(Gr=>Gr.chats)])ne.set(xr.chatId,xr.status);const Se=hn.current,$e=Mt.current,It=Pn.current;it(Cn=>{let xr=Cn;for(const[Gr,qh]of ne){const vu=Se.get(Gr);Kb(qh)&&xr.has(Gr)&&(xr===Cn&&(xr=new Set(Cn)),xr.delete(Gr)),vu&&Kb(vu)&&qh==="idle"&&(Gr!==$e||!It)&&(xr===Cn&&(xr=new Set(Cn)),xr.add(Gr))}return xr}),hn.current=ne,c(Y),Z(!0),J(null)}),[i]),v.useEffect(()=>i.subscribe({type:"local-projects"},Y=>{d(Y),W(!0),J(null)}),[i]),v.useEffect(()=>i.subscribe({type:"update"},Y=>{p(Y),J(null)}),[i]),v.useEffect(()=>{j==="connected"&&i.command({type:"update.check",force:!0}).catch(Y=>{J(Y instanceof Error?Y.message:String(Y))})},[j,i]),v.useEffect(()=>{const Y=Gb(),ne=fZ(Y,j);if(ne==="awaiting_reconnect"){eT("awaiting_reconnect");return}ne==="clear_phase"&&Mm()},[j,r]),v.useEffect(()=>{if(Gb()!=="awaiting_reconnect"||j!=="disconnected")return;const ne=Date.now(),Se=window.setTimeout(()=>{mZ(Gb(),j,Date.now()-ne)&&Mm()},w4);return()=>{window.clearTimeout(Se)}},[j]),v.useEffect(()=>{function Y(){g!=null&&g.lastCheckedAt&&(Date.now()-g.lastCheckedAt<=3600*1e3||i.command({type:"update.check"}).catch(ne=>{J(ne instanceof Error?ne.message:String(ne))}))}return window.addEventListener("focus",Y),()=>{window.removeEventListener("focus",Y)}},[i,g==null?void 0:g.lastCheckedAt]),v.useEffect(()=>i.subscribe({type:"keybindings"},Y=>{k(Y),J(null)}),[i]),v.useEffect(()=>i.subscribe({type:"theme-settings"},Y=>{E(Y),_n.setState({themePreference:Y.settings.themePreference,themeId:Y.settings.themeId,customAppearance:Y.settings.customAppearance,backgroundImage:Y.settings.backgroundImage,backgroundOpacity:Y.settings.backgroundOpacity,backgroundBlur:Y.settings.backgroundBlur,showProjectIconsInSidebar:Y.settings.showProjectIconsInSidebar,availableThemes:Y.availableThemes,themeCssText:Y.themeCssText})}),[i]),v.useEffect(()=>i.subscribe({type:"provider-settings"},Y=>{L(Y),J(null)}),[i]),v.useEffect(()=>{if(!t){Ad("clearing chat snapshot for non-chat route"),y(null),$(!0);return}return Ad("subscribing to chat",{activeChatId:t}),y(null),$(!1),i.subscribe({type:"chat",chatId:t},Y=>{Ad("chat snapshot received",{activeChatId:t,snapshotChatId:(Y==null?void 0:Y.runtime.chatId)??null,snapshotProvider:(Y==null?void 0:Y.runtime.provider)??null,snapshotStatus:(Y==null?void 0:Y.runtime.status)??null}),y(Y),$(!0),J(null)})},[t,i]),v.useEffect(()=>{if(!n){S(null);return}return S(null),i.subscribe({type:"feature-overview",featureId:n},Y=>{S(Y),J(null)})},[n,i]),v.useEffect(()=>{t&&it(Y=>{if(!Y.has(t))return Y;const ne=new Set(Y);return ne.delete(t),ne})},[t]),v.useEffect(()=>{if(!t)return;const Y=JR(l.projectGroups,t);Y&&ft(Y,!1)},[t,ft,l.projectGroups]),v.useEffect(()=>{n&&w&&q(w.projectId)},[n,w]),v.useEffect(()=>{if(V)return;const Y=l.projectGroups[0];Y&&q(Y.groupKey)},[V,l.projectGroups]),v.useEffect(()=>{if(!t||!H||!F)return;if(l.projectGroups.some(ne=>lh(ne).some(Se=>Se.chatId===t))){ue===t&&fe(null);return}ue!==t&&r("/")},[t,F,r,ue,l.projectGroups,H]),v.useEffect(()=>{_&&(q(_.runtime.projectId),ue===_.runtime.chatId&&fe(null))},[_,ue]),v.useEffect(()=>{de.current=!1,se.current!==null&&(window.cancelAnimationFrame(se.current),se.current=null),A(!0)},[t]),v.useEffect(()=>()=>{se.current!==null&&window.cancelAnimationFrame(se.current)},[]),v.useLayoutEffect(()=>{const Y=De.current;if(!Y)return;const ne=new ResizeObserver(()=>{B(Y.getBoundingClientRect().height)});return ne.observe(Y),B(Y.getBoundingClientRect().height),()=>ne.disconnect()},[]);const Ee=v.useMemo(()=>gZ(_,t),[t,_]);v.useEffect(()=>{Ad("active snapshot resolved",{routeChatId:t,rawSnapshotChatId:(_==null?void 0:_.runtime.chatId)??null,rawSnapshotProvider:(_==null?void 0:_.runtime.provider)??null,activeSnapshotChatId:(Ee==null?void 0:Ee.runtime.chatId)??null,activeSnapshotProvider:(Ee==null?void 0:Ee.runtime.provider)??null,pendingChatId:ue})},[t,Ee,_,ue]);const qe=v.useMemo(()=>{const Y=Ee;if(!Y)return[];const ne=Y.messages,Se=Y.runtime.chatId,$e=ne.at(-1),It=`${ne.length}:${($e==null?void 0:$e._id)??""}:${($e==null?void 0:$e.createdAt)??0}`,Cn=ye.current.get(Se);if((Cn==null?void 0:Cn.signature)===It)return Cn.messages;const xr=ZX(ne);return ye.current.set(Se,{signature:It,messages:xr}),xr},[Ee]),lt=v.useMemo(()=>nZ(qe),[qe]),Je=(Ee==null?void 0:Ee.runtime)??null,Ae=(Ee==null?void 0:Ee.usage)??null,He=(Ee==null?void 0:Ee.availableProviders)??$0((N==null?void 0:N.settings)??sr),mt=Kb(Je==null?void 0:Je.status),Ve=rZ(Je==null?void 0:Je.status),fn=hZ(M),rn=!X&&qe.length>0,et=((gu=h==null?void 0:h.projects[0])==null?void 0:gu.localPath)??null,en=(w==null?void 0:w.localPath)??(Je==null?void 0:Je.localPath)??et??((Aa=l.projectGroups[0])==null?void 0:Aa.localPath),Un=(w==null?void 0:w.projectId)??(Je==null?void 0:Je.projectId)??null,Qt=!!(V??Un??((Wh=l.projectGroups[0])==null?void 0:Wh.groupKey)??et);v.useLayoutEffect(()=>{if(de.current)return;const Y=Fe.current;Y&&(t&&!Je||(Y.scrollTo({top:Y.scrollHeight,behavior:"auto"}),se.current!==null&&window.cancelAnimationFrame(se.current),se.current=window.requestAnimationFrame(()=>{const ne=Fe.current;ne&&(ne.scrollTo({top:ne.scrollHeight,behavior:"auto"}),se.current=null)}),de.current=!0))},[t,M,qe.length,Je]),v.useEffect(()=>{if(!de.current||!X)return;const Y=window.requestAnimationFrame(()=>{const ne=Fe.current;!ne||!X||ne.scrollTo({top:ne.scrollHeight,behavior:"auto"})});return()=>window.cancelAnimationFrame(Y)},[t,M,X,qe.length,Je==null?void 0:Je.status]);function qt(){const Y=Fe.current;if(!Y)return;const ne=Y.scrollHeight-Y.scrollTop-Y.clientHeight;A(x4(ne))}function Ie(Y){const ne=Fe.current;A(!0),ne&&ne.scrollTo({top:ne.scrollHeight,behavior:Y})}function gt(){Ie("smooth")}async function wt(Y,ne){Ii.getState().initializeComposerForNewChat();const Se=await i.command({type:"chat.create",projectId:Y,featureId:ne});q(Y),fe(Se.chatId),r(`/chat/${Se.chatId}`),U(!1),J(null)}async function Rt(Y,ne=yi.getState().commitProjectMetadataDirectory){await i.command({type:"project.setProjectMetadataDirectoryCommitMode",projectId:Y.projectId,localPath:Y.localPath,commitProjectMetadata:ne})}async function Jt(Y){return Y.kind==="project_id"?{projectId:Y.projectId}:Y.kind==="local_path"?{projectId:(await i.command({type:"project.open",localPath:Y.localPath})).projectId,localPath:Y.localPath}:{projectId:(await i.command(Y.project.mode==="new"?{type:"project.create",localPath:Y.project.localPath,title:Y.project.title}:{type:"project.open",localPath:Y.project.localPath})).projectId,localPath:Y.project.localPath}}async function vt(Y){try{const ne=Y.kind==="project_id"?null:Y.kind==="local_path"?Y.localPath:Y.project.localPath;ne&&re(ne);const{projectId:Se}=await Jt(Y);await Rt({projectId:Se}),await wt(Se)}catch(ne){J(ne instanceof Error?ne.message:String(ne))}finally{re(null)}}async function _t(Y){const ne=Y.split("/").filter(Boolean).pop()??Y;if(await o.confirm({title:"Hide Project",description:`Hide "${ne}" from ${Dn}? This only removes it from ${Dn} until you re-add it or reset local state.`,confirmLabel:"Hide",confirmVariant:"destructive"}))try{await i.command({type:"project.hide",localPath:Y}),J(null)}catch($e){J($e instanceof Error?$e.message:String($e))}}async function Sn(Y,ne){try{await wt(Y,ne)}catch(Se){J(Se instanceof Error?Se.message:String(Se))}}function ke(Y){Ce(Y)}function Oe(Y){r(`/overview/${Y}`),U(!1),J(null)}function Tt(){Ce(null)}async function ct(Y){const ne=ge;if(ne)try{const Se=await i.command({type:"feature.create",projectId:ne,title:Y.title,description:Y.description,generateOverview:yi.getState().showFeatureOverviewInSidebar});Ce(null),await wt(ne,Se.featureId)}catch(Se){J(Se instanceof Error?Se.message:String(Se))}}async function mn(Y){const ne=l.projectGroups.flatMap($e=>$e.features).find($e=>$e.featureId===Y);if(!ne)return;const Se=await o.prompt({title:"Rename Feature",placeholder:"Feature name",initialValue:ne.title,confirmLabel:"Rename"});if(!(!Se||Se===ne.title))try{await i.command({type:"feature.rename",featureId:Y,title:Se}),J(null)}catch($e){J($e instanceof Error?$e.message:String($e))}}async function bn(Y){const ne=l.projectGroups.flatMap($e=>$e.features).find($e=>$e.featureId===Y);if(!(!ne||!await o.confirm({title:"Delete Feature",description:`Delete "${ne.title}"? Its chats will move to General and the feature folder will be removed.`,confirmLabel:"Delete",confirmVariant:"destructive"})))try{await i.command({type:"feature.delete",featureId:Y}),n===Y&&r("/"),J(null)}catch($e){J($e instanceof Error?$e.message:String($e))}}async function sn(Y,ne){try{await i.command({type:"feature.setBrowserState",featureId:Y,browserState:ne}),J(null)}catch(Se){J(Se instanceof Error?Se.message:String(Se))}}async function Kt(Y,ne){try{await i.command({type:"project.setBrowserState",projectId:Y,browserState:ne}),J(null)}catch(Se){J(Se instanceof Error?Se.message:String(Se))}}async function Gt(Y,ne){try{await i.command({type:"project.setGeneralChatsBrowserState",projectId:Y,browserState:ne}),J(null)}catch(Se){J(Se instanceof Error?Se.message:String(Se))}}async function Mr(Y,ne){try{await i.command({type:"feature.setStage",featureId:Y,stage:ne}),J(null)}catch(Se){J(Se instanceof Error?Se.message:String(Se))}}async function fs(Y,ne){try{const Se=await i.command({type:"feature.updateOverview",featureId:Y,content:ne});return J(null),Se}catch(Se){const $e=Se instanceof Error?Se.message:String(Se);throw J($e),Se}}async function Dl(Y){try{await i.command({type:"provider.refreshUsage",provider:Y}),J(null)}catch(ne){J(ne instanceof Error?ne.message:String(ne))}}async function K(Y){if(Y==="cursor")try{const ne=await i.command({type:"provider.browserLogin",provider:Y});if(ne.availability==="login_required"){ne.statusDetail==="browser_launch_failed"&&je(!0),J(ne.statusDetail==="browser_launch_failed"?"Could not launch a Chromium browser for Cursor sign-in. Paste a copied cURL command instead.":"Cursor sign-in did not complete. Try again and finish login in the opened browser.");return}J(null)}catch(ne){J(ne instanceof Error?ne.message:String(ne))}}async function st(Y){try{const ne=await i.command({type:"provider.importUsageCurl",provider:"cursor",curlCommand:Y});if(ne.availability==="login_required"&&ne.statusDetail==="invalid_curl_import"){J("Could not import that cURL command. Copy the get-current-period-usage request as cURL and paste it here.");return}je(!1),J(null)}catch(ne){J(ne instanceof Error?ne.message:String(ne))}}async function Vn(Y,ne){try{await i.command({type:"chat.setFeature",chatId:Y,featureId:ne}),J(null)}catch(Se){J(Se instanceof Error?Se.message:String(Se))}}async function ms(Y,ne){try{await i.command({type:"feature.reorder",projectId:Y,orderedFeatureIds:ne}),J(null)}catch(Se){J(Se instanceof Error?Se.message:String(Se))}}async function Ei(Y){await vt({kind:"local_path",localPath:Y})}async function Ft(Y){await vt({kind:"project_request",project:Y})}async function In(Y){try{await Promise.all(_Z((h==null?void 0:h.projects.map(ne=>({localPath:ne.localPath})))??l.projectGroups.map(ne=>({projectId:ne.groupKey,localPath:ne.localPath}))).map(ne=>Rt(ne,Y))),J(null)}catch(ne){throw J(ne instanceof Error?ne.message:String(ne)),ne}}async function ps(Y){const ne=new URL("/api/directories",window.location.origin);Y&&ne.searchParams.set("path",Y);const Se=await fetch(ne.toString());if(!Se.ok){let It="Failed to load directories";try{const Cn=await Se.json();Cn.error&&(It=Cn.error)}catch{}throw new Error(It)}const $e=await Se.json();return J(null),$e}async function Wn(Y){try{await i.command({type:"update.check",force:Y==null?void 0:Y.force}),J(null)}catch(ne){J(ne instanceof Error?ne.message:String(ne))}}async function Fh(){try{const Y=await i.command({type:"update.install"});if(!Y.ok){Mm(),J(null),await o.alert({title:Y.userTitle??"Update failed",description:Y.userMessage??`${Dn} could not install the update. Try again later.`,closeLabel:"OK"});return}if(Y.ok&&Y.action==="reload"){window.location.reload();return}Y.ok&&Y.action==="restart"&&eT("awaiting_disconnect"),J(null)}catch(Y){Mm(),J(Y instanceof Error?Y.message:String(Y))}}async function Hh(Y,ne){var Se;try{let $e=V??((Se=l.projectGroups[0])==null?void 0:Se.groupKey)??null;if(!t&&!$e&&et&&($e=(await i.command({type:"project.open",localPath:et})).projectId,q($e)),!t&&!$e)throw new Error("Open a project first");if(ne!=null&&ne.provider&&!nE(ne.provider,(N==null?void 0:N.settings)??sr))throw new Error(`${ne.provider} is inactive.`);if(Ie("auto"),ne!=null&&ne.provider&&!nE(ne.provider,(N==null?void 0:N.settings)??sr))throw new Error(`${ne.provider} is inactive.`);Ie("auto");const It=await i.command({type:"chat.send",chatId:t??void 0,projectId:t?void 0:$e??void 0,provider:ne==null?void 0:ne.provider,message:Y,model:ne==null?void 0:ne.model,modelOptions:ne==null?void 0:ne.modelOptions,planMode:ne==null?void 0:ne.planMode});!t&&It.chatId&&(fe(It.chatId),r(`/chat/${It.chatId}`)),J(null)}catch($e){throw J($e instanceof Error?$e.message:String($e)),$e}}async function $s(){if(t)try{await i.command({type:"chat.cancel",chatId:t})}catch(Y){J(Y instanceof Error?Y.message:String(Y))}}async function jo(Y){if(await o.confirm({title:"Delete Chat",description:`Delete "${Y.title}"? This cannot be undone.`,confirmLabel:"Delete",confirmVariant:"destructive"}))try{if(await i.command({type:"chat.delete",chatId:Y.chatId}),Y.chatId===t){const Se=lZ(l.projectGroups,Y.chatId);r(Se?`/chat/${Se}`:"/")}}catch(Se){J(Se instanceof Error?Se.message:String(Se))}}async function Fg(Y){const ne=l.projectGroups.find(It=>It.groupKey===Y);if(!ne)return;const Se=ne.localPath.split("/").filter(Boolean).pop()??ne.localPath;if(await o.confirm({title:"Hide Project",description:`Hide "${Se}" from ${Dn}? Existing chats for this project will be removed from ${Dn}, but the project itself is not deleted.`,confirmLabel:"Hide",confirmVariant:"destructive"}))try{await i.command({type:"project.remove",projectId:Y}),ua.getState().clearProject(Y),Ud.getState().clearProject(Y),((Je==null?void 0:Je.projectId)??(w==null?void 0:w.projectId))===Y&&r("/"),J(null)}catch(It){J(It instanceof Error?It.message:String(It))}}async function $h(Y){var Se,$e;const ne=(Je==null?void 0:Je.localPath)??((Se=h==null?void 0:h.projects[0])==null?void 0:Se.localPath)??(($e=l.projectGroups[0])==null?void 0:$e.localPath);if(ne)try{await yr({action:Y,localPath:ne})}catch(It){J(It instanceof Error?It.message:String(It))}}async function Uh(Y){try{await yr({action:"open_editor",localPath:Y.path,line:Y.line,column:Y.column})}catch(ne){J(ne instanceof Error?ne.message:String(ne))}}async function Hg(Y,ne){try{await yr({action:Y,localPath:ne})}catch(Se){J(Se instanceof Error?Se.message:String(Se))}}async function Ol(){var Y;try{J(null);const ne=await i.command({type:"settings.bootstrapCustomThemes"}),Se=(R==null?void 0:R.themesReadmeFileDisplay)??((Y=ne==null?void 0:ne.localPath)==null?void 0:Y.replace(/[/\\][^/\\]+$/,`${Ll(ne==null?void 0:ne.localPath)??"/"}THEME_README.md`))??WF();await yr({action:"open_editor",localPath:Se})}catch(ne){J(ne instanceof Error?ne.message:String(ne))}}function Ll(Y){return Y?Y.includes("\\")?"\\":"/":null}async function Qi(){try{J(null);const Y=await i.command({type:"settings.reloadThemeSettings"});Y&&(E(Y),_n.setState({themePreference:Y.settings.themePreference,themeId:Y.settings.themeId,customAppearance:Y.settings.customAppearance,backgroundImage:Y.settings.backgroundImage,backgroundOpacity:Y.settings.backgroundOpacity,backgroundBlur:Y.settings.backgroundBlur,showProjectIconsInSidebar:Y.settings.showProjectIconsInSidebar,availableThemes:Y.availableThemes,themeCssText:Y.themeCssText}))}catch(Y){J(Y instanceof Error?Y.message:String(Y))}}async function yr(Y){const ne=Bi.getState();J(null),await i.command({type:"system.openExternal",...Y,editor:Y.action==="open_editor"?{preset:ne.editorPreset,commandTemplate:ne.editorCommandTemplate}:void 0})}function Vh(){var $e;const Y=t?cZ(l.projectGroups,t):null,ne=t?JR(l.projectGroups,t):null;if(Y&&ne){J(null),Sn(ne,Y.featureId??void 0);return}const Se=pZ({selectedProjectId:V,sidebarProjectId:($e=l.projectGroups[0])==null?void 0:$e.groupKey,fallbackLocalProjectPath:et});if(Se){J(null),vt(Se);return}J("Open a project first")}async function $g(Y,ne,Se){if(t)try{await i.command({type:"chat.respondTool",chatId:t,toolUseId:Y,result:{questions:ne,answers:Se}})}catch($e){J($e instanceof Error?$e.message:String($e))}}async function pu(Y,ne,Se,$e,It){if(t){ne&&Ii.getState().setComposerPlanMode(!1);try{await i.command({type:"chat.respondTool",chatId:t,toolUseId:Y,result:{confirmed:ne,...Se?{clearContext:!0}:{},...$e?{message:$e}:{},...It?{attachments:It}:{}}})}catch(Cn){J(Cn instanceof Error?Cn.message:String(Cn))}}}return{socket:i,activeChatId:t,activeOverviewFeatureId:n,sidebarData:l,completedChatIds:at,localProjects:h,updateSnapshot:g,chatSnapshot:_,featureOverviewSnapshot:w,keybindings:C,themeSettings:R,providerSettings:N,connectionStatus:j,sidebarReady:H,localProjectsReady:I,commandError:ie,startingLocalPath:ee,folderGroupsEnabled:Xe,showFeatureOverviewInSidebar:xt,kanbanStatusesEnabled:Et,sidebarOpen:D,sidebarCollapsed:z,scrollRef:Fe,inputRef:De,messages:qe,latestToolIds:lt,runtime:Je,usage:Ae,availableProviders:He,isProcessing:mt,canCancel:Ve,transcriptPaddingBottom:fn,showScrollButton:rn,navbarLocalPath:en,editorLabel:me,hasSelectedProject:Qt,createFeatureModalProjectId:ge,cursorCurlImportOpen:Te,openSidebar:()=>U(!0),closeSidebar:()=>U(!1),collapseSidebar:()=>G(!0),expandSidebar:()=>G(!1),toggleProjectsSidebar:Y=>{if(Y){U(!1),G(ne=>!ne);return}U(ne=>!ne)},updateScrollState:qt,scrollToBottom:gt,handleCreateChat:Sn,handleCreateFeature:ke,handleOpenFeatureOverview:Oe,handleCloseCreateFeatureModal:Tt,handleConfirmCreateFeature:ct,handleRenameFeature:mn,handleDeleteFeature:bn,handleSetProjectBrowserState:Kt,handleSetProjectGeneralChatsBrowserState:Gt,handleSetFeatureBrowserState:sn,handleSetFeatureStage:Mr,handleSetChatFeature:Vn,handleReorderFeatures:ms,handleOpenLocalProject:Ei,handleHideLocalProject:_t,handleListDirectories:ps,handleCreateProject:Ft,handleCheckForUpdates:Wn,handleInstallUpdate:Fh,handleRefreshProviderUsage:Dl,handleOpenProviderLogin:K,handleCloseCursorCurlImport:()=>je(!1),handleSubmitCursorCurlImport:st,handleSetCommitProjectMetadataDirectory:In,handleSend:Hh,handleCancel:$s,handleDeleteChat:jo,handleRemoveProject:Fg,handleUpdateFeatureOverview:fs,handleOpenExternal:$h,handleOpenExternalPath:Hg,handleOpenCustomThemes:Ol,handleRefreshThemeSettings:Qi,handleOpenLocalLink:Uh,handleCompose:Vh,handleAskUserQuestion:$g,handleExitPlanMode:pu}}function lh(e){return[...e.features.flatMap(t=>t.chats),...e.generalChats]}function _Z(e){const t=new Set;return e.filter(n=>{const r=n.localPath??n.projectId;return!r||t.has(r)?!1:(t.add(r),!0)})}function bZ(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const yZ=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xZ=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wZ={};function tT(e,t){return(wZ.jsx?xZ:yZ).test(e)}const SZ=/[ \t\n\f\r]/g;function CZ(e){return typeof e=="object"?e.type==="text"?nT(e.value):!1:nT(e)}function nT(e){return e.replace(SZ,"")===""}class Ph{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ph.prototype.normal={};Ph.prototype.property={};Ph.prototype.space=void 0;function S4(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ph(n,r,t)}function Kx(e){return e.toLowerCase()}class li{constructor(t,n){this.attribute=n,this.property=t}}li.prototype.attribute="";li.prototype.booleanish=!1;li.prototype.boolean=!1;li.prototype.commaOrSpaceSeparated=!1;li.prototype.commaSeparated=!1;li.prototype.defined=!1;li.prototype.mustUseProperty=!1;li.prototype.number=!1;li.prototype.overloadedBoolean=!1;li.prototype.property="";li.prototype.spaceSeparated=!1;li.prototype.space=void 0;let kZ=0;const yt=jl(),Xn=jl(),Gx=jl(),Re=jl(),vn=jl(),Pc=jl(),bi=jl();function jl(){return 2**++kZ}const Yx=Object.freeze(Object.defineProperty({__proto__:null,boolean:yt,booleanish:Xn,commaOrSpaceSeparated:bi,commaSeparated:Pc,number:Re,overloadedBoolean:Gx,spaceSeparated:vn},Symbol.toStringTag,{value:"Module"})),Yb=Object.keys(Yx);class Fw extends li{constructor(t,n,r,i){let o=-1;if(super(t,n),rT(this,"space",i),typeof r=="number")for(;++o<Yb.length;){const l=Yb[o];rT(this,Yb[o],(r&Yx[l])===Yx[l])}}}Fw.prototype.defined=!0;function rT(e,t,n){n&&(e[t]=n)}function du(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new Fw(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Kx(r)]=r,n[Kx(o.attribute)]=r}return new Ph(t,n,e.space)}const C4=du({properties:{ariaActiveDescendant:null,ariaAtomic:Xn,ariaAutoComplete:null,ariaBusy:Xn,ariaChecked:Xn,ariaColCount:Re,ariaColIndex:Re,ariaColSpan:Re,ariaControls:vn,ariaCurrent:null,ariaDescribedBy:vn,ariaDetails:null,ariaDisabled:Xn,ariaDropEffect:vn,ariaErrorMessage:null,ariaExpanded:Xn,ariaFlowTo:vn,ariaGrabbed:Xn,ariaHasPopup:null,ariaHidden:Xn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:vn,ariaLevel:Re,ariaLive:null,ariaModal:Xn,ariaMultiLine:Xn,ariaMultiSelectable:Xn,ariaOrientation:null,ariaOwns:vn,ariaPlaceholder:null,ariaPosInSet:Re,ariaPressed:Xn,ariaReadOnly:Xn,ariaRelevant:null,ariaRequired:Xn,ariaRoleDescription:vn,ariaRowCount:Re,ariaRowIndex:Re,ariaRowSpan:Re,ariaSelected:Xn,ariaSetSize:Re,ariaSort:null,ariaValueMax:Re,ariaValueMin:Re,ariaValueNow:Re,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function k4(e,t){return t in e?e[t]:t}function E4(e,t){return k4(e,t.toLowerCase())}const EZ=du({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Pc,acceptCharset:vn,accessKey:vn,action:null,allow:null,allowFullScreen:yt,allowPaymentRequest:yt,allowUserMedia:yt,alt:null,as:null,async:yt,autoCapitalize:null,autoComplete:vn,autoFocus:yt,autoPlay:yt,blocking:vn,capture:null,charSet:null,checked:yt,cite:null,className:vn,cols:Re,colSpan:null,content:null,contentEditable:Xn,controls:yt,controlsList:vn,coords:Re|Pc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:yt,defer:yt,dir:null,dirName:null,disabled:yt,download:Gx,draggable:Xn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:yt,formTarget:null,headers:vn,height:Re,hidden:Gx,high:Re,href:null,hrefLang:null,htmlFor:vn,httpEquiv:vn,id:null,imageSizes:null,imageSrcSet:null,inert:yt,inputMode:null,integrity:null,is:null,isMap:yt,itemId:null,itemProp:vn,itemRef:vn,itemScope:yt,itemType:vn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:yt,low:Re,manifest:null,max:null,maxLength:Re,media:null,method:null,min:null,minLength:Re,multiple:yt,muted:yt,name:null,nonce:null,noModule:yt,noValidate:yt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:yt,optimum:Re,pattern:null,ping:vn,placeholder:null,playsInline:yt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:yt,referrerPolicy:null,rel:vn,required:yt,reversed:yt,rows:Re,rowSpan:Re,sandbox:vn,scope:null,scoped:yt,seamless:yt,selected:yt,shadowRootClonable:yt,shadowRootDelegatesFocus:yt,shadowRootMode:null,shape:null,size:Re,sizes:null,slot:null,span:Re,spellCheck:Xn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Re,step:null,style:null,tabIndex:Re,target:null,title:null,translate:null,type:null,typeMustMatch:yt,useMap:null,value:Xn,width:Re,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:vn,axis:null,background:null,bgColor:null,border:Re,borderColor:null,bottomMargin:Re,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:yt,declare:yt,event:null,face:null,frame:null,frameBorder:null,hSpace:Re,leftMargin:Re,link:null,longDesc:null,lowSrc:null,marginHeight:Re,marginWidth:Re,noResize:yt,noHref:yt,noShade:yt,noWrap:yt,object:null,profile:null,prompt:null,rev:null,rightMargin:Re,rules:null,scheme:null,scrolling:Xn,standby:null,summary:null,text:null,topMargin:Re,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Re,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:yt,disableRemotePlayback:yt,prefix:null,property:null,results:Re,security:null,unselectable:null},space:"html",transform:E4}),RZ=du({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:bi,accentHeight:Re,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Re,amplitude:Re,arabicForm:null,ascent:Re,attributeName:null,attributeType:null,azimuth:Re,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Re,by:null,calcMode:null,capHeight:Re,className:vn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Re,diffuseConstant:Re,direction:null,display:null,dur:null,divisor:Re,dominantBaseline:null,download:yt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Re,enableBackground:null,end:null,event:null,exponent:Re,externalResourcesRequired:null,fill:null,fillOpacity:Re,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Pc,g2:Pc,glyphName:Pc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Re,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Re,horizOriginX:Re,horizOriginY:Re,id:null,ideographic:Re,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Re,k:Re,k1:Re,k2:Re,k3:Re,k4:Re,kernelMatrix:bi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Re,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Re,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Re,overlineThickness:Re,paintOrder:null,panose1:null,path:null,pathLength:Re,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:vn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Re,pointsAtY:Re,pointsAtZ:Re,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:bi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:bi,rev:bi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:bi,requiredFeatures:bi,requiredFonts:bi,requiredFormats:bi,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Re,specularExponent:Re,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Re,strikethroughThickness:Re,string:null,stroke:null,strokeDashArray:bi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Re,strokeOpacity:Re,strokeWidth:null,style:null,surfaceScale:Re,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:bi,tabIndex:Re,tableValues:null,target:null,targetX:Re,targetY:Re,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:bi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Re,underlineThickness:Re,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Re,values:null,vAlphabetic:Re,vMathematical:Re,vectorEffect:null,vHanging:Re,vIdeographic:Re,version:null,vertAdvY:Re,vertOriginX:Re,vertOriginY:Re,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Re,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:k4}),R4=du({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),T4=du({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:E4}),N4=du({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),TZ={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},NZ=/[A-Z]/g,iT=/-[a-z]/g,MZ=/^data[-\w.:]+$/i;function AZ(e,t){const n=Kx(t);let r=t,i=li;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&MZ.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(iT,DZ);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!iT.test(o)){let l=o.replace(NZ,jZ);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=Fw}return new i(r,t)}function jZ(e){return"-"+e.toLowerCase()}function DZ(e){return e.charAt(1).toUpperCase()}const OZ=S4([C4,EZ,R4,T4,N4],"html"),Hw=S4([C4,RZ,R4,T4,N4],"svg");function LZ(e){return e.join(" ").trim()}var yc={},Xb,sT;function zZ(){if(sT)return Xb;sT=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,h=`
618
+ `,d="/",g="*",p="",_="comment",y="declaration";function w(C,k){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];k=k||{};var R=1,E=1;function N(V){var q=V.match(t);q&&(R+=q.length);var D=V.lastIndexOf(h);E=~D?V.length-D:E+V.length}function L(){var V={line:R,column:E};return function(q){return q.position=new j(V),Z(),q}}function j(V){this.start=V,this.end={line:R,column:E},this.source=k.source}j.prototype.content=C;function O(V){var q=new Error(k.source+":"+R+":"+E+": "+V);if(q.reason=V,q.filename=k.source,q.line=R,q.column=E,q.source=C,!k.silent)throw q}function H(V){var q=V.exec(C);if(q){var D=q[0];return N(D),C=C.slice(D.length),q}}function Z(){H(n)}function I(V){var q;for(V=V||[];q=W();)q!==!1&&V.push(q);return V}function W(){var V=L();if(!(d!=C.charAt(0)||g!=C.charAt(1))){for(var q=2;p!=C.charAt(q)&&(g!=C.charAt(q)||d!=C.charAt(q+1));)++q;if(q+=2,p===C.charAt(q-1))return O("End of comment missing");var D=C.slice(2,q-2);return E+=2,N(D),C=C.slice(q),E+=2,V({type:_,comment:D})}}function F(){var V=L(),q=H(r);if(q){if(W(),!H(i))return O("property missing ':'");var D=H(o),U=V({type:y,property:S(q[0].replace(e,p)),value:D?S(D[0].replace(e,p)):p});return H(l),U}}function $(){var V=[];I(V);for(var q;q=F();)q!==!1&&(V.push(q),I(V));return V}return Z(),$()}function S(C){return C?C.replace(c,p):p}return Xb=w,Xb}var oT;function PZ(){if(oT)return yc;oT=1;var e=yc&&yc.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(yc,"__esModule",{value:!0}),yc.default=n;const t=e(zZ());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const l=(0,t.default)(r),c=typeof i=="function";return l.forEach(h=>{if(h.type!=="declaration")return;const{property:d,value:g}=h;c?i(d,g,h):g&&(o=o||{},o[d]=g)}),o}return yc}var gd={},aT;function IZ(){if(aT)return gd;aT=1,Object.defineProperty(gd,"__esModule",{value:!0}),gd.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(d){return!d||n.test(d)||e.test(d)},l=function(d,g){return g.toUpperCase()},c=function(d,g){return"".concat(g,"-")},h=function(d,g){return g===void 0&&(g={}),o(d)?d:(d=d.toLowerCase(),g.reactCompat?d=d.replace(i,c):d=d.replace(r,c),d.replace(t,l))};return gd.camelCase=h,gd}var vd,lT;function BZ(){if(lT)return vd;lT=1;var e=vd&&vd.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(PZ()),n=IZ();function r(i,o){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(c,h){c&&h&&(l[(0,n.camelCase)(c,o)]=h)}),l}return r.default=r,vd=r,vd}var FZ=BZ();const HZ=qp(FZ),M4=A4("end"),$w=A4("start");function A4(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function $Z(e){const t=$w(e),n=M4(e);if(t&&n)return{start:t,end:n}}function Vd(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?cT(e.position):"start"in e||"end"in e?cT(e):"line"in e||"column"in e?Xx(e):""}function Xx(e){return uT(e&&e.line)+":"+uT(e&&e.column)}function cT(e){return Xx(e&&e.start)+"-"+Xx(e&&e.end)}function uT(e){return e&&typeof e=="number"?e:1}class Ir extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},l=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(l=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const h=r.indexOf(":");h===-1?o.ruleId=r:(o.source=r.slice(0,h),o.ruleId=r.slice(h+1))}if(!o.place&&o.ancestors&&o.ancestors){const h=o.ancestors[o.ancestors.length-1];h&&(o.place=h.position)}const c=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=c?c.line:void 0,this.name=Vd(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=l&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ir.prototype.file="";Ir.prototype.name="";Ir.prototype.reason="";Ir.prototype.message="";Ir.prototype.stack="";Ir.prototype.column=void 0;Ir.prototype.line=void 0;Ir.prototype.ancestors=void 0;Ir.prototype.cause=void 0;Ir.prototype.fatal=void 0;Ir.prototype.place=void 0;Ir.prototype.ruleId=void 0;Ir.prototype.source=void 0;const Uw={}.hasOwnProperty,UZ=new Map,VZ=/[A-Z]/g,WZ=new Set(["table","tbody","thead","tfoot","tr"]),qZ=new Set(["td","th"]),j4="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function KZ(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=tQ(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=eQ(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Hw:OZ,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=D4(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function D4(e,t,n){if(t.type==="element")return GZ(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return YZ(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return ZZ(e,t,n);if(t.type==="mdxjsEsm")return XZ(e,t);if(t.type==="root")return QZ(e,t,n);if(t.type==="text")return JZ(e,t)}function GZ(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Hw,e.schema=i),e.ancestors.push(t);const o=L4(e,t.tagName,!1),l=nQ(e,t);let c=Ww(e,t);return WZ.has(t.tagName)&&(c=c.filter(function(h){return typeof h=="string"?!CZ(h):!0})),O4(e,l,o,t),Vw(l,c),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function YZ(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ch(e,t.position)}function XZ(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ch(e,t.position)}function ZZ(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Hw,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:L4(e,t.name,!0),l=rQ(e,t),c=Ww(e,t);return O4(e,l,o,t),Vw(l,c),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function QZ(e,t,n){const r={};return Vw(r,Ww(e,t)),e.create(t,e.Fragment,r,n)}function JZ(e,t){return t.value}function O4(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Vw(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function eQ(e,t,n){return r;function r(i,o,l,c){const d=Array.isArray(l.children)?n:t;return c?d(o,l,c):d(o,l)}}function tQ(e,t){return n;function n(r,i,o,l){const c=Array.isArray(o.children),h=$w(r);return t(i,o,l,c,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function nQ(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Uw.call(t.properties,i)){const o=iQ(e,i,t.properties[i]);if(o){const[l,c]=o;e.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&qZ.has(t.tagName)?r=c:n[l]=c}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function rQ(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const l=o.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else ch(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const c=r.value.data.estree.body[0];c.type,o=e.evaluater.evaluateExpression(c.expression)}else ch(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function Ww(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:UZ;for(;++r<t.children.length;){const o=t.children[r];let l;if(e.passKeys){const h=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(h){const d=i.get(h)||0;l=h+"-"+d,i.set(h,d+1)}}const c=D4(e,o,l);c!==void 0&&n.push(c)}return n}function iQ(e,t,n){const r=AZ(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?bZ(n):LZ(n)),r.property==="style"){let i=typeof n=="object"?n:sQ(e,String(n));return e.stylePropertyNameCase==="css"&&(i=oQ(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?TZ[r.property]||r.property:r.attribute,n]}}function sQ(e,t){try{return HZ(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Ir("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=j4+"#cannot-parse-style-attribute",i}}function L4(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,l;for(;++o<i.length;){const c=tT(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};l=l?{type:"MemberExpression",object:l,property:c,computed:!!(o&&c.type==="Literal"),optional:!1}:c}r=l}else r=tT(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Uw.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ch(e)}function ch(e,t){const n=new Ir("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=j4+"#cannot-handle-mdx-estrees-without-createevaluater",n}function oQ(e){const t={};let n;for(n in e)Uw.call(e,n)&&(t[aQ(n)]=e[n]);return t}function aQ(e){let t=e.replace(VZ,lQ);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function lQ(e){return"-"+e.toLowerCase()}const Zb={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},cQ={};function qw(e,t){const n=cQ,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return z4(e,r,i)}function z4(e,t,n){if(uQ(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return dT(e.children,t,n)}return Array.isArray(e)?dT(e,t,n):""}function dT(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=z4(e[i],t,n);return r.join("")}function uQ(e){return!!(e&&typeof e=="object")}const hT=document.createElement("i");function Kw(e){const t="&"+e+";";hT.innerHTML=t;const n=hT.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Si(e,t,n,r){const i=e.length;let o=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);o<r.length;)l=r.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function Ui(e,t){return e.length>0?(Si(e,e.length,0,t),e):t}const fT={}.hasOwnProperty;function P4(e){const t={};let n=-1;for(;++n<e.length;)dQ(t,e[n]);return t}function dQ(e,t){let n;for(n in t){const i=(fT.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let l;if(o)for(l in o){fT.call(i,l)||(i[l]=[]);const c=o[l];hQ(i[l],Array.isArray(c)?c:c?[c]:[])}}}function hQ(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Si(e,0,0,r)}function I4(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function as(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ur=Ma(/[A-Za-z]/),zr=Ma(/[\dA-Za-z]/),fQ=Ma(/[#-'*+\--9=?A-Z^-~]/);function zp(e){return e!==null&&(e<32||e===127)}const Zx=Ma(/\d/),mQ=Ma(/[\dA-Fa-f]/),pQ=Ma(/[!-/:-@[-`{-~]/);function nt(e){return e!==null&&e<-2}function gn(e){return e!==null&&(e<0||e===32)}function Dt(e){return e===-2||e===-1||e===32}const Lg=Ma(new RegExp("\\p{P}|\\p{S}","u")),Sl=Ma(/\s/);function Ma(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function hu(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let l="";if(o===37&&zr(e.charCodeAt(n+1))&&zr(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const c=e.charCodeAt(n+1);o<56320&&c>56319&&c<57344?(l=String.fromCharCode(o,c),i=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Bt(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return l;function l(h){return Dt(h)?(e.enter(n),c(h)):t(h)}function c(h){return Dt(h)&&o++<i?(e.consume(h),c):(e.exit(n),t(h))}}const gQ={tokenize:vQ};function vQ(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Bt(e,t,"linePrefix")}function i(c){return e.enter("paragraph"),o(c)}function o(c){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,l(c)}function l(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return nt(c)?(e.consume(c),e.exit("chunkText"),o):(e.consume(c),l)}}const _Q={tokenize:bQ},mT={tokenize:yQ};function bQ(e){const t=this,n=[];let r=0,i,o,l;return c;function c(E){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,h,d)(E)}return d(E)}function h(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&R();const N=t.events.length;let L=N,j;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){j=t.events[L][1].end;break}k(r);let O=N;for(;O<t.events.length;)t.events[O][1].end={...j},O++;return Si(t.events,L+1,0,t.events.slice(N)),t.events.length=O,d(E)}return c(E)}function d(E){if(r===n.length){if(!i)return _(E);if(i.currentConstruct&&i.currentConstruct.concrete)return w(E);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(mT,g,p)(E)}function g(E){return i&&R(),k(r),_(E)}function p(E){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,w(E)}function _(E){return t.containerState={},e.attempt(mT,y,w)(E)}function y(E){return r++,n.push([t.currentConstruct,t.containerState]),_(E)}function w(E){if(E===null){i&&R(),k(0),e.consume(E);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),S(E)}function S(E){if(E===null){C(e.exit("chunkFlow"),!0),k(0),e.consume(E);return}return nt(E)?(e.consume(E),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(E),S)}function C(E,N){const L=t.sliceStream(E);if(N&&L.push(null),E.previous=o,o&&(o.next=E),o=E,i.defineSkip(E.start),i.write(L),t.parser.lazy[E.start.line]){let j=i.events.length;for(;j--;)if(i.events[j][1].start.offset<l&&(!i.events[j][1].end||i.events[j][1].end.offset>l))return;const O=t.events.length;let H=O,Z,I;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){if(Z){I=t.events[H][1].end;break}Z=!0}for(k(r),j=O;j<t.events.length;)t.events[j][1].end={...I},j++;Si(t.events,H+1,0,t.events.slice(O)),t.events.length=j}}function k(E){let N=n.length;for(;N-- >E;){const L=n[N];t.containerState=L[1],L[0].exit.call(t,e)}n.length=E}function R(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function yQ(e,t,n){return Bt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Wc(e){if(e===null||gn(e)||Sl(e))return 1;if(Lg(e))return 2}function zg(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Qx={name:"attention",resolveAll:xQ,tokenize:wQ};function xQ(e,t){let n=-1,r,i,o,l,c,h,d,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},_={...e[n][1].start};pT(p,-h),pT(_,h),l={type:h>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},c={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:_},o={type:h>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:h>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},e[r][1].end={...l.start},e[n][1].start={...c.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=Ui(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Ui(d,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",o,t]]),d=Ui(d,zg(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Ui(d,[["exit",o,t],["enter",c,t],["exit",c,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,d=Ui(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,Si(e,r-1,n-r+3,d),n=r+d.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function wQ(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Wc(r);let o;return l;function l(h){return o=h,e.enter("attentionSequence"),c(h)}function c(h){if(h===o)return e.consume(h),c;const d=e.exit("attentionSequence"),g=Wc(h),p=!g||g===2&&i||n.includes(h),_=!i||i===2&&g||n.includes(r);return d._open=!!(o===42?p:p&&(i||!_)),d._close=!!(o===42?_:_&&(g||!p)),t(h)}}function pT(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const SQ={name:"autolink",tokenize:CQ};function CQ(e,t,n){let r=0;return i;function i(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return Ur(y)?(e.consume(y),l):y===64?n(y):d(y)}function l(y){return y===43||y===45||y===46||zr(y)?(r=1,c(y)):d(y)}function c(y){return y===58?(e.consume(y),r=0,h):(y===43||y===45||y===46||zr(y))&&r++<32?(e.consume(y),c):(r=0,d(y))}function h(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||zp(y)?n(y):(e.consume(y),h)}function d(y){return y===64?(e.consume(y),g):fQ(y)?(e.consume(y),d):n(y)}function g(y){return zr(y)?p(y):n(y)}function p(y){return y===46?(e.consume(y),r=0,g):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):_(y)}function _(y){if((y===45||zr(y))&&r++<63){const w=y===45?_:p;return e.consume(y),w}return n(y)}}const Ih={partial:!0,tokenize:kQ};function kQ(e,t,n){return r;function r(o){return Dt(o)?Bt(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||nt(o)?t(o):n(o)}}const B4={continuation:{tokenize:RQ},exit:TQ,name:"blockQuote",tokenize:EQ};function EQ(e,t,n){const r=this;return i;function i(l){if(l===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return n(l)}function o(l){return Dt(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function RQ(e,t,n){const r=this;return i;function i(l){return Dt(l)?Bt(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(B4,t,n)(l)}}function TQ(e){e.exit("blockQuote")}const F4={name:"characterEscape",tokenize:NQ};function NQ(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return pQ(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const H4={name:"characterReference",tokenize:MQ};function MQ(e,t,n){const r=this;let i=0,o,l;return c;function c(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),h}function h(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),o=31,l=zr,g(p))}function d(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=mQ,g):(e.enter("characterReferenceValue"),o=7,l=Zx,g(p))}function g(p){if(p===59&&i){const _=e.exit("characterReferenceValue");return l===zr&&!Kw(r.sliceSerialize(_))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(p)&&i++<o?(e.consume(p),g):n(p)}}const gT={partial:!0,tokenize:jQ},vT={concrete:!0,name:"codeFenced",tokenize:AQ};function AQ(e,t,n){const r=this,i={partial:!0,tokenize:L};let o=0,l=0,c;return h;function h(j){return d(j)}function d(j){const O=r.events[r.events.length-1];return o=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,c=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(j)}function g(j){return j===c?(l++,e.consume(j),g):l<3?n(j):(e.exit("codeFencedFenceSequence"),Dt(j)?Bt(e,p,"whitespace")(j):p(j))}function p(j){return j===null||nt(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(gT,S,N)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),_(j))}function _(j){return j===null||nt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(j)):Dt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Bt(e,y,"whitespace")(j)):j===96&&j===c?n(j):(e.consume(j),_)}function y(j){return j===null||nt(j)?p(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(j))}function w(j){return j===null||nt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(j)):j===96&&j===c?n(j):(e.consume(j),w)}function S(j){return e.attempt(i,N,C)(j)}function C(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),k}function k(j){return o>0&&Dt(j)?Bt(e,R,"linePrefix",o+1)(j):R(j)}function R(j){return j===null||nt(j)?e.check(gT,S,N)(j):(e.enter("codeFlowValue"),E(j))}function E(j){return j===null||nt(j)?(e.exit("codeFlowValue"),R(j)):(e.consume(j),E)}function N(j){return e.exit("codeFenced"),t(j)}function L(j,O,H){let Z=0;return I;function I(q){return j.enter("lineEnding"),j.consume(q),j.exit("lineEnding"),W}function W(q){return j.enter("codeFencedFence"),Dt(q)?Bt(j,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):F(q)}function F(q){return q===c?(j.enter("codeFencedFenceSequence"),$(q)):H(q)}function $(q){return q===c?(Z++,j.consume(q),$):Z>=l?(j.exit("codeFencedFenceSequence"),Dt(q)?Bt(j,V,"whitespace")(q):V(q)):H(q)}function V(q){return q===null||nt(q)?(j.exit("codeFencedFence"),O(q)):H(q)}}}function jQ(e,t,n){const r=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Qb={name:"codeIndented",tokenize:OQ},DQ={partial:!0,tokenize:LQ};function OQ(e,t,n){const r=this;return i;function i(d){return e.enter("codeIndented"),Bt(e,o,"linePrefix",5)(d)}function o(d){const g=r.events[r.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?l(d):n(d)}function l(d){return d===null?h(d):nt(d)?e.attempt(DQ,l,h)(d):(e.enter("codeFlowValue"),c(d))}function c(d){return d===null||nt(d)?(e.exit("codeFlowValue"),l(d)):(e.consume(d),c)}function h(d){return e.exit("codeIndented"),t(d)}}function LQ(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):nt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):Bt(e,o,"linePrefix",5)(l)}function o(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):nt(l)?i(l):n(l)}}const zQ={name:"codeText",previous:IQ,resolve:PQ,tokenize:BQ};function PQ(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function IQ(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function BQ(e,t,n){let r=0,i,o;return l;function l(p){return e.enter("codeText"),e.enter("codeTextSequence"),c(p)}function c(p){return p===96?(e.consume(p),r++,c):(e.exit("codeTextSequence"),h(p))}function h(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),h):p===96?(o=e.enter("codeTextSequence"),i=0,g(p)):nt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),h):(e.enter("codeTextData"),d(p))}function d(p){return p===null||p===32||p===96||nt(p)?(e.exit("codeTextData"),h(p)):(e.consume(p),d)}function g(p){return p===96?(e.consume(p),i++,g):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(o.type="codeTextData",d(p))}}class FQ{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&_d(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),_d(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),_d(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);_d(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);_d(this.left,n.reverse())}}}function _d(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function $4(e){const t={};let n=-1,r,i,o,l,c,h,d;const g=new FQ(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(r=g.get(n),n&&r[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(h=r[1]._tokenizer.events,o=0,o<h.length&&h[o][1].type==="lineEndingBlank"&&(o+=2),o<h.length&&h[o][1].type==="content"))for(;++o<h.length&&h[o][1].type!=="content";)h[o][1].type==="chunkText"&&(h[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,HQ(g,n)),n=t[n],d=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(l=g.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(g.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...g.get(i)[1].start},c=g.slice(i,n),c.unshift(r),g.splice(i,n-i+1,c))}}return Si(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!d}function HQ(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,h=[],d={};let g,p,_=-1,y=n,w=0,S=0;const C=[S];for(;y;){for(;e.get(++i)[1]!==y;);o.push(i),y._tokenizer||(g=r.sliceStream(y),y.next||g.push(null),p&&l.defineSkip(y.start),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(g),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),p=y,y=y.next}for(y=n;++_<c.length;)c[_][0]==="exit"&&c[_-1][0]==="enter"&&c[_][1].type===c[_-1][1].type&&c[_][1].start.line!==c[_][1].end.line&&(S=_+1,C.push(S),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(l.events=[],y?(y._tokenizer=void 0,y.previous=void 0):C.pop(),_=C.length;_--;){const k=c.slice(C[_],C[_+1]),R=o.pop();h.push([R,R+k.length-1]),e.splice(R,2,k)}for(h.reverse(),_=-1;++_<h.length;)d[w+h[_][0]]=w+h[_][1],w+=h[_][1]-h[_][0]-1;return d}const $Q={resolve:VQ,tokenize:WQ},UQ={partial:!0,tokenize:qQ};function VQ(e){return $4(e),e}function WQ(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(c)}function i(c){return c===null?o(c):nt(c)?e.check(UQ,l,o)(c):(e.consume(c),i)}function o(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function l(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function qQ(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Bt(e,o,"linePrefix")}function o(l){if(l===null||nt(l))return n(l);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function U4(e,t,n,r,i,o,l,c,h){const d=h||Number.POSITIVE_INFINITY;let g=0;return p;function p(k){return k===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(k),e.exit(o),_):k===null||k===32||k===41||zp(k)?n(k):(e.enter(r),e.enter(l),e.enter(c),e.enter("chunkString",{contentType:"string"}),S(k))}function _(k){return k===62?(e.enter(o),e.consume(k),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),y(k))}function y(k){return k===62?(e.exit("chunkString"),e.exit(c),_(k)):k===null||k===60||nt(k)?n(k):(e.consume(k),k===92?w:y)}function w(k){return k===60||k===62||k===92?(e.consume(k),y):y(k)}function S(k){return!g&&(k===null||k===41||gn(k))?(e.exit("chunkString"),e.exit(c),e.exit(l),e.exit(r),t(k)):g<d&&k===40?(e.consume(k),g++,S):k===41?(e.consume(k),g--,S):k===null||k===32||k===40||zp(k)?n(k):(e.consume(k),k===92?C:S)}function C(k){return k===40||k===41||k===92?(e.consume(k),S):S(k)}}function V4(e,t,n,r,i,o){const l=this;let c=0,h;return d;function d(y){return e.enter(r),e.enter(i),e.consume(y),e.exit(i),e.enter(o),g}function g(y){return c>999||y===null||y===91||y===93&&!h||y===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(y):y===93?(e.exit(o),e.enter(i),e.consume(y),e.exit(i),e.exit(r),t):nt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===null||y===91||y===93||nt(y)||c++>999?(e.exit("chunkString"),g(y)):(e.consume(y),h||(h=!Dt(y)),y===92?_:p)}function _(y){return y===91||y===92||y===93?(e.consume(y),c++,p):p(y)}}function W4(e,t,n,r,i,o){let l;return c;function c(_){return _===34||_===39||_===40?(e.enter(r),e.enter(i),e.consume(_),e.exit(i),l=_===40?41:_,h):n(_)}function h(_){return _===l?(e.enter(i),e.consume(_),e.exit(i),e.exit(r),t):(e.enter(o),d(_))}function d(_){return _===l?(e.exit(o),h(l)):_===null?n(_):nt(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),Bt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(_))}function g(_){return _===l||_===null||nt(_)?(e.exit("chunkString"),d(_)):(e.consume(_),_===92?p:g)}function p(_){return _===l||_===92?(e.consume(_),g):g(_)}}function Wd(e,t){let n;return r;function r(i){return nt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Dt(i)?Bt(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const KQ={name:"definition",tokenize:YQ},GQ={partial:!0,tokenize:XQ};function YQ(e,t,n){const r=this;let i;return o;function o(y){return e.enter("definition"),l(y)}function l(y){return V4.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function c(y){return i=as(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),h):n(y)}function h(y){return gn(y)?Wd(e,d)(y):d(y)}function d(y){return U4(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return e.attempt(GQ,p,p)(y)}function p(y){return Dt(y)?Bt(e,_,"whitespace")(y):_(y)}function _(y){return y===null||nt(y)?(e.exit("definition"),r.parser.defined.push(i),t(y)):n(y)}}function XQ(e,t,n){return r;function r(c){return gn(c)?Wd(e,i)(c):n(c)}function i(c){return W4(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function o(c){return Dt(c)?Bt(e,l,"whitespace")(c):l(c)}function l(c){return c===null||nt(c)?t(c):n(c)}}const ZQ={name:"hardBreakEscape",tokenize:QQ};function QQ(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return nt(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const JQ={name:"headingAtx",resolve:eJ,tokenize:tJ};function eJ(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Si(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function tJ(e,t,n){let r=0;return i;function i(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),l(g)}function l(g){return g===35&&r++<6?(e.consume(g),l):g===null||gn(g)?(e.exit("atxHeadingSequence"),c(g)):n(g)}function c(g){return g===35?(e.enter("atxHeadingSequence"),h(g)):g===null||nt(g)?(e.exit("atxHeading"),t(g)):Dt(g)?Bt(e,c,"whitespace")(g):(e.enter("atxHeadingText"),d(g))}function h(g){return g===35?(e.consume(g),h):(e.exit("atxHeadingSequence"),c(g))}function d(g){return g===null||g===35||gn(g)?(e.exit("atxHeadingText"),c(g)):(e.consume(g),d)}}const nJ=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],_T=["pre","script","style","textarea"],rJ={concrete:!0,name:"htmlFlow",resolveTo:oJ,tokenize:aJ},iJ={partial:!0,tokenize:cJ},sJ={partial:!0,tokenize:lJ};function oJ(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function aJ(e,t,n){const r=this;let i,o,l,c,h;return d;function d(A){return g(A)}function g(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),p}function p(A){return A===33?(e.consume(A),_):A===47?(e.consume(A),o=!0,S):A===63?(e.consume(A),i=3,r.interrupt?t:M):Ur(A)?(e.consume(A),l=String.fromCharCode(A),C):n(A)}function _(A){return A===45?(e.consume(A),i=2,y):A===91?(e.consume(A),i=5,c=0,w):Ur(A)?(e.consume(A),i=4,r.interrupt?t:M):n(A)}function y(A){return A===45?(e.consume(A),r.interrupt?t:M):n(A)}function w(A){const ie="CDATA[";return A===ie.charCodeAt(c++)?(e.consume(A),c===ie.length?r.interrupt?t:F:w):n(A)}function S(A){return Ur(A)?(e.consume(A),l=String.fromCharCode(A),C):n(A)}function C(A){if(A===null||A===47||A===62||gn(A)){const ie=A===47,J=l.toLowerCase();return!ie&&!o&&_T.includes(J)?(i=1,r.interrupt?t(A):F(A)):nJ.includes(l.toLowerCase())?(i=6,ie?(e.consume(A),k):r.interrupt?t(A):F(A)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):o?R(A):E(A))}return A===45||zr(A)?(e.consume(A),l+=String.fromCharCode(A),C):n(A)}function k(A){return A===62?(e.consume(A),r.interrupt?t:F):n(A)}function R(A){return Dt(A)?(e.consume(A),R):I(A)}function E(A){return A===47?(e.consume(A),I):A===58||A===95||Ur(A)?(e.consume(A),N):Dt(A)?(e.consume(A),E):I(A)}function N(A){return A===45||A===46||A===58||A===95||zr(A)?(e.consume(A),N):L(A)}function L(A){return A===61?(e.consume(A),j):Dt(A)?(e.consume(A),L):E(A)}function j(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),h=A,O):Dt(A)?(e.consume(A),j):H(A)}function O(A){return A===h?(e.consume(A),h=null,Z):A===null||nt(A)?n(A):(e.consume(A),O)}function H(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||gn(A)?L(A):(e.consume(A),H)}function Z(A){return A===47||A===62||Dt(A)?E(A):n(A)}function I(A){return A===62?(e.consume(A),W):n(A)}function W(A){return A===null||nt(A)?F(A):Dt(A)?(e.consume(A),W):n(A)}function F(A){return A===45&&i===2?(e.consume(A),D):A===60&&i===1?(e.consume(A),U):A===62&&i===4?(e.consume(A),B):A===63&&i===3?(e.consume(A),M):A===93&&i===5?(e.consume(A),G):nt(A)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(iJ,X,$)(A)):A===null||nt(A)?(e.exit("htmlFlowData"),$(A)):(e.consume(A),F)}function $(A){return e.check(sJ,V,X)(A)}function V(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),q}function q(A){return A===null||nt(A)?$(A):(e.enter("htmlFlowData"),F(A))}function D(A){return A===45?(e.consume(A),M):F(A)}function U(A){return A===47?(e.consume(A),l="",z):F(A)}function z(A){if(A===62){const ie=l.toLowerCase();return _T.includes(ie)?(e.consume(A),B):F(A)}return Ur(A)&&l.length<8?(e.consume(A),l+=String.fromCharCode(A),z):F(A)}function G(A){return A===93?(e.consume(A),M):F(A)}function M(A){return A===62?(e.consume(A),B):A===45&&i===2?(e.consume(A),M):F(A)}function B(A){return A===null||nt(A)?(e.exit("htmlFlowData"),X(A)):(e.consume(A),B)}function X(A){return e.exit("htmlFlow"),t(A)}}function lJ(e,t,n){const r=this;return i;function i(l){return nt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):n(l)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function cJ(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ih,t,n)}}const uJ={name:"htmlText",tokenize:dJ};function dJ(e,t,n){const r=this;let i,o,l;return c;function c(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),h}function h(M){return M===33?(e.consume(M),d):M===47?(e.consume(M),L):M===63?(e.consume(M),E):Ur(M)?(e.consume(M),H):n(M)}function d(M){return M===45?(e.consume(M),g):M===91?(e.consume(M),o=0,w):Ur(M)?(e.consume(M),R):n(M)}function g(M){return M===45?(e.consume(M),y):n(M)}function p(M){return M===null?n(M):M===45?(e.consume(M),_):nt(M)?(l=p,U(M)):(e.consume(M),p)}function _(M){return M===45?(e.consume(M),y):p(M)}function y(M){return M===62?D(M):M===45?_(M):p(M)}function w(M){const B="CDATA[";return M===B.charCodeAt(o++)?(e.consume(M),o===B.length?S:w):n(M)}function S(M){return M===null?n(M):M===93?(e.consume(M),C):nt(M)?(l=S,U(M)):(e.consume(M),S)}function C(M){return M===93?(e.consume(M),k):S(M)}function k(M){return M===62?D(M):M===93?(e.consume(M),k):S(M)}function R(M){return M===null||M===62?D(M):nt(M)?(l=R,U(M)):(e.consume(M),R)}function E(M){return M===null?n(M):M===63?(e.consume(M),N):nt(M)?(l=E,U(M)):(e.consume(M),E)}function N(M){return M===62?D(M):E(M)}function L(M){return Ur(M)?(e.consume(M),j):n(M)}function j(M){return M===45||zr(M)?(e.consume(M),j):O(M)}function O(M){return nt(M)?(l=O,U(M)):Dt(M)?(e.consume(M),O):D(M)}function H(M){return M===45||zr(M)?(e.consume(M),H):M===47||M===62||gn(M)?Z(M):n(M)}function Z(M){return M===47?(e.consume(M),D):M===58||M===95||Ur(M)?(e.consume(M),I):nt(M)?(l=Z,U(M)):Dt(M)?(e.consume(M),Z):D(M)}function I(M){return M===45||M===46||M===58||M===95||zr(M)?(e.consume(M),I):W(M)}function W(M){return M===61?(e.consume(M),F):nt(M)?(l=W,U(M)):Dt(M)?(e.consume(M),W):Z(M)}function F(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),i=M,$):nt(M)?(l=F,U(M)):Dt(M)?(e.consume(M),F):(e.consume(M),V)}function $(M){return M===i?(e.consume(M),i=void 0,q):M===null?n(M):nt(M)?(l=$,U(M)):(e.consume(M),$)}function V(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||gn(M)?Z(M):(e.consume(M),V)}function q(M){return M===47||M===62||gn(M)?Z(M):n(M)}function D(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function U(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),z}function z(M){return Dt(M)?Bt(e,G,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):G(M)}function G(M){return e.enter("htmlTextData"),l(M)}}const Gw={name:"labelEnd",resolveAll:pJ,resolveTo:gJ,tokenize:vJ},hJ={tokenize:_J},fJ={tokenize:bJ},mJ={tokenize:yJ};function pJ(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Si(e,0,e.length,n),e}function gJ(e,t){let n=e.length,r=0,i,o,l,c;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const h={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[o][1].start},end:{...e[l][1].end}},g={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[l-2][1].start}};return c=[["enter",h,t],["enter",d,t]],c=Ui(c,e.slice(o+1,o+r+3)),c=Ui(c,[["enter",g,t]]),c=Ui(c,zg(t.parser.constructs.insideSpan.null,e.slice(o+r+4,l-3),t)),c=Ui(c,[["exit",g,t],e[l-2],e[l-1],["exit",d,t]]),c=Ui(c,e.slice(l+1)),c=Ui(c,[["exit",h,t]]),Si(e,o,e.length,c),e}function vJ(e,t,n){const r=this;let i=r.events.length,o,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return c;function c(_){return o?o._inactive?p(_):(l=r.parser.defined.includes(as(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(_),e.exit("labelMarker"),e.exit("labelEnd"),h):n(_)}function h(_){return _===40?e.attempt(hJ,g,l?g:p)(_):_===91?e.attempt(fJ,g,l?d:p)(_):l?g(_):p(_)}function d(_){return e.attempt(mJ,g,p)(_)}function g(_){return t(_)}function p(_){return o._balanced=!0,n(_)}}function _J(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),i}function i(p){return gn(p)?Wd(e,o)(p):o(p)}function o(p){return p===41?g(p):U4(e,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function l(p){return gn(p)?Wd(e,h)(p):g(p)}function c(p){return n(p)}function h(p){return p===34||p===39||p===40?W4(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):g(p)}function d(p){return gn(p)?Wd(e,g)(p):g(p)}function g(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function bJ(e,t,n){const r=this;return i;function i(c){return V4.call(r,e,o,l,"reference","referenceMarker","referenceString")(c)}function o(c){return r.parser.defined.includes(as(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function l(c){return n(c)}}function yJ(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const xJ={name:"labelStartImage",resolveAll:Gw.resolveAll,tokenize:wJ};function wJ(e,t,n){const r=this;return i;function i(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),o}function o(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const SJ={name:"labelStartLink",resolveAll:Gw.resolveAll,tokenize:CJ};function CJ(e,t,n){const r=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Jb={name:"lineEnding",tokenize:kJ};function kJ(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Bt(e,t,"linePrefix")}}const tp={name:"thematicBreak",tokenize:EJ};function EJ(e,t,n){let r=0,i;return o;function o(d){return e.enter("thematicBreak"),l(d)}function l(d){return i=d,c(d)}function c(d){return d===i?(e.enter("thematicBreakSequence"),h(d)):r>=3&&(d===null||nt(d))?(e.exit("thematicBreak"),t(d)):n(d)}function h(d){return d===i?(e.consume(d),r++,h):(e.exit("thematicBreakSequence"),Dt(d)?Bt(e,c,"whitespace")(d):c(d))}}const ri={continuation:{tokenize:MJ},exit:jJ,name:"list",tokenize:NJ},RJ={partial:!0,tokenize:DJ},TJ={partial:!0,tokenize:AJ};function NJ(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return c;function c(y){const w=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:Zx(y)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(tp,n,d)(y):d(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(y)}return n(y)}function h(y){return Zx(y)&&++l<10?(e.consume(y),h):(!r.interrupt||l<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),d(y)):n(y)}function d(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(Ih,r.interrupt?n:g,e.attempt(RJ,_,p))}function g(y){return r.containerState.initialBlankLine=!0,o++,_(y)}function p(y){return Dt(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),_):n(y)}function _(y){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function MJ(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ih,i,o);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Bt(e,t,"listItemIndent",r.containerState.size+1)(c)}function o(c){return r.containerState.furtherBlankLines||!Dt(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(TJ,t,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Bt(e,e.attempt(ri,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function AJ(e,t,n){const r=this;return Bt(e,i,"listItemIndent",r.containerState.size+1);function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(o):n(o)}}function jJ(e){e.exit(this.containerState.type)}function DJ(e,t,n){const r=this;return Bt(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const l=r.events[r.events.length-1];return!Dt(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const bT={name:"setextUnderline",resolveTo:OJ,tokenize:LJ};function OJ(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",l,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function LJ(e,t,n){const r=this;let i;return o;function o(d){let g=r.events.length,p;for(;g--;)if(r.events[g][1].type!=="lineEnding"&&r.events[g][1].type!=="linePrefix"&&r.events[g][1].type!=="content"){p=r.events[g][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),i=d,l(d)):n(d)}function l(d){return e.enter("setextHeadingLineSequence"),c(d)}function c(d){return d===i?(e.consume(d),c):(e.exit("setextHeadingLineSequence"),Dt(d)?Bt(e,h,"lineSuffix")(d):h(d))}function h(d){return d===null||nt(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const zJ={tokenize:PJ};function PJ(e){const t=this,n=e.attempt(Ih,r,e.attempt(this.parser.constructs.flowInitial,i,Bt(e,e.attempt(this.parser.constructs.flow,i,e.attempt($Q,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const IJ={resolveAll:K4()},BJ=q4("string"),FJ=q4("text");function q4(e){return{resolveAll:K4(e==="text"?HJ:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,l,c);return l;function l(g){return d(g)?o(g):c(g)}function c(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),h}function h(g){return d(g)?(n.exit("data"),o(g)):(n.consume(g),h)}function d(g){if(g===null)return!0;const p=i[g];let _=-1;if(p)for(;++_<p.length;){const y=p[_];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function K4(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function HJ(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,l=-1,c=0,h;for(;o--;){const d=i[o];if(typeof d=="string"){for(l=d.length;d.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(d===-2)h=!0,c++;else if(d!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const d={type:n===e.length||h||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?l:r.start._bufferIndex+l,_index:r.start._index+o,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(e.splice(n,0,["enter",d,t],["exit",d,t]),n+=2)}n++}return e}const $J={42:ri,43:ri,45:ri,48:ri,49:ri,50:ri,51:ri,52:ri,53:ri,54:ri,55:ri,56:ri,57:ri,62:B4},UJ={91:KQ},VJ={[-2]:Qb,[-1]:Qb,32:Qb},WJ={35:JQ,42:tp,45:[bT,tp],60:rJ,61:bT,95:tp,96:vT,126:vT},qJ={38:H4,92:F4},KJ={[-5]:Jb,[-4]:Jb,[-3]:Jb,33:xJ,38:H4,42:Qx,60:[SQ,uJ],91:SJ,92:[ZQ,F4],93:Gw,95:Qx,96:zQ},GJ={null:[Qx,IJ]},YJ={null:[42,95]},XJ={null:[]},ZJ=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:YJ,contentInitial:UJ,disable:XJ,document:$J,flow:WJ,flowInitial:VJ,insideSpan:GJ,string:qJ,text:KJ},Symbol.toStringTag,{value:"Module"}));function QJ(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let l=[],c=[];const h={attempt:O(L),check:O(j),consume:R,enter:E,exit:N,interrupt:O(j,{interrupt:!0})},d={code:null,containerState:{},defineSkip:S,events:[],now:w,parser:e,previous:null,sliceSerialize:_,sliceStream:y,write:p};let g=t.tokenize.call(d,h);return t.resolveAll&&o.push(t),d;function p(W){return l=Ui(l,W),C(),l[l.length-1]!==null?[]:(H(t,0),d.events=zg(o,d.events,d),d.events)}function _(W,F){return eee(y(W),F)}function y(W){return JJ(l,W)}function w(){const{_bufferIndex:W,_index:F,line:$,column:V,offset:q}=r;return{_bufferIndex:W,_index:F,line:$,column:V,offset:q}}function S(W){i[W.line]=W.column,I()}function C(){let W;for(;r._index<l.length;){const F=l[r._index];if(typeof F=="string")for(W=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===W&&r._bufferIndex<F.length;)k(F.charCodeAt(r._bufferIndex));else k(F)}}function k(W){g=g(W)}function R(W){nt(W)?(r.line++,r.column=1,r.offset+=W===-3?2:1,I()):W!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=W}function E(W,F){const $=F||{};return $.type=W,$.start=w(),d.events.push(["enter",$,d]),c.push($),$}function N(W){const F=c.pop();return F.end=w(),d.events.push(["exit",F,d]),F}function L(W,F){H(W,F.from)}function j(W,F){F.restore()}function O(W,F){return $;function $(V,q,D){let U,z,G,M;return Array.isArray(V)?X(V):"tokenize"in V?X([V]):B(V);function B(ee){return re;function re(ue){const fe=ue!==null&&ee[ue],ge=ue!==null&&ee.null,Ce=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(ge)?ge:ge?[ge]:[]];return X(Ce)(ue)}}function X(ee){return U=ee,z=0,ee.length===0?D:A(ee[z])}function A(ee){return re;function re(ue){return M=Z(),G=ee,ee.partial||(d.currentConstruct=ee),ee.name&&d.parser.constructs.disable.null.includes(ee.name)?J():ee.tokenize.call(F?Object.assign(Object.create(d),F):d,h,ie,J)(ue)}}function ie(ee){return W(G,M),q}function J(ee){return M.restore(),++z<U.length?A(U[z]):D}}}function H(W,F){W.resolveAll&&!o.includes(W)&&o.push(W),W.resolve&&Si(d.events,F,d.events.length-F,W.resolve(d.events.slice(F),d)),W.resolveTo&&(d.events=W.resolveTo(d.events,d))}function Z(){const W=w(),F=d.previous,$=d.currentConstruct,V=d.events.length,q=Array.from(c);return{from:V,restore:D};function D(){r=W,d.previous=F,d.currentConstruct=$,d.events.length=V,c=q,I()}}function I(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function JJ(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,o)];else{if(l=e.slice(n,i),r>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}o>0&&l.push(e[i].slice(0,o))}return l}function eee(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
619
+ `;break}case-3:{l=`\r
620
+ `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(o)}i=o===-2,r.push(l)}return r.join("")}function tee(e){const r={constructs:P4([ZJ,...(e||{}).extensions||[]]),content:i(gQ),defined:[],document:i(_Q),flow:i(zJ),lazy:{},string:i(BJ),text:i(FJ)};return r;function i(o){return l;function l(c){return QJ(r,o,c)}}}function nee(e){for(;!$4(e););return e}const yT=/[\0\t\n\r]/g;function ree(){let e=1,t="",n=!0,r;return i;function i(o,l,c){const h=[];let d,g,p,_,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(yT.lastIndex=p,d=yT.exec(o),_=d&&d.index!==void 0?d.index:o.length,y=o.charCodeAt(_),!d){t=o.slice(p);break}if(y===10&&p===_&&r)h.push(-3),r=void 0;else switch(r&&(h.push(-5),r=void 0),p<_&&(h.push(o.slice(p,_)),e+=_-p),y){case 0:{h.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,h.push(-2);e++<g;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:r=!0,e=1}p=_+1}return c&&(r&&h.push(-5),t&&h.push(t),h.push(null)),h}}const iee=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function see(e){return e.replace(iee,oee)}function oee(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return I4(n.slice(o?2:1),o?16:10)}return Kw(n)||e}const G4={}.hasOwnProperty;function aee(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),lee(n)(nee(tee(n).document().write(ree()(e,t,!0))))}function lee(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(De),autolinkProtocol:Z,autolinkEmail:Z,atxHeading:o(xt),blockQuote:o(ge),characterEscape:Z,characterReference:Z,codeFenced:o(Ce),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:o(Ce,l),codeText:o(Te,l),codeTextData:Z,data:Z,codeFlowValue:Z,definition:o(je),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:o(Xe),hardBreakEscape:o(Et),hardBreakTrailing:o(Et),htmlFlow:o(me,l),htmlFlowData:Z,htmlText:o(me,l),htmlTextData:Z,image:o(Fe),label:l,link:o(De),listItem:o(at),listItemValue:_,listOrdered:o(ft,p),listUnordered:o(ft),paragraph:o(it),reference:A,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:o(xt),strong:o(hn),thematicBreak:o(Pn)},exit:{atxHeading:h(),atxHeadingSequence:L,autolink:h(),autolinkEmail:fe,autolinkProtocol:ue,blockQuote:h(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:J,characterReferenceMarkerNumeric:J,characterReferenceValue:ee,characterReference:re,codeFenced:h(C),codeFencedFence:S,codeFencedFenceInfo:y,codeFencedFenceMeta:w,codeFlowValue:I,codeIndented:h(k),codeText:h(q),codeTextData:I,data:I,definition:h(),definitionDestinationString:N,definitionLabelString:R,definitionTitleString:E,emphasis:h(),hardBreakEscape:h(F),hardBreakTrailing:h(F),htmlFlow:h($),htmlFlowData:I,htmlText:h(V),htmlTextData:I,image:h(U),label:G,labelText:z,lineEnding:W,link:h(D),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:ie,resourceDestinationString:M,resourceTitleString:B,resource:X,setextHeading:h(H),setextHeadingLineSequence:O,setextHeadingText:j,strong:h(),thematicBreak:h()}};Y4(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(de){let se={type:"root",children:[]};const ye={stack:[se],tokenStack:[],config:t,enter:c,exit:d,buffer:l,resume:g,data:n},Ee=[];let qe=-1;for(;++qe<de.length;)if(de[qe][1].type==="listOrdered"||de[qe][1].type==="listUnordered")if(de[qe][0]==="enter")Ee.push(qe);else{const lt=Ee.pop();qe=i(de,lt,qe)}for(qe=-1;++qe<de.length;){const lt=t[de[qe][0]];G4.call(lt,de[qe][1].type)&&lt[de[qe][1].type].call(Object.assign({sliceSerialize:de[qe][2].sliceSerialize},ye),de[qe][1])}if(ye.tokenStack.length>0){const lt=ye.tokenStack[ye.tokenStack.length-1];(lt[1]||xT).call(ye,void 0,lt[0])}for(se.position={start:la(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:la(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},qe=-1;++qe<t.transforms.length;)se=t.transforms[qe](se)||se;return se}function i(de,se,ye){let Ee=se-1,qe=-1,lt=!1,Je,Ae,He,mt;for(;++Ee<=ye;){const Ve=de[Ee];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ve[0]==="enter"?qe++:qe--,mt=void 0;break}case"lineEndingBlank":{Ve[0]==="enter"&&(Je&&!mt&&!qe&&!He&&(He=Ee),mt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:mt=void 0}if(!qe&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||qe===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(Je){let fn=Ee;for(Ae=void 0;fn--;){const rn=de[fn];if(rn[1].type==="lineEnding"||rn[1].type==="lineEndingBlank"){if(rn[0]==="exit")continue;Ae&&(de[Ae][1].type="lineEndingBlank",lt=!0),rn[1].type="lineEnding",Ae=fn}else if(!(rn[1].type==="linePrefix"||rn[1].type==="blockQuotePrefix"||rn[1].type==="blockQuotePrefixWhitespace"||rn[1].type==="blockQuoteMarker"||rn[1].type==="listItemIndent"))break}He&&(!Ae||He<Ae)&&(Je._spread=!0),Je.end=Object.assign({},Ae?de[Ae][1].start:Ve[1].end),de.splice(Ae||Ee,0,["exit",Je,Ve[2]]),Ee++,ye++}if(Ve[1].type==="listItemPrefix"){const fn={type:"listItem",_spread:!1,start:Object.assign({},Ve[1].start),end:void 0};Je=fn,de.splice(Ee,0,["enter",fn,Ve[2]]),Ee++,ye++,He=void 0,mt=!0}}}return de[se][1]._spread=lt,ye}function o(de,se){return ye;function ye(Ee){c.call(this,de(Ee),Ee),se&&se.call(this,Ee)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(de,se,ye){this.stack[this.stack.length-1].children.push(de),this.stack.push(de),this.tokenStack.push([se,ye||void 0]),de.position={start:la(se.start),end:void 0}}function h(de){return se;function se(ye){de&&de.call(this,ye),d.call(this,ye)}}function d(de,se){const ye=this.stack.pop(),Ee=this.tokenStack.pop();if(Ee)Ee[0].type!==de.type&&(se?se.call(this,de,Ee[0]):(Ee[1]||xT).call(this,de,Ee[0]));else throw new Error("Cannot close `"+de.type+"` ("+Vd({start:de.start,end:de.end})+"): it’s not open");ye.position.end=la(de.end)}function g(){return qw(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function _(de){if(this.data.expectingFirstListItemValue){const se=this.stack[this.stack.length-2];se.start=Number.parseInt(this.sliceSerialize(de),10),this.data.expectingFirstListItemValue=void 0}}function y(){const de=this.resume(),se=this.stack[this.stack.length-1];se.lang=de}function w(){const de=this.resume(),se=this.stack[this.stack.length-1];se.meta=de}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const de=this.resume(),se=this.stack[this.stack.length-1];se.value=de.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const de=this.resume(),se=this.stack[this.stack.length-1];se.value=de.replace(/(\r?\n|\r)$/g,"")}function R(de){const se=this.resume(),ye=this.stack[this.stack.length-1];ye.label=se,ye.identifier=as(this.sliceSerialize(de)).toLowerCase()}function E(){const de=this.resume(),se=this.stack[this.stack.length-1];se.title=de}function N(){const de=this.resume(),se=this.stack[this.stack.length-1];se.url=de}function L(de){const se=this.stack[this.stack.length-1];if(!se.depth){const ye=this.sliceSerialize(de).length;se.depth=ye}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function O(de){const se=this.stack[this.stack.length-1];se.depth=this.sliceSerialize(de).codePointAt(0)===61?1:2}function H(){this.data.setextHeadingSlurpLineEnding=void 0}function Z(de){const ye=this.stack[this.stack.length-1].children;let Ee=ye[ye.length-1];(!Ee||Ee.type!=="text")&&(Ee=Mt(),Ee.position={start:la(de.start),end:void 0},ye.push(Ee)),this.stack.push(Ee)}function I(de){const se=this.stack.pop();se.value+=this.sliceSerialize(de),se.position.end=la(de.end)}function W(de){const se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ye=se.children[se.children.length-1];ye.position.end=la(de.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(se.type)&&(Z.call(this,de),I.call(this,de))}function F(){this.data.atHardBreak=!0}function $(){const de=this.resume(),se=this.stack[this.stack.length-1];se.value=de}function V(){const de=this.resume(),se=this.stack[this.stack.length-1];se.value=de}function q(){const de=this.resume(),se=this.stack[this.stack.length-1];se.value=de}function D(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=se,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function U(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=se,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function z(de){const se=this.sliceSerialize(de),ye=this.stack[this.stack.length-2];ye.label=see(se),ye.identifier=as(se).toLowerCase()}function G(){const de=this.stack[this.stack.length-1],se=this.resume(),ye=this.stack[this.stack.length-1];if(this.data.inReference=!0,ye.type==="link"){const Ee=de.children;ye.children=Ee}else ye.alt=se}function M(){const de=this.resume(),se=this.stack[this.stack.length-1];se.url=de}function B(){const de=this.resume(),se=this.stack[this.stack.length-1];se.title=de}function X(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ie(de){const se=this.resume(),ye=this.stack[this.stack.length-1];ye.label=se,ye.identifier=as(this.sliceSerialize(de)).toLowerCase(),this.data.referenceType="full"}function J(de){this.data.characterReferenceType=de.type}function ee(de){const se=this.sliceSerialize(de),ye=this.data.characterReferenceType;let Ee;ye?(Ee=I4(se,ye==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ee=Kw(se);const qe=this.stack[this.stack.length-1];qe.value+=Ee}function re(de){const se=this.stack.pop();se.position.end=la(de.end)}function ue(de){I.call(this,de);const se=this.stack[this.stack.length-1];se.url=this.sliceSerialize(de)}function fe(de){I.call(this,de);const se=this.stack[this.stack.length-1];se.url="mailto:"+this.sliceSerialize(de)}function ge(){return{type:"blockquote",children:[]}}function Ce(){return{type:"code",lang:null,meta:null,value:""}}function Te(){return{type:"inlineCode",value:""}}function je(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Xe(){return{type:"emphasis",children:[]}}function xt(){return{type:"heading",depth:0,children:[]}}function Et(){return{type:"break"}}function me(){return{type:"html",value:""}}function Fe(){return{type:"image",title:null,url:"",alt:null}}function De(){return{type:"link",title:null,url:"",children:[]}}function ft(de){return{type:"list",ordered:de.type==="listOrdered",start:null,spread:de._spread,children:[]}}function at(de){return{type:"listItem",spread:de._spread,checked:null,children:[]}}function it(){return{type:"paragraph",children:[]}}function hn(){return{type:"strong",children:[]}}function Mt(){return{type:"text",value:""}}function Pn(){return{type:"thematicBreak"}}}function la(e){return{line:e.line,column:e.column,offset:e.offset}}function Y4(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Y4(e,r):cee(e,r)}}function cee(e,t){let n;for(n in t)if(G4.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function xT(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Vd({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Vd({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Vd({start:t.start,end:t.end})+") is still open")}function uee(e){const t=this;t.parser=n;function n(r){return aee(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function dee(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function hee(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
621
+ `}]}function fee(e,t){const n=t.value?t.value+`
622
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function mee(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pee(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gee(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=hu(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let l,c=e.footnoteCounts.get(r);c===void 0?(c=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=o+1,c+=1,e.footnoteCounts.set(r,c);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,h);const d={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,d),e.applyData(t,d)}function vee(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _ee(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function X4(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function bee(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return X4(e,t);const i={src:hu(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function yee(e,t){const n={src:hu(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function xee(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function wee(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return X4(e,t);const i={href:hu(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function See(e,t){const n={href:hu(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Cee(e,t,n){const r=e.all(t),i=n?kee(n):Z4(t),o={},l=[];if(typeof t.checked=="boolean"){const g=r[0];let p;g&&g.type==="element"&&g.tagName==="p"?p=g:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const g=r[c];(i||c!==0||g.type!=="element"||g.tagName!=="p")&&l.push({type:"text",value:`
623
+ `}),g.type==="element"&&g.tagName==="p"&&!i?l.push(...g.children):l.push(g)}const h=r[r.length-1];h&&(i||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
624
+ `});const d={type:"element",tagName:"li",properties:o,children:l};return e.patch(t,d),e.applyData(t,d)}function kee(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Z4(n[r])}return t}function Z4(e){const t=e.spread;return t??e.children.length>1}function Eee(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const l=r[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function Ree(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Tee(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Nee(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Mee(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},c=$w(t.children[1]),h=M4(t.children[t.children.length-1]);c&&h&&(l.position={start:c,end:h}),i.push(l)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function Aee(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,c=l?l.length:t.children.length;let h=-1;const d=[];for(;++h<c;){const p=t.children[h],_={},y=l?l[h]:void 0;y&&(_.align=y);let w={type:"element",tagName:o,properties:_,children:[]};p&&(w.children=e.all(p),e.patch(p,w),w=e.applyData(p,w)),d.push(w)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,g),e.applyData(t,g)}function jee(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const wT=9,ST=32;function Dee(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(CT(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(CT(t.slice(i),i>0,!1)),o.join("")}function CT(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===wT||o===ST;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===wT||o===ST;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function Oee(e,t){const n={type:"text",value:Dee(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Lee(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const zee={blockquote:dee,break:hee,code:fee,delete:mee,emphasis:pee,footnoteReference:gee,heading:vee,html:_ee,imageReference:bee,image:yee,inlineCode:xee,linkReference:wee,link:See,listItem:Cee,list:Eee,paragraph:Ree,root:Tee,strong:Nee,table:Mee,tableCell:jee,tableRow:Aee,text:Oee,thematicBreak:Lee,toml:Am,yaml:Am,definition:Am,footnoteDefinition:Am};function Am(){}const Q4=-1,Pg=0,qd=1,Pp=2,Yw=3,Xw=4,Zw=5,Qw=6,J4=7,eO=8,kT=typeof self=="object"?self:globalThis,Pee=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,l]=t[i];switch(o){case Pg:case Q4:return n(l,i);case qd:{const c=n([],i);for(const h of l)c.push(r(h));return c}case Pp:{const c=n({},i);for(const[h,d]of l)c[r(h)]=r(d);return c}case Yw:return n(new Date(l),i);case Xw:{const{source:c,flags:h}=l;return n(new RegExp(c,h),i)}case Zw:{const c=n(new Map,i);for(const[h,d]of l)c.set(r(h),r(d));return c}case Qw:{const c=n(new Set,i);for(const h of l)c.add(r(h));return c}case J4:{const{name:c,message:h}=l;return n(new kT[c](h),i)}case eO:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:c}=new Uint8Array(l);return n(new DataView(c),l)}}return n(new kT[o](l),i)};return r},ET=e=>Pee(new Map,e)(0),xc="",{toString:Iee}={},{keys:Bee}=Object,bd=e=>{const t=typeof e;if(t!=="object"||!e)return[Pg,t];const n=Iee.call(e).slice(8,-1);switch(n){case"Array":return[qd,xc];case"Object":return[Pp,xc];case"Date":return[Yw,xc];case"RegExp":return[Xw,xc];case"Map":return[Zw,xc];case"Set":return[Qw,xc];case"DataView":return[qd,n]}return n.includes("Array")?[qd,n]:n.includes("Error")?[J4,n]:[Pp,n]},jm=([e,t])=>e===Pg&&(t==="function"||t==="symbol"),Fee=(e,t,n,r)=>{const i=(l,c)=>{const h=r.push(l)-1;return n.set(c,h),h},o=l=>{if(n.has(l))return n.get(l);let[c,h]=bd(l);switch(c){case Pg:{let g=l;switch(h){case"bigint":c=eO,g=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);g=null;break;case"undefined":return i([Q4],l)}return i([c,g],l)}case qd:{if(h){let _=l;return h==="DataView"?_=new Uint8Array(l.buffer):h==="ArrayBuffer"&&(_=new Uint8Array(l)),i([h,[..._]],l)}const g=[],p=i([c,g],l);for(const _ of l)g.push(o(_));return p}case Pp:{if(h)switch(h){case"BigInt":return i([h,l.toString()],l);case"Boolean":case"Number":case"String":return i([h,l.valueOf()],l)}if(t&&"toJSON"in l)return o(l.toJSON());const g=[],p=i([c,g],l);for(const _ of Bee(l))(e||!jm(bd(l[_])))&&g.push([o(_),o(l[_])]);return p}case Yw:return i([c,l.toISOString()],l);case Xw:{const{source:g,flags:p}=l;return i([c,{source:g,flags:p}],l)}case Zw:{const g=[],p=i([c,g],l);for(const[_,y]of l)(e||!(jm(bd(_))||jm(bd(y))))&&g.push([o(_),o(y)]);return p}case Qw:{const g=[],p=i([c,g],l);for(const _ of l)(e||!jm(bd(_)))&&g.push(o(_));return p}}const{message:d}=l;return i([c,{name:h,message:d}],l)};return o},RT=(e,{json:t,lossy:n}={})=>{const r=[];return Fee(!(t||n),!!t,new Map,r)(e),r},Ip=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ET(RT(e,t)):structuredClone(e):(e,t)=>ET(RT(e,t));function Hee(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function $ee(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Uee(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Hee,r=e.options.footnoteBackLabel||$ee,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let h=-1;for(;++h<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[h]);if(!d)continue;const g=e.all(d),p=String(d.identifier).toUpperCase(),_=hu(p.toLowerCase());let y=0;const w=[],S=e.footnoteCounts.get(p);for(;S!==void 0&&++y<=S;){w.length>0&&w.push({type:"text",value:" "});let R=typeof n=="string"?n:n(h,y);typeof R=="string"&&(R={type:"text",value:R}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+_+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(h,y),className:["data-footnote-backref"]},children:Array.isArray(R)?R:[R]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const R=C.children[C.children.length-1];R&&R.type==="text"?R.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...w)}else g.push(...w);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+_},children:e.wrap(g,!0)};e.patch(d,k),c.push(k)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Ip(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
625
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
626
+ `}]}}const Ig=function(e){if(e==null)return Kee;if(typeof e=="function")return Bg(e);if(typeof e=="object")return Array.isArray(e)?Vee(e):Wee(e);if(typeof e=="string")return qee(e);throw new Error("Expected function, string, or object as test")};function Vee(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ig(e[n]);return Bg(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function Wee(e){const t=e;return Bg(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function qee(e){return Bg(t);function t(n){return n&&n.type===e}}function Bg(e){return t;function t(n,r,i){return!!(Gee(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Kee(){return!0}function Gee(e){return e!==null&&typeof e=="object"&&"type"in e}const tO=[],Yee=!0,Jx=!1,Xee="skip";function nO(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=Ig(i),l=r?-1:1;c(e,void 0,[])();function c(h,d,g){const p=h&&typeof h=="object"?h:{};if(typeof p.type=="string"){const y=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(_,"name",{value:"node ("+(h.type+(y?"<"+y+">":""))+")"})}return _;function _(){let y=tO,w,S,C;if((!t||o(h,d,g[g.length-1]||void 0))&&(y=Zee(n(h,g)),y[0]===Jx))return y;if("children"in h&&h.children){const k=h;if(k.children&&y[0]!==Xee)for(S=(r?k.children.length:-1)+l,C=g.concat(k);S>-1&&S<k.children.length;){const R=k.children[S];if(w=c(R,S,C)(),w[0]===Jx)return w;S=typeof w[1]=="number"?w[1]:S+l}}return y}}}function Zee(e){return Array.isArray(e)?e:typeof e=="number"?[Yee,e]:e==null?tO:[e]}function Jw(e,t,n,r){let i,o,l;typeof t=="function"&&typeof n!="function"?(o=void 0,l=t,i=n):(o=t,l=n,i=r),nO(e,o,c,i);function c(h,d){const g=d[d.length-1],p=g?g.children.indexOf(h):void 0;return l(h,p,g)}}const e0={}.hasOwnProperty,Qee={};function Jee(e,t){const n=t||Qee,r=new Map,i=new Map,o=new Map,l={...zee,...n.handlers},c={all:d,applyData:tte,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:l,one:h,options:n,patch:ete,wrap:rte};return Jw(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const p=g.type==="definition"?r:i,_=String(g.identifier).toUpperCase();p.has(_)||p.set(_,g)}}),c;function h(g,p){const _=g.type,y=c.handlers[_];if(e0.call(c.handlers,_)&&y)return y(c,g,p);if(c.options.passThrough&&c.options.passThrough.includes(_)){if("children"in g){const{children:S,...C}=g,k=Ip(C);return k.children=c.all(g),k}return Ip(g)}return(c.options.unknownHandler||nte)(c,g,p)}function d(g){const p=[];if("children"in g){const _=g.children;let y=-1;for(;++y<_.length;){const w=c.one(_[y],g);if(w){if(y&&_[y-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=TT(w.value)),!Array.isArray(w)&&w.type==="element")){const S=w.children[0];S&&S.type==="text"&&(S.value=TT(S.value))}Array.isArray(w)?p.push(...w):p.push(w)}}}return p}}function ete(e,t){e.position&&(t.position=$Z(e))}function tte(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&o&&Object.assign(n.properties,Ip(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function nte(e,t){const n=t.data||{},r="value"in t&&!(e0.call(n,"hProperties")||e0.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function rte(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
627
+ `});++r<e.length;)r&&n.push({type:"text",value:`
628
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
629
+ `}),n}function TT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function NT(e,t){const n=Jee(e,t),r=n.one(e,void 0),i=Uee(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
630
+ `},i),o}function ite(e,t){return e&&"run"in e?async function(n,r){const i=NT(n,{file:r,...t});await e.run(i,r)}:function(n,r){return NT(n,{file:r,...e||t})}}function MT(e){if(e)throw e}var ey,AT;function ste(){if(AT)return ey;AT=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},o=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var g=e.call(d,"constructor"),p=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!g&&!p)return!1;var _;for(_ in d);return typeof _>"u"||e.call(d,_)},l=function(d,g){n&&g.name==="__proto__"?n(d,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):d[g.name]=g.newValue},c=function(d,g){if(g==="__proto__")if(e.call(d,g)){if(r)return r(d,g).value}else return;return d[g]};return ey=function h(){var d,g,p,_,y,w,S=arguments[0],C=1,k=arguments.length,R=!1;for(typeof S=="boolean"&&(R=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});C<k;++C)if(d=arguments[C],d!=null)for(g in d)p=c(S,g),_=c(d,g),S!==_&&(R&&_&&(o(_)||(y=i(_)))?(y?(y=!1,w=p&&i(p)?p:[]):w=p&&o(p)?p:{},l(S,{name:g,newValue:h(R,w,_)})):typeof _<"u"&&l(S,{name:g,newValue:_}));return S},ey}var ote=ste();const ty=qp(ote);function t0(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function ate(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...i);function c(h,...d){const g=e[++o];let p=-1;if(h){l(h);return}for(;++p<i.length;)(d[p]===null||d[p]===void 0)&&(d[p]=i[p]);i=d,g?lte(g,c)(...d):l(null,...d)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function lte(e,t){let n;return r;function r(...l){const c=e.length>l.length;let h;c&&l.push(i);try{h=e.apply(this,l)}catch(d){const g=d;if(c&&n)throw g;return i(g)}c||(h&&h.then&&typeof h.then=="function"?h.then(o,i):h instanceof Error?i(h):o(h))}function i(l,...c){n||(n=!0,t(l,...c))}function o(l){i(null,l)}}const Cs={basename:cte,dirname:ute,extname:dte,join:hte,sep:"/"};function cte(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Bh(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,c=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else l<0&&(o=!0,l=i+1),c>-1&&(e.codePointAt(i)===t.codePointAt(c--)?c<0&&(r=i):(c=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function ute(e){if(Bh(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function dte(e){Bh(e);let t=e.length,n=-1,r=0,i=-1,o=0,l;for(;t--;){const c=e.codePointAt(t);if(c===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),c===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function hte(...e){let t=-1,n;for(;++t<e.length;)Bh(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":fte(n)}function fte(e){Bh(e);const t=e.codePointAt(0)===47;let n=mte(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function mte(e,t){let n="",r=0,i=-1,o=0,l=-1,c,h;for(;++l<=e.length;){if(l<e.length)c=e.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(i===l-1||o===1))if(i!==l-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",r=0):(n=n.slice(0,h),r=n.length-1-n.lastIndexOf("/")),i=l,o=0;continue}}else if(n.length>0){n="",r=0,i=l,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,l):n=e.slice(i+1,l),r=l-i-1;i=l,o=0}else c===46&&o>-1?o++:o=-1}return n}function Bh(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const pte={cwd:gte};function gte(){return"/"}function n0(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function vte(e){if(typeof e=="string")e=new URL(e);else if(!n0(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return _te(e)}function _te(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const ny=["history","path","basename","stem","extname","dirname"];class rO{constructor(t){let n;t?n0(t)?n={path:t}:typeof t=="string"||bte(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":pte.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ny.length;){const o=ny[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)ny.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Cs.basename(this.path):void 0}set basename(t){iy(t,"basename"),ry(t,"basename"),this.path=Cs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Cs.dirname(this.path):void 0}set dirname(t){jT(this.basename,"dirname"),this.path=Cs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Cs.extname(this.path):void 0}set extname(t){if(ry(t,"extname"),jT(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Cs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){n0(t)&&(t=vte(t)),iy(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Cs.basename(this.path,this.extname):void 0}set stem(t){iy(t,"stem"),ry(t,"stem"),this.path=Cs.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Ir(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ry(e,t){if(e&&e.includes(Cs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Cs.sep+"`")}function iy(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function jT(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function bte(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yte=function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o},xte={}.hasOwnProperty;class e1 extends yte{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=ate()}copy(){const t=new e1;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(ty(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(ay("data",this.frozen),this.namespace[t]=n,this):xte.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ay("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Dm(t),r=this.parser||this.Parser;return sy("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),sy("process",this.parser||this.Parser),oy("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,l){const c=Dm(t),h=r.parse(c);r.run(h,c,function(g,p,_){if(g||!p||!_)return d(g);const y=p,w=r.stringify(y,_);Cte(w)?_.value=w:_.result=w,d(g,_)});function d(g,p){g||!p?l(g):o?o(p):n(void 0,p)}}}processSync(t){let n=!1,r;return this.freeze(),sy("processSync",this.parser||this.Parser),oy("processSync",this.compiler||this.Compiler),this.process(t,i),OT("processSync","process",n),r;function i(o,l){n=!0,MT(o),r=l}}run(t,n,r){DT(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(l,c){const h=Dm(n);i.run(t,h,d);function d(g,p,_){const y=p||t;g?c(g):l?l(y):r(void 0,y,_)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),OT("runSync","run",r),i;function o(l,c){MT(l),i=c,r=!0}}stringify(t,n){this.freeze();const r=Dm(n),i=this.compiler||this.Compiler;return oy("stringify",i),DT(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(ay("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(d){if(typeof d=="function")h(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[g,...p]=d;h(g,p)}else l(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function l(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(d.plugins),d.settings&&(i.settings=ty(!0,i.settings,d.settings))}function c(d){let g=-1;if(d!=null)if(Array.isArray(d))for(;++g<d.length;){const p=d[g];o(p)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function h(d,g){let p=-1,_=-1;for(;++p<r.length;)if(r[p][0]===d){_=p;break}if(_===-1)r.push([d,...g]);else if(g.length>0){let[y,...w]=g;const S=r[_][1];t0(S)&&t0(y)&&(y=ty(!0,S,y)),r[_]=[d,y,...w]}}}}const wte=new e1().freeze();function sy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function oy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ay(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function DT(e){if(!t0(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function OT(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Dm(e){return Ste(e)?e:new rO(e)}function Ste(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Cte(e){return typeof e=="string"||kte(e)}function kte(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ete="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",LT=[],zT={allowDangerousHtml:!0},Rte=/^(https?|ircs?|mailto|xmpp)$/i,Tte=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function fu(e){const t=Nte(e),n=Mte(e);return Ate(t.runSync(t.parse(n),n),e)}function Nte(e){const t=e.rehypePlugins||LT,n=e.remarkPlugins||LT,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...zT}:zT;return wte().use(uee).use(n).use(ite,r).use(t)}function Mte(e){const t=e.children||"",n=new rO;return typeof t=="string"&&(n.value=t),n}function Ate(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,l=t.skipHtml,c=t.unwrapDisallowed,h=t.urlTransform||jte;for(const g of Tte)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+Ete+g.id,void 0);return Jw(e,d),KZ(e,{Fragment:f.Fragment,components:i,ignoreInvalidStyle:!0,jsx:f.jsx,jsxs:f.jsxs,passKeys:!0,passNode:!0});function d(g,p,_){if(g.type==="raw"&&_&&typeof p=="number")return l?_.children.splice(p,1):_.children[p]={type:"text",value:g.value},p;if(g.type==="element"){let y;for(y in Zb)if(Object.hasOwn(Zb,y)&&Object.hasOwn(g.properties,y)){const w=g.properties[y],S=Zb[y];(S===null||S.includes(g.tagName))&&(g.properties[y]=h(String(w||""),y,g))}}if(g.type==="element"){let y=n?!n.includes(g.tagName):o?o.includes(g.tagName):!1;if(!y&&r&&typeof p=="number"&&(y=!r(g,p,_)),y&&_&&typeof p=="number")return c&&g.children?_.children.splice(p,1,...g.children):_.children.splice(p,1),p}}}function jte(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Rte.test(e.slice(0,t))?e:""}function PT(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Dte(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Ote(e,t,n){const i=Ig((n||{}).ignore||[]),o=Lte(t);let l=-1;for(;++l<o.length;)nO(e,"text",c);function c(d,g){let p=-1,_;for(;++p<g.length;){const y=g[p],w=_?_.children:void 0;if(i(y,w?w.indexOf(y):void 0,_))return;_=y}if(_)return h(d,g)}function h(d,g){const p=g[g.length-1],_=o[l][0],y=o[l][1];let w=0;const C=p.children.indexOf(d);let k=!1,R=[];_.lastIndex=0;let E=_.exec(d.value);for(;E;){const N=E.index,L={index:E.index,input:E.input,stack:[...g,d]};let j=y(...E,L);if(typeof j=="string"&&(j=j.length>0?{type:"text",value:j}:void 0),j===!1?_.lastIndex=N+1:(w!==N&&R.push({type:"text",value:d.value.slice(w,N)}),Array.isArray(j)?R.push(...j):j&&R.push(j),w=N+E[0].length,k=!0),!_.global)break;E=_.exec(d.value)}return k?(w<d.value.length&&R.push({type:"text",value:d.value.slice(w)}),p.children.splice(C,1,...R)):R=[d],C+R.length}}function Lte(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([zte(i[0]),Pte(i[1])])}return t}function zte(e){return typeof e=="string"?new RegExp(Dte(e),"g"):e}function Pte(e){return typeof e=="function"?e:function(){return e}}const ly="phrasing",cy=["autolink","link","image","label"];function Ite(){return{transforms:[Wte],enter:{literalAutolink:Fte,literalAutolinkEmail:uy,literalAutolinkHttp:uy,literalAutolinkWww:uy},exit:{literalAutolink:Vte,literalAutolinkEmail:Ute,literalAutolinkHttp:Hte,literalAutolinkWww:$te}}}function Bte(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ly,notInConstruct:cy},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ly,notInConstruct:cy},{character:":",before:"[ps]",after:"\\/",inConstruct:ly,notInConstruct:cy}]}}function Fte(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function uy(e){this.config.enter.autolinkProtocol.call(this,e)}function Hte(e){this.config.exit.autolinkProtocol.call(this,e)}function $te(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Ute(e){this.config.exit.autolinkEmail.call(this,e)}function Vte(e){this.exit(e)}function Wte(e){Ote(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,qte],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Kte]],{ignore:["link","linkReference"]})}function qte(e,t,n,r,i){let o="";if(!iO(i)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!Gte(n)))return!1;const l=Yte(n+r);if(!l[0])return!1;const c={type:"link",title:null,url:o+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[c,{type:"text",value:l[1]}]:c}function Kte(e,t,n,r){return!iO(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Gte(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Yte(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=PT(e,"(");let o=PT(e,")");for(;r!==-1&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function iO(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Sl(n)||Lg(n))&&(!t||n!==47)}sO.peek=ine;function Xte(){this.buffer()}function Zte(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Qte(){this.buffer()}function Jte(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ene(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=as(this.sliceSerialize(e)).toLowerCase(),n.label=t}function tne(e){this.exit(e)}function nne(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=as(this.sliceSerialize(e)).toLowerCase(),n.label=t}function rne(e){this.exit(e)}function ine(){return"["}function sO(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const l=n.enter("footnoteReference"),c=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),c(),l(),o+=i.move("]"),o}function sne(){return{enter:{gfmFootnoteCallString:Xte,gfmFootnoteCall:Zte,gfmFootnoteDefinitionLabelString:Qte,gfmFootnoteDefinition:Jte},exit:{gfmFootnoteCallString:ene,gfmFootnoteCall:tne,gfmFootnoteDefinitionLabelString:nne,gfmFootnoteDefinition:rne}}}function one(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:sO},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,o,l){const c=o.createTracker(l);let h=c.move("[^");const d=o.enter("footnoteDefinition"),g=o.enter("label");return h+=c.move(o.safe(o.associationId(r),{before:h,after:"]"})),g(),h+=c.move("]:"),r.children&&r.children.length>0&&(c.shift(4),h+=c.move((t?`
631
+ `:" ")+o.indentLines(o.containerFlow(r,c.current()),t?oO:ane))),d(),h}}function ane(e,t,n){return t===0?e:oO(e,t,n)}function oO(e,t,n){return(n?"":" ")+e}const lne=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];aO.peek=fne;function cne(){return{canContainEols:["delete"],enter:{strikethrough:dne},exit:{strikethrough:hne}}}function une(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:lne}],handlers:{delete:aO}}}function dne(e){this.enter({type:"delete",children:[]},e)}function hne(e){this.exit(e)}function aO(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let l=i.move("~~");return l+=n.containerPhrasing(e,{...i.current(),before:l,after:"~"}),l+=i.move("~~"),o(),l}function fne(){return"~"}function mne(e){return e.length}function pne(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||mne,o=[],l=[],c=[],h=[];let d=0,g=-1;for(;++g<e.length;){const S=[],C=[];let k=-1;for(e[g].length>d&&(d=e[g].length);++k<e[g].length;){const R=gne(e[g][k]);if(n.alignDelimiters!==!1){const E=i(R);C[k]=E,(h[k]===void 0||E>h[k])&&(h[k]=E)}S.push(R)}l[g]=S,c[g]=C}let p=-1;if(typeof r=="object"&&"length"in r)for(;++p<d;)o[p]=IT(r[p]);else{const S=IT(r);for(;++p<d;)o[p]=S}p=-1;const _=[],y=[];for(;++p<d;){const S=o[p];let C="",k="";S===99?(C=":",k=":"):S===108?C=":":S===114&&(k=":");let R=n.alignDelimiters===!1?1:Math.max(1,h[p]-C.length-k.length);const E=C+"-".repeat(R)+k;n.alignDelimiters!==!1&&(R=C.length+R+k.length,R>h[p]&&(h[p]=R),y[p]=R),_[p]=E}l.splice(1,0,_),c.splice(1,0,y),g=-1;const w=[];for(;++g<l.length;){const S=l[g],C=c[g];p=-1;const k=[];for(;++p<d;){const R=S[p]||"";let E="",N="";if(n.alignDelimiters!==!1){const L=h[p]-(C[p]||0),j=o[p];j===114?E=" ".repeat(L):j===99?L%2?(E=" ".repeat(L/2+.5),N=" ".repeat(L/2-.5)):(E=" ".repeat(L/2),N=E):N=" ".repeat(L)}n.delimiterStart!==!1&&!p&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&R==="")&&(n.delimiterStart!==!1||p)&&k.push(" "),n.alignDelimiters!==!1&&k.push(E),k.push(R),n.alignDelimiters!==!1&&k.push(N),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||p!==d-1)&&k.push("|")}w.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return w.join(`
632
+ `)}function gne(e){return e==null?"":String(e)}function IT(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function vne(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const l=n.indentLines(n.containerFlow(e,o.current()),_ne);return i(),l}function _ne(e,t,n){return">"+(n?"":" ")+e}function bne(e,t){return BT(e,t.inConstruct,!0)&&!BT(e,t.notInConstruct,!1)}function BT(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function FT(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
633
+ `&&bne(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
634
+ `}function yne(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>l&&(l=o):o=1,i=r+t.length,r=n.indexOf(t,i);return l}function xne(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function wne(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Sne(e,t,n,r){const i=wne(n),o=e.value||"",l=i==="`"?"GraveAccent":"Tilde";if(xne(e,n)){const p=n.enter("codeIndented"),_=n.indentLines(o,Cne);return p(),_}const c=n.createTracker(r),h=i.repeat(Math.max(yne(o,i)+1,3)),d=n.enter("codeFenced");let g=c.move(h);if(e.lang){const p=n.enter(`codeFencedLang${l}`);g+=c.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...c.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${l}`);g+=c.move(" "),g+=c.move(n.safe(e.meta,{before:g,after:`
635
+ `,encode:["`"],...c.current()})),p()}return g+=c.move(`
636
+ `),o&&(g+=c.move(o+`
637
+ `)),g+=c.move(h),d(),g}function Cne(e,t,n){return(n?"":" ")+e}function t1(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function kne(e,t,n,r){const i=t1(n),o=i==='"'?"Quote":"Apostrophe",l=n.enter("definition");let c=n.enter("label");const h=n.createTracker(r);let d=h.move("[");return d+=h.move(n.safe(n.associationId(e),{before:d,after:"]",...h.current()})),d+=h.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=h.move("<"),d+=h.move(n.safe(e.url,{before:d,after:">",...h.current()})),d+=h.move(">")):(c=n.enter("destinationRaw"),d+=h.move(n.safe(e.url,{before:d,after:e.title?" ":`
638
+ `,...h.current()}))),c(),e.title&&(c=n.enter(`title${o}`),d+=h.move(" "+i),d+=h.move(n.safe(e.title,{before:d,after:i,...h.current()})),d+=h.move(i),c()),l(),d}function Ene(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function uh(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Bp(e,t,n){const r=Wc(e),i=Wc(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}lO.peek=Rne;function lO(e,t,n,r){const i=Ene(n),o=n.enter("emphasis"),l=n.createTracker(r),c=l.move(i);let h=l.move(n.containerPhrasing(e,{after:i,before:c,...l.current()}));const d=h.charCodeAt(0),g=Bp(r.before.charCodeAt(r.before.length-1),d,i);g.inside&&(h=uh(d)+h.slice(1));const p=h.charCodeAt(h.length-1),_=Bp(r.after.charCodeAt(0),p,i);_.inside&&(h=h.slice(0,-1)+uh(p));const y=l.move(i);return o(),n.attentionEncodeSurroundingInfo={after:_.outside,before:g.outside},c+h+y}function Rne(e,t,n){return n.options.emphasis||"*"}function Tne(e,t){let n=!1;return Jw(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Jx}),!!((!e.depth||e.depth<3)&&qw(e)&&(t.options.setext||n))}function Nne(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(Tne(e,n)){const g=n.enter("headingSetext"),p=n.enter("phrasing"),_=n.containerPhrasing(e,{...o.current(),before:`
639
+ `,after:`
640
+ `});return p(),g(),_+`
641
+ `+(i===1?"=":"-").repeat(_.length-(Math.max(_.lastIndexOf("\r"),_.lastIndexOf(`
642
+ `))+1))}const l="#".repeat(i),c=n.enter("headingAtx"),h=n.enter("phrasing");o.move(l+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
643
+ `,...o.current()});return/^[\t ]/.test(d)&&(d=uh(d.charCodeAt(0))+d.slice(1)),d=d?l+" "+d:l,n.options.closeAtx&&(d+=" "+l),h(),c(),d}cO.peek=Mne;function cO(e){return e.value||""}function Mne(){return"<"}uO.peek=Ane;function uO(e,t,n,r){const i=t1(n),o=i==='"'?"Quote":"Apostrophe",l=n.enter("image");let c=n.enter("label");const h=n.createTracker(r);let d=h.move("![");return d+=h.move(n.safe(e.alt,{before:d,after:"]",...h.current()})),d+=h.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=h.move("<"),d+=h.move(n.safe(e.url,{before:d,after:">",...h.current()})),d+=h.move(">")):(c=n.enter("destinationRaw"),d+=h.move(n.safe(e.url,{before:d,after:e.title?" ":")",...h.current()}))),c(),e.title&&(c=n.enter(`title${o}`),d+=h.move(" "+i),d+=h.move(n.safe(e.title,{before:d,after:i,...h.current()})),d+=h.move(i),c()),d+=h.move(")"),l(),d}function Ane(){return"!"}dO.peek=jne;function dO(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("![");const d=n.safe(e.alt,{before:h,after:"]",...c.current()});h+=c.move(d+"]["),l();const g=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:h,after:"]",...c.current()});return l(),n.stack=g,o(),i==="full"||!d||d!==p?h+=c.move(p+"]"):i==="shortcut"?h=h.slice(0,-1):h+=c.move("]"),h}function jne(){return"!"}hO.peek=Dne;function hO(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const l=n.unsafe[o],c=n.compilePattern(l);let h;if(l.atBreak)for(;h=c.exec(r);){let d=h.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(h.index+1)}}return i+r+i}function Dne(){return"`"}function fO(e,t){const n=qw(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}mO.peek=One;function mO(e,t,n,r){const i=t1(n),o=i==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let c,h;if(fO(e,n)){const g=n.stack;n.stack=[],c=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(e,{before:p,after:">",...l.current()})),p+=l.move(">"),c(),n.stack=g,p}c=n.enter("link"),h=n.enter("label");let d=l.move("[");return d+=l.move(n.containerPhrasing(e,{before:d,after:"](",...l.current()})),d+=l.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),d+=l.move("<"),d+=l.move(n.safe(e.url,{before:d,after:">",...l.current()})),d+=l.move(">")):(h=n.enter("destinationRaw"),d+=l.move(n.safe(e.url,{before:d,after:e.title?" ":")",...l.current()}))),h(),e.title&&(h=n.enter(`title${o}`),d+=l.move(" "+i),d+=l.move(n.safe(e.title,{before:d,after:i,...l.current()})),d+=l.move(i),h()),d+=l.move(")"),c(),d}function One(e,t,n){return fO(e,n)?"<":"["}pO.peek=Lne;function pO(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("[");const d=n.containerPhrasing(e,{before:h,after:"]",...c.current()});h+=c.move(d+"]["),l();const g=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:h,after:"]",...c.current()});return l(),n.stack=g,o(),i==="full"||!d||d!==p?h+=c.move(p+"]"):i==="shortcut"?h=h.slice(0,-1):h+=c.move("]"),h}function Lne(){return"["}function n1(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function zne(e){const t=n1(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Pne(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function gO(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Ine(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let l=e.ordered?Pne(n):n1(n);const c=e.ordered?l==="."?")":".":zne(n);let h=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(h=!0),gO(n)===l&&g){let p=-1;for(;++p<e.children.length;){const _=e.children[p];if(_&&_.type==="listItem"&&_.children&&_.children[0]&&_.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(l=c),n.bulletCurrent=l;const d=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=o,i(),d}function Bne(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Fne(e,t,n,r){const i=Bne(n);let o=n.bulletCurrent||n1(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let l=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const c=n.createTracker(r);c.move(o+" ".repeat(l-o.length)),c.shift(l);const h=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,c.current()),g);return h(),d;function g(p,_,y){return _?(y?"":" ".repeat(l))+p:(y?o:o+" ".repeat(l-o.length))+p}}function Hne(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),i(),l}const $ne=Ig(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Une(e,t,n,r){return(e.children.some(function(l){return $ne(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Vne(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}vO.peek=Wne;function vO(e,t,n,r){const i=Vne(n),o=n.enter("strong"),l=n.createTracker(r),c=l.move(i+i);let h=l.move(n.containerPhrasing(e,{after:i,before:c,...l.current()}));const d=h.charCodeAt(0),g=Bp(r.before.charCodeAt(r.before.length-1),d,i);g.inside&&(h=uh(d)+h.slice(1));const p=h.charCodeAt(h.length-1),_=Bp(r.after.charCodeAt(0),p,i);_.inside&&(h=h.slice(0,-1)+uh(p));const y=l.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:_.outside,before:g.outside},c+h+y}function Wne(e,t,n){return n.options.strong||"*"}function qne(e,t,n,r){return n.safe(e.value,r)}function Kne(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Gne(e,t,n){const r=(gO(n)+(n.options.ruleSpaces?" ":"")).repeat(Kne(n));return n.options.ruleSpaces?r.slice(0,-1):r}const _O={blockquote:vne,break:FT,code:Sne,definition:kne,emphasis:lO,hardBreak:FT,heading:Nne,html:cO,image:uO,imageReference:dO,inlineCode:hO,link:mO,linkReference:pO,list:Ine,listItem:Fne,paragraph:Hne,root:Une,strong:vO,text:qne,thematicBreak:Gne};function Yne(){return{enter:{table:Xne,tableData:HT,tableHeader:HT,tableRow:Qne},exit:{codeText:Jne,table:Zne,tableData:dy,tableHeader:dy,tableRow:dy}}}function Xne(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Zne(e){this.exit(e),this.data.inTable=void 0}function Qne(e){this.enter({type:"tableRow",children:[]},e)}function dy(e){this.exit(e)}function HT(e){this.enter({type:"tableCell",children:[]},e)}function Jne(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,ere));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function ere(e,t){return t==="|"?t:e}function tre(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
644
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:_,table:l,tableCell:h,tableRow:c}};function l(y,w,S,C){return d(g(y,S,C),y.align)}function c(y,w,S,C){const k=p(y,S,C),R=d([k]);return R.slice(0,R.indexOf(`
645
+ `))}function h(y,w,S,C){const k=S.enter("tableCell"),R=S.enter("phrasing"),E=S.containerPhrasing(y,{...C,before:o,after:o});return R(),k(),E}function d(y,w){return pne(y,{align:w,alignDelimiters:r,padding:n,stringLength:i})}function g(y,w,S){const C=y.children;let k=-1;const R=[],E=w.enter("table");for(;++k<C.length;)R[k]=p(C[k],w,S);return E(),R}function p(y,w,S){const C=y.children;let k=-1;const R=[],E=w.enter("tableRow");for(;++k<C.length;)R[k]=h(C[k],y,w,S);return E(),R}function _(y,w,S){let C=_O.inlineCode(y,w,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function nre(){return{exit:{taskListCheckValueChecked:$T,taskListCheckValueUnchecked:$T,paragraph:ire}}}function rre(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:sre}}}function $T(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function ire(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,l;for(;++o<i.length;){const c=i[o];if(c.type==="paragraph"){l=c;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function sre(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",c=n.createTracker(r);o&&c.move(l);let h=_O.listItem(e,t,n,{...r,...c.current()});return o&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),h;function d(g){return g+l}}function ore(){return[Ite(),sne(),cne(),Yne(),nre()]}function are(e){return{extensions:[Bte(),one(e),une(),tre(e),rre()]}}const lre={tokenize:mre,partial:!0},bO={tokenize:pre,partial:!0},yO={tokenize:gre,partial:!0},xO={tokenize:vre,partial:!0},cre={tokenize:_re,partial:!0},wO={name:"wwwAutolink",tokenize:hre,previous:CO},SO={name:"protocolAutolink",tokenize:fre,previous:kO},Ao={name:"emailAutolink",tokenize:dre,previous:EO},Hs={};function ure(){return{text:Hs}}let el=48;for(;el<123;)Hs[el]=Ao,el++,el===58?el=65:el===91&&(el=97);Hs[43]=Ao;Hs[45]=Ao;Hs[46]=Ao;Hs[95]=Ao;Hs[72]=[Ao,SO];Hs[104]=[Ao,SO];Hs[87]=[Ao,wO];Hs[119]=[Ao,wO];function dre(e,t,n){const r=this;let i,o;return l;function l(p){return!r0(p)||!EO.call(r,r.previous)||r1(r.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(p))}function c(p){return r0(p)?(e.consume(p),c):p===64?(e.consume(p),h):n(p)}function h(p){return p===46?e.check(cre,g,d)(p):p===45||p===95||zr(p)?(o=!0,e.consume(p),h):g(p)}function d(p){return e.consume(p),i=!0,h}function g(p){return o&&i&&Ur(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function hre(e,t,n){const r=this;return i;function i(l){return l!==87&&l!==119||!CO.call(r,r.previous)||r1(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(lre,e.attempt(bO,e.attempt(yO,o),n),n)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function fre(e,t,n){const r=this;let i="",o=!1;return l;function l(p){return(p===72||p===104)&&kO.call(r,r.previous)&&!r1(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(p),e.consume(p),c):n(p)}function c(p){if(Ur(p)&&i.length<5)return i+=String.fromCodePoint(p),e.consume(p),c;if(p===58){const _=i.toLowerCase();if(_==="http"||_==="https")return e.consume(p),h}return n(p)}function h(p){return p===47?(e.consume(p),o?d:(o=!0,h)):n(p)}function d(p){return p===null||zp(p)||gn(p)||Sl(p)||Lg(p)?n(p):e.attempt(bO,e.attempt(yO,g),n)(p)}function g(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function mre(e,t,n){let r=0;return i;function i(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),i):l===46&&r===3?(e.consume(l),o):n(l)}function o(l){return l===null?n(l):t(l)}}function pre(e,t,n){let r,i,o;return l;function l(d){return d===46||d===95?e.check(xO,h,c)(d):d===null||gn(d)||Sl(d)||d!==45&&Lg(d)?h(d):(o=!0,e.consume(d),l)}function c(d){return d===95?r=!0:(i=r,r=void 0),e.consume(d),l}function h(d){return i||r||!o?n(d):t(d)}}function gre(e,t){let n=0,r=0;return i;function i(l){return l===40?(n++,e.consume(l),i):l===41&&r<n?o(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(xO,t,o)(l):l===null||gn(l)||Sl(l)?t(l):(e.consume(l),i)}function o(l){return l===41&&r++,e.consume(l),i}}function vre(e,t,n){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),r):c===38?(e.consume(c),o):c===93?(e.consume(c),i):c===60||c===null||gn(c)||Sl(c)?t(c):n(c)}function i(c){return c===null||c===40||c===91||gn(c)||Sl(c)?t(c):r(c)}function o(c){return Ur(c)?l(c):n(c)}function l(c){return c===59?(e.consume(c),r):Ur(c)?(e.consume(c),l):n(c)}}function _re(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return zr(o)?n(o):t(o)}}function CO(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||gn(e)}function kO(e){return!Ur(e)}function EO(e){return!(e===47||r0(e))}function r0(e){return e===43||e===45||e===46||e===95||zr(e)}function r1(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const bre={tokenize:Rre,partial:!0};function yre(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Cre,continuation:{tokenize:kre},exit:Ere}},text:{91:{name:"gfmFootnoteCall",tokenize:Sre},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:xre,resolveTo:wre}}}}function xre(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const h=r.events[i][1];if(h.type==="labelImage"){l=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return c;function c(h){if(!l||!l._balanced)return n(h);const d=as(r.sliceSerialize({start:l.end,end:r.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function wre(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},c=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",l,t],["exit",l,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...c),e}function Sre(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,l;return c;function c(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),h}function h(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(p){if(o>999||p===93&&!l||p===null||p===91||gn(p))return n(p);if(p===93){e.exit("chunkString");const _=e.exit("gfmFootnoteCallString");return i.includes(as(r.sliceSerialize(_)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return gn(p)||(l=!0),o++,e.consume(p),p===92?g:d}function g(p){return p===91||p===92||p===93?(e.consume(p),o++,d):d(p)}}function Cre(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,l=0,c;return h;function h(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(w)}function g(w){if(l>999||w===93&&!c||w===null||w===91||gn(w))return n(w);if(w===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return o=as(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),_}return gn(w)||(c=!0),l++,e.consume(w),w===92?p:g}function p(w){return w===91||w===92||w===93?(e.consume(w),l++,g):g(w)}function _(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),i.includes(o)||i.push(o),Bt(e,y,"gfmFootnoteDefinitionWhitespace")):n(w)}function y(w){return t(w)}}function kre(e,t,n){return e.check(Ih,t,e.attempt(bre,t,n))}function Ere(e){e.exit("gfmFootnoteDefinition")}function Rre(e,t,n){const r=this;return Bt(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(o):n(o)}}function Tre(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(l,c){let h=-1;for(;++h<l.length;)if(l[h][0]==="enter"&&l[h][1].type==="strikethroughSequenceTemporary"&&l[h][1]._close){let d=h;for(;d--;)if(l[d][0]==="exit"&&l[d][1].type==="strikethroughSequenceTemporary"&&l[d][1]._open&&l[h][1].end.offset-l[h][1].start.offset===l[d][1].end.offset-l[d][1].start.offset){l[h][1].type="strikethroughSequence",l[d][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},l[d][1].start),end:Object.assign({},l[h][1].end)},p={type:"strikethroughText",start:Object.assign({},l[d][1].end),end:Object.assign({},l[h][1].start)},_=[["enter",g,c],["enter",l[d][1],c],["exit",l[d][1],c],["enter",p,c]],y=c.parser.constructs.insideSpan.null;y&&Si(_,_.length,0,zg(y,l.slice(d+1,h),c)),Si(_,_.length,0,[["exit",p,c],["enter",l[h][1],c],["exit",l[h][1],c],["exit",g,c]]),Si(l,d-1,h-d+3,_),h=d+_.length-2;break}}for(h=-1;++h<l.length;)l[h][1].type==="strikethroughSequenceTemporary"&&(l[h][1].type="data");return l}function o(l,c,h){const d=this.previous,g=this.events;let p=0;return _;function _(w){return d===126&&g[g.length-1][1].type!=="characterEscape"?h(w):(l.enter("strikethroughSequenceTemporary"),y(w))}function y(w){const S=Wc(d);if(w===126)return p>1?h(w):(l.consume(w),p++,y);if(p<2&&!n)return h(w);const C=l.exit("strikethroughSequenceTemporary"),k=Wc(w);return C._open=!k||k===2&&!!S,C._close=!S||S===2&&!!k,c(w)}}}class Nre{constructor(){this.map=[]}add(t,n,r){Mre(this,t,n,r)}consume(t){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function Mre(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Are(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function jre(){return{flow:{null:{name:"table",tokenize:Dre,resolveAll:Ore}}}}function Dre(e,t,n){const r=this;let i=0,o=0,l;return c;function c(I){let W=r.events.length-1;for(;W>-1;){const V=r.events[W][1].type;if(V==="lineEnding"||V==="linePrefix")W--;else break}const F=W>-1?r.events[W][1].type:null,$=F==="tableHead"||F==="tableRow"?j:h;return $===j&&r.parser.lazy[r.now().line]?n(I):$(I)}function h(I){return e.enter("tableHead"),e.enter("tableRow"),d(I)}function d(I){return I===124||(l=!0,o+=1),g(I)}function g(I){return I===null?n(I):nt(I)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),y):n(I):Dt(I)?Bt(e,g,"whitespace")(I):(o+=1,l&&(l=!1,i+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),l=!0,g):(e.enter("data"),p(I)))}function p(I){return I===null||I===124||gn(I)?(e.exit("data"),g(I)):(e.consume(I),I===92?_:p)}function _(I){return I===92||I===124?(e.consume(I),p):p(I)}function y(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(e.enter("tableDelimiterRow"),l=!1,Dt(I)?Bt(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):w(I))}function w(I){return I===45||I===58?C(I):I===124?(l=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),S):L(I)}function S(I){return Dt(I)?Bt(e,C,"whitespace")(I):C(I)}function C(I){return I===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),k):I===45?(o+=1,k(I)):I===null||nt(I)?N(I):L(I)}function k(I){return I===45?(e.enter("tableDelimiterFiller"),R(I)):L(I)}function R(I){return I===45?(e.consume(I),R):I===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(I))}function E(I){return Dt(I)?Bt(e,N,"whitespace")(I):N(I)}function N(I){return I===124?w(I):I===null||nt(I)?!l||i!==o?L(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):L(I)}function L(I){return n(I)}function j(I){return e.enter("tableRow"),O(I)}function O(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),O):I===null||nt(I)?(e.exit("tableRow"),t(I)):Dt(I)?Bt(e,O,"whitespace")(I):(e.enter("data"),H(I))}function H(I){return I===null||I===124||gn(I)?(e.exit("data"),O(I)):(e.consume(I),I===92?Z:H)}function Z(I){return I===92||I===124?(e.consume(I),H):H(I)}}function Ore(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],l=[0,0,0,0],c=!1,h=0,d,g,p;const _=new Nre;for(;++n<e.length;){const y=e[n],w=y[1];y[0]==="enter"?w.type==="tableHead"?(c=!1,h!==0&&(UT(_,t,h,d,g),g=void 0,h=0),d={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},_.add(n,0,[["enter",d,t]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(r=!0,p=void 0,o=[0,0,0,0],l=[0,n+1,0,0],c&&(c=!1,g={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},_.add(n,0,[["enter",g,t]])),i=w.type==="tableDelimiterRow"?2:g?3:1):i&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],p=Om(_,t,o,i,void 0,p),o=[0,0,0,0]),l[2]=n)):w.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(l[0]=l[1],p=Om(_,t,o,i,void 0,p)),o=l,l=[o[1],n,0,0])):w.type==="tableHead"?(c=!0,h=n):w.type==="tableRow"||w.type==="tableDelimiterRow"?(h=n,o[1]!==0?(l[0]=l[1],p=Om(_,t,o,i,n,p)):l[1]!==0&&(p=Om(_,t,l,i,n,p)),i=0):i&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(l[3]=n)}for(h!==0&&UT(_,t,h,d,g),_.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=Are(t.events,n))}return e}function Om(e,t,n,r,i,o){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(o.end=Object.assign({},Cc(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const h=Cc(t.events,n[1]);if(o={type:l,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const d=Cc(t.events,n[2]),g=Cc(t.events,n[3]),p={type:c,start:Object.assign({},d),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",p,t]]),r!==2){const _=t.events[n[2]],y=t.events[n[3]];if(_[1].end=Object.assign({},y[1].end),_[1].type="chunkText",_[1].contentType="text",n[3]>n[2]+1){const w=n[2]+1,S=n[3]-n[2]-1;e.add(w,S,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return i!==void 0&&(o.end=Object.assign({},Cc(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function UT(e,t,n,r,i){const o=[],l=Cc(t.events,n);i&&(i.end=Object.assign({},l),o.push(["exit",i,t])),r.end=Object.assign({},l),o.push(["exit",r,t]),e.add(n+1,0,o)}function Cc(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Lre={name:"tasklistCheck",tokenize:Pre};function zre(){return{text:{91:Lre}}}function Pre(e,t,n){const r=this;return i;function i(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),o)}function o(h){return gn(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),l):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),l):n(h)}function l(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(h)}function c(h){return nt(h)?t(h):Dt(h)?e.check({tokenize:Ire},t,n)(h):n(h)}}function Ire(e,t,n){return Bt(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Bre(e){return P4([ure(),yre(),Tre(e),jre(),zre()])}const Fre={};function mu(e){const t=this,n=e||Fre,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Bre(n)),o.push(ore()),l.push(are(n))}function Hre({content:e,attachments:t}){const[n,r]=v.useState(null),i=(t==null?void 0:t.find(o=>o.id===n))??null;return v.useEffect(()=>{i||r(null)},[i]),f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"flex gap-2 justify-end",children:f.jsxs("div",{className:"max-w-[85%] sm:max-w-[80%] rounded-[20px] py-1.5 px-3.5 bg-muted text-primary border border-border prose prose-sm prose-invert [&_p]:whitespace-pre-line",children:[t!=null&&t.length?f.jsx("div",{className:"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:t.map(o=>f.jsxs("button",{type:"button",className:"overflow-hidden rounded-lg border border-border/80 bg-background/70 text-left cursor-zoom-in",onClick:()=>r(o.id),children:[f.jsx("img",{src:o.previewUrl,alt:o.name,className:"h-full max-h-[220px] w-full object-cover"}),f.jsx("div",{className:"border-t border-border/60 px-2 py-1 text-[11px] text-muted-foreground",children:o.name})]},o.id))}):null,e.trim()?f.jsx(fu,{remarkPlugins:[mu],components:uu(),children:e}):null]})}),i?f.jsx("button",{type:"button",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 cursor-zoom-out",onClick:()=>r(null),children:f.jsx("img",{src:i.previewUrl,alt:i.name,className:"max-h-full max-w-full rounded-xl shadow-2xl"})}):null]})}function $re({json:e}){return f.jsx("div",{className:"flex gap-3 justify-start",children:f.jsx("div",{className:"flex-1 max-w-[90%]",children:f.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words bg-muted rounded-lg p-3 overflow-auto max-h-96",children:e})})})}function RO({title:e,count:t,children:n,badge:r}){const[i,o]=v.useState(!1);return t===0?null:f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsxs("button",{onClick:()=>o(!i),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[f.jsx(Vr,{className:pe("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",i&&"rotate-90")}),f.jsx("span",{className:"text-muted-foreground font-medium",children:e}),f.jsx("span",{className:"text-muted-foreground/60",children:t}),r]}),i&&f.jsx("div",{className:"ml-5",children:n})]})}function hy({title:e,items:t,icon:n,getIcon:r}){return t.length===0?null:f.jsx(RO,{title:e,count:t.length,children:f.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map(i=>f.jsx(p4,{icon:r?r(i):n,children:i},i))})})}function Ure(e){const t=e.match(/^mcp__([^_]+)__(.+)$/);return t?{server:t[1],tool:t[2]}:null}function TO({status:e}){const t=e==="connected"?"bg-emerald-500":e==="pending"?"bg-yellow-500":"bg-red-500";return f.jsx("span",{className:pe("inline-block h-2 w-2 rounded-full shrink-0",t)})}function Vre(e){switch(e){case"connected":return"Connected";case"failed":return"Failed";case"needs-auth":return"Needs auth";case"pending":return"Connecting...";case"disabled":return"Disabled";default:return e}}function VT({server:e}){const[t,n]=v.useState(!1),r=e.status==="connected";return f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsxs("button",{onClick:()=>r&&e.tools.length>0&&n(!t),className:pe("flex items-center gap-1.5",r&&e.tools.length>0&&"cursor-pointer hover:opacity-60 transition-opacity"),children:[r&&e.tools.length>0&&f.jsx(Vr,{className:pe("h-3 w-3 text-muted-foreground transition-transform duration-200",t&&"rotate-90")}),f.jsx(TO,{status:e.status}),f.jsx("span",{className:"text-muted-foreground font-medium",children:Py(e.name)}),r?f.jsxs("span",{className:"text-muted-foreground/50",children:[e.tools.length," tools"]}):f.jsx("span",{className:"text-muted-foreground/50",children:Vre(e.status)})]}),!r&&e.error&&f.jsx("span",{className:"text-destructive ml-5",children:e.error}),t&&e.tools.length>0&&f.jsx("div",{className:"flex flex-wrap gap-1.5 ml-5",children:e.tools.map(i=>f.jsx(p4,{icon:m4(`mcp__${e.name}__${i}`),children:i},i))})]})}function Wre({servers:e}){if(e.length===0)return null;const t=e.filter(i=>i.status==="connected"),n=e.filter(i=>i.status!=="connected"),r=n.length>0?f.jsxs("span",{className:"flex items-center gap-1 ml-1",children:[f.jsx(TO,{status:"failed"}),f.jsxs("span",{className:"text-muted-foreground/60",children:[n.length," disconnected"]})]}):null;return f.jsx(RO,{title:"MCP Servers",count:e.length,badge:r,children:f.jsxs("div",{className:"flex flex-col gap-2",children:[t.map(i=>f.jsx(VT,{server:i},i.name)),n.map(i=>f.jsx(VT,{server:i},i.name))]})})}function qre({rawJson:e}){const[t,n]=v.useState(!1);return f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsxs("button",{onClick:()=>n(!t),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[f.jsx(Vr,{className:pe("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",t&&"rotate-90")}),f.jsx("span",{className:"text-muted-foreground font-medium",children:"Raw Message"})]}),t&&f.jsx("pre",{className:"ml-5 text-xs whitespace-pre-wrap break-all border border-border rounded-md p-3 overflow-x-auto max-h-96 overflow-y-auto",children:e})]})}function Kre({message:e,rawJson:t}){const{coreTools:n,mcpServersWithTools:r}=v.useMemo(()=>{const i=new Map,o=[];for(const c of e.tools){const h=Ure(c);if(h){const d=i.get(h.server)||[];d.push(h.tool),i.set(h.server,d)}else o.push(c)}const l=e.mcpServers.map(c=>({name:c.name,status:c.status,error:c.error,tools:i.get(c.name)||[]}));return{coreTools:o,mcpServersWithTools:l}},[e.tools,e.mcpServers]);return f.jsx(Mo,{children:f.jsxs(Lh,{expandedContent:f.jsx(zh,{className:"my-4 text-xs",children:f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsx(bX,{children:e.model}),f.jsx(hy,{title:"Tools",items:n,getIcon:i=>Bx[i]??f4}),f.jsx(hy,{title:"Agents",items:e.agents,icon:E0}),f.jsx(hy,{title:"Commands",items:e.slashCommands,icon:k9}),f.jsx(Wre,{servers:r}),t&&f.jsx(qre,{rawJson:t})]})}),children:[f.jsx(KB,{className:"h-5 w-5 text-logo"}),f.jsx(wo,{children:"Session Started"})]})})}function Gre({message:e}){return f.jsx(Mo,{className:"hidden",children:f.jsxs(Lh,{expandedContent:f.jsx(zh,{className:"my-4 text-xs",children:f.jsx("pre",{className:"font-mono whitespace-pre-wrap break-all bg-muted border border-border rounded-lg p-2 max-h-64 overflow-auto",children:JSON.stringify(e.accountInfo,null,2)})}),children:[f.jsx("div",{className:"size-5 flex justify-center items-center ",children:f.jsx(E0,{className:"h-4 w-4 text-muted-foreground"})}),f.jsx(wo,{children:"Account"})]})})}function Yre({message:e}){return f.jsx("div",{className:"text-pretty prose prose-sm dark:prose-invert px-0.5 w-full max-w-full space-y-4",children:f.jsx(fu,{remarkPlugins:[mu],components:uu(),children:e.text})})}function Xre({message:e}){return f.jsx(Mo,{className:"w-full",children:f.jsxs(Lh,{expandedContent:f.jsx(zh,{className:"my-4 text-sm text-muted-foreground/90",children:f.jsx("div",{className:"text-pretty prose prose-sm max-w-full px-0.5 opacity-90 dark:prose-invert",children:f.jsx(fu,{remarkPlugins:[mu],components:uu(),children:e.text})})}),children:[f.jsx(_i,{className:"h-4 w-4 text-muted-icon"}),f.jsx(wo,{className:"text-left text-muted-foreground",children:"Thinking"})]})})}function Zre({question:e,currentIndex:t,totalQuestions:n,onBack:r,children:i}){const o=r&&t>0;return f.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[f.jsxs("div",{className:"relative",children:[f.jsxs("h3",{className:"font-medium text-foreground text-sm p-3 px-4 bg-card border-b border-border text-foreground flex flex-row items-center gap-2",children:[o?f.jsx("button",{onClick:r,className:" text-muted-foreground hover:opacity-60 transition-all flex items-center",children:f.jsx(P5,{className:"h-4 w-4 -ml-0.5",strokeWidth:3})}):n>1?f.jsxs("span",{className:"font-bold text-muted-foreground whitespace-nowrap",children:[t+1," of ",n]}):null,e]}),n>1&&f.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-border",children:f.jsx("div",{className:"h-full bg-muted-foreground/40 transition-all duration-300",style:{width:`${t/n*100}%`}})})]}),i]})}function WT({label:e,description:t}){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-foreground text-sm",children:e}),t&&f.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]})}function NO({selected:e,multiSelect:t,onClick:n}){return f.jsx("button",{type:"button",onClick:n,className:pe("flex-shrink-0 w-5 h-5 border-1 flex items-center justify-center",t?"rounded":"rounded-full",e?"border-slate-500/0 bg-foreground":"border-muted-foreground/50 bg-background",n&&e&&"cursor-pointer"),children:e&&f.jsx(Wi,{strokeWidth:3,className:"translate-y-[0.5px] h-3 w-3 text-white dark:text-background"})})}function Qre({option:e,selected:t,multiSelect:n,onClick:r,isLast:i}){const o="w-full text-left p-3 pt-2.5 pl-4 pr-5 bg-background",l=i?"":"border-b border-border";return r?f.jsx("button",{onClick:r,className:pe(o,l,"transition-all cursor-pointer"),children:f.jsxs("div",{className:"flex items-center justify-between gap-3",children:[f.jsx("div",{className:"flex-1 min-w-0",children:f.jsx(WT,{label:e.label,description:e.description})}),f.jsx(NO,{selected:t,multiSelect:n})]})}):f.jsx("div",{className:pe(o,l),children:f.jsx(WT,{label:e.label,description:e.description})})}function Jre(e){return e==null?void 0:e.answers}function ns(e){return e.id||e.question}function eie({message:e,onSubmit:t,isLatest:n}){var D,U;const r=e.input.questions,i=!!e.result,o=Jre(e.result),l=((D=e.result)==null?void 0:D.discarded)===!0,[c,h]=v.useState(0),[d,g]=v.useState({}),[p,_]=v.useState({}),[y,w]=v.useState(o??null),[S,C]=v.useState(i),k=(z,G)=>{var ie;const M=(ie=p[z])==null?void 0:ie.trim(),B=d[z]||"",X=G||r.find(J=>ns(J)===z);if(X!=null&&X.multiSelect)return[B,M].filter(Boolean).flatMap(J=>J.split(", ").filter(Boolean));const A=M||B;return A?[A]:[]},R=z=>{const G=d[ns(z)]||"";return z.multiSelect?G.split(", ").filter(Boolean):[G]},E=(z,G)=>{const M=ns(z);if(z.multiSelect){const B=d[M]?d[M].split(", ").filter(Boolean):[],X=B.includes(G)?B.filter(A=>A!==G):[...B,G];g({...d,[M]:X.join(", ")})}else g({...d,[M]:G}),_({...p,[M]:""}),c<r.length-1&&setTimeout(()=>h(c+1),150)},N=(z,G)=>{const M=ns(z);_({...p,[M]:G}),G&&!z.multiSelect&&g({...d,[M]:""})},L=z=>{const G=ns(z);z.multiSelect&&p[G]&&_({...p,[G]:""})},j=r.every(z=>k(ns(z),z).length>0),O=r[c],H=c===r.length-1,Z=O&&k(ns(O),O).length>0,I=()=>{c<r.length-1&&h(c+1)},W=()=>{c>0&&h(c-1)},F=()=>{if(!j)return;const z={};for(const G of r){const M=ns(G);z[M]=k(M,G)}w(z),C(!0),t(e.toolId,r,z)},$=z=>{if(z.key==="Enter"&&!(!O||!Z)){if(z.preventDefault(),H){F();return}I()}};if(S||i){const z=o||y||{};return f.jsx("div",{className:"w-full",children:f.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[f.jsxs("div",{className:"font-medium text-sm p-3 px-4 pr-5 bg-muted border-b border-border flex flex-row items-center justify-between",children:[f.jsxs("p",{children:["Question",r.length!==1?"s":""]}),f.jsx("p",{className:"",children:l?"Discarded":"Answers"})]}),r.map((G,M)=>{const B=z[ns(G)]||z[G.question]||[],X=M===r.length-1;return f.jsxs("div",{className:pe("w-full p-3 pt-2.5 pl-4 pr-5 bg-background flex items-center justify-between gap-3",!X&&"border-b border-border"),children:[f.jsx("div",{className:"text-sm text-pretty",children:G.question}),B.length>0&&f.jsx("div",{className:"text-sm font-medium text-right max-w-[50%] text-pretty",children:B.join(", ")}),B.length===0&&f.jsx("div",{className:"text-sm font-medium text-right italic",children:l?"Discarded":"No Response"})]},ns(G))})]})})}if(!n)return f.jsx("div",{className:"w-full py-2",children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx($5,{className:"h-4 w-4 text-muted-foreground"}),f.jsx("span",{className:"text-sm text-muted-foreground",children:"Questions pending (newer question active)"})]})});if(!O)return null;const V=R(O),q=p[ns(O)]||"";return f.jsxs("div",{className:"w-full space-y-3",children:[f.jsxs(Zre,{question:O.question,currentIndex:c,totalQuestions:r.length,onBack:c>0?W:void 0,children:[(U=O.options)==null?void 0:U.map(z=>f.jsx(Qre,{option:z,selected:V.includes(z.label),multiSelect:O.multiSelect,onClick:()=>E(O,z.label)},z.label)),f.jsx("div",{className:"transition-all bg-background",children:f.jsxs("div",{className:"flex pr-5 items-center justify-between gap-3",children:[f.jsx("input",{type:"text",value:q,onChange:z=>N(O,z.target.value),onKeyDown:$,placeholder:"Other...",className:"flex-1 px-3 !py-1 pl-4 min-h-[55px] min-w-0 text-base md:text-sm bg-transparent outline-none text-foreground placeholder:text-muted-foreground"}),f.jsx(NO,{selected:!!q,multiSelect:O.multiSelect,onClick:O.multiSelect&&q?()=>L(O):void 0})]})})]}),f.jsxs("div",{className:"flex justify-end gap-2 mx-2",children:[!H&&Z&&(O.multiSelect||!!q)&&f.jsx(Qe,{size:"sm",onClick:I,children:"Next"}),H&&f.jsx(Qe,{size:"sm",onClick:F,disabled:!j,className:pe(!j&&"opacity-50 cursor-not-allowed","rounded-full"),children:"Submit"})]})]})}async function tie(e){const t=await new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{if(typeof i.result=="string"){n(i.result);return}r(new Error("Failed to read image attachment"))},i.onerror=()=>r(i.error??new Error("Failed to read image attachment")),i.readAsDataURL(e)});return{type:"image",name:e.name,mimeType:e.type,sizeBytes:e.size,dataUrl:t}}function Lm(e){return String(e).padStart(2,"0")}function nie(e,t=new Date){const n=e?new Date(e):null,r=n&&!Number.isNaN(n.getTime())?n:t;return["kaizen-plan",`${r.getFullYear()}-${Lm(r.getMonth()+1)}-${Lm(r.getDate())}`,`${Lm(r.getHours())}-${Lm(r.getMinutes())}.md`].join("-")}function rie(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}function iie({message:e,onConfirm:t,isLatest:n,isActionable:r=n}){const i=!!e.result,[o,l]=v.useState(!1),[c,h]=v.useState(!1),[d,g]=v.useState(!1),[p,_]=v.useState(""),[y,w]=v.useState([]),[S,C]=v.useState(null),[k,R]=v.useState(!1),[E,N]=v.useState(!1),[L,j]=v.useState(null),O=v.useRef(null),H=v.useRef(null),Z=v.useRef(null),I=e.input;v.useEffect(()=>{d&&O.current&&O.current.focus()},[d]),v.useEffect(()=>()=>{for(const z of y)URL.revokeObjectURL(z.previewUrl);Z.current&&clearTimeout(Z.current)},[y]);const W=async()=>{var z;if(I!=null&&I.plan)try{if((z=navigator.clipboard)!=null&&z.writeText)await navigator.clipboard.writeText(I.plan);else if(!rie(I.plan))throw new Error("Clipboard copy failed");h(!0),Ec("Plan copied to clipboard."),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>h(!1),2e3)}catch{Ec("Failed to copy plan.")}},F=v.useCallback(()=>{if(!(I!=null&&I.plan))return;const z=new Blob([I.plan],{type:"text/markdown;charset=utf-8"}),G=URL.createObjectURL(z),M=document.createElement("a");M.href=G,M.download=nie(e.timestamp),M.click(),URL.revokeObjectURL(G)},[I==null?void 0:I.plan,e.timestamp]),$=v.useCallback(z=>{const G=z.filter(M=>M.type.startsWith("image/"));if(G.length===0){C("Only PNG, JPEG, WEBP, and GIF images are supported.");return}w(M=>{const B=[...M];let X=null;for(const A of G){if(!pp.includes(A.type)){X=`Unsupported image type: ${A.type||"unknown"}`;continue}if(A.size<=0||A.size>OM){X=`${A.name} is empty or larger than 10 MB.`;continue}if(B.length>=mp){X=`You can attach up to ${mp} images per message.`;break}B.push({id:Od(),file:A,name:A.name||"image",mimeType:A.type,sizeBytes:A.size,previewUrl:URL.createObjectURL(A)})}return C(X),B})},[]),V=v.useCallback(z=>{w(G=>{const M=G.find(B=>B.id===z);return M&&URL.revokeObjectURL(M.previewUrl),G.filter(B=>B.id!==z)}),C(null)},[]),q=async()=>{if(!(!p.trim()&&y.length===0)){N(!0);try{const z=y.length?await Promise.all(y.map(G=>tie(G.file))):void 0;t(e.toolId,!1,void 0,p.trim(),z)}finally{N(!1)}}},D=i?e.result:null,U=(D==null?void 0:D.discarded)===!0;return f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsxs("div",{className:"relative rounded-2xl border border-border overflow-hidden group/plan",children:[(I==null?void 0:I.plan)&&f.jsx(Qe,{variant:"ghost",size:"icon",className:pe("absolute top-2 right-2 z-10 h-8 w-8 rounded-md text-muted-foreground opacity-100 transition-opacity",!c&&"md:opacity-0 md:group-hover/plan:opacity-100",!c&&"hover:text-foreground",c&&"hover:!bg-transparent hover:!border-transparent"),onClick:W,"aria-label":c?"Plan copied":"Copy plan",title:c?"Plan copied":"Copy plan",children:c?f.jsx(Wi,{className:"h-4 w-4 text-green-400"}):f.jsx(ul,{className:"h-4 w-4"})}),f.jsxs("div",{className:pe("!pt-5 !pb-0 px-4 md:py-4.5 md:px-5.5 bg-muted dark:bg-card overflow-scroll no-pre-highlight transition-all",i&&!o?"max-h-[min(400px,40vh)] ":"",i?"hover:!pb-[32px]":""),children:[i&&f.jsxs(Qe,{variant:"ghost",className:"absolute z-10 bottom-2 pr-2.5 !pl-3.5 h-[34px] inline-flex gap-1 text-sm left-[50%] -translate-x-[50%] text-muted-foreground backdrop-blur-sm hover:text-foreground opacity-0 group-hover/plan:opacity-100 transition-all rounded-full border border-border",onClick:()=>l(!o),children:[o?"Show Less":"Show More",f.jsx(ng,{className:`size-3.5 transition-transform ${o?"rotate-180":""}`})]}),I!=null&&I.plan?f.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:[f.jsx(fu,{remarkPlugins:[mu],components:uu(),children:I.plan}),f.jsx("div",{className:"mt-5"})]}):f.jsx("p",{className:"text-sm text-muted-foreground",children:"No plan provided"})]})]}),i?f.jsx("div",{className:"flex justify-end mx-2",children:f.jsxs("span",{className:"pl-4 inline text-sm font-medium bg-background text-foreground/60 border border-border py-1.5 px-3 rounded-[20px] leading-relaxed max-w-[85%] sm:max-w-[80%]",children:[f.jsx("em",{children:U?"Discarded":D!=null&&D.clearContext?"Approved & Cleared Context":D!=null&&D.confirmed?"Approved":D!=null&&D.message?`Adjusted: "${D.message}"`:"Adjusted Plan"}),f.jsx(_8,{className:"inline h-4 w-4 ml-1.5 -mt-0.5"})]})}):n?r?f.jsxs("div",{className:"flex flex-col gap-3",children:[!d&&f.jsxs("div",{className:"flex flex-col gap-2 mx-2 md:flex-row md:items-center md:justify-between",children:[f.jsx("div",{className:"flex items-center gap-2",children:I!=null&&I.plan?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"hidden items-center gap-2 md:flex",children:[f.jsxs(Qe,{type:"button",size:"sm",variant:"outline",className:"rounded-full",onClick:()=>void W(),children:[c?f.jsx(Wi,{className:"h-4 w-4 mr-1.5 text-green-400"}):f.jsx(ul,{className:"h-4 w-4 mr-1.5"}),c?"Copied":"Copy"]}),f.jsxs(Qe,{type:"button",size:"sm",variant:"outline",className:"rounded-full",onClick:F,children:[f.jsx(j2,{className:"h-4 w-4 mr-1.5"}),"Download .md"]})]}),f.jsxs("div",{className:"md:hidden",children:[f.jsx(Qe,{type:"button",size:"icon",variant:"outline",className:"rounded-full","aria-label":"More plan actions",title:"More plan actions",onClick:z=>{const G=z.currentTarget.getBoundingClientRect();j({x:G.left,y:G.bottom+4})},children:f.jsx(x8,{className:"h-4 w-4"})}),f.jsxs(pw,{open:L!==null,onOpenChange:z=>{z||j(null)},position:L,children:[f.jsxs(rh,{onSelect:()=>{j(null),W()},children:[f.jsx(ul,{className:"h-4 w-4"}),f.jsx("span",{children:"Copy"})]}),f.jsxs(rh,{onSelect:()=>{j(null),F()},children:[f.jsx(j2,{className:"h-4 w-4"}),f.jsx("span",{children:"Download .md"})]})]})]})]}):null}),f.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center justify-end gap-2",children:[f.jsxs(Qe,{size:"sm",onClick:()=>t(e.toolId,!0,!0),className:"rounded-full bg-primary text-primary-foreground pr-4 md:order-last",children:[f.jsx(XB,{className:"h-4 w-4 mr-1.5"}),"Approve & Clear"]}),f.jsxs("div",{className:"flex items-stretch md:items-center gap-2 md:contents",children:[f.jsxs(Qe,{size:"sm",variant:"outline",onClick:()=>g(!0),className:"rounded-full border-border flex-1 md:flex-initial md:order-first",children:[f.jsx(Bc,{className:"h-4 w-4 mr-1.5"}),"Suggest Edits"]}),f.jsxs(Qe,{size:"sm",variant:"outline",onClick:()=>t(e.toolId,!0),className:"rounded-full border-border flex-1 md:flex-initial",children:[f.jsx(Wi,{className:"h-4 w-4 mr-1.5"}),"Approve"]})]})]})]}),d&&f.jsxs("div",{className:pe("flex flex-col gap-2 rounded-2xl border bg-muted dark:bg-card px-4 py-3 transition-colors",k?"border-foreground/40 bg-muted/80":"border-border"),onDragEnter:z=>{z.dataTransfer.types.includes("Files")&&(z.preventDefault(),R(!0))},onDragOver:z=>{z.dataTransfer.types.includes("Files")&&(z.preventDefault(),z.dataTransfer.dropEffect="copy",R(!0))},onDragLeave:z=>{if(!z.dataTransfer.types.includes("Files"))return;z.preventDefault();const G=z.relatedTarget;G instanceof Node&&z.currentTarget.contains(G)||R(!1)},onDrop:z=>{var G;z.dataTransfer.types.includes("Files")&&(z.preventDefault(),R(!1),$(Array.from(z.dataTransfer.files)),(G=O.current)==null||G.focus())},children:[f.jsx("input",{ref:H,type:"file",accept:pp.join(","),multiple:!0,className:"hidden",onChange:z=>{$(Array.from(z.target.files??[])),z.target.value=""}}),y.length?f.jsx("div",{className:"grid grid-cols-2 gap-2 pt-1 pb-2 sm:grid-cols-3",children:y.map(z=>f.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border/80 bg-background/80",children:[f.jsx("img",{src:z.previewUrl,alt:z.name,className:"h-28 w-full object-cover"}),f.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 px-2 py-1.5",children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:"truncate text-xs text-foreground",children:z.name}),f.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[Math.max(1,Math.round(z.sizeBytes/1024))," KB"]})]}),f.jsx(Qe,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>V(z.id),disabled:E,children:f.jsx(_o,{className:"h-3.5 w-3.5"})})]})]},z.id))}):null,f.jsx("textarea",{ref:O,value:p,onChange:z=>_(z.target.value),onPaste:z=>{const G=Array.from(z.clipboardData.files);G.some(M=>M.type.startsWith("image/"))&&(z.preventDefault(),$(G))},onKeyDown:z=>{z.key==="Enter"&&!z.shiftKey&&(p.trim()||y.length>0)&&(z.preventDefault(),q()),z.key==="Escape"&&(g(!1),_(""),w([]),C(null))},placeholder:"Describe what you'd like to change...",rows:3,className:"w-full bg-transparent text-[16px] md:text-sm text-foreground placeholder:text-muted-foreground resize-none outline-none"}),S?f.jsx("div",{className:"text-xs text-destructive",children:S}):null,f.jsxs("div",{className:"flex items-center justify-between mt-1",children:[f.jsx(Qe,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 rounded-full text-muted-foreground hover:text-foreground",onClick:()=>{var z;return(z=H.current)==null?void 0:z.click()},disabled:E,children:f.jsx(W5,{className:"h-4 w-4"})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Qe,{size:"sm",variant:"ghost",onClick:()=>{g(!1),_(""),w([]),C(null)},className:"rounded-full text-muted-foreground",disabled:E,children:"Cancel"}),f.jsxs(Qe,{size:"sm",disabled:!p.trim()&&y.length===0||E,onClick:()=>void q(),className:"rounded-full bg-primary text-primary-foreground disabled:opacity-50 disabled:pointer-events-none",children:[f.jsx(b9,{className:"h-4 w-4 mr-1.5"}),E?"Adjusting...":"Adjust Plan"]})]})]})]})]}):f.jsx("div",{className:"flex justify-end mx-2",children:f.jsx("span",{className:"inline text-sm text-muted-foreground italic",children:"Plan pending"})}):f.jsx("div",{className:"flex justify-end mx-2",children:f.jsx("span",{className:"inline text-sm text-muted-foreground italic",children:"Plan pending (newer prompt active)"})})]})}const sie={completed:{Icon:Wi,iconClass:"text-emerald-500",textClass:"text-muted-foreground"},in_progress:{Icon:Lr,iconClass:"text-foreground animate-spin",textClass:"text-foreground font-medium"},pending:{Icon:u8,iconClass:"text-muted-foreground",textClass:"text-muted-foreground"}};function oie({message:e}){const t=e.input.todos;return t.length?f.jsx("div",{className:"w-full",children:f.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[f.jsxs("h3",{className:"font-medium text-foreground text-sm p-3 px-4 bg-card border-b border-border flex items-center gap-2",children:[f.jsx(K8,{className:"h-4 w-4 text-muted-foreground"}),"Progress"]}),f.jsx("div",{children:t.map((n,r)=>{const i=r===t.length-1,{Icon:o,iconClass:l,textClass:c}=sie[n.status];return f.jsxs("div",{className:pe("flex items-center gap-3 px-4 py-2.5 bg-background",!i&&"border-b border-border"),children:[f.jsx(o,{className:pe("h-4 w-4 flex-shrink-0",l)}),f.jsx("span",{className:pe("text-sm",c),children:n.status==="in_progress"?n.activeForm:n.content})]},r)})})]})}):null}function aie(e){const t=e.split(`
646
+ `),n=/^\s*(\d+)→(.*)$/;return t.map(r=>{const i=r.match(n);return i?{lineNumber:parseInt(i[1],10),content:i[2]}:{lineNumber:null,content:r}})}function lie(e){return e.replace(/<[^>]+>/g,"")}function cie(e,t){const n=e.split(`
647
+ `),r=t.split(`
648
+ `),i=uie(n,r),o=die(n,r,i);return hie(o)}function uie(e,t){const n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let o=1;o<=n;o++)for(let l=1;l<=r;l++)i[o][l]=e[o-1]===t[l-1]?i[o-1][l-1]+1:Math.max(i[o-1][l],i[o][l-1]);return i}function die(e,t,n){const r=[];let i=e.length,o=t.length;for(;i>0||o>0;)i>0&&o>0&&e[i-1]===t[o-1]?(r.push({type:"context",text:e[i-1],oldIdx:i,newIdx:o}),i--,o--):o>0&&(i===0||n[i][o-1]>=n[i-1][o])?(r.push({type:"added",text:t[o-1],oldIdx:i,newIdx:o}),o--):(r.push({type:"removed",text:e[i-1],oldIdx:i,newIdx:o}),i--);return r.reverse()}function hie(e){return e.map(t=>{const n=t.type==="removed"?"-":t.type==="added"?"+":" ";return{type:t.type,content:`${n}${t.text}`}})}function fy({content:e,isDiff:t=!1,oldString:n,newString:r}){const i=v.useMemo(()=>t&&n!==void 0&&r!==void 0?cie(n,r):[],[t,n,r]),o=v.useMemo(()=>t?[]:aie(e),[e,t]),l=v.useMemo(()=>o.some(c=>c.lineNumber!==null),[o]);return t&&i.length>0?f.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:f.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:f.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:f.jsx("tbody",{children:i.map((c,h)=>{const d=c.type==="removed"?"bg-red-500/10 dark:bg-red-500/15":c.type==="added"?"bg-green-500/10 dark:bg-green-500/15":"",g=c.type==="removed"?"text-red-700 dark:text-red-400":c.type==="added"?"text-green-700 dark:text-green-400":"text-foreground";return f.jsxs("tr",{className:d,children:[f.jsx("td",{className:`px-2 py-0 select-none w-0 whitespace-nowrap ${c.type==="removed"?"text-red-500/50":c.type==="added"?"text-green-500/50":"text-muted-foreground/50"}`,children:c.type==="removed"?"-":c.type==="added"?"+":" "}),f.jsx("td",{className:`px-2 py-0 whitespace-pre select-all ${g}`,children:c.content.slice(1)})]},h)})})})})}):f.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:f.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:f.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:f.jsx("tbody",{children:o.map((c,h)=>f.jsxs("tr",{children:[l&&f.jsx("td",{className:"px-2 py-0 select-none w-0 whitespace-nowrap text-muted-foreground/50 text-right",children:c.lineNumber!==null?c.lineNumber:""}),f.jsx("td",{className:"px-2 py-0 whitespace-pre select-all text-foreground",children:lie(c.content)})]},h))})})})})}function MO({message:e,isLoading:t=!1,localPath:n}){var k;const r=e.result!==void 0,i=!r&&t,o=v.useMemo(()=>{if(typeof e.result=="string")return e.result;if(!e.result)return"";if(typeof e.result=="object"&&e.result!==null&&"content"in e.result){const R=e.result.content;if(typeof R=="string")return R}return JSON.stringify(e.result,null,2)},[e.result]),l=v.useMemo(()=>{if((e.toolKind==="read_file"||e.toolKind==="write_file"||e.toolKind==="edit_file")&&e.input.filePath)return e.input.filePath;if(e.toolKind==="edit_file"){const R=o.match(/^Updated\s+(.+)$/m);if(R!=null&&R[1])return R[1].trim()}return""},[e.input,e.toolKind,o]),c=v.useMemo(()=>{if(e.toolKind==="skill")return e.input.skill;if(e.toolKind==="glob")return`Search files ${e.input.pattern==="**/*"?"in all directories":`matching ${e.input.pattern}`}`;if(e.toolKind==="grep"){const R=e.input.pattern,E=e.input.outputMode;return E==="count"?`Count \`${R}\` occurrences`:E==="content"?`Find \`${R}\` in text`:`Find \`${R}\` in files`}return e.toolKind==="bash"?e.input.description||(e.input.command?xH(e.input.command):"Bash"):e.toolKind==="web_search"?e.input.query||"Web Search":e.toolKind==="read_file"?l?`Read ${Ub(l,n)}`:"Read file":e.toolKind==="write_file"?l?`Write ${Ub(l,n)}`:"Write file":e.toolKind==="edit_file"?l?`Edit ${Ub(l,n)}`:"Edit file":e.toolKind==="mcp_generic"?`${Py(e.input.tool)} from ${Py(e.input.server)}`:e.toolKind==="subagent_task"&&e.input.subagentType||e.toolName},[l,e.input,e.toolKind,e.toolName,n]),h=v.useMemo(()=>e.toolKind==="subagent_task",[e.toolKind]),d=v.useMemo(()=>{if(e.toolKind==="skill")return e.input.skill},[e.input,e.toolKind]),g=e.toolKind==="bash",p=e.toolKind==="write_file",_=e.toolKind==="edit_file",y=e.toolKind==="read_file",w=y&&!!o.trim(),S=_&&(!!e.input.oldString.trim()||!!e.input.newString.trim()),C=v.useMemo(()=>{switch(e.toolKind){case"bash":return e.input.command;case"write_file":return e.input.content;default:return JSON.stringify(e.input,null,2)}},[e]);return f.jsx(Mo,{className:"w-full",children:f.jsxs(Lh,{expandedContent:f.jsx(zh,{className:"my-4 text-sm",children:f.jsxs("div",{className:"flex flex-col gap-2",children:[_?S?f.jsx(fy,{content:"",isDiff:!0,oldString:e.input.oldString,newString:e.input.newString}):o.trim()?f.jsx(Vb,{label:e.isError?"Error":"Result",copyText:o,children:o}):f.jsx("div",{className:"text-muted-foreground text-xs",children:"Cursor completed this edit, but ACP did not include the file diff details."}):!y&&!p&&f.jsx(Vb,{label:g?f.jsxs("span",{className:"flex items-center gap-2 w-full",children:[f.jsx("span",{children:"Command"}),!!e.input.timeoutMs&&f.jsxs("span",{className:"text-muted-foreground",children:["timeout: ",String(e.input.timeoutMs),"ms"]}),!!e.input.runInBackground&&f.jsx("span",{className:"text-muted-foreground",children:"background"})]}):p?"Contents":"Input",copyText:C,children:C}),r&&y&&!e.isError&&(w?f.jsx(fy,{content:o}):f.jsx("div",{className:"text-muted-foreground text-xs",children:"Cursor completed this read, but ACP did not include the file contents."})),p&&!e.isError&&f.jsx(fy,{content:e.input.content}),r&&!y&&!(p&&!e.isError)&&!(_&&!e.isError)&&f.jsx(Vb,{label:e.isError?"Error":"Result",copyText:o,children:o})]})}),children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:(()=>{if(e.isError)return f.jsx(_o,{className:"size-4 text-destructive"});if(h)return f.jsx(E0,{className:"size-4 text-muted-icon"});const R=m4(e.toolName);return f.jsx(R,{className:"size-4 text-muted-icon"})})()}),f.jsx(wo,{className:"text-left transition-opacity duration-200 truncate",children:f.jsx(_g,{animate:i,shimmerWidth:Math.max(20,(((k=d||c)==null?void 0:k.length)??33)*3),children:d||c})})]})})}function fie({message:e}){const t=n=>{if(n<1e3)return`${n}ms`;const r=Math.floor(n/1e3),i=Math.floor(r/3600),o=Math.floor(r%3600/60),l=r%60;return i>0?`${i}h${o>0?` ${o}m`:""}`:o>0?`${o}m${l>0?` ${l}s`:""}`:`${l}s`};return e.success?f.jsxs(Mo,{className:`px-0.5 text-xs tracking-wide ${e.durationMs>6e4?"":"hidden"}`,children:[f.jsx("div",{className:"w-full h-[1px] bg-border"}),f.jsxs(wo,{className:"whitespace-nowrap text-[11px] tracking-widest text-muted-foreground/60 uppercase flex-shrink-0",children:["Worked for ",t(e.durationMs)]}),f.jsx("div",{className:"w-full h-[1px] bg-border"})]}):f.jsx("div",{className:"px-4 py-3 mx-2 my-1 rounded-lg bg-destructive/10 border border-destructive/20 text-destructive text-sm",children:e.result||"An unknown error occurred."})}function mie({message:e}){return f.jsx("div",{className:"flex items-center justify-end gap-2 text-sm text-muted-foreground my-3",children:f.jsxs("div",{className:"inline-flex gap-1.5 items-center justify-center whitespace-nowrap text-sm font-medium bg-background text-foreground/60 border border-border h-9 pl-1 pr-4 rounded-full",children:[f.jsx(l8,{className:"h-4 w-4 ml-1.5"}),f.jsx("em",{children:"Interrupted"})]})})}function Fp({size:e=4}){return f.jsxs("svg",{className:"flex-1",viewBox:`0 0 100 ${e}`,preserveAspectRatio:"none",style:{height:`${e}px`},children:[f.jsx("pattern",{id:"zigzag",width:e,height:e,patternUnits:"userSpaceOnUse",children:f.jsx("path",{d:`M0 ${e} L${e/2} 0 L${e} ${e}`,fill:"none",stroke:"currentColor",strokeWidth:"0.5",className:"text-muted-foreground/30",style:{stroke:"currentColor"}})}),f.jsx("rect",{width:"100%",height:e,fill:"url(#zigzag)",className:"text-muted-foreground/30"})]})}function pie(){return f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Fp,{}),f.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Compacted"}),f.jsx(Fp,{})]})}function gie(){return f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Fp,{}),f.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Context Cleared"}),f.jsx(Fp,{})]})}function vie({message:e}){return f.jsx(Mo,{children:f.jsxs(Lh,{expandedContent:f.jsx(zh,{className:"my-4 text-xs",children:f.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:f.jsx(fu,{remarkPlugins:[mu],components:uu(),children:e.summary})})}),children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:f.jsx(U5,{className:"h-4.5 w-4.5 text-muted-foreground"})}),f.jsx(wo,{children:"Summarized"})]})})}const _ie={compacting:"Compacting..."};function bie({message:e}){const t=_ie[e.status]||e.status;return f.jsxs(Mo,{className:"grid grid-cols-[auto_1fr] items-center gap-1.5 text-sm animate-pulse",children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:f.jsx(U5,{className:"h-4.5 w-4.5 text-muted-foreground"})}),f.jsx(wo,{className:"text-left transition-opacity duration-200 truncate",children:t})]})}const yie={read_file:{key:"read",singular:"read",plural:"reads"},edit_file:{key:"edit",singular:"edit",plural:"edits"},write_file:{key:"write",singular:"write",plural:"writes"},bash:{key:"bash",singular:"command",plural:"commands"},grep:{key:"grep",singular:"search",plural:"searches"},glob:{key:"glob",singular:"glob",plural:"globs"},subagent_task:{key:"task",singular:"agent",plural:"agents"},web_search:{key:"websearch",singular:"web search",plural:"web searches"},skill:{key:"skill",singular:"skill",plural:"skills"},todo_write:{key:"todo",singular:"todo update",plural:"todo updates"}},xie={key:"other",singular:"tool call",plural:"tool calls"};function wie(e){return yie[e]??xie}function Sie(e){const t=new Map,n=[];for(const r of e){const i=r.toolKind,o=wie(i),l=t.get(o.key);l?l.count++:(t.set(o.key,{category:o,count:1}),n.push(o.key))}return n.map(r=>{const{category:i,count:o}=t.get(r);return`${o} ${o===1?i.singular:i.plural}`}).join(", ")}function Cie({messages:e,isLoading:t,localPath:n}){const[r,i]=v.useState(!1),o=v.useMemo(()=>Sie(e),[e]),c=e.some(h=>h.result===void 0)&&t;return f.jsx(Mo,{className:"w-full",children:f.jsxs("div",{className:"flex flex-col w-full",children:[f.jsx("button",{onClick:()=>i(!r),className:`group cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${!r&&!c?"hover:opacity-60 transition-opacity":""}`,children:f.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:f.jsx(Vr,{className:`h-4.5 w-4.5 text-muted-icon transition-all duration-200 ${r?"rotate-90":""}`})}),f.jsx(wo,{className:"text-left",children:f.jsx(_g,{animate:c,children:o})})]})}),r&&f.jsxs("div",{className:"my-4 flex flex-col gap-3",children:[e.map(h=>f.jsx(MO,{message:h,isLoading:t,localPath:n},h.id)),e.length>5&&f.jsx("button",{onClick:()=>i(!1),className:"cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-xs hover:opacity-80 transition-opacity",children:f.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:f.jsx(Vr,{className:"h-4.5 w-4.5 text-muted-icon -rotate-90"})}),f.jsx(wo,{className:"text-left",children:"Collapse"})]})})]})]})})}const kie=new Set(["AskUserQuestion","ExitPlanMode","TodoWrite"]);function qT(e){if(e.kind!=="tool")return!1;const t=e.toolName;return!kie.has(t)}function Eie(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(qT(r)){const i=[r],o=n;for(n+=1;n<e.length&&qT(e[n]);)i.push(e[n]),n+=1;i.length>=2?t.push({type:"tool-group",messages:i,startIndex:o}):t.push({type:"single",message:r,index:o});continue}t.push({type:"single",message:r,index:n}),n+=1}return t}function Rie({messages:e,isLoading:t,localPath:n,latestToolIds:r,onOpenLocalLink:i,onAskUserQuestionSubmit:o,onExitPlanModeConfirm:l,pendingTool:c}){const h=v.useMemo(()=>Eie(e),[e]);function d(g,p){if(g.kind==="user_prompt")return f.jsx(Hre,{content:g.content,attachments:g.attachments},g.id);switch(g.kind){case"unknown":return f.jsx($re,{json:g.json},g.id);case"system_init":return e.findIndex(y=>y.kind==="system_init")===p?f.jsx(Kre,{message:g,rawJson:g.debugRaw},g.id):null;case"account_info":return e.findIndex(y=>y.kind==="account_info")===p?f.jsx(Gre,{message:g},g.id):null;case"assistant_text":return f.jsx(Yre,{message:g},g.id);case"assistant_thought":return f.jsx(Xre,{message:g},g.id);case"tool":return g.toolKind==="ask_user_question"?f.jsx(eie,{message:g,onSubmit:o,isLatest:g.id===r.AskUserQuestion},g.id):g.toolKind==="exit_plan_mode"?f.jsx(iie,{message:g,onConfirm:l,isLatest:g.id===r.ExitPlanMode,isActionable:(c==null?void 0:c.toolKind)==="exit_plan_mode"&&c.toolUseId===g.toolId},g.id):g.toolKind==="todo_write"?g.id!==r.TodoWrite?null:f.jsx(oie,{message:g},g.id):f.jsx(MO,{message:g,isLoading:t,localPath:n},g.id);case"result":{const _=e[p+1],y=e[p-1];return(_==null?void 0:_.kind)==="context_cleared"||(y==null?void 0:y.kind)==="context_cleared"?null:f.jsx(fie,{message:g},g.id)}case"interrupted":return f.jsx(mie,{message:g},g.id);case"compact_boundary":return f.jsx(pie,{},g.id);case"context_cleared":return f.jsx(gie,{},g.id);case"compact_summary":return f.jsx(vie,{message:g},g.id);case"status":return p===e.length-1?f.jsx(bie,{message:g},g.id):null}}return f.jsx(vX,{onOpenLocalLink:i,children:h.map(g=>{if(g.type==="tool-group")return f.jsx("div",{className:"group relative",[lp]:"",children:f.jsx(Cie,{messages:g.messages,isLoading:t,localPath:n})},`group-${g.startIndex}`);const p=d(g.message,g.index);return p?f.jsx("div",{id:`msg-${g.message.id}`,className:"group relative",[lp]:"",children:p},g.message.id):null})})}function Tie({rootRef:e,fallbackRef:t,enabled:n,canCancel:r}){v.useEffect(()=>{if(!n)return;let i=0,o=null;const l=p=>{const _=p instanceof Element?p:null,y=e.current,w=t.current;if(B2({trigger:"pointer",activeElement:document.activeElement,pointerStartTarget:o,pointerEndTarget:_,root:y,fallback:w,hasActiveOverlay:I2(document),hasActiveSelection:$9(window.getSelection())})!=="restore"){o=null;return}w==null||w.focus({preventScroll:!0}),o=null},c=p=>{cancelAnimationFrame(i),o=p.target instanceof Element?p.target:null},h=p=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(()=>{l(p.target)})},d=()=>{o=null;const p=t.current;!p||p.disabled||p.focus({preventScroll:!0})},g=p=>{if(p.key!=="Escape")return;const _=t.current;B2({trigger:"escape",activeElement:document.activeElement,fallback:_,hasActiveOverlay:I2(document),canCancel:r,defaultPrevented:p.defaultPrevented})==="escape-focus"&&(p.preventDefault(),_==null||_.focus({preventScroll:!0}))};return window.addEventListener("pointerdown",c,!0),window.addEventListener("pointerup",h,!0),window.addEventListener("keydown",g,!0),window.addEventListener(ap,d),()=>{cancelAnimationFrame(i),window.removeEventListener("pointerdown",c,!0),window.removeEventListener("pointerup",h,!0),window.removeEventListener("keydown",g,!0),window.removeEventListener(ap,d)}},[r,n,t,e])}const zm="How can I help you?",Nie=19,Mie=72,Aie=120;function jie(){var Et,me,Fe,De,ft,at,it,hn,Mt,Pn,de;const e=Yp(),t=v.useRef(null),n=v.useRef(null),r=v.useRef(null),[i,o]=v.useState(""),[l,c]=v.useState(!1),[h,d]=v.useState(0),[g,p]=v.useState(!1),_=Mh("(min-width: 768px)"),y=typeof window>"u"?!0:g4(window.location.hostname),w=((Et=e.runtime)==null?void 0:Et.projectId)??null,C=ua(se=>w?se.projects[w]:void 0)??MX,R=Ud(se=>w?se.projects[w]:void 0)??kX,E=ua(se=>se.addTerminal),N=ua(se=>se.removeTerminal),L=ua(se=>se.toggleVisibility),j=ua(se=>se.resetMainSizes),O=ua(se=>se.setMainSizes),H=ua(se=>se.setTerminalSizes),Z=Ud(se=>se.toggleVisibility),I=Ud(se=>se.setSize),W=Bi(se=>se.scrollbackLines),F=Bi(se=>se.minColumnWidth),$=e.keybindings,V=v.useMemo(()=>gw($),[$]),q=C.terminals.length>0,D=!!(w&&C.isVisible&&q),U=!!(w&&q),z=!!(w&&R.isVisible),G=!!(w&&!_&&z),M=!!(w&&_),{isAnimating:B,mainPanelGroupRef:X,terminalFocusRequestVersion:A,terminalPanelRef:ie,terminalVisualRef:J}=WX({showTerminalPane:D,shouldRenderTerminalLayout:U,projectId:w,terminalLayout:C,chatInputRef:r}),{isAnimating:ee,panelGroupRef:re,sidebarPanelRef:ue,sidebarVisualRef:fe}=$X({projectId:w,shouldRenderRightSidebarLayout:M,showRightSidebar:z,rightSidebarSize:R.size});Tie({rootRef:n,fallbackRef:r,enabled:e.hasSelectedProject&&((me=e.runtime)==null?void 0:me.status)!=="waiting_for_user",canCancel:e.canCancel});const ge=()=>{if(w){if(q){p(!1),L(w);return}E(w)}},Ce=()=>{p(se=>!se)},Te=se=>{var lt;if(!w||!D||B.current)return;const ye=se.chat,Ee=se.terminal;if(!Number.isFinite(ye)||!Number.isFinite(Ee))return;const qe=((lt=t.current)==null?void 0:lt.getBoundingClientRect().height)??0;if(OX(qe,Ee)){j(w),L(w);return}O(w,[ye,Ee])};v.useEffect(()=>{if(e.messages.length!==0)return;o(""),c(!1);let se=0;const ye=window.setInterval(()=>{se+=1,o(zm.slice(0,se)),se>=zm.length&&(window.clearInterval(ye),c(!0))},Nie);return()=>window.clearInterval(ye)},[e.activeChatId,e.messages.length]),v.useEffect(()=>{function se(ye){if(w){if(il(V,"toggleEmbeddedTerminal",ye)){ye.preventDefault(),ge();return}if(il(V,"toggleRightSidebar",ye)){ye.preventDefault(),Z(w);return}if(il(V,"openInFinder",ye)){if(!y)return;ye.preventDefault(),e.handleOpenExternal("open_finder");return}if(il(V,"openInEditor",ye)){if(!y)return;ye.preventDefault(),e.handleOpenExternal("open_editor");return}il(V,"addSplitTerminal",ye)&&(ye.preventDefault(),E(w))}}return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[E,y,ge,w,V,Z]),v.useEffect(()=>{D||p(!1)},[D]),v.useEffect(()=>{const se=window.requestAnimationFrame(()=>{e.updateScrollState()}),ye=window.setTimeout(()=>{e.updateScrollState()},Ac);return()=>{window.cancelAnimationFrame(se),window.clearTimeout(ye)}},[U,D,e.updateScrollState]),v.useEffect(()=>{function se(){e.updateScrollState()}return window.addEventListener("resize",se),()=>window.removeEventListener("resize",se)},[e.updateScrollState]),v.useEffect(()=>{if(_)return;const se=window.visualViewport;if(!se)return;const ye=()=>{const Ee=e.scrollRef.current;if(!Ee)return;const qe=Ee.scrollHeight-Ee.scrollTop-Ee.clientHeight;if(x4(qe)){requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.scrollToBottom(),e.updateScrollState()})});return}const lt=document.activeElement;lt&&Ee.contains(lt)&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{var He;const Je=(He=e.inputRef.current)==null?void 0:He.getBoundingClientRect(),Ae=lt.getBoundingClientRect();if(Je&&Ae.bottom>Je.top){const mt=Ae.bottom-Je.top;Ee.scrollBy({top:mt+16,behavior:"auto"})}e.updateScrollState()})})};return se.addEventListener("resize",ye),se.addEventListener("scroll",ye),()=>{se.removeEventListener("resize",ye),se.removeEventListener("scroll",ye)}},[_,e.scrollRef,e.scrollToBottom,e.updateScrollState]),v.useEffect(()=>{const se=t.current;if(!se||!U)return;const ye=()=>{const qe=se.getBoundingClientRect().height;if(qe<=0)return;const lt=qe*(C.mainSizes[1]/100);lt<=0||d(Je=>Math.abs(Je-lt)<1?Je:lt)},Ee=new ResizeObserver(ye);return Ee.observe(se),ye(),()=>Ee.disconnect()},[w,U,C.mainSizes]);const je=se=>Number.isFinite(se)?Math.min(Fx,Math.max(Og,se)):R.size,Xe=()=>{w&&Z(w)},xt=f.jsxs(vw,{ref:n,className:"bg-background h-full flex flex-col overflow-hidden border-0 rounded-none relative",children:[f.jsxs(_w,{className:"flex flex-1 min-h-0 flex-col p-0 overflow-hidden relative",children:[f.jsx(aq,{sidebarCollapsed:e.sidebarCollapsed,hasCompletedChats:e.completedChatIds.size>0,onOpenSidebar:e.openSidebar,onExpandSidebar:e.expandSidebar,usage:e.usage,localPath:e.navbarLocalPath,embeddedTerminalVisible:D,onToggleEmbeddedTerminal:w?ge:void 0,rightSidebarVisible:z,onToggleRightSidebar:w?()=>Z(w):void 0,onOpenExternal:y?se=>{e.handleOpenExternal(se)}:void 0,editorLabel:e.editorLabel,projectId:w??void 0,socket:e.socket,finderShortcut:y?V.bindings.openInFinder:void 0,editorShortcut:y?V.bindings.openInEditor:void 0,terminalShortcut:V.bindings.toggleEmbeddedTerminal,rightSidebarShortcut:V.bindings.toggleRightSidebar}),f.jsxs(Dg,{ref:e.scrollRef,onScroll:e.updateScrollState,className:"flex-1 min-h-0 px-4 scroll-pt-[72px]",children:[(Fe=e.runtime)!=null&&Fe.inactiveProviderMessage?f.jsxs("div",{className:"mx-auto mt-[72px] max-w-[800px] rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-sm text-amber-900 dark:text-amber-200",children:["This thread uses ",e.runtime.provider,", which is currently inactive. ",e.runtime.inactiveProviderMessage]}):null,e.messages.length===0?f.jsx("div",{style:{height:e.transcriptPaddingBottom},"aria-hidden":"true"}):null,e.messages.length>0?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"animate-fade-in space-y-5 pt-[72px] max-w-[800px] mx-auto",children:[f.jsx(Rie,{messages:e.messages,isLoading:e.isProcessing,localPath:(De=e.runtime)==null?void 0:De.localPath,latestToolIds:e.latestToolIds,pendingTool:((ft=e.runtime)==null?void 0:ft.pendingTool)??null,onOpenLocalLink:e.handleOpenLocalLink,onAskUserQuestionSubmit:e.handleAskUserQuestion,onExitPlanModeConfirm:e.handleExitPlanMode}),e.isProcessing?f.jsx(wX,{status:(at=e.runtime)==null?void 0:at.status}):null,e.commandError?f.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3",children:e.commandError}):null]}),f.jsx("div",{style:{height:e.transcriptPaddingBottom},"aria-hidden":"true"})]}):null]}),e.messages.length===0?f.jsx("div",{className:"pointer-events-none absolute inset-x-4 animate-fade-in",style:{top:Mie,bottom:e.transcriptPaddingBottom},children:f.jsx("div",{className:"mx-auto flex h-full max-w-[800px] items-center justify-center",children:f.jsxs("div",{className:"flex flex-col items-center justify-center text-muted-foreground gap-4 opacity-70",children:[f.jsx(Ld,{className:"size-8 text-muted-foreground kaizen-empty-state-flower"}),f.jsx("div",{className:"text-base font-normal text-muted-foreground text-center max-w-xs flex items-center kaizen-empty-state-text","aria-label":zm,children:f.jsxs("span",{className:"relative inline-grid place-items-start",children:[f.jsxs("span",{className:"invisible col-start-1 row-start-1 whitespace-pre flex items-center",children:[f.jsx("span",{children:zm}),f.jsx("span",{className:"kaizen-typewriter-cursor-slot","aria-hidden":"true"})]}),f.jsxs("span",{className:"col-start-1 row-start-1 whitespace-pre flex items-center",children:[f.jsx("span",{children:i}),f.jsx("span",{className:"kaizen-typewriter-cursor-slot","aria-hidden":"true",children:f.jsx("span",{className:"kaizen-typewriter-cursor","data-typing-complete":l?"true":"false"})})]})]})})]})})},e.activeChatId??"new-chat"):null,f.jsx("div",{style:{bottom:Aie},className:pe("absolute left-1/2 -translate-x-1/2 z-10 transition-all",e.showScrollButton?"scale-100 duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]":"scale-60 duration-300 ease-out pointer-events-none blur-sm opacity-0"),children:f.jsx("button",{onClick:e.scrollToBottom,className:"flex items-center transition-colors gap-1.5 px-2 bg-background/80 dark:bg-card/40 backdrop-blur-lg hover:bg-muted/80 border border-border rounded-full aspect-square cursor-pointer text-sm text-foreground/80 hover:text-foreground",children:f.jsx(BB,{className:"h-5 w-5"})})})]}),f.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-20 pointer-events-none",children:f.jsx("div",{className:"bg-gradient-to-t from-background via-background pointer-events-auto",ref:e.inputRef,children:f.jsx(nq,{ref:r,onSubmit:e.handleSend,onCancel:()=>{e.handleCancel()},disabled:!e.hasSelectedProject||((it=e.runtime)==null?void 0:it.status)==="waiting_for_user"||!!((hn=e.runtime)!=null&&hn.inactiveProviderMessage),canCancel:e.canCancel,chatId:e.activeChatId,activeProvider:((Mt=e.runtime)==null?void 0:Mt.provider)??null,activeModel:((Pn=e.runtime)==null?void 0:Pn.model)??null,activePlanMode:((de=e.runtime)==null?void 0:de.planMode)??!1,availableProviders:e.availableProviders,keybindings:V},e.activeChatId??"new-chat")})})]});return f.jsxs("div",{ref:t,className:"flex-1 flex flex-col min-w-0 relative",children:[M&&w?f.jsxs(Fd,{groupRef:re,orientation:"horizontal",className:"flex-1 min-h-0",onLayoutChange:se=>{var Ee;if(!z||ee.current)return;const ye=je(se.rightSidebar);Math.abs(ye-se.rightSidebar)<.1||(Ee=re.current)==null||Ee.setLayout({workspace:100-ye,rightSidebar:ye})},onLayoutChanged:se=>{!z||ee.current||I(w,je(se.rightSidebar))},children:[f.jsx(mo,{id:"workspace",defaultSize:`${100-R.size}%`,minSize:"50%",className:"min-h-0 min-w-0",children:U?f.jsxs(Fd,{groupRef:X,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:Te,children:[f.jsx(mo,{id:"chat",defaultSize:`${C.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:xt}),f.jsx(Hd,{withHandle:!0,orientation:"vertical",disabled:!D,className:pe(!D&&"pointer-events-none opacity-0")}),f.jsx(mo,{id:"terminal",defaultSize:`${C.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:ie,children:f.jsx("div",{ref:J,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":D?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${Ac}ms`},children:f.jsx("div",{style:h>0?{height:`${h}px`}:void 0,children:g?null:f.jsx($b,{projectId:w,layout:C,onAddTerminal:E,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:W,minColumnWidth:F,maximized:!1,splitTerminalShortcut:V.bindings.addSplitTerminal,focusRequestVersion:A,onToggleMaximized:Ce,onRemoveTerminal:(se,ye)=>{e.socket.command({type:"terminal.close",terminalId:ye}).catch(()=>{}),N(se,ye)},onTerminalLayout:H})})})})]},w):xt}),f.jsx(Hd,{withHandle:!0,orientation:"horizontal",disabled:!z,className:pe(!z&&"pointer-events-none opacity-0")}),f.jsx(mo,{id:"rightSidebar",defaultSize:`${R.size}%`,maxSize:`${Fx}%`,className:"min-h-0 min-w-0",elementRef:ue,children:f.jsx("div",{ref:fe,className:"h-full min-h-0 overflow-hidden","data-right-sidebar-open":z?"true":"false","data-right-sidebar-animated":"false","data-right-sidebar-visual":!0,style:{"--terminal-toggle-duration":`${Ac}ms`},children:f.jsx(AE,{onClose:()=>Z(w)})})})]},`${w}-right-sidebar`):U&&w?f.jsxs(Fd,{groupRef:X,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:Te,children:[f.jsx(mo,{id:"chat",defaultSize:`${C.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:xt}),f.jsx(Hd,{withHandle:!0,orientation:"vertical",disabled:!D,className:pe(!D&&"pointer-events-none opacity-0")}),f.jsx(mo,{id:"terminal",defaultSize:`${C.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:ie,children:f.jsx("div",{ref:J,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":D?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${Ac}ms`},children:f.jsx("div",{style:h>0?{height:`${h}px`}:void 0,children:g?null:f.jsx($b,{projectId:w,layout:C,onAddTerminal:E,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:W,minColumnWidth:F,maximized:!1,splitTerminalShortcut:V.bindings.addSplitTerminal,focusRequestVersion:A,onToggleMaximized:Ce,onRemoveTerminal:(se,ye)=>{e.socket.command({type:"terminal.close",terminalId:ye}).catch(()=>{}),N(se,ye)},onTerminalLayout:H})})})})]},w):xt,g&&w&&D?f.jsx("div",{className:"absolute inset-0 z-30 flex min-h-0 min-w-0 flex-col bg-background/96 backdrop-blur-sm",children:f.jsx($b,{projectId:w,layout:C,onAddTerminal:E,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:W,minColumnWidth:F,maximized:!0,splitTerminalShortcut:V.bindings.addSplitTerminal,focusRequestVersion:A,onToggleMaximized:Ce,onRemoveTerminal:(se,ye)=>{e.socket.command({type:"terminal.close",terminalId:ye}).catch(()=>{}),N(se,ye)},onTerminalLayout:H})}):null,G?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 md:hidden",onClick:Xe}),f.jsx("div",{className:"fixed inset-0 z-50 flex flex-col bg-background/95 backdrop-blur-2xl md:hidden",children:f.jsx(AE,{onClose:Xe,className:"h-[var(--app-shell-height)]"})})]}):null]})}const Die=700,Oie=1500;function Lie(){const e=kl(),t=Yp(),n=t.featureOverviewSnapshot,r=Mh("(min-width: 768px)"),i=typeof window>"u"?!0:g4(window.location.hostname),[o,l]=v.useState("view"),[c,h]=v.useState(""),[d,g]=v.useState(!1),[p,_]=v.useState("idle"),[y,w]=v.useState(null),S=v.useRef(""),C=v.useRef(0);if(v.useEffect(()=>{n&&(S.current=n.content,h(n.content),g(!1),_("idle"),w(null))},[n==null?void 0:n.featureId]),v.useEffect(()=>{n&&(S.current=n.content,h(j=>d?j:n.content),d||(_("idle"),w(null)))},[d,n]),v.useEffect(()=>{if(!n||!d)return;const j=C.current+1;C.current=j,_("saving"),w(null);const O=window.setTimeout(()=>{t.socket.command({type:"feature.updateOverview",featureId:n.featureId,content:c}).then(H=>{C.current!==j||!H||(S.current=H.content,g(!1),_("saved"))}).catch(H=>{C.current===j&&(_("error"),w(H instanceof Error?H.message:String(H)))})},Die);return()=>window.clearTimeout(O)},[c,d,n==null?void 0:n.featureId,t.socket]),v.useEffect(()=>{if(p!=="saved")return;const j=window.setTimeout(()=>{_("idle")},Oie);return()=>window.clearTimeout(j)},[p]),v.useEffect(()=>{r||o!=="split"||l("view")},[r,o]),!n)return f.jsx("div",{className:"flex flex-1 items-center justify-center",children:f.jsx("div",{className:"text-sm text-muted-foreground",children:t.sidebarReady?"Overview not found.":"Loading overview…"})});const k=o==="view"||o==="split",R=p==="saving"?"Saving…":p==="saved"?"Saved":p==="error"?"Save failed":"Ready",E=pe("shrink-0 text-[11px] md:text-xs",p==="error"?"text-destructive":"text-muted-foreground"),N=f.jsx(Dg,{className:"h-full min-h-0",children:f.jsx("div",{className:"mx-auto max-w-4xl px-4 py-5",children:f.jsx("div",{className:"prose prose-slate max-w-none dark:prose-invert",children:f.jsx(fu,{remarkPlugins:[mu],components:uu({onOpenLocalLink:t.handleOpenLocalLink}),children:c})})})}),L=f.jsx("div",{className:"flex h-full min-h-0 flex-col",children:f.jsx("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-4xl px-4 py-5",children:f.jsx(bh,{value:c,onChange:j=>{const O=j.target.value;h(O),g(O!==S.current),p!=="saving"&&_("idle"),w(null)},spellCheck:!1,className:"h-full min-h-0 resize-none rounded-none border-0 bg-transparent px-0 py-0 font-mono text-base leading-7 focus-visible:ring-0 md:text-[13px] md:leading-6"})})});return f.jsx("div",{className:"flex flex-1 min-w-0 flex-col",children:f.jsx(vw,{className:"h-full rounded-none border-0 bg-background",children:f.jsxs(_w,{className:"flex h-full min-h-0 flex-col p-0",children:[f.jsxs("div",{className:"flex flex-col gap-3 border-b border-border px-4 py-3 md:flex-row md:items-center md:justify-between",children:[f.jsxs("div",{className:"flex min-w-0 items-start gap-2 md:flex-1",children:[f.jsx(Qe,{variant:"ghost",size:"icon",className:"mt-0.5 h-8 w-8 shrink-0 rounded-full",title:"Back",onClick:()=>{if(window.history.length>1){e(-1);return}e("/")},children:f.jsx(UB,{className:"size-4"})}),f.jsxs("div",{className:"min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:n.title}),r?null:f.jsx("div",{className:pe(E,"text-right"),children:R})]}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:n.overviewRelativePath})]})]}),f.jsxs("div",{className:"flex items-center gap-2 md:shrink-0 md:gap-3",children:[r?f.jsx("div",{className:E,children:R}):null,f.jsx("div",{className:"flex min-w-0 flex-1 items-center rounded-lg border border-border p-1 md:flex-none",children:(r?[{mode:"view",label:"View",icon:D2},{mode:"edit",label:"Edit",icon:Bc},{mode:"split",label:"Split",icon:W8}]:[{mode:"view",label:"View",icon:D2},{mode:"edit",label:"Edit",icon:Bc}]).map(({mode:j,label:O,icon:H})=>{const Z=o===j;return f.jsxs("button",{type:"button",onClick:()=>l(j),className:pe("inline-flex flex-1 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors md:flex-none",Z?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),children:[f.jsx(H,{className:"size-4"}),f.jsx("span",{children:O})]},j)})}),i?f.jsxs(Qe,{variant:"outline",size:"sm",className:"shrink-0 px-2.5 md:px-3",title:`Open in ${t.editorLabel}`,onClick:()=>{t.handleOpenExternalPath("open_editor",n.localPath)},children:[f.jsx(k8,{className:"size-4"}),f.jsxs("span",{className:"hidden md:inline",children:["Open in ",t.editorLabel]})]}):null]})]}),y?f.jsx("div",{className:"border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-sm text-destructive",children:y}):null,f.jsx("div",{className:"flex-1 min-h-0",children:r&&o==="split"?f.jsxs(Fd,{orientation:"horizontal",className:"h-full",children:[f.jsx(mo,{defaultSize:"50%",minSize:"25%",className:"min-w-0",children:N}),f.jsx(Hd,{orientation:"horizontal",withHandle:!0}),f.jsx(mo,{defaultSize:"50%",minSize:"25%",className:"min-w-0 border-l border-border/60",children:L})]}):k?N:L})]})})})}function KT({narrow:e=!1,title:t,subtitle:n,icon:r=V5}){return f.jsxs("div",{className:pe("w-full",e?"max-w-2xl px-6 pt-16 mx-auto":"px-6 pt-16 mb-10"),children:[f.jsxs("div",{className:pe("flex items-center gap-1 mb-2",e&&"justify-center"),children:[f.jsx("div",{className:"p-2 pl-0 rounded-lg",children:f.jsx(r,{className:"h-6 w-6 text-muted-foreground"})}),f.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:t})]}),n&&f.jsx("p",{className:pe("text-muted-foreground",e&&"mb-10 text-center"),children:n})]})}const zie={sm:"text-sm px-2.5 py-1",md:"text-sm px-3 py-1.5"};function Pie({value:e,onValueChange:t,options:n,size:r="md",className:i,optionClassName:o}){return f.jsx("div",{className:pe("inline-flex items-center rounded-lg border border-border p-[3px] ",i),children:n.map(l=>{const c=l.value===e,h=l.icon,d=h?v.isValidElement(h)?h:(()=>{const p=h;return f.jsx(p,{className:r==="sm"?"h-3.5 w-3.5":"h-4 w-4"})})():null,g=f.jsxs("button",{type:"button",onClick:()=>t(l.value),disabled:l.disabled,"aria-pressed":c,className:pe("rounded-[4px] border transition-colors",h?"grid grid-cols-[auto_auto] items-center gap-2":"inline-flex items-center gap-1.5",zie[r],c?"bg-white dark:bg-muted text-slate-900 dark:text-slate-200 border-slate-300 dark:border-white/10 bg-slate-200 ":"border-transparent text-slate-800 hover:text-slate-900 dark:text-muted-foreground dark:hover:text-foreground",l.disabled&&"opacity-50 pointer-events-none",o),children:[d,f.jsx("span",{children:l.label})]},l.value);return l.tooltip?f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:g}),f.jsx(os,{children:l.tooltip})]},l.value):g})})}function Iie(e){return e.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Bie(e){const t=e.split("/").filter(Boolean);return t[t.length-1]||e}function Fie({open:e,onOpenChange:t,initialDirectory:n,onListDirectories:r,onConfirm:i}){var D;const[o,l]=v.useState("new"),[c,h]=v.useState(""),[d,g]=v.useState([]),[p,_]=v.useState({}),[y,w]=v.useState([]),[S,C]=v.useState(null),[k,R]=v.useState(""),[E,N]=v.useState(null),[L,j]=v.useState(null),O=v.useRef(null);v.useEffect(()=>{e&&(l("new"),h(""),g(n?n.roots:[]),_(n?{[n.currentPath]:n.entries}:{}),w(n?[n.currentPath]:[]),C((n==null?void 0:n.currentPath)??null),R(""),N(null),j(null),setTimeout(()=>{var U;return(U=O.current)==null?void 0:U.focus()},0))},[n,e]),v.useEffect(()=>{e&&setTimeout(()=>{var U;o==="new"&&((U=O.current)==null||U.focus())},0)},[o,e]);const H=Iie(c),Z=H?`${FF}/${H}`:"",I=k.trim(),W=o==="new"?!!H:!!I,F=async U=>{N(null),j(U??"__root__");try{const z=await r(U);if(!U){g(z.roots),C(z.currentPath),_({[z.currentPath]:z.entries}),w([z.currentPath]);return}d.length===0&&(g([{name:Bie(z.currentPath),localPath:z.currentPath}]),C(z.currentPath)),_(G=>({...G,[z.currentPath]:z.entries})),w(G=>G.includes(z.currentPath)?G:[...G,z.currentPath])}catch(z){N(z instanceof Error?z.message:String(z))}finally{j(null)}},$=async U=>{if(y.includes(U)){w(z=>z.filter(G=>G!==U));return}if(p[U]){w(z=>[...z,U]);return}await F(U)},V=(U,z,G)=>{const M=y.includes(U),B=k===U,X=p[U]??[],A=L===U;return f.jsxs("div",{children:[f.jsxs("div",{className:pe("grid grid-cols-[auto_1fr] items-center gap-2 px-3 py-2",B?"bg-muted":"hover:bg-muted/50"),style:{paddingLeft:`${12+G*16}px`},children:[f.jsx("button",{type:"button",className:"flex h-6 w-6 items-center justify-center rounded hover:bg-background disabled:opacity-50",onClick:()=>void $(U),disabled:A,children:A?f.jsx(Lr,{className:"h-4 w-4 animate-spin text-muted-foreground"}):f.jsx(Vr,{className:pe("h-4 w-4 text-muted-foreground transition-transform",M&&"rotate-90")})}),f.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2 text-left",onClick:()=>R(U),children:[M?f.jsx(B5,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):f.jsx(H5,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),f.jsx("span",{className:"truncate",children:z})]})]}),M&&X.length>0?X.map(ie=>V(ie.localPath,ie.name,G+1)):null]},U)},q=()=>{if(W){if(o==="new")i({mode:"new",localPath:Z,title:c.trim()});else{const U=I.split("/").pop()||I;i({mode:"existing",localPath:I,title:U})}t(!1)}};return f.jsx(rg,{open:e,onOpenChange:t,children:f.jsxs(_h,{size:"sm",children:[f.jsxs(sg,{className:"space-y-4",children:[f.jsx(ig,{children:"Add Project"}),f.jsx(Pie,{value:o,onValueChange:l,options:[{value:"new",label:"New Folder"},{value:"existing",label:"Existing Folder"}],className:"w-full mb-2",optionClassName:"flex-1 justify-center"}),o==="new"?f.jsxs("div",{className:"space-y-2",children:[f.jsx(Fi,{ref:O,type:"text",value:c,onChange:U=>h(U.target.value),onKeyDown:U=>{U.key==="Enter"&&q(),U.key==="Escape"&&t(!1)},placeholder:"Project name"}),Z&&f.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:Z})]}):f.jsxs("div",{className:"space-y-2",children:[f.jsx(Fi,{type:"text",value:k,onChange:U=>R(U.target.value),onKeyDown:U=>{U.key==="Enter"&&F(k||void 0)},placeholder:"Enter a server path, for example /home/bettie/Projects/my-app"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Import an existing folder from the connected server machine. You can type a path manually or choose from the root folder list below."}),f.jsx("div",{className:"flex justify-end",children:f.jsx(Qe,{type:"button",variant:"ghost",size:"sm",onClick:()=>void F("~"),disabled:L!==null,children:"Load Root"})}),d.length>0?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Server Folders"}),f.jsxs(Dg,{className:"max-h-64 rounded-xl border border-border",children:[d.map(U=>V(U.localPath,U.name,0)),S&&((D=p[S])==null?void 0:D.length)===0?f.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"No subfolders"}):null]})]}):L?f.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-border px-3 py-2 text-sm text-muted-foreground",children:[f.jsx(Lr,{className:"h-4 w-4 animate-spin"}),"Loading folders from server machine..."]}):null,E?f.jsx("p",{className:"text-xs text-destructive",children:E}):null]})]}),f.jsxs(og,{children:[f.jsx(Qe,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(Qe,{variant:"secondary",size:"sm",onClick:q,disabled:!W,children:o==="new"?"Create":"Import"})]})]})})}function Hie({text:e}){const[t,n]=v.useState(!1);async function r(){await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}return f.jsx(Qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>void r(),children:t?f.jsx(Wi,{className:"h-4 w-4 text-green-400"}):f.jsx(ul,{className:"h-4 w-4"})})}function GT({children:e}){return f.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center group bg-background border border-border text-foreground rounded-xl p-1.5 pl-3 font-mono text-sm",children:[f.jsxs("pre",{className:"inline-flex items-center gap-2 overflow-x-auto",children:[f.jsx(Vr,{className:"inline h-4 w-4 opacity-40"}),f.jsx("code",{children:e})]}),f.jsx(Hie,{text:e})]})}function Pm({children:e}){return f.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:e})}function my({children:e}){return f.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider mb-3",children:e})}function py({icon:e,title:t,subtitle:n,iconClassName:r}){return f.jsxs("div",{className:"flex flex-col items-center gap-0",children:[f.jsx("div",{className:"p-3 mb-2 rounded-xl bg-background border border-border",children:f.jsx(e,{className:r||"h-8 w-8 text-muted-foreground"})}),f.jsx("span",{className:"text-sm font-medium",children:t}),f.jsx("span",{className:"text-xs text-muted-foreground",children:n})]})}function YT(){return f.jsx(HB,{className:"h-4 w-4 text-muted-foreground"})}function XT({number:e,title:t,children:n}){return f.jsx("div",{className:"flex gap-4",children:f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-baseline gap-3",children:[f.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center font-medium text-logo",children:[e,"."]}),f.jsx("h3",{className:"font-medium text-foreground mb-2",children:t})]}),f.jsx("div",{className:"text-muted-foreground text-sm space-y-3",children:n})]})})}function $ie({localPath:e,iconDataUrl:t,loading:n,onClick:r,onHide:i}){const o=_n(l=>l.showProjectIconsInSidebar);return f.jsxs("div",{className:"relative group",children:[f.jsxs(Ms,{children:[f.jsx(As,{asChild:!0,children:f.jsxs("button",{className:pe("border border-border hover:border-primary/30 rounded-lg bg-card px-4 py-3 flex items-center gap-3 w-full text-left hover:bg-muted/50 transition-colors",n&&"opacity-50 cursor-not-allowed"),disabled:n,onClick:r,children:[o?f.jsx(Uj,{iconDataUrl:t,alt:`${vp(e)} icon`,className:"h-5.5 w-5.5",fallback:f.jsx(H5,{className:"h-5.5 w-5.5 text-muted-foreground flex-shrink-0"})}):null,f.jsx("span",{className:"font-medium text-foreground truncate flex-1 pr-10",children:vp(e)}),n?f.jsx(Lr,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary animate-spin flex-shrink-0"}):null]})}),f.jsx(os,{children:f.jsx("p",{children:e})})]}),f.jsx(Qe,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 h-7 w-7 -translate-y-1/2 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",disabled:n,onClick:l=>{l.stopPropagation(),i()},children:f.jsx(Gd,{className:"h-4 w-4"})})]})}function Uie({connectionStatus:e,ready:t,snapshot:n,startingLocalPath:r,commandError:i,onOpenProject:o,onHideProject:l,onListDirectories:c,onCreateProject:h}){const[d,g]=TP(),[p,_]=v.useState(!1),y=v.useMemo(()=>(n==null?void 0:n.projects)??[],[n==null?void 0:n.projects]),w=e==="connecting"||!t,S=e==="connected"&&t,C=d.get("newProject")==="1";v.useEffect(()=>{S&&C&&_(!0)},[S,C]);const k=R=>{if(_(R),!R&&C){const E=new URLSearchParams(d);E.delete("newProject"),g(E,{replace:!0})}};return f.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-y-auto",children:[S?f.jsxs(f.Fragment,{children:[f.jsx(KT,{title:(n==null?void 0:n.machine.displayName)??"Local Projects",subtitle:`${Dn} is connected, choose a project below to get started.`}),f.jsxs("div",{className:"w-full px-6 mb-10",children:[f.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[f.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider",children:"Projects"}),f.jsxs(Qe,{variant:"default",size:"sm",onClick:()=>_(!0),children:[f.jsx(C0,{className:"h-4 w-4 mr-1.5"}),"Add Project"]})]}),y.length>0?f.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-4 3xl:grid-cols-5 gap-2",children:y.map(R=>f.jsx($ie,{localPath:R.localPath,iconDataUrl:R.iconDataUrl,loading:r===R.localPath,onClick:()=>{o(R.localPath)},onHide:()=>{l(R.localPath)}},R.localPath))}):f.jsx(Pm,{children:f.jsx("p",{className:"text-sm text-muted-foreground",children:"No local projects discovered yet. Open one with Claude or Codex, or create a new project here."})}),i?f.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3 mt-4",children:i}):null]})]}):f.jsxs(f.Fragment,{children:[f.jsx(KT,{narrow:!0,icon:A2,title:w?`Connecting ${Dn}`:`Connect ${Dn}`,subtitle:w?`${Dn} is starting up and loading your local projects.`:`Run ${Dn} directly on your machine with full access to your local files and agent project history.`}),f.jsxs("div",{className:"max-w-2xl w-full mx-auto pb-12 px-6",children:[f.jsx(my,{children:"Status"}),f.jsx("div",{className:"mb-8",children:f.jsx(Pm,{children:f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Lr,{className:"h-4 w-4 text-muted-foreground animate-spin"}),f.jsx("span",{className:"text-sm text-muted-foreground",children:w?`Connecting to your local ${Dn} server...`:f.jsxs(f.Fragment,{children:["Not connected. Run ",f.jsx("code",{className:"bg-background border border-border rounded-md mx-0.5 p-1 font-mono text-xs text-foreground",children:fm()})," from any terminal on this machine."]})})]})})}),w?null:f.jsxs("div",{className:"mb-10",children:[f.jsx(my,{children:"How it works"}),f.jsx(Pm,{children:f.jsxs("div",{className:"flex items-center justify-around gap-6 py-4 px-2",children:[f.jsx(py,{icon:k0,title:`${Dn} CLI`,subtitle:"On Your Machine"}),f.jsx(YT,{}),f.jsx(py,{icon:V5,title:`${Dn} Server`,subtitle:"Local WebSocket"}),f.jsx(YT,{}),f.jsx(py,{icon:A2,title:`${Dn} UI`,subtitle:"Project Chat"})]})})]}),w?null:f.jsxs("div",{className:"mb-10",children:[f.jsx(my,{children:"Setup"}),f.jsx(Pm,{children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs(XT,{number:1,title:`Start ${Dn}`,children:[f.jsx("p",{children:"Run this command in your terminal:"}),f.jsx(GT,{children:fm()})]}),f.jsxs(XT,{number:2,title:"Open the local UI",children:[f.jsxs("p",{children:[Dn," serves the app locally and opens the Local Projects page in an app-style browser window."]}),f.jsx(GT,{children:"http://localhost:3210/local"})]}),f.jsxs("div",{className:"mt-8",children:[f.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-4",children:"Notes"}),f.jsxs("div",{className:"space-y-3 text-sm",children:[f.jsxs("div",{className:"flex gap-4",children:[f.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:fm("").trim()}),f.jsx("span",{className:"text-muted-foreground",children:"Start in the current directory"})]}),f.jsxs("div",{className:"flex gap-4",children:[f.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:fm("--no-open")}),f.jsx("span",{className:"text-muted-foreground",children:"Start the server without opening the browser"})]})]})]})]})})]})]})]}),f.jsx(Fie,{open:p,onOpenChange:k,initialDirectory:(n==null?void 0:n.rootDirectory)??null,onListDirectories:c,onConfirm:R=>{h(R)}}),f.jsx("div",{className:"py-4 text-center",children:f.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v",F0.split("/")[1]]})})]})}function Vie(){const e=Yp();return f.jsx("div",{className:"flex-1 flex flex-col min-w-0 relative",children:f.jsx(Uie,{connectionStatus:e.connectionStatus,ready:e.localProjectsReady,snapshot:e.localProjects,startingLocalPath:e.startingLocalPath,commandError:e.commandError,onOpenProject:e.handleOpenLocalProject,onHideProject:e.handleHideLocalProject,onListDirectories:e.handleListDirectories,onCreateProject:e.handleCreateProject})})}const Wie="web+kaizen";function i0(e){return!e||!e.startsWith("/")||e.startsWith("//")?"/":e}function qie(e){const t=new URLSearchParams(e),n=i0(t.get("target"));if(n!=="/")return n;const r=t.get("launch");if(!r)return"/";try{const i=new URL(r);return i0(i.searchParams.get("target"))}catch{return"/"}}function Kie(e){const t=new URL(`${Wie}://open`);return t.searchParams.set("target",i0(e)),t.toString()}function Gie(e){return e.innerWidth<=820||e.matchMedia("(pointer: coarse)").matches}function Yie(e){return/\b(?:Chrome|CriOS|Edg|EdgA|EdgiOS)\b/i.test(e)}function Xie(e){return/iPhone|iPad|iPod/i.test(e)?"In Safari, tap Share, then Add to Home Screen.":/Android/i.test(e)?"Use your browser menu to install Kaizen to the home screen.":"Use your browser install action to save Kaizen as an app, or continue in the browser."}function Zie(){const e=oi(),t=Yj(),n=v.useMemo(()=>qie(e.search),[e.search]),[r,i]=v.useState(!1),[o,l]=v.useState(null);v.useEffect(()=>{function d(g){g.preventDefault(),l(g)}return window.addEventListener("beforeinstallprompt",d),()=>{window.removeEventListener("beforeinstallprompt",d)}},[]),v.useEffect(()=>{if(t){window.location.replace(n);return}if(new URLSearchParams(e.search).has("launch")){window.location.replace(n);return}if(!Gie(window)){window.location.replace(n);return}if(!Yie(navigator.userAgent)){i(!0);return}const p=Kie(n),_=window.setTimeout(()=>{i(!0)},900),y=()=>{document.visibilityState==="hidden"&&window.clearTimeout(_)};return document.addEventListener("visibilitychange",y),window.location.assign(p),()=>{window.clearTimeout(_),document.removeEventListener("visibilitychange",y)}},[t,e.search,n]);async function c(){o&&(await o.prompt(),await o.userChoice.catch(()=>{}),l(null))}const h=Xie(navigator.userAgent);return f.jsxs("main",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-[radial-gradient(circle_at_top,rgba(241,245,249,0.96),rgba(255,255,255,1)_42%),linear-gradient(135deg,#fff8ef_0%,#ffffff_45%,#eef6ff_100%)] px-5 py-8 text-slate-950 dark:bg-[radial-gradient(circle_at_top,rgba(30,41,59,0.92),rgba(15,23,42,1)_46%),linear-gradient(135deg,#0f172a_0%,#111827_45%,#1f2937_100%)] dark:text-slate-50",children:[f.jsx("div",{className:"absolute inset-x-0 top-0 h-40 bg-[radial-gradient(circle_at_center,rgba(249,115,22,0.12),transparent_68%)] dark:bg-[radial-gradient(circle_at_center,rgba(251,146,60,0.14),transparent_68%)]"}),f.jsxs("section",{className:"relative w-full max-w-sm overflow-hidden rounded-[2rem] border border-white/70 bg-white/88 p-6 shadow-[0_30px_120px_-32px_rgba(15,23,42,0.42)] backdrop-blur-xl dark:border-slate-700/70 dark:bg-slate-900/88",children:[f.jsx("div",{className:"mb-6 inline-flex rounded-full border border-orange-200 bg-orange-50 px-3 py-1 text-xs font-semibold uppercase tracking-[0.2em] text-orange-700 dark:border-orange-400/30 dark:bg-orange-400/10 dark:text-orange-200",children:"Remote handoff"}),f.jsxs("h1",{className:"font-logo text-3xl leading-none tracking-tight",children:["Open ",Dn]}),f.jsx("p",{className:"mt-3 text-sm leading-6 text-slate-600 dark:text-slate-300",children:r?"Kaizen could not jump straight into the installed app on this device. You can keep going in the browser or install it for one-tap launches next time.":"Trying to open your installed Kaizen app. If it does not switch automatically, use the browser fallback below."}),f.jsxs("div",{className:"mt-6 space-y-3",children:[f.jsx(Zp,{to:n,className:"block rounded-2xl bg-slate-950 px-4 py-3 text-center text-sm font-semibold text-white transition hover:bg-slate-800 dark:bg-white dark:text-slate-950 dark:hover:bg-slate-200",children:"Continue in browser"}),o?f.jsx("button",{type:"button",onClick:()=>{c()},className:"block w-full rounded-2xl border border-orange-300 bg-orange-50 px-4 py-3 text-sm font-semibold text-orange-800 transition hover:bg-orange-100 dark:border-orange-400/40 dark:bg-orange-400/10 dark:text-orange-100 dark:hover:bg-orange-400/20",children:"Install Kaizen"}):null]}),f.jsxs("div",{className:"mt-6 rounded-2xl border border-slate-200/80 bg-slate-50/90 p-4 text-sm leading-6 text-slate-700 dark:border-slate-700 dark:bg-slate-800/80 dark:text-slate-200",children:[f.jsx("p",{className:"font-semibold text-slate-950 dark:text-white",children:"Install hint"}),f.jsx("p",{className:"mt-1",children:h})]})]})]})}const Qie=3210;function Jie(e,t){const n=new URLSearchParams(e),r=Number(n.get("localPort"));if(Number.isFinite(r)&&r>0)return Math.round(r);const i=Number(t);return Number.isFinite(i)&&i>0?Math.round(i):Qie}function ese(e){return`tailscale serve --bg --https 443 http://127.0.0.1:${String(e)}`}function tse(e){return new URLSearchParams(e).get("reason")==="serve_permission_denied"?"serve_permission_denied":null}function nse(e){const n=new URLSearchParams(e).get("setupCommand");return n!=null&&n.trim()?n:null}const rse="https://tailscale.com/download",ise="https://tailscale.com/kb/1242/tailscale-serve",sse="https://tailscale.com/docs/how-to/set-up-https-certificates";function ose(){const e=oi(),t=v.useMemo(()=>Jie(e.search,window.location.port),[e.search]),n=v.useMemo(()=>tse(e.search),[e.search]),r=v.useMemo(()=>nse(e.search),[e.search]),i=v.useMemo(()=>ese(t),[t]);return f.jsxs("main",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-[radial-gradient(circle_at_top,rgba(241,245,249,0.96),rgba(255,255,255,1)_42%),linear-gradient(135deg,#fff8ef_0%,#ffffff_45%,#eef6ff_100%)] px-5 py-8 text-slate-950 dark:bg-[radial-gradient(circle_at_top,rgba(30,41,59,0.92),rgba(15,23,42,1)_46%),linear-gradient(135deg,#0f172a_0%,#111827_45%,#1f2937_100%)] dark:text-slate-50",children:[f.jsx("div",{className:"absolute inset-x-0 top-0 h-40 bg-[radial-gradient(circle_at_center,rgba(249,115,22,0.12),transparent_68%)] dark:bg-[radial-gradient(circle_at_center,rgba(251,146,60,0.14),transparent_68%)]"}),f.jsxs("section",{className:"relative w-full max-w-2xl overflow-hidden rounded-[2rem] border border-white/70 bg-white/88 p-6 shadow-[0_30px_120px_-32px_rgba(15,23,42,0.42)] backdrop-blur-xl dark:border-slate-700/70 dark:bg-slate-900/88",children:[f.jsx("div",{className:"mb-6 inline-flex rounded-full border border-orange-200 bg-orange-50 px-3 py-1 text-xs font-semibold uppercase tracking-[0.2em] text-orange-700 dark:border-orange-400/30 dark:bg-orange-400/10 dark:text-orange-200",children:"Remote setup"}),f.jsxs("h1",{className:"font-logo text-3xl leading-none tracking-tight",children:["Enable remote ",Dn]}),f.jsx("p",{className:"mt-3 text-sm leading-6 text-slate-600 dark:text-slate-300",children:"Kaizen remote mode works best over Tailscale. If HTTPS handoff is not ready yet, use the steps below to install Tailscale, join your tailnet, and expose this local Kaizen session through Tailscale Serve."}),n==="serve_permission_denied"&&r?f.jsxs("section",{className:"mt-6 rounded-2xl border border-orange-300 bg-orange-50/90 p-4 text-sm leading-6 text-orange-950 dark:border-orange-400/40 dark:bg-orange-400/10 dark:text-orange-100",children:[f.jsx("p",{className:"font-semibold",children:"One-time machine setup needed"}),f.jsx("p",{className:"mt-1",children:"Tailscale is connected, but this user is not allowed to change Serve config yet. Run this once on the Kaizen machine:"}),f.jsx("pre",{className:"mt-3 overflow-x-auto rounded-2xl bg-slate-950 p-4 text-xs text-slate-50",children:f.jsx("code",{children:r})})]}):null,f.jsxs("div",{className:"mt-6 space-y-4 text-sm leading-6",children:[f.jsxs("section",{className:"rounded-2xl border border-slate-200/80 bg-slate-50/90 p-4 dark:border-slate-700 dark:bg-slate-800/80",children:[f.jsx("p",{className:"font-semibold text-slate-950 dark:text-white",children:"1. Install and connect Tailscale"}),f.jsx("p",{className:"mt-1 text-slate-700 dark:text-slate-200",children:"Install Tailscale on this machine and on the device you want to open Kaizen from. Then sign in and connect both devices to the same tailnet."}),f.jsxs("div",{className:"mt-3 flex flex-wrap gap-3",children:[f.jsx("a",{href:rse,target:"_blank",rel:"noreferrer",className:"rounded-xl border border-slate-300 px-3 py-2 font-medium text-slate-900 transition hover:bg-slate-100 dark:border-slate-600 dark:text-slate-100 dark:hover:bg-slate-700",children:"Download Tailscale"}),f.jsx("code",{className:"rounded-xl bg-slate-950 px-3 py-2 text-xs text-slate-50 dark:bg-slate-950",children:"tailscale up"})]})]}),f.jsxs("section",{className:"rounded-2xl border border-slate-200/80 bg-slate-50/90 p-4 dark:border-slate-700 dark:bg-slate-800/80",children:[f.jsx("p",{className:"font-semibold text-slate-950 dark:text-white",children:"2. Turn on HTTPS handoff with Tailscale Serve"}),f.jsx("p",{className:"mt-1 text-slate-700 dark:text-slate-200",children:"Run this on the machine where Kaizen is already running. It tells Tailscale to publish your local Kaizen port behind your tailnet HTTPS URL."}),f.jsx("pre",{className:"mt-3 overflow-x-auto rounded-2xl bg-slate-950 p-4 text-xs text-slate-50",children:f.jsx("code",{children:i})}),f.jsx("p",{className:"mt-3 text-slate-700 dark:text-slate-200",children:"If Tailscale says Serve is not enabled on your tailnet, an admin needs to enable HTTPS certificates and Serve support first."}),f.jsxs("div",{className:"mt-3 flex flex-wrap gap-3",children:[f.jsx("a",{href:ise,target:"_blank",rel:"noreferrer",className:"rounded-xl border border-slate-300 px-3 py-2 font-medium text-slate-900 transition hover:bg-slate-100 dark:border-slate-600 dark:text-slate-100 dark:hover:bg-slate-700",children:"Tailscale Serve docs"}),f.jsx("a",{href:sse,target:"_blank",rel:"noreferrer",className:"rounded-xl border border-slate-300 px-3 py-2 font-medium text-slate-900 transition hover:bg-slate-100 dark:border-slate-600 dark:text-slate-100 dark:hover:bg-slate-700",children:"Enable HTTPS certs"})]})]}),f.jsxs("section",{className:"rounded-2xl border border-slate-200/80 bg-slate-50/90 p-4 dark:border-slate-700 dark:bg-slate-800/80",children:[f.jsx("p",{className:"font-semibold text-slate-950 dark:text-white",children:"3. Start Kaizen remote mode again"}),f.jsx("pre",{className:"mt-3 overflow-x-auto rounded-2xl bg-slate-950 p-4 text-xs text-slate-50",children:f.jsx("code",{children:"kaizen --remote"})}),f.jsxs("p",{className:"mt-3 text-slate-700 dark:text-slate-200",children:["Once Serve is ready, Kaizen should print an"," ",f.jsx("span",{className:"font-semibold",children:"https://…ts.net/open"})," QR handoff URL instead of the HTTP fallback."]})]})]}),f.jsx("div",{className:"mt-6 flex flex-wrap gap-3",children:f.jsx(Zp,{to:"/",className:"rounded-2xl bg-slate-950 px-4 py-3 text-sm font-semibold text-white transition hover:bg-slate-800 dark:bg-white dark:text-slate-950 dark:hover:bg-slate-200",children:"Back to Kaizen"})})]})]})}function wc({children:e,className:t,icon:n,type:r="button",variant:i="outline",...o}){return f.jsxs("button",{type:r,className:pe(s5({variant:i,size:"sm"}),"h-auto gap-1.5 px-3 py-1.5",t),...o,children:[n,e?f.jsx("span",{children:e}):null]})}var Wt;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const l of i)o[l]=l;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),l={};for(const c of o)l[c]=i[c];return e.objectValues(l)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const l in i)Object.prototype.hasOwnProperty.call(i,l)&&o.push(l);return o},e.find=(i,o)=>{for(const l of i)if(o(l))return l},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Wt||(Wt={}));var ZT;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(ZT||(ZT={}));const Ge=Wt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),fa=e=>{switch(typeof e){case"undefined":return Ge.undefined;case"string":return Ge.string;case"number":return Number.isNaN(e)?Ge.nan:Ge.number;case"boolean":return Ge.boolean;case"function":return Ge.function;case"bigint":return Ge.bigint;case"symbol":return Ge.symbol;case"object":return Array.isArray(e)?Ge.array:e===null?Ge.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ge.promise:typeof Map<"u"&&e instanceof Map?Ge.map:typeof Set<"u"&&e instanceof Set?Ge.set:typeof Date<"u"&&e instanceof Date?Ge.date:Ge.object;default:return Ge.unknown}},Ne=Wt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class So extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{let c=r,h=0;for(;h<l.path.length;){const d=l.path[h];h===l.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(n(l))):c[d]=c[d]||{_errors:[]},c=c[d],h++}}};return i(this),r}static assert(t){if(!(t instanceof So))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Wt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const o=i.path[0];n[o]=n[o]||[],n[o].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}So.create=e=>new So(e);const s0=(e,t)=>{let n;switch(e.code){case Ne.invalid_type:e.received===Ge.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Ne.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Wt.jsonStringifyReplacer)}`;break;case Ne.unrecognized_keys:n=`Unrecognized key(s) in object: ${Wt.joinValues(e.keys,", ")}`;break;case Ne.invalid_union:n="Invalid input";break;case Ne.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Wt.joinValues(e.options)}`;break;case Ne.invalid_enum_value:n=`Invalid enum value. Expected ${Wt.joinValues(e.options)}, received '${e.received}'`;break;case Ne.invalid_arguments:n="Invalid function arguments";break;case Ne.invalid_return_type:n="Invalid function return type";break;case Ne.invalid_date:n="Invalid date";break;case Ne.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Wt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Ne.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Ne.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Ne.custom:n="Invalid input";break;case Ne.invalid_intersection_types:n="Intersection results could not be merged";break;case Ne.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Ne.not_finite:n="Number must be finite";break;default:n=t.defaultError,Wt.assertNever(e)}return{message:n}};let ase=s0;function lse(){return ase}const cse=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],l={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let c="";const h=r.filter(d=>!!d).slice().reverse();for(const d of h)c=d(l,{data:t,defaultError:c}).message;return{...i,path:o,message:c}};function Pe(e,t){const n=lse(),r=cse({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===s0?void 0:s0].filter(i=>!!i)});e.common.issues.push(r)}class Ci{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return dt;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const o=await i.key,l=await i.value;r.push({key:o,value:l})}return Ci.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:l}=i;if(o.status==="aborted"||l.status==="aborted")return dt;o.status==="dirty"&&t.dirty(),l.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(r[o.value]=l.value)}return{status:t.value,value:r}}}const dt=Object.freeze({status:"aborted"}),jd=e=>({status:"dirty",value:e}),Zi=e=>({status:"valid",value:e}),QT=e=>e.status==="aborted",JT=e=>e.status==="dirty",qc=e=>e.status==="valid",Hp=e=>typeof Promise<"u"&&e instanceof Promise;var Ze;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ze||(Ze={}));class Sa{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const eN=(e,t)=>{if(qc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new So(e.common.issues);return this._error=n,this._error}}};function Nt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(l,c)=>{const{message:h}=e;return l.code==="invalid_enum_value"?{message:h??c.defaultError}:typeof c.data>"u"?{message:h??r??c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:h??n??c.defaultError}},description:i}}class $t{get description(){return this._def.description}_getType(t){return fa(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:fa(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ci,ctx:{common:t.parent.common,data:t.data,parsedType:fa(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Hp(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fa(t)},i=this._parseSync({data:t,path:r.path,parent:r});return eN(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fa(t)};if(!this["~standard"].async)try{const o=this._parseSync({data:t,path:[],parent:n});return qc(o)?{value:o.value}:{issues:n.common.issues}}catch(o){(i=(r=o==null?void 0:o.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(o=>qc(o)?{value:o.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fa(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(Hp(i)?i:Promise.resolve(i));return eN(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const l=t(i),c=()=>o.addIssue({code:Ne.custom,...r(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(h=>h?!0:(c(),!1)):l?!0:(c(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Gc({schema:this,typeName:ht.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ya.create(this,this._def)}nullable(){return Yc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ps.create(this)}promise(){return Wp.create(this,this._def)}or(t){return Up.create([this,t],this._def)}and(t){return Vp.create(this,t,this._def)}transform(t){return new Gc({...Nt(this._def),schema:this,typeName:ht.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new l0({...Nt(this._def),innerType:this,defaultValue:n,typeName:ht.ZodDefault})}brand(){return new jse({typeName:ht.ZodBranded,type:this,...Nt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new c0({...Nt(this._def),innerType:this,catchValue:n,typeName:ht.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return i1.create(this,t)}readonly(){return u0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const use=/^c[^\s-]{8,}$/i,dse=/^[0-9a-z]+$/,hse=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fse=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,mse=/^[a-z0-9_-]{21}$/i,pse=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gse=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,vse=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_se="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let gy;const bse=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,yse=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,xse=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,wse=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sse=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Cse=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,AO="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",kse=new RegExp(`^${AO}$`);function jO(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Ese(e){return new RegExp(`^${jO(e)}$`)}function Rse(e){let t=`${AO}T${jO(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Tse(e,t){return!!((t==="v4"||!t)&&bse.test(e)||(t==="v6"||!t)&&xse.test(e))}function Nse(e,t){if(!pse.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function Mse(e,t){return!!((t==="v4"||!t)&&yse.test(e)||(t==="v6"||!t)&&wse.test(e))}class va extends $t{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ge.string){const o=this._getOrReturnCtx(t);return Pe(o,{code:Ne.invalid_type,expected:Ge.string,received:o.parsedType}),dt}const r=new Ci;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),Pe(i,{code:Ne.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),Pe(i,{code:Ne.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const l=t.data.length>o.value,c=t.data.length<o.value;(l||c)&&(i=this._getOrReturnCtx(t,i),l?Pe(i,{code:Ne.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):c&&Pe(i,{code:Ne.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")vse.test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"email",code:Ne.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")gy||(gy=new RegExp(_se,"u")),gy.test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"emoji",code:Ne.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")fse.test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"uuid",code:Ne.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")mse.test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"nanoid",code:Ne.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")use.test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"cuid",code:Ne.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")dse.test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"cuid2",code:Ne.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")hse.test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"ulid",code:Ne.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Pe(i,{validation:"url",code:Ne.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"regex",code:Ne.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),Pe(i,{code:Ne.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),Pe(i,{code:Ne.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),Pe(i,{code:Ne.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?Rse(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{code:Ne.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?kse.test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{code:Ne.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?Ese(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{code:Ne.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?gse.test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"duration",code:Ne.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?Tse(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"ip",code:Ne.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?Nse(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"jwt",code:Ne.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?Mse(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"cidr",code:Ne.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?Sse.test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"base64",code:Ne.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?Cse.test(t.data)||(i=this._getOrReturnCtx(t,i),Pe(i,{validation:"base64url",code:Ne.invalid_string,message:o.message}),r.dirty()):Wt.assertNever(o);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:Ne.invalid_string,...Ze.errToObj(r)})}_addCheck(t){return new va({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ze.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ze.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ze.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ze.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ze.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ze.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ze.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ze.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ze.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Ze.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Ze.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ze.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Ze.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Ze.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Ze.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Ze.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ze.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Ze.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ze.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ze.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ze.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ze.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ze.errToObj(n)})}nonempty(t){return this.min(1,Ze.errToObj(t))}trim(){return new va({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new va({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new va({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}va.create=e=>new va({checks:[],typeName:ht.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Nt(e)});function Ase(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return o%l/10**i}class dh extends $t{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Ge.number){const o=this._getOrReturnCtx(t);return Pe(o,{code:Ne.invalid_type,expected:Ge.number,received:o.parsedType}),dt}let r;const i=new Ci;for(const o of this._def.checks)o.kind==="int"?Wt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Pe(r,{code:Ne.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Ne.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Ne.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Ase(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Ne.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Pe(r,{code:Ne.not_finite,message:o.message}),i.dirty()):Wt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ze.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ze.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ze.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ze.toString(n))}setLimit(t,n,r,i){return new dh({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ze.toString(i)}]})}_addCheck(t){return new dh({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ze.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ze.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ze.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ze.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ze.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ze.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ze.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ze.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ze.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Wt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}dh.create=e=>new dh({checks:[],typeName:ht.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Nt(e)});class hh extends $t{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Ge.bigint)return this._getInvalidInput(t);let r;const i=new Ci;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Ne.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Ne.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Ne.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Wt.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return Pe(n,{code:Ne.invalid_type,expected:Ge.bigint,received:n.parsedType}),dt}gte(t,n){return this.setLimit("min",t,!0,Ze.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ze.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ze.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ze.toString(n))}setLimit(t,n,r,i){return new hh({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ze.toString(i)}]})}_addCheck(t){return new hh({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ze.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ze.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ze.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ze.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ze.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}hh.create=e=>new hh({checks:[],typeName:ht.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Nt(e)});class o0 extends $t{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ge.boolean){const r=this._getOrReturnCtx(t);return Pe(r,{code:Ne.invalid_type,expected:Ge.boolean,received:r.parsedType}),dt}return Zi(t.data)}}o0.create=e=>new o0({typeName:ht.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Nt(e)});class $p extends $t{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ge.date){const o=this._getOrReturnCtx(t);return Pe(o,{code:Ne.invalid_type,expected:Ge.date,received:o.parsedType}),dt}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return Pe(o,{code:Ne.invalid_date}),dt}const r=new Ci;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),Pe(i,{code:Ne.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),Pe(i,{code:Ne.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Wt.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new $p({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ze.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ze.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}$p.create=e=>new $p({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ht.ZodDate,...Nt(e)});class tN extends $t{_parse(t){if(this._getType(t)!==Ge.symbol){const r=this._getOrReturnCtx(t);return Pe(r,{code:Ne.invalid_type,expected:Ge.symbol,received:r.parsedType}),dt}return Zi(t.data)}}tN.create=e=>new tN({typeName:ht.ZodSymbol,...Nt(e)});class nN extends $t{_parse(t){if(this._getType(t)!==Ge.undefined){const r=this._getOrReturnCtx(t);return Pe(r,{code:Ne.invalid_type,expected:Ge.undefined,received:r.parsedType}),dt}return Zi(t.data)}}nN.create=e=>new nN({typeName:ht.ZodUndefined,...Nt(e)});class rN extends $t{_parse(t){if(this._getType(t)!==Ge.null){const r=this._getOrReturnCtx(t);return Pe(r,{code:Ne.invalid_type,expected:Ge.null,received:r.parsedType}),dt}return Zi(t.data)}}rN.create=e=>new rN({typeName:ht.ZodNull,...Nt(e)});class iN extends $t{constructor(){super(...arguments),this._any=!0}_parse(t){return Zi(t.data)}}iN.create=e=>new iN({typeName:ht.ZodAny,...Nt(e)});class sN extends $t{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Zi(t.data)}}sN.create=e=>new sN({typeName:ht.ZodUnknown,...Nt(e)});class Ca extends $t{_parse(t){const n=this._getOrReturnCtx(t);return Pe(n,{code:Ne.invalid_type,expected:Ge.never,received:n.parsedType}),dt}}Ca.create=e=>new Ca({typeName:ht.ZodNever,...Nt(e)});class oN extends $t{_parse(t){if(this._getType(t)!==Ge.undefined){const r=this._getOrReturnCtx(t);return Pe(r,{code:Ne.invalid_type,expected:Ge.void,received:r.parsedType}),dt}return Zi(t.data)}}oN.create=e=>new oN({typeName:ht.ZodVoid,...Nt(e)});class Ps extends $t{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==Ge.array)return Pe(n,{code:Ne.invalid_type,expected:Ge.array,received:n.parsedType}),dt;if(i.exactLength!==null){const l=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(l||c)&&(Pe(n,{code:l?Ne.too_big:Ne.too_small,minimum:c?i.exactLength.value:void 0,maximum:l?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(Pe(n,{code:Ne.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(Pe(n,{code:Ne.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((l,c)=>i.type._parseAsync(new Sa(n,l,n.path,c)))).then(l=>Ci.mergeArray(r,l));const o=[...n.data].map((l,c)=>i.type._parseSync(new Sa(n,l,n.path,c)));return Ci.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new Ps({...this._def,minLength:{value:t,message:Ze.toString(n)}})}max(t,n){return new Ps({...this._def,maxLength:{value:t,message:Ze.toString(n)}})}length(t,n){return new Ps({...this._def,exactLength:{value:t,message:Ze.toString(n)}})}nonempty(t){return this.min(1,t)}}Ps.create=(e,t)=>new Ps({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ht.ZodArray,...Nt(t)});function kc(e){if(e instanceof Qn){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ya.create(kc(r))}return new Qn({...e._def,shape:()=>t})}else return e instanceof Ps?new Ps({...e._def,type:kc(e.element)}):e instanceof ya?ya.create(kc(e.unwrap())):e instanceof Yc?Yc.create(kc(e.unwrap())):e instanceof Cl?Cl.create(e.items.map(t=>kc(t))):e}class Qn extends $t{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Wt.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Ge.object){const d=this._getOrReturnCtx(t);return Pe(d,{code:Ne.invalid_type,expected:Ge.object,received:d.parsedType}),dt}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:l}=this._getCached(),c=[];if(!(this._def.catchall instanceof Ca&&this._def.unknownKeys==="strip"))for(const d in i.data)l.includes(d)||c.push(d);const h=[];for(const d of l){const g=o[d],p=i.data[d];h.push({key:{status:"valid",value:d},value:g._parse(new Sa(i,p,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof Ca){const d=this._def.unknownKeys;if(d==="passthrough")for(const g of c)h.push({key:{status:"valid",value:g},value:{status:"valid",value:i.data[g]}});else if(d==="strict")c.length>0&&(Pe(i,{code:Ne.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const g of c){const p=i.data[g];h.push({key:{status:"valid",value:g},value:d._parse(new Sa(i,p,i.path,g)),alwaysSet:g in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const g of h){const p=await g.key,_=await g.value;d.push({key:p,value:_,alwaysSet:g.alwaysSet})}return d}).then(d=>Ci.mergeObjectSync(r,d)):Ci.mergeObjectSync(r,h)}get shape(){return this._def.shape()}strict(t){return Ze.errToObj,new Qn({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,l;const i=((l=(o=this._def).errorMap)==null?void 0:l.call(o,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Ze.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new Qn({...this._def,unknownKeys:"strip"})}passthrough(){return new Qn({...this._def,unknownKeys:"passthrough"})}extend(t){return new Qn({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Qn({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ht.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Qn({...this._def,catchall:t})}pick(t){const n={};for(const r of Wt.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Qn({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Wt.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new Qn({...this._def,shape:()=>n})}deepPartial(){return kc(this)}partial(t){const n={};for(const r of Wt.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new Qn({...this._def,shape:()=>n})}required(t){const n={};for(const r of Wt.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof ya;)o=o._def.innerType;n[r]=o}return new Qn({...this._def,shape:()=>n})}keyof(){return DO(Wt.objectKeys(this.shape))}}Qn.create=(e,t)=>new Qn({shape:()=>e,unknownKeys:"strip",catchall:Ca.create(),typeName:ht.ZodObject,...Nt(t)});Qn.strictCreate=(e,t)=>new Qn({shape:()=>e,unknownKeys:"strict",catchall:Ca.create(),typeName:ht.ZodObject,...Nt(t)});Qn.lazycreate=(e,t)=>new Qn({shape:e,unknownKeys:"strip",catchall:Ca.create(),typeName:ht.ZodObject,...Nt(t)});class Up extends $t{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const c of o)if(c.result.status==="valid")return c.result;for(const c of o)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const l=o.map(c=>new So(c.ctx.common.issues));return Pe(n,{code:Ne.invalid_union,unionErrors:l}),dt}if(n.common.async)return Promise.all(r.map(async o=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(i);{let o;const l=[];for(const h of r){const d={...n,common:{...n.common,issues:[]},parent:null},g=h._parseSync({data:n.data,path:n.path,parent:d});if(g.status==="valid")return g;g.status==="dirty"&&!o&&(o={result:g,ctx:d}),d.common.issues.length&&l.push(d.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const c=l.map(h=>new So(h));return Pe(n,{code:Ne.invalid_union,unionErrors:c}),dt}}get options(){return this._def.options}}Up.create=(e,t)=>new Up({options:e,typeName:ht.ZodUnion,...Nt(t)});function a0(e,t){const n=fa(e),r=fa(t);if(e===t)return{valid:!0,data:e};if(n===Ge.object&&r===Ge.object){const i=Wt.objectKeys(t),o=Wt.objectKeys(e).filter(c=>i.indexOf(c)!==-1),l={...e,...t};for(const c of o){const h=a0(e[c],t[c]);if(!h.valid)return{valid:!1};l[c]=h.data}return{valid:!0,data:l}}else if(n===Ge.array&&r===Ge.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o<e.length;o++){const l=e[o],c=t[o],h=a0(l,c);if(!h.valid)return{valid:!1};i.push(h.data)}return{valid:!0,data:i}}else return n===Ge.date&&r===Ge.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Vp extends $t{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(o,l)=>{if(QT(o)||QT(l))return dt;const c=a0(o.value,l.value);return c.valid?((JT(o)||JT(l))&&n.dirty(),{status:n.value,value:c.data}):(Pe(r,{code:Ne.invalid_intersection_types}),dt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,l])=>i(o,l)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Vp.create=(e,t,n)=>new Vp({left:e,right:t,typeName:ht.ZodIntersection,...Nt(n)});class Cl extends $t{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ge.array)return Pe(r,{code:Ne.invalid_type,expected:Ge.array,received:r.parsedType}),dt;if(r.data.length<this._def.items.length)return Pe(r,{code:Ne.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),dt;!this._def.rest&&r.data.length>this._def.items.length&&(Pe(r,{code:Ne.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((l,c)=>{const h=this._def.items[c]||this._def.rest;return h?h._parse(new Sa(r,l,r.path,c)):null}).filter(l=>!!l);return r.common.async?Promise.all(o).then(l=>Ci.mergeArray(n,l)):Ci.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Cl({...this._def,rest:t})}}Cl.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Cl({items:e,typeName:ht.ZodTuple,rest:null,...Nt(t)})};class aN extends $t{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ge.map)return Pe(r,{code:Ne.invalid_type,expected:Ge.map,received:r.parsedType}),dt;const i=this._def.keyType,o=this._def.valueType,l=[...r.data.entries()].map(([c,h],d)=>({key:i._parse(new Sa(r,c,r.path,[d,"key"])),value:o._parse(new Sa(r,h,r.path,[d,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const h of l){const d=await h.key,g=await h.value;if(d.status==="aborted"||g.status==="aborted")return dt;(d.status==="dirty"||g.status==="dirty")&&n.dirty(),c.set(d.value,g.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const h of l){const d=h.key,g=h.value;if(d.status==="aborted"||g.status==="aborted")return dt;(d.status==="dirty"||g.status==="dirty")&&n.dirty(),c.set(d.value,g.value)}return{status:n.value,value:c}}}}aN.create=(e,t,n)=>new aN({valueType:t,keyType:e,typeName:ht.ZodMap,...Nt(n)});class fh extends $t{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ge.set)return Pe(r,{code:Ne.invalid_type,expected:Ge.set,received:r.parsedType}),dt;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(Pe(r,{code:Ne.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(Pe(r,{code:Ne.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function l(h){const d=new Set;for(const g of h){if(g.status==="aborted")return dt;g.status==="dirty"&&n.dirty(),d.add(g.value)}return{status:n.value,value:d}}const c=[...r.data.values()].map((h,d)=>o._parse(new Sa(r,h,r.path,d)));return r.common.async?Promise.all(c).then(h=>l(h)):l(c)}min(t,n){return new fh({...this._def,minSize:{value:t,message:Ze.toString(n)}})}max(t,n){return new fh({...this._def,maxSize:{value:t,message:Ze.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}fh.create=(e,t)=>new fh({valueType:e,minSize:null,maxSize:null,typeName:ht.ZodSet,...Nt(t)});class lN extends $t{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}lN.create=(e,t)=>new lN({getter:e,typeName:ht.ZodLazy,...Nt(t)});class cN extends $t{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Pe(n,{received:n.data,code:Ne.invalid_literal,expected:this._def.value}),dt}return{status:"valid",value:t.data}}get value(){return this._def.value}}cN.create=(e,t)=>new cN({value:e,typeName:ht.ZodLiteral,...Nt(t)});function DO(e,t){return new Kc({values:e,typeName:ht.ZodEnum,...Nt(t)})}class Kc extends $t{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Pe(n,{expected:Wt.joinValues(r),received:n.parsedType,code:Ne.invalid_type}),dt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return Pe(n,{received:n.data,code:Ne.invalid_enum_value,options:r}),dt}return Zi(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Kc.create(t,{...this._def,...n})}exclude(t,n=this._def){return Kc.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Kc.create=DO;class uN extends $t{_parse(t){const n=Wt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Ge.string&&r.parsedType!==Ge.number){const i=Wt.objectValues(n);return Pe(r,{expected:Wt.joinValues(i),received:r.parsedType,code:Ne.invalid_type}),dt}if(this._cache||(this._cache=new Set(Wt.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Wt.objectValues(n);return Pe(r,{received:r.data,code:Ne.invalid_enum_value,options:i}),dt}return Zi(t.data)}get enum(){return this._def.values}}uN.create=(e,t)=>new uN({values:e,typeName:ht.ZodNativeEnum,...Nt(t)});class Wp extends $t{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ge.promise&&n.common.async===!1)return Pe(n,{code:Ne.invalid_type,expected:Ge.promise,received:n.parsedType}),dt;const r=n.parsedType===Ge.promise?n.data:Promise.resolve(n.data);return Zi(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Wp.create=(e,t)=>new Wp({type:e,typeName:ht.ZodPromise,...Nt(t)});class Gc extends $t{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ht.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:l=>{Pe(r,l),l.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const l=i.transform(r.data,o);if(r.common.async)return Promise.resolve(l).then(async c=>{if(n.value==="aborted")return dt;const h=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return h.status==="aborted"?dt:h.status==="dirty"||n.value==="dirty"?jd(h.value):h});{if(n.value==="aborted")return dt;const c=this._def.schema._parseSync({data:l,path:r.path,parent:r});return c.status==="aborted"?dt:c.status==="dirty"||n.value==="dirty"?jd(c.value):c}}if(i.type==="refinement"){const l=c=>{const h=i.refinement(c,o);if(r.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?dt:(c.status==="dirty"&&n.dirty(),l(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?dt:(c.status==="dirty"&&n.dirty(),l(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!qc(l))return dt;const c=i.transform(l.value,o);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>qc(l)?Promise.resolve(i.transform(l.value,o)).then(c=>({status:n.value,value:c})):dt);Wt.assertNever(i)}}Gc.create=(e,t,n)=>new Gc({schema:e,typeName:ht.ZodEffects,effect:t,...Nt(n)});Gc.createWithPreprocess=(e,t,n)=>new Gc({schema:t,effect:{type:"preprocess",transform:e},typeName:ht.ZodEffects,...Nt(n)});class ya extends $t{_parse(t){return this._getType(t)===Ge.undefined?Zi(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ya.create=(e,t)=>new ya({innerType:e,typeName:ht.ZodOptional,...Nt(t)});class Yc extends $t{_parse(t){return this._getType(t)===Ge.null?Zi(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Yc.create=(e,t)=>new Yc({innerType:e,typeName:ht.ZodNullable,...Nt(t)});class l0 extends $t{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Ge.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}l0.create=(e,t)=>new l0({innerType:e,typeName:ht.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Nt(t)});class c0 extends $t{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Hp(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new So(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new So(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}c0.create=(e,t)=>new c0({innerType:e,typeName:ht.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Nt(t)});class dN extends $t{_parse(t){if(this._getType(t)!==Ge.nan){const r=this._getOrReturnCtx(t);return Pe(r,{code:Ne.invalid_type,expected:Ge.nan,received:r.parsedType}),dt}return{status:"valid",value:t.data}}}dN.create=e=>new dN({typeName:ht.ZodNaN,...Nt(e)});class jse extends $t{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class i1 extends $t{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?dt:o.status==="dirty"?(n.dirty(),jd(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?dt:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new i1({in:t,out:n,typeName:ht.ZodPipeline})}}class u0 extends $t{_parse(t){const n=this._def.innerType._parse(t),r=i=>(qc(i)&&(i.value=Object.freeze(i.value)),i);return Hp(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}u0.create=(e,t)=>new u0({innerType:e,typeName:ht.ZodReadonly,...Nt(t)});var ht;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ht||(ht={}));const hl=va.create,OO=o0.create;Ca.create;const LO=Ps.create,s1=Qn.create;Up.create;Vp.create;Cl.create;const Dse=Kc.create;Wp.create;ya.create;Yc.create;const Ose=/^\d{4}-\d{2}-\d{2}$/,Lse=s1({title:hl().min(1),items:LO(hl().min(1)).min(1)}),zse=s1({version:hl().min(1),publishedAt:hl().regex(Ose,"Expected YYYY-MM-DD"),title:hl().min(1),sections:LO(Lse).min(1),prerelease:OO().optional()});s1({changeType:Dse(["feature","improvement","fix","internal","docs"]),title:hl().min(1),summary:hl().min(1),public:OO()});const Pse=[{version:"0.6.0",publishedAt:"2026-03-29",title:"Remote handoff setup and QR launches",sections:[{title:"New Features",items:["Add remote handoff flow for Kaizen: Kaizen can now guide remote Tailscale setup and generate handoff links and QR codes for opening sessions on another device."]}]},{version:"0.5.0",publishedAt:"2026-03-29",title:"Bundled release history and stronger session recovery",sections:[{title:"New Features",items:["Bundled release history and stronger session recovery: Kaizen now ships in-app and web release notes while recovering chat usage and session state more reliably after reloads."]}]},{version:"0.4.0",publishedAt:"2026-03-29",title:"Branding refresh and packaged runtime updates",sections:[{title:"Highlights",items:["Refreshed the Kaizen branding and theme system across the product surface.","Published the built Kaizen runtime and added the web start command needed for the packaged flow.","Renamed the `keizen` app paths to `kaizen`, fixed review follow-ups, and aligned web builds on Node 20."]}]},{version:"0.3.0",publishedAt:"2026-03-29",title:"Feature overview workflow and release workflow baseline",sections:[{title:"Highlights",items:["Added the feature overview workflow and plan attachment support for structured project work.","Added the pull-request skill and the first pass of the npm publish and release workflow guidance."]}]},{version:"0.2.2",publishedAt:"2026-03-28",title:"UI and restart regression fixes",sections:[{title:"Highlights",items:["Fixed Kaizen UI regressions and restart issues that were blocking a stable local runtime."]}]}];function hN(e){return new Date(`${e}T00:00:00.000Z`).getTime()}function Ise(e,t="en-US"){return new Intl.DateTimeFormat(t,{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}).format(new Date(`${e}T00:00:00.000Z`))}function Bse(e){return[...e].sort((t,n)=>{const r=hN(n.publishedAt)-hN(t.publishedAt);return r!==0?r:n.version.localeCompare(t.version,void 0,{numeric:!0,sensitivity:"base"})})}const Fse=Object.freeze(Bse(Pse.map(e=>zse.parse(e))));function Hse({entries:e}){return e.length===0?f.jsx("div",{className:"rounded-2xl border border-dashed border-border bg-card/30 px-6 py-10 text-sm text-muted-foreground",children:"No release notes have been published yet."}):f.jsx("div",{className:"space-y-4",children:e.map(t=>f.jsxs("article",{className:"rounded-2xl border border-border bg-card/60 p-5",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("h3",{className:"text-base font-semibold text-foreground",children:t.title}),f.jsxs("span",{className:"rounded-full border border-border bg-muted/60 px-2.5 py-1 text-xs font-medium text-muted-foreground",children:["v",t.version]}),t.prerelease?f.jsx("span",{className:"rounded-full border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-xs font-medium text-amber-600 dark:text-amber-300",children:"Prerelease"}):null]}),f.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Published ",Ise(t.publishedAt)]}),f.jsx("div",{className:"mt-4 space-y-4 text-sm text-foreground",children:t.sections.map(n=>f.jsxs("section",{className:"space-y-2",children:[f.jsx("h4",{className:"text-sm font-semibold text-foreground",children:n.title}),f.jsx("ul",{className:"list-disc space-y-2 pl-5 text-muted-foreground",children:n.items.map(r=>f.jsx("li",{children:r},r))})]},n.title))})]},`${t.version}-${t.publishedAt}`))})}const Dd=[{id:"general",label:"General",icon:S9,subtitle:"Manage appearance, editor behavior, and embedded terminal defaults."},{id:"changelog",label:"Release Notes",icon:I5,subtitle:"Review shipped changes included in the npm release history."},{id:"providers",label:"Providers",icon:r9,subtitle:"Manage the default chat provider and saved model defaults for Claude, Codex, Gemini, and Cursor."},{id:"keybindings",label:"Keybindings",icon:p8,subtitle:"Edit global app shortcuts stored in the active keybindings file."}];function fN(e){return e&&Dd.some(t=>t.id===e)?e:null}const $se=[{value:"cursor",label:"Cursor"},{value:"vscode",label:"VS Code"},{value:"windsurf",label:"Windsurf"},{value:"custom",label:"Custom"}],mN=Object.keys(Gj);function Use(e){return`Edit global app shortcuts stored in ${e}.`}function Vse(e){const t=(e==null?void 0:e.status)==="checking",n=(e==null?void 0:e.status)==="updating"||(e==null?void 0:e.status)==="restart_pending";return e!=null&&e.updateAvailable?{disabled:n,kind:"update",label:"Update",variant:"default"}:{disabled:t||n,kind:"check",label:"Check for updates",spinning:t,variant:"outline"}}function Im(e,t){const n=un(t),r=(e==null?void 0:e.settings[t])??sr[t];return n.systemActive?r.active?"Active.":"Inactive.":"Inactive by server policy."}function Wse(e){return e&&typeof e=="object"&&"idx"in e&&typeof e.idx=="number"&&e.idx>0?"back":"home"}function pN({themePreference:e,nextBackgroundImage:t,backgroundOpacity:n}){const r=typeof t=="string"&&t.trim()!=="";return e!=="custom"||!r||n!==1?{}:{backgroundOpacity:.85,backgroundBlur:6}}function jn({title:e,description:t,children:n,bordered:r=!0,alignStart:i=!1}){return f.jsx("div",{className:r?"border-t border-border":void 0,children:f.jsxs("div",{className:`flex flex-col sm:flex-row sm:justify-between gap-3 sm:gap-8 py-5 ${i?"sm:items-start":"sm:items-center"}`,children:[f.jsxs("div",{className:"min-w-0 max-w-xl",children:[f.jsx("div",{className:"text-sm font-medium text-foreground",children:e}),f.jsx("div",{className:"mt-1 text-[13px] text-muted-foreground",children:t})]}),f.jsx("div",{className:"flex w-full items-center sm:w-auto sm:shrink-0",children:n})]})})}function qse(){var fs,Dl;const e=kl(),{sectionId:t}=ON(),n=Yp(),{theme:r,setTheme:i}=l4(),o=fN(t)??"general",l=n.connectionStatus==="connecting"||!n.localProjectsReady,c=((fs=n.localProjects)==null?void 0:fs.machine.displayName)??"Unavailable",h=((Dl=n.localProjects)==null?void 0:Dl.projects.length)??0,d=F0.split("/")[1]??"unknown",g=Bi(K=>K.scrollbackLines),p=Bi(K=>K.minColumnWidth),_=Bi(K=>K.editorPreset),y=Bi(K=>K.editorCommandTemplate),w=Bi(K=>K.setScrollbackLines),S=Bi(K=>K.setMinColumnWidth),C=Bi(K=>K.setEditorPreset),k=Bi(K=>K.setEditorCommandTemplate),R=n.keybindings,E=n.providerSettings,N=Ii(K=>K.defaultProvider),L=Ii(K=>K.providerDefaults),j=Ii(K=>K.showProviderIconsInSideTray),O=Ii(K=>K.setDefaultProvider),H=Ii(K=>K.setProviderDefaultModel),Z=Ii(K=>K.setProviderDefaultModelOptions),I=Ii(K=>K.setProviderDefaultPlanMode),W=Ii(K=>K.setShowProviderIconsInSideTray),F=yi(K=>K.folderGroupsEnabled),$=yi(K=>K.showFeatureOverviewInSidebar),V=yi(K=>K.kanbanStatusesEnabled),q=yi(K=>K.commitProjectMetadataDirectory),D=yi(K=>K.setFolderGroupsEnabled),U=yi(K=>K.setShowFeatureOverviewInSidebar),z=yi(K=>K.setKanbanStatusesEnabled),G=yi(K=>K.setCommitProjectMetadataDirectory),M=_n(K=>K.themeId),B=_n(K=>K.customAppearance),X=_n(K=>K.backgroundImage),A=_n(K=>K.backgroundOpacity),ie=_n(K=>K.backgroundBlur),J=_n(K=>K.showProjectIconsInSidebar),ee=_n(K=>K.availableThemes),re=_n(K=>K.setThemeId),ue=_n(K=>K.setCustomAppearance),fe=_n(K=>K.setBackgroundImage),ge=_n(K=>K.setBackgroundOpacity),Ce=_n(K=>K.setBackgroundBlur),Te=_n(K=>K.setShowProjectIconsInSidebar),je=v.useMemo(()=>gw(R),[R]),Xe=je.filePathDisplay||UF(),[xt,Et]=v.useState(String(g)),[me,Fe]=v.useState(String(p)),[De,ft]=v.useState(y),[at,it]=v.useState(X??""),[hn,Mt]=v.useState(String(A)),[Pn,de]=v.useState(String(ie)),[se,ye]=v.useState({}),[Ee,qe]=v.useState(null),[lt,Je]=v.useState(null),[Ae,He]=v.useState(null),mt=v.useMemo(()=>$0((E==null?void 0:E.settings)??sr),[E==null?void 0:E.settings]),Ve=N==="last_used"||mt.some(K=>K.id===N)?N:"last_used",[fn,rn]=v.useState([]),et=n.updateSnapshot,en=n.themeSettings,Un=Vse(et),Qt=(et==null?void 0:et.status)==="checking"?"Checking for updates…":(et==null?void 0:et.status)==="updating"?"Installing update…":(et==null?void 0:et.status)==="restart_pending"?`Restarting ${Dn}…`:(et==null?void 0:et.status)==="available"?`Update available${et.latestVersion?`: ${et.latestVersion}`:""}`:(et==null?void 0:et.status)==="up_to_date"?"Up to date":(et==null?void 0:et.status)==="error"?"Update check failed":"Not checked yet";v.useEffect(()=>{fetch("/api/backgrounds").then(K=>K.json()).then(K=>rn(K)).catch(K=>console.error("Failed to load system backgrounds",K))},[]),v.useEffect(()=>{Et(String(g))},[g]),v.useEffect(()=>{Fe(String(p))},[p]),v.useEffect(()=>{ft(y)},[y]),v.useEffect(()=>{it(X??"")},[X]),v.useEffect(()=>{Mt(String(A))},[A]),v.useEffect(()=>{de(String(ie))},[ie]),v.useEffect(()=>{ye(Object.fromEntries(mN.map(K=>[K,Eb(je.bindings[K])])))},[je]),v.useEffect(()=>{t&&(fN(t)||e("/settings/general",{replace:!0}))},[e,t]);function qt(){const K=Number(xt);if(!Number.isFinite(K)){Et(String(g));return}w(K)}function Ie(){const K=Number(me);if(!Number.isFinite(K)){Fe(String(p));return}S(K)}function gt(){const K=at.trim()===""?null:at.trim(),st=pN({themePreference:r,nextBackgroundImage:K,backgroundOpacity:A});fe(K),st.backgroundOpacity!==void 0&&ge(st.backgroundOpacity),st.backgroundBlur!==void 0&&Ce(st.backgroundBlur),ke({backgroundImage:K,...st})}function wt(){const K=Number(hn);if(!Number.isFinite(K)||K<0||K>1){Mt(String(A));return}ge(K),ke({backgroundOpacity:K})}function Rt(){const K=Number(Pn);if(!Number.isFinite(K)||K<0){de(String(ie));return}Ce(K),ke({backgroundBlur:K})}function Jt(K,st){K.key==="Enter"&&(st(),K.currentTarget.blur())}function vt(K,st){K.key==="Enter"&&(st(),K.currentTarget.blur())}function _t(){k(De)}async function Sn(K=se){try{qe(null),await n.socket.command({type:"settings.writeKeybindings",bindings:gN(K)})}catch(st){qe(st instanceof Error?st.message:"Unable to save keybindings.")}}async function ke(K){try{await n.socket.command({type:"settings.writeThemeSettings",settings:{themePreference:(K==null?void 0:K.themePreference)??r,themeId:(K==null?void 0:K.themeId)??M,customAppearance:(K==null?void 0:K.customAppearance)??B,backgroundImage:(K==null?void 0:K.backgroundImage)!==void 0?K.backgroundImage:X,backgroundOpacity:(K==null?void 0:K.backgroundOpacity)??A,backgroundBlur:(K==null?void 0:K.backgroundBlur)??ie,showProjectIconsInSidebar:(K==null?void 0:K.showProjectIconsInSidebar)??J}})}catch(st){console.error("Failed to save theme settings:",st)}}async function Oe(K,st){He(K);try{await st()}finally{He(Vn=>Vn===K?null:Vn)}}async function Tt(K){try{Je(null),await n.socket.command({type:"settings.writeProviderSettings",settings:K})}catch(st){Je(st instanceof Error?st.message:"Unable to save provider settings.")}}async function ct(K){const st={...se,[K]:Eb(ks[K])};ye(st);try{qe(null),await n.socket.command({type:"settings.writeKeybindings",bindings:gN(st)})}catch(Vn){qe(Vn instanceof Error?Vn.message:"Unable to save keybindings.")}}const mn=De.replaceAll("{path}","/Users/jake/Projects/kaizen/src/client/app/App.tsx").replaceAll("{line}","12").replaceAll("{column}","1"),bn=Dd.find(K=>K.id===o)??Dd[0],sn=o==="keybindings"?Use(Xe):bn.subtitle,Kt=!l,Gt=o==="keybindings"?f.jsxs(wc,{onClick:()=>{n.handleOpenExternalPath("open_editor",Xe)},icon:f.jsx(Cy,{className:"h-4 w-4"}),children:["Open in ",n.editorLabel]}):o==="general"?f.jsx(wc,{variant:Un.variant,onClick:()=>{if(Un.kind==="update"){n.handleInstallUpdate();return}n.handleCheckForUpdates({force:!0})},disabled:Un.disabled,icon:Un.kind==="check"?f.jsx(op,{className:pe("size-3.5",Un.spinning&&"animate-spin")}):Un.kind==="update"?f.jsx(I5,{className:pe("size-3.5")}):void 0,children:Un.label}):null;function Mr(){if(Wse(window.history.state)==="back"){e(-1);return}e("/",{replace:!0})}return f.jsxs("div",{className:"relative flex h-full flex-1 min-w-0 bg-background",children:[f.jsxs("div",{className:"flex min-w-0 flex-1",children:[f.jsx("aside",{className:`hidden w-[200px] shrink-0 md:block ${Kt?"pb-[89px]":""}`,children:f.jsxs("div",{className:"flex flex-col gap-1 px-4 py-6",children:[f.jsx("div",{className:"px-3 pb-5 text-[22px] font-extrabold tracking-[-0.5px] text-foreground",children:"Settings"}),Dd.map(K=>f.jsx("button",{type:"button",onClick:()=>e(`/settings/${K.id}`),className:`cursor-pointer rounded-lg px-3 py-2 text-sm ${K.id===o?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:f.jsxs("div",{className:"flex items-center gap-2.5",children:[f.jsx(K.icon,{className:"h-4 w-4 shrink-0"}),f.jsx("span",{children:K.label})]})},K.label))]})}),f.jsxs("div",{className:"min-w-0 flex-1 overflow-y-auto",children:[f.jsx("div",{className:"md:hidden sticky top-0 z-10 bg-background border-b border-border px-4 py-2 backdrop-blur-md",children:f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto scrollbar-hide",children:Dd.map(K=>f.jsxs("button",{type:"button",onClick:()=>e(`/settings/${K.id}`),className:`flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm transition-colors ${K.id===o?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:[f.jsx(K.icon,{className:"h-3.5 w-3.5 shrink-0"}),f.jsx("span",{children:K.label})]},K.id))}),f.jsx("button",{type:"button","aria-label":"Close settings",onClick:Mr,className:"ml-1 flex shrink-0 items-center justify-center rounded-lg p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:f.jsx(_o,{className:"h-4 w-4"})})]})}),f.jsxs("div",{className:"w-full px-6 pt-8 md:pt-16 pb-32",children:[l?f.jsx("div",{className:"flex min-h-[240px] items-center justify-center rounded-2xl border border-border bg-card/40 px-4 py-6 text-sm text-muted-foreground",children:f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Lr,{className:"h-4 w-4 animate-spin"}),f.jsx("span",{children:"Loading machine settings…"})]})}):f.jsxs("div",{className:"mx-auto max-w-4xl",children:[f.jsxs("div",{className:"pb-6",children:[f.jsxs("div",{className:"flex items-center justify-between gap-4 min-h-[34px]",children:[f.jsx("div",{className:"text-lg font-semibold tracking-[-0.2px] text-foreground",children:bn.label}),f.jsxs("div",{className:"flex items-center gap-2",children:[Gt,f.jsx(wc,{"aria-label":"Close settings",title:"Close settings",onClick:Mr,icon:f.jsx(_o,{className:"h-4 w-4"}),className:"hidden md:flex"})]})]}),f.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:sn})]}),o==="general"?f.jsx(f.Fragment,{children:f.jsxs("div",{className:"border-b border-border",children:[f.jsx(jn,{title:"Application Update",description:f.jsxs(f.Fragment,{children:[f.jsxs("span",{children:[Qt,"."]}),et!=null&&et.lastCheckedAt?f.jsxs("span",{children:[" ","Last checked"," ",new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(et.lastCheckedAt),"."]}):null,et!=null&&et.error?f.jsxs("span",{children:[" ",et.error]}):null]}),bordered:!1,children:f.jsxs("div",{className:"text-right text-sm text-foreground",children:[f.jsxs("div",{children:["Current:"," ",(et==null?void 0:et.currentVersion)??d]}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:["Latest: ",(et==null?void 0:et.latestVersion)??"Unknown"]})]})}),f.jsx(jn,{title:"Theme",description:"Choose between light, dark, system, or custom appearance",children:f.jsxs(Er,{value:r,onValueChange:K=>{i(K),ke({themePreference:K})},children:[f.jsx(cr,{className:"w-[150px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx(Ht,{value:"light",children:"Light"}),f.jsx(Ht,{value:"dark",children:"Dark"}),f.jsx(Ht,{value:"system",children:"System"}),f.jsx(Ht,{value:"custom",children:"Custom"})]})]})}),r==="custom"?f.jsxs("div",{className:"mb-2 ml-6 space-y-0 border-l border-border/60 pl-4",children:[f.jsx(jn,{title:"Appearance",description:"Choose light, dark, or system mode for your custom theme",bordered:!1,children:f.jsxs(Er,{value:B,onValueChange:K=>{ue(K),ke({customAppearance:K})},children:[f.jsx(cr,{className:"w-[150px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx(Ht,{value:"light",children:"Light"}),f.jsx(Ht,{value:"dark",children:"Dark"}),f.jsx(Ht,{value:"system",children:"System"})]})]})}),f.jsx(jn,{title:"Color Theme",description:`Choose a color palette for the interface. Custom JSON themes live in ${(en==null?void 0:en.themesDirectoryDisplay)??"~/.kaizen/themes"}. Read ${(en==null?void 0:en.themesReadmeFileDisplay)??"~/.kaizen/themes/THEME_README.md"} for authoring guidance.`,alignStart:!0,bordered:!1,children:f.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-2 sm:max-w-[320px]",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(Er,{value:M,onValueChange:K=>{re(K),ke({themeId:K})},children:[f.jsx(cr,{className:"min-w-[180px]",children:f.jsx(jr,{})}),f.jsx(ur,{children:f.jsx(wb,{children:ee.map(K=>f.jsx(Ht,{value:K.id,children:K.label},K.id))})})]}),f.jsx(wc,{variant:"outline","aria-label":"Refresh themes",title:"Refresh themes",className:"px-2.5",disabled:Ae!==null,onClick:()=>{Oe("refresh",()=>n.handleRefreshThemeSettings())},icon:Ae==="refresh"?f.jsx(Lr,{className:"size-3.5 animate-spin"}):f.jsx(op,{className:"size-3.5"})})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsxs(wc,{disabled:Ae!==null,onClick:()=>{Oe("open_editor",()=>n.handleOpenCustomThemes())},icon:Ae==="open_editor"?f.jsx(Lr,{className:"size-3.5 animate-spin"}):f.jsx(c9,{className:"size-3.5"}),children:["Open in ",n.editorLabel]}),f.jsx(wc,{variant:"outline",disabled:Ae!==null,onClick:()=>{Oe("open_folder",()=>n.handleOpenExternalPath("open_finder",(en==null?void 0:en.themesDirectoryDisplay)??"~/.kaizen/themes"))},icon:Ae==="open_folder"?f.jsx(Lr,{className:"size-3.5 animate-spin"}):f.jsx(Cy,{className:"size-3.5"}),children:"Open folder"})]}),en!=null&&en.customThemeWarnings.length?f.jsx("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/5 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:en.customThemeWarnings.join(" ")}):null]})}),f.jsx(jn,{title:"Background Image",description:"Choose a background or enter a custom URL",alignStart:!0,bordered:!1,children:(()=>{const K=fn.find(Ft=>Ft.url===at),st=!at,Vn=!!at&&!K,ms=st?"__none__":Vn?"__custom__":at,Ei=st?"None":Vn?"Custom URL":(K==null?void 0:K.name)??"Unknown";return f.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-2 sm:max-w-[320px]",children:[f.jsxs(Er,{value:ms,onValueChange:Ft=>{if(Ft==="__none__")it(""),fe(null),ke({backgroundImage:null});else{const In=pN({themePreference:r,nextBackgroundImage:Ft,backgroundOpacity:A});it(Ft),fe(Ft),In.backgroundOpacity!==void 0&&ge(In.backgroundOpacity),In.backgroundBlur!==void 0&&Ce(In.backgroundBlur),ke({backgroundImage:Ft,...In})}},children:[f.jsx(cr,{className:"w-full",children:f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[st?null:f.jsx("img",{src:at,alt:"",className:"h-5 w-9 shrink-0 rounded object-cover"}),f.jsx("span",{className:"truncate",children:Ei})]})}),f.jsxs(ur,{children:[f.jsx(Wm,{value:"__none__",children:"None"}),fn.map(Ft=>f.jsx(Wm,{value:Ft.url,thumbnail:Ft.url,thumbnailAlt:Ft.name,children:Ft.name},Ft.id)),Vn?f.jsx(Wm,{value:"__custom__",thumbnail:at,thumbnailAlt:"Custom",children:"Custom URL"}):null]})]}),f.jsx(Fi,{type:"text",placeholder:"Or enter a custom URL...",value:at,onChange:Ft=>it(Ft.target.value),onBlur:gt,onKeyDown:Ft=>vt(Ft,gt),className:"w-full"})]})})()}),f.jsx(jn,{title:"Background Opacity",description:"Opacity of the interface layered over the background (0 to 1)",bordered:!1,children:f.jsx("div",{className:"flex min-w-0 flex-col items-end gap-2",children:f.jsx(Fi,{type:"number",min:0,max:1,step:.05,value:hn,onChange:K=>Mt(K.target.value),onBlur:wt,onKeyDown:K=>Jt(K,wt),className:"hide-number-steppers w-28 text-right font-mono"})})}),f.jsx(jn,{title:"Background Blur",description:"Blur applied to the background image (in pixels)",bordered:!1,children:f.jsx("div",{className:"flex min-w-0 flex-col items-end gap-2",children:f.jsx(Fi,{type:"number",min:0,max:50,step:1,value:Pn,onChange:K=>de(K.target.value),onBlur:Rt,onKeyDown:K=>Jt(K,Rt),className:"hide-number-steppers w-28 text-right font-mono"})})})]}):null,f.jsx(jn,{title:"Project Icons",description:"Show detected project icons in the sidebar and open-project list.",children:f.jsxs(Er,{value:J?"enabled":"disabled",onValueChange:K=>{const st=K==="enabled";Te(st),ke({showProjectIconsInSidebar:st})},children:[f.jsx(cr,{className:"w-[100px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx(Ht,{value:"disabled",children:"Off"}),f.jsx(Ht,{value:"enabled",children:"On"})]})]})}),f.jsx(jn,{title:"Folder Groups",description:"Show or hide feature folder grouping in the sidebar. Turning this off keeps the existing feature state, but flattens chats into a direct list and hides the new-folder button.",children:f.jsxs(Er,{value:F?"enabled":"disabled",onValueChange:K=>D(K==="enabled"),children:[f.jsx(cr,{className:"w-[100px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx(Ht,{value:"disabled",children:"Off"}),f.jsx(Ht,{value:"enabled",children:"On"})]})]})}),F?f.jsxs("div",{className:"mb-2 ml-6 space-y-0 border-l border-border/60 pl-4",children:[f.jsx(jn,{title:"Feature Overview",description:"Generate and show an `overview.md` file for feature folders. Turning this off stops creating new overview files and hides existing overview rows from the sidebar.",bordered:!1,children:f.jsxs(Er,{value:$?"enabled":"disabled",onValueChange:K=>U(K==="enabled"),children:[f.jsx(cr,{className:"w-[100px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx(Ht,{value:"disabled",children:"Off"}),f.jsx(Ht,{value:"enabled",children:"On"})]})]})}),f.jsx(jn,{title:"Kanban Status",description:"Show or hide feature status controls like Idea, Todo, Progress, Testing, and Done.",bordered:!1,children:f.jsxs(Er,{value:V?"enabled":"disabled",onValueChange:K=>z(K==="enabled"),children:[f.jsx(cr,{className:"w-[100px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx(Ht,{value:"disabled",children:"Off"}),f.jsx(Ht,{value:"enabled",children:"On"})]})]})}),f.jsx(jn,{title:`${pb} In Git`,description:`Control whether ${Dn} keeps the project ${pb} directory tracked in git or adds it to .gitignore for currently loaded projects and future opens. This is best suited to solo developers working across multiple machines. For team repos, we recommend ignoring \`${pb}\`.`,bordered:!1,children:f.jsxs(Er,{value:q?"commit":"ignore",onValueChange:K=>{const st=K==="commit";G(st),n.handleSetCommitProjectMetadataDirectory(st)},children:[f.jsx(cr,{className:"w-[120px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx(Ht,{value:"commit",children:"Commit"}),f.jsx(Ht,{value:"ignore",children:"Ignore"})]})]})})]}):null,f.jsx(jn,{title:"Provider Icons In Side Tray",description:"Show provider badges next to chats in the left sidebar side tray.",children:f.jsxs(Er,{value:j?"enabled":"disabled",onValueChange:K=>W(K==="enabled"),children:[f.jsx(cr,{className:"w-[100px]",children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx(Ht,{value:"disabled",children:"Off"}),f.jsx(Ht,{value:"enabled",children:"On"})]})]})}),f.jsx(jn,{title:"Default Editor",description:"Used by the navbar code button and local file links in chat",alignStart:!0,children:f.jsxs(Er,{value:_,onValueChange:K=>C(K),children:[f.jsx(cr,{className:"min-w-[180px]",children:f.jsx(jr,{})}),f.jsx(ur,{children:f.jsx(wb,{children:$se.map(K=>f.jsx(Ht,{value:K.value,children:K.label},K.value))})})]})}),_==="custom"?f.jsx("div",{className:"border-t border-border",children:f.jsxs("div",{className:"flex justify-between gap-8 py-5 pl-6",children:[f.jsxs("div",{className:"min-w-0 max-w-xl",children:[f.jsx("div",{className:"text-sm font-medium text-foreground",children:"Command Template"}),f.jsxs("div",{className:"mt-1 text-[13px] text-muted-foreground",children:["Include ","{path}"," and optionally ","{line}"," and"," ","{column}"," in your command."]})]}),f.jsxs("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:[f.jsx(Fi,{type:"text",value:De,onChange:K=>ft(K.target.value),onBlur:_t,onKeyDown:K=>vt(K,_t),className:"font-mono"}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:["Preview:"," ",f.jsx("span",{className:"font-mono",children:mn})]})]})]})}):null,f.jsx(jn,{title:"Terminal Scrollback",description:"Lines retained for embedded terminal history",children:f.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[f.jsx(Fi,{type:"number",min:Hx,max:$x,step:100,value:xt,onChange:K=>Et(K.target.value),onBlur:qt,onKeyDown:K=>Jt(K,qt),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),f.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[Hx,"-",$x," ","lines",g===Op?" (default)":""]})]})}),f.jsx(jn,{title:"Terminal Min Column Width",description:"Minimum width for each terminal pane",children:f.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[f.jsx(Fi,{type:"number",min:Ux,max:Vx,step:10,value:me,onChange:K=>Fe(K.target.value),onBlur:Ie,onKeyDown:K=>Jt(K,Ie),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),f.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[Ux,"-",Vx," px",p===Lp?" (default)":""]})]})})]})}):o==="changelog"?f.jsx(Hse,{entries:Fse}):o==="providers"?f.jsxs("div",{className:"border-b border-border",children:[f.jsx(jn,{title:"Default Provider",description:"The default harness used for new chats before a provider is locked by an existing session.",bordered:!1,children:f.jsxs(Er,{value:Ve,onValueChange:K=>O(K),children:[f.jsx(cr,{className:"min-w-[180px]",children:f.jsx(jr,{})}),f.jsx(ur,{children:f.jsxs(wb,{children:[f.jsx(Ht,{value:"last_used",children:"Last Used"}),mt.map(K=>f.jsx(Ht,{value:K.id,children:K.label},K.id))]})})]})}),lt?f.jsx("div",{className:"border-t border-border px-0 py-3 text-sm text-destructive",children:lt}):null,f.jsx(jn,{title:"Claude Code Defaults",description:`Saved defaults when using Claude Code. ${Im(E,"claude")}`,alignStart:!0,children:f.jsxs("div",{className:pe("max-w-[420px]",!un("claude").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(Er,{value:((E==null?void 0:E.settings.claude)??sr.claude).active?"active":"inactive",onValueChange:K=>{Tt({...(E==null?void 0:E.settings)??sr,claude:{...(E==null?void 0:E.settings.claude)??sr.claude,active:K==="active"}})},children:[f.jsx(cr,{className:"min-w-[140px]",disabled:!un("claude").systemActive,children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx(Ht,{value:"active",children:"Active"}),f.jsx(Ht,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(wd,{availableProviders:pa,selectedProvider:"claude",disabled:!un("claude").systemActive,showProviderPicker:!1,providerLocked:!0,model:L.claude.model,modelOptions:L.claude.modelOptions,onModelChange:(K,st)=>{H("claude",st)},onClaudeReasoningEffortChange:K=>{Z("claude",{reasoningEffort:K})},onClaudeContextWindowChange:K=>{Z("claude",{contextWindow:K})},onCodexReasoningEffortChange:()=>{},onGeminiThinkingModeChange:()=>{},onCodexFastModeChange:()=>{},planMode:L.claude.planMode,onPlanModeChange:K=>I("claude",K),includePlanMode:!0,className:"justify-start flex-wrap"})]})}),f.jsx(jn,{title:"Codex Defaults",description:`Saved defaults when using Codex. ${Im(E,"codex")}`,alignStart:!0,children:f.jsxs("div",{className:pe("max-w-[420px]",!un("codex").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(Er,{value:((E==null?void 0:E.settings.codex)??sr.codex).active?"active":"inactive",onValueChange:K=>{Tt({...(E==null?void 0:E.settings)??sr,codex:{...(E==null?void 0:E.settings.codex)??sr.codex,active:K==="active"}})},children:[f.jsx(cr,{className:"min-w-[140px]",disabled:!un("codex").systemActive,children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx(Ht,{value:"active",children:"Active"}),f.jsx(Ht,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(wd,{availableProviders:pa,selectedProvider:"codex",disabled:!un("codex").systemActive,showProviderPicker:!1,providerLocked:!0,model:L.codex.model,modelOptions:L.codex.modelOptions,onModelChange:(K,st)=>{H("codex",st)},onClaudeReasoningEffortChange:()=>{},onClaudeContextWindowChange:()=>{},onCodexReasoningEffortChange:K=>{Z("codex",{reasoningEffort:K})},onGeminiThinkingModeChange:()=>{},onCodexFastModeChange:K=>{Z("codex",{fastMode:K})},planMode:L.codex.planMode,onPlanModeChange:K=>I("codex",K),includePlanMode:!0,className:"justify-start flex-wrap"})]})}),f.jsx(jn,{title:"Gemini Defaults",description:`Saved defaults when using Gemini. ${Im(E,"gemini")}`,alignStart:!0,children:f.jsxs("div",{className:pe("max-w-[420px]",!un("gemini").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(Er,{value:((E==null?void 0:E.settings.gemini)??sr.gemini).active?"active":"inactive",onValueChange:K=>{Tt({...(E==null?void 0:E.settings)??sr,gemini:{...(E==null?void 0:E.settings.gemini)??sr.gemini,active:K==="active"}})},children:[f.jsx(cr,{className:"min-w-[140px]",disabled:!un("gemini").systemActive,children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx(Ht,{value:"active",children:"Active"}),f.jsx(Ht,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(wd,{availableProviders:pa,selectedProvider:"gemini",disabled:!un("gemini").systemActive,showProviderPicker:!1,providerLocked:!0,model:L.gemini.model,modelOptions:L.gemini.modelOptions,onModelChange:(K,st)=>{H("gemini",st)},onClaudeReasoningEffortChange:()=>{},onClaudeContextWindowChange:()=>{},onCodexReasoningEffortChange:()=>{},onGeminiThinkingModeChange:K=>{Z("gemini",{thinkingMode:K})},onCodexFastModeChange:()=>{},planMode:L.gemini.planMode,onPlanModeChange:K=>I("gemini",K),includePlanMode:!0,className:"justify-start flex-wrap"})]})}),f.jsx(jn,{title:"Cursor Defaults",description:`Saved defaults when using Cursor. ${Im(E,"cursor")}`,alignStart:!0,children:f.jsxs("div",{className:pe("max-w-[420px]",!un("cursor").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(Er,{value:((E==null?void 0:E.settings.cursor)??sr.cursor).active?"active":"inactive",onValueChange:K=>{Tt({...(E==null?void 0:E.settings)??sr,cursor:{...(E==null?void 0:E.settings.cursor)??sr.cursor,active:K==="active"}})},children:[f.jsx(cr,{className:"min-w-[140px]",disabled:!un("cursor").systemActive,children:f.jsx(jr,{})}),f.jsxs(ur,{children:[f.jsx(Ht,{value:"active",children:"Active"}),f.jsx(Ht,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(wd,{availableProviders:pa,selectedProvider:"cursor",disabled:!un("cursor").systemActive,showProviderPicker:!1,providerLocked:!0,model:L.cursor.model,modelOptions:L.cursor.modelOptions,onModelChange:(K,st)=>{H("cursor",st)},onClaudeReasoningEffortChange:()=>{},onClaudeContextWindowChange:()=>{},onCodexReasoningEffortChange:()=>{},onGeminiThinkingModeChange:()=>{},onCodexFastModeChange:()=>{},planMode:L.cursor.planMode,onPlanModeChange:K=>I("cursor",K),includePlanMode:!0,className:"justify-start flex-wrap"})]})})]}):o==="keybindings"?f.jsxs("div",{className:"border-b border-border",children:[Ee?f.jsx("div",{className:"mb-4 rounded-2xl border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:Ee}):null,je.warning?f.jsx("div",{className:"mb-4 rounded-2xl border border-border bg-card/30 px-4 py-3 text-sm text-muted-foreground",children:je.warning}):null,mN.map((K,st)=>{const Vn=Eb(ks[K]),ms=se[K]??"",Ei=ms!==Vn;return f.jsx(jn,{title:Gj[K],description:f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"Comma-separated shortcuts."}),Ei?f.jsxs(f.Fragment,{children:[f.jsx("span",{children:" "}),f.jsxs("button",{type:"button",onClick:()=>{ct(K)},className:"inline rounded text-foreground hover:text-foreground/80",children:["Restore: ",Vn]})]}):null]}),bordered:st!==0,children:f.jsx("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:f.jsx(Fi,{type:"text",value:ms,onChange:Ft=>{const In=Ft.target.value;ye(ps=>({...ps,[K]:In}))},onBlur:Ft=>{const In={...se,[K]:Ft.currentTarget.value};ye(In),Sn(In)},onKeyDown:Ft=>vt(Ft,()=>{const In={...se,[K]:Ft.currentTarget.value};ye(In),Sn(In)}),className:"font-mono"})})},K)})]}):null]}),n.commandError?f.jsxs("div",{className:"mx-auto mt-4 flex max-w-4xl items-start gap-3 rounded-2xl border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:[f.jsx(U8,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),f.jsx("span",{children:n.commandError})]}):null]})]})]}),Kt?f.jsx("div",{className:"absolute bottom-0 left-0 right-0 border-t border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:f.jsx("div",{className:"px-6 py-[14.25px]",children:f.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-xs text-muted-foreground lg:grid-cols-4 lg:gap-3",children:[f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex items-baseline gap-1.5 lg:block",children:[f.jsx("div",{className:"uppercase tracking-wide text-[11px] text-muted-foreground/80 lg:mb-1",children:"Machine"}),f.jsx("div",{className:"truncate text-foreground/80",children:c})]})}),f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex items-baseline gap-1.5 lg:block",children:[f.jsx("div",{className:"uppercase tracking-wide text-[11px] text-muted-foreground/80 lg:mb-1",children:"Connection"}),f.jsx("div",{className:"truncate text-foreground/80",children:n.connectionStatus})]})}),f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex items-baseline gap-1.5 lg:block",children:[f.jsx("div",{className:"uppercase tracking-wide text-[11px] text-muted-foreground/80 lg:mb-1",children:"Projects"}),f.jsx("div",{className:"truncate text-foreground/80",children:h})]})}),f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex items-baseline gap-1.5 lg:block",children:[f.jsx("div",{className:"uppercase tracking-wide text-[11px] text-muted-foreground/80 lg:mb-1",children:"Version"}),f.jsx("div",{className:"truncate text-foreground/80",children:d})]})})]})})}):null]})}function gN(e){return{submitChatMessage:Xa(e.submitChatMessage??""),toggleProjectsSidebar:Xa(e.toggleProjectsSidebar??""),toggleEmbeddedTerminal:Xa(e.toggleEmbeddedTerminal??""),toggleRightSidebar:Xa(e.toggleRightSidebar??""),openInFinder:Xa(e.openInFinder??""),openInEditor:Xa(e.openInEditor??""),addSplitTerminal:Xa(e.addSplitTerminal??"")}}function Kse(){const e=typeof navigator<"u"&&navigator.standalone===!0,t=typeof window<"u"&&window.matchMedia("(display-mode: standalone)").matches;return e||t}function Gse(){const e=window.visualViewport,t=Math.round((e==null?void 0:e.height)??window.innerHeight),n=Math.max(0,Math.round((e==null?void 0:e.offsetTop)??0));return{height:t,offsetTop:n}}function Yse(){v.useLayoutEffect(()=>{let e=0,t=null,n=0;const r=Kse(),i=()=>{e=0;const{height:c,offsetTop:h}=Gse();t===null&&(t=h),c>n&&(n=c);const d=Math.max(0,h-t),g=n-c>120||d>12,p=document.documentElement;p.style.setProperty("--app-shell-height",`${c}px`),p.style.setProperty("--app-shell-offset-top",r?g?`max(0px, calc(${d}px - env(safe-area-inset-top)))`:"0px":`${d}px`),p.style.setProperty("--app-composer-bottom-padding",r?g?"0px":"max(12px, env(safe-area-inset-bottom))":g?"12px":"20px")},o=()=>{e!==0&&window.cancelAnimationFrame(e),e=window.requestAnimationFrame(i)};o();const l=window.visualViewport;return window.addEventListener("resize",o),window.addEventListener("orientationchange",o),l==null||l.addEventListener("resize",o),l==null||l.addEventListener("scroll",o),()=>{e!==0&&window.cancelAnimationFrame(e),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),l==null||l.removeEventListener("resize",o),l==null||l.removeEventListener("scroll",o)}},[])}const Xse=`${gg}last-seen-version`;function Zse(e,t){return!(!t||e.defaultPrevented||e.isComposing||XW(e.target))}function Qse(){const e=oi(),t=ON(),n=vZ({activeChatId:t.chatId??null,activeOverviewFeatureId:t.featureId??null}),r=Mh("(min-width: 768px)"),i=RE(d=>d.widthPx),o=RE(d=>d.setWidth),l=e.pathname==="/",c=F0.split("/")[1]??"unknown",h=v.useMemo(()=>gw(n.keybindings),[n.keybindings]);return Yse(),v.useEffect(()=>{window.localStorage.setItem(Xse,c)},[c]),v.useEffect(()=>{function d(g){const p=il(h,"toggleProjectsSidebar",g);Zse(g,p)&&(g.preventDefault(),n.toggleProjectsSidebar(r))}return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[r,h,n.toggleProjectsSidebar]),f.jsxs("div",{className:"relative flex h-[var(--app-shell-height)] min-h-[var(--app-shell-height)] overflow-hidden",style:{top:"var(--app-shell-offset-top)"},children:[f.jsx(qW,{data:n.sidebarData,completedChatIds:n.completedChatIds,activeChatId:n.activeChatId,activeOverviewFeatureId:n.activeOverviewFeatureId,connectionStatus:n.connectionStatus,ready:n.sidebarReady,open:n.sidebarOpen,collapsed:n.sidebarCollapsed,isDesktopViewport:r,showMobileOpenButton:l,onOpen:n.openSidebar,onClose:n.closeSidebar,onToggle:n.toggleProjectsSidebar,onExpand:n.expandSidebar,desktopWidth:i,toggleShortcut:h.bindings.toggleProjectsSidebar,onResizeDesktopWidth:o,onCreateChat:(d,g)=>{n.handleCreateChat(d,g)},onCreateFeature:d=>{n.handleCreateFeature(d)},onRenameFeature:d=>{n.handleRenameFeature(d)},onDeleteFeature:d=>{n.handleDeleteFeature(d)},onSetProjectBrowserState:(d,g)=>{n.handleSetProjectBrowserState(d,g)},onSetProjectGeneralChatsBrowserState:(d,g)=>{n.handleSetProjectGeneralChatsBrowserState(d,g)},onSetFeatureBrowserState:(d,g)=>{n.handleSetFeatureBrowserState(d,g)},onSetFeatureStage:(d,g)=>{n.handleSetFeatureStage(d,g)},onSetChatFeature:(d,g)=>{n.handleSetChatFeature(d,g)},onReorderFeatures:(d,g)=>{n.handleReorderFeatures(d,g)},folderGroupsEnabled:n.folderGroupsEnabled,showFeatureOverviewInSidebar:n.showFeatureOverviewInSidebar,kanbanStatusesEnabled:n.kanbanStatusesEnabled,onOpenFeatureOverview:d=>{n.handleOpenFeatureOverview(d)},onDeleteChat:d=>{n.handleDeleteChat(d)},onRemoveProject:d=>{n.handleRemoveProject(d)},onRefreshProviderUsage:n.handleRefreshProviderUsage,onOpenProviderLogin:d=>{n.handleOpenProviderLogin(d)},providerSettings:n.providerSettings,startingLocalPath:n.startingLocalPath,updateSnapshot:n.updateSnapshot,onInstallUpdate:()=>{n.handleInstallUpdate()}}),f.jsx(Y9,{open:n.createFeatureModalProjectId!==null,onOpenChange:d=>{d||n.handleCloseCreateFeatureModal()},onConfirm:d=>n.handleConfirmCreateFeature(d)}),f.jsx(X9,{open:n.cursorCurlImportOpen,onOpenChange:d=>{d||n.handleCloseCursorCurlImport()},onSubmit:d=>n.handleSubmitCursorCurlImport(d)}),f.jsx(Xz,{context:n})]})}function Jse(){return f.jsx(jF,{children:f.jsxs(q9,{children:[f.jsxs(Qz,{children:[f.jsx(uo,{path:"/open",element:f.jsx(Zie,{})}),f.jsx(uo,{path:"/remote-setup",element:f.jsx(ose,{})}),f.jsxs(uo,{element:f.jsx(Qse,{}),children:[f.jsx(uo,{path:"/",element:f.jsx(Vie,{})}),f.jsx(uo,{path:"/settings",element:f.jsx(Yz,{to:"/settings/general",replace:!0})}),f.jsx(uo,{path:"/settings/:sectionId",element:f.jsx(qse,{})}),f.jsx(uo,{path:"/chat/:chatId",element:f.jsx(jie,{})}),f.jsx(uo,{path:"/overview/:featureId",element:f.jsx(Lie,{})})]})]}),f.jsx(oI,{})]})})}const zO=document.getElementById("root");if(!zO)throw new Error("Missing #root");QL.createRoot(zO).render(f.jsx(v.StrictMode,{children:f.jsx(SP,{children:f.jsx(uX,{children:f.jsx(Jse,{})})})}));