claudit 0.1.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.
Files changed (40) hide show
  1. package/README.md +139 -0
  2. package/bin/claudit-mcp.js +3 -0
  3. package/bin/claudit.js +11 -0
  4. package/client/dist/assets/index-DhjH_2Wd.css +32 -0
  5. package/client/dist/assets/index-Dwom-XdC.js +98 -0
  6. package/client/dist/index.html +13 -0
  7. package/package.json +40 -0
  8. package/server/dist/server/src/index.js +170 -0
  9. package/server/dist/server/src/mcp-server.js +144 -0
  10. package/server/dist/server/src/routes/cron.js +101 -0
  11. package/server/dist/server/src/routes/filesystem.js +71 -0
  12. package/server/dist/server/src/routes/groups.js +60 -0
  13. package/server/dist/server/src/routes/sessions.js +206 -0
  14. package/server/dist/server/src/routes/todo.js +93 -0
  15. package/server/dist/server/src/routes/todoProviders.js +179 -0
  16. package/server/dist/server/src/services/claudeProcess.js +220 -0
  17. package/server/dist/server/src/services/cronScheduler.js +163 -0
  18. package/server/dist/server/src/services/cronStorage.js +154 -0
  19. package/server/dist/server/src/services/database.js +103 -0
  20. package/server/dist/server/src/services/eventBus.js +11 -0
  21. package/server/dist/server/src/services/groupStorage.js +52 -0
  22. package/server/dist/server/src/services/historyIndex.js +100 -0
  23. package/server/dist/server/src/services/jsonStore.js +41 -0
  24. package/server/dist/server/src/services/managedSessions.js +96 -0
  25. package/server/dist/server/src/services/providerConfigStorage.js +80 -0
  26. package/server/dist/server/src/services/providers/TodoProvider.js +1 -0
  27. package/server/dist/server/src/services/providers/larkDocsProvider.js +75 -0
  28. package/server/dist/server/src/services/providers/mcpClient.js +151 -0
  29. package/server/dist/server/src/services/providers/meegoProvider.js +99 -0
  30. package/server/dist/server/src/services/providers/registry.js +17 -0
  31. package/server/dist/server/src/services/providers/supabaseProvider.js +172 -0
  32. package/server/dist/server/src/services/ptyManager.js +263 -0
  33. package/server/dist/server/src/services/sessionIndexCache.js +24 -0
  34. package/server/dist/server/src/services/sessionParser.js +98 -0
  35. package/server/dist/server/src/services/sessionScanner.js +244 -0
  36. package/server/dist/server/src/services/todoStorage.js +112 -0
  37. package/server/dist/server/src/services/todoSyncEngine.js +170 -0
  38. package/server/dist/server/src/types.js +1 -0
  39. package/server/dist/shared/src/index.js +1 -0
  40. package/server/dist/shared/src/types.js +2 -0
@@ -0,0 +1,98 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))n(l);new MutationObserver(l=>{for(const a of l)if(a.type==="childList")for(const h of a.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&n(h)}).observe(document,{childList:!0,subtree:!0});function i(l){const a={};return l.integrity&&(a.integrity=l.integrity),l.referrerPolicy&&(a.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?a.credentials="include":l.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(l){if(l.ep)return;l.ep=!0;const a=i(l);fetch(l.href,a)}})();function v_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Lc={exports:{}},Mn={},Bc={exports:{}},Te={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its 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 Uf;function Ov(){if(Uf)return Te;Uf=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),h=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.iterator;function w(R){return R===null||typeof R!="object"?null:(R=y&&R[y]||R["@@iterator"],typeof R=="function"?R:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,E={};function x(R,F,ae){this.props=R,this.context=F,this.refs=E,this.updater=ae||S}x.prototype.isReactComponent={},x.prototype.setState=function(R,F){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,F,"setState")},x.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function I(){}I.prototype=x.prototype;function U(R,F,ae){this.props=R,this.context=F,this.refs=E,this.updater=ae||S}var W=U.prototype=new I;W.constructor=U,k(W,x.prototype),W.isPureReactComponent=!0;var P=Array.isArray,M=Object.prototype.hasOwnProperty,A={current:null},re={key:!0,ref:!0,__self:!0,__source:!0};function se(R,F,ae){var le,_e={},ue=null,De=null;if(F!=null)for(le in F.ref!==void 0&&(De=F.ref),F.key!==void 0&&(ue=""+F.key),F)M.call(F,le)&&!re.hasOwnProperty(le)&&(_e[le]=F[le]);var ke=arguments.length-2;if(ke===1)_e.children=ae;else if(1<ke){for(var Ee=Array(ke),we=0;we<ke;we++)Ee[we]=arguments[we+2];_e.children=Ee}if(R&&R.defaultProps)for(le in ke=R.defaultProps,ke)_e[le]===void 0&&(_e[le]=ke[le]);return{$$typeof:e,type:R,key:ue,ref:De,props:_e,_owner:A.current}}function pe(R,F){return{$$typeof:e,type:R.type,key:F,ref:R.ref,props:R.props,_owner:R._owner}}function Se(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function z(R){var F={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(ae){return F[ae]})}var q=/\/+/g;function j(R,F){return typeof R=="object"&&R!==null&&R.key!=null?z(""+R.key):F.toString(36)}function G(R,F,ae,le,_e){var ue=typeof R;(ue==="undefined"||ue==="boolean")&&(R=null);var De=!1;if(R===null)De=!0;else switch(ue){case"string":case"number":De=!0;break;case"object":switch(R.$$typeof){case e:case t:De=!0}}if(De)return De=R,_e=_e(De),R=le===""?"."+j(De,0):le,P(_e)?(ae="",R!=null&&(ae=R.replace(q,"$&/")+"/"),G(_e,F,ae,"",function(we){return we})):_e!=null&&(Se(_e)&&(_e=pe(_e,ae+(!_e.key||De&&De.key===_e.key?"":(""+_e.key).replace(q,"$&/")+"/")+R)),F.push(_e)),1;if(De=0,le=le===""?".":le+":",P(R))for(var ke=0;ke<R.length;ke++){ue=R[ke];var Ee=le+j(ue,ke);De+=G(ue,F,ae,Ee,_e)}else if(Ee=w(R),typeof Ee=="function")for(R=Ee.call(R),ke=0;!(ue=R.next()).done;)ue=ue.value,Ee=le+j(ue,ke++),De+=G(ue,F,ae,Ee,_e);else if(ue==="object")throw F=String(R),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.");return De}function X(R,F,ae){if(R==null)return R;var le=[],_e=0;return G(R,le,"","",function(ue){return F.call(ae,ue,_e++)}),le}function ee(R){if(R._status===-1){var F=R._result;F=F(),F.then(function(ae){(R._status===0||R._status===-1)&&(R._status=1,R._result=ae)},function(ae){(R._status===0||R._status===-1)&&(R._status=2,R._result=ae)}),R._status===-1&&(R._status=0,R._result=F)}if(R._status===1)return R._result.default;throw R._result}var ie={current:null},B={transition:null},Q={ReactCurrentDispatcher:ie,ReactCurrentBatchConfig:B,ReactCurrentOwner:A};function J(){throw Error("act(...) is not supported in production builds of React.")}return Te.Children={map:X,forEach:function(R,F,ae){X(R,function(){F.apply(this,arguments)},ae)},count:function(R){var F=0;return X(R,function(){F++}),F},toArray:function(R){return X(R,function(F){return F})||[]},only:function(R){if(!Se(R))throw Error("React.Children.only expected to receive a single React element child.");return R}},Te.Component=x,Te.Fragment=i,Te.Profiler=l,Te.PureComponent=U,Te.StrictMode=n,Te.Suspense=_,Te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q,Te.act=J,Te.cloneElement=function(R,F,ae){if(R==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+R+".");var le=k({},R.props),_e=R.key,ue=R.ref,De=R._owner;if(F!=null){if(F.ref!==void 0&&(ue=F.ref,De=A.current),F.key!==void 0&&(_e=""+F.key),R.type&&R.type.defaultProps)var ke=R.type.defaultProps;for(Ee in F)M.call(F,Ee)&&!re.hasOwnProperty(Ee)&&(le[Ee]=F[Ee]===void 0&&ke!==void 0?ke[Ee]:F[Ee])}var Ee=arguments.length-2;if(Ee===1)le.children=ae;else if(1<Ee){ke=Array(Ee);for(var we=0;we<Ee;we++)ke[we]=arguments[we+2];le.children=ke}return{$$typeof:e,type:R.type,key:_e,ref:ue,props:le,_owner:De}},Te.createContext=function(R){return R={$$typeof:h,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},R.Provider={$$typeof:a,_context:R},R.Consumer=R},Te.createElement=se,Te.createFactory=function(R){var F=se.bind(null,R);return F.type=R,F},Te.createRef=function(){return{current:null}},Te.forwardRef=function(R){return{$$typeof:d,render:R}},Te.isValidElement=Se,Te.lazy=function(R){return{$$typeof:v,_payload:{_status:-1,_result:R},_init:ee}},Te.memo=function(R,F){return{$$typeof:f,type:R,compare:F===void 0?null:F}},Te.startTransition=function(R){var F=B.transition;B.transition={};try{R()}finally{B.transition=F}},Te.unstable_act=J,Te.useCallback=function(R,F){return ie.current.useCallback(R,F)},Te.useContext=function(R){return ie.current.useContext(R)},Te.useDebugValue=function(){},Te.useDeferredValue=function(R){return ie.current.useDeferredValue(R)},Te.useEffect=function(R,F){return ie.current.useEffect(R,F)},Te.useId=function(){return ie.current.useId()},Te.useImperativeHandle=function(R,F,ae){return ie.current.useImperativeHandle(R,F,ae)},Te.useInsertionEffect=function(R,F){return ie.current.useInsertionEffect(R,F)},Te.useLayoutEffect=function(R,F){return ie.current.useLayoutEffect(R,F)},Te.useMemo=function(R,F){return ie.current.useMemo(R,F)},Te.useReducer=function(R,F,ae){return ie.current.useReducer(R,F,ae)},Te.useRef=function(R){return ie.current.useRef(R)},Te.useState=function(R){return ie.current.useState(R)},Te.useSyncExternalStore=function(R,F,ae){return ie.current.useSyncExternalStore(R,F,ae)},Te.useTransition=function(){return ie.current.useTransition()},Te.version="18.3.1",Te}var Kf;function Kh(){return Kf||(Kf=1,Bc.exports=Ov()),Bc.exports}/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its 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 Vf;function Av(){if(Vf)return Mn;Vf=1;var e=Kh(),t=Symbol.for("react.element"),i=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function h(d,_,f){var v,y={},w=null,S=null;f!==void 0&&(w=""+f),_.key!==void 0&&(w=""+_.key),_.ref!==void 0&&(S=_.ref);for(v in _)n.call(_,v)&&!a.hasOwnProperty(v)&&(y[v]=_[v]);if(d&&d.defaultProps)for(v in _=d.defaultProps,_)y[v]===void 0&&(y[v]=_[v]);return{$$typeof:t,type:d,key:w,ref:S,props:y,_owner:l.current}}return Mn.Fragment=i,Mn.jsx=h,Mn.jsxs=h,Mn}var qf;function jv(){return qf||(qf=1,Lc.exports=Av()),Lc.exports}var g=jv(),b=Kh();const pt=v_(b);var _l={},Ic={exports:{}},rr={},Oc={exports:{}},Ac={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its 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 Yf;function zv(){return Yf||(Yf=1,(function(e){function t(B,Q){var J=B.length;B.push(Q);e:for(;0<J;){var R=J-1>>>1,F=B[R];if(0<l(F,Q))B[R]=Q,B[J]=F,J=R;else break e}}function i(B){return B.length===0?null:B[0]}function n(B){if(B.length===0)return null;var Q=B[0],J=B.pop();if(J!==Q){B[0]=J;e:for(var R=0,F=B.length,ae=F>>>1;R<ae;){var le=2*(R+1)-1,_e=B[le],ue=le+1,De=B[ue];if(0>l(_e,J))ue<F&&0>l(De,_e)?(B[R]=De,B[ue]=J,R=ue):(B[R]=_e,B[le]=J,R=le);else if(ue<F&&0>l(De,J))B[R]=De,B[ue]=J,R=ue;else break e}}return Q}function l(B,Q){var J=B.sortIndex-Q.sortIndex;return J!==0?J:B.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var h=Date,d=h.now();e.unstable_now=function(){return h.now()-d}}var _=[],f=[],v=1,y=null,w=3,S=!1,k=!1,E=!1,x=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function W(B){for(var Q=i(f);Q!==null;){if(Q.callback===null)n(f);else if(Q.startTime<=B)n(f),Q.sortIndex=Q.expirationTime,t(_,Q);else break;Q=i(f)}}function P(B){if(E=!1,W(B),!k)if(i(_)!==null)k=!0,ee(M);else{var Q=i(f);Q!==null&&ie(P,Q.startTime-B)}}function M(B,Q){k=!1,E&&(E=!1,I(se),se=-1),S=!0;var J=w;try{for(W(Q),y=i(_);y!==null&&(!(y.expirationTime>Q)||B&&!z());){var R=y.callback;if(typeof R=="function"){y.callback=null,w=y.priorityLevel;var F=R(y.expirationTime<=Q);Q=e.unstable_now(),typeof F=="function"?y.callback=F:y===i(_)&&n(_),W(Q)}else n(_);y=i(_)}if(y!==null)var ae=!0;else{var le=i(f);le!==null&&ie(P,le.startTime-Q),ae=!1}return ae}finally{y=null,w=J,S=!1}}var A=!1,re=null,se=-1,pe=5,Se=-1;function z(){return!(e.unstable_now()-Se<pe)}function q(){if(re!==null){var B=e.unstable_now();Se=B;var Q=!0;try{Q=re(!0,B)}finally{Q?j():(A=!1,re=null)}}else A=!1}var j;if(typeof U=="function")j=function(){U(q)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,X=G.port2;G.port1.onmessage=q,j=function(){X.postMessage(null)}}else j=function(){x(q,0)};function ee(B){re=B,A||(A=!0,j())}function ie(B,Q){se=x(function(){B(e.unstable_now())},Q)}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(B){B.callback=null},e.unstable_continueExecution=function(){k||S||(k=!0,ee(M))},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):pe=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_getFirstCallbackNode=function(){return i(_)},e.unstable_next=function(B){switch(w){case 1:case 2:case 3:var Q=3;break;default:Q=w}var J=w;w=Q;try{return B()}finally{w=J}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(B,Q){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var J=w;w=B;try{return Q()}finally{w=J}},e.unstable_scheduleCallback=function(B,Q,J){var R=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?R+J:R):J=R,B){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=J+F,B={id:v++,callback:Q,priorityLevel:B,startTime:J,expirationTime:F,sortIndex:-1},J>R?(B.sortIndex=J,t(f,B),i(_)===null&&B===i(f)&&(E?(I(se),se=-1):E=!0,ie(P,J-R))):(B.sortIndex=F,t(_,B),k||S||(k=!0,ee(M))),B},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(B){var Q=w;return function(){var J=w;w=Q;try{return B.apply(this,arguments)}finally{w=J}}}})(Ac)),Ac}var Gf;function Fv(){return Gf||(Gf=1,Oc.exports=zv()),Oc.exports}/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its 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 Xf;function Hv(){if(Xf)return rr;Xf=1;var e=Kh(),t=Fv();function i(r){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+r,o=1;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,l={};function a(r,s){h(r,s),h(r+"Capture",s)}function h(r,s){for(l[r]=s,r=0;r<s.length;r++)n.add(s[r])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_=Object.prototype.hasOwnProperty,f=/^[: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]*$/,v={},y={};function w(r){return _.call(y,r)?!0:_.call(v,r)?!1:f.test(r)?y[r]=!0:(v[r]=!0,!1)}function S(r,s,o,c){if(o!==null&&o.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return c?!1:o!==null?!o.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function k(r,s,o,c){if(s===null||typeof s>"u"||S(r,s,o,c))return!0;if(c)return!1;if(o!==null)switch(o.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function E(r,s,o,c,u,p,m){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=c,this.attributeNamespace=u,this.mustUseProperty=o,this.propertyName=r,this.type=s,this.sanitizeURL=p,this.removeEmptyString=m}var x={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){x[r]=new E(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var s=r[0];x[s]=new E(s,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){x[r]=new E(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){x[r]=new E(r,2,!1,r,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){x[r]=new E(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){x[r]=new E(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){x[r]=new E(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){x[r]=new E(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){x[r]=new E(r,5,!1,r.toLowerCase(),null,!1,!1)});var I=/[\-:]([a-z])/g;function U(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var s=r.replace(I,U);x[s]=new E(s,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var s=r.replace(I,U);x[s]=new E(s,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var s=r.replace(I,U);x[s]=new E(s,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){x[r]=new E(r,1,!1,r.toLowerCase(),null,!1,!1)}),x.xlinkHref=new E("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){x[r]=new E(r,1,!1,r.toLowerCase(),null,!0,!0)});function W(r,s,o,c){var u=x.hasOwnProperty(s)?x[s]:null;(u!==null?u.type!==0:c||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(k(s,o,u,c)&&(o=null),c||u===null?w(s)&&(o===null?r.removeAttribute(s):r.setAttribute(s,""+o)):u.mustUseProperty?r[u.propertyName]=o===null?u.type===3?!1:"":o:(s=u.attributeName,c=u.attributeNamespace,o===null?r.removeAttribute(s):(u=u.type,o=u===3||u===4&&o===!0?"":""+o,c?r.setAttributeNS(c,s,o):r.setAttribute(s,o))))}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,M=Symbol.for("react.element"),A=Symbol.for("react.portal"),re=Symbol.for("react.fragment"),se=Symbol.for("react.strict_mode"),pe=Symbol.for("react.profiler"),Se=Symbol.for("react.provider"),z=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),ie=Symbol.for("react.offscreen"),B=Symbol.iterator;function Q(r){return r===null||typeof r!="object"?null:(r=B&&r[B]||r["@@iterator"],typeof r=="function"?r:null)}var J=Object.assign,R;function F(r){if(R===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);R=s&&s[1]||""}return`
34
+ `+R+r}var ae=!1;function le(r,s){if(!r||ae)return"";ae=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(O){var c=O}Reflect.construct(r,[],s)}else{try{s.call()}catch(O){c=O}r.call(s.prototype)}else{try{throw Error()}catch(O){c=O}r()}}catch(O){if(O&&c&&typeof O.stack=="string"){for(var u=O.stack.split(`
35
+ `),p=c.stack.split(`
36
+ `),m=u.length-1,C=p.length-1;1<=m&&0<=C&&u[m]!==p[C];)C--;for(;1<=m&&0<=C;m--,C--)if(u[m]!==p[C]){if(m!==1||C!==1)do if(m--,C--,0>C||u[m]!==p[C]){var N=`
37
+ `+u[m].replace(" at new "," at ");return r.displayName&&N.includes("<anonymous>")&&(N=N.replace("<anonymous>",r.displayName)),N}while(1<=m&&0<=C);break}}}finally{ae=!1,Error.prepareStackTrace=o}return(r=r?r.displayName||r.name:"")?F(r):""}function _e(r){switch(r.tag){case 5:return F(r.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return r=le(r.type,!1),r;case 11:return r=le(r.type.render,!1),r;case 1:return r=le(r.type,!0),r;default:return""}}function ue(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case re:return"Fragment";case A:return"Portal";case pe:return"Profiler";case se:return"StrictMode";case j:return"Suspense";case G:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case z:return(r.displayName||"Context")+".Consumer";case Se:return(r._context.displayName||"Context")+".Provider";case q:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case X:return s=r.displayName||null,s!==null?s:ue(r.type)||"Memo";case ee:s=r._payload,r=r._init;try{return ue(r(s))}catch{}}return null}function De(r){var s=r.type;switch(r.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=s.render,r=r.displayName||r.name||"",s.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ue(s);case 8:return s===se?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function ke(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Ee(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function we(r){var s=Ee(r)?"checked":"value",o=Object.getOwnPropertyDescriptor(r.constructor.prototype,s),c=""+r[s];if(!r.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,p=o.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return u.call(this)},set:function(m){c=""+m,p.call(this,m)}}),Object.defineProperty(r,s,{enumerable:o.enumerable}),{getValue:function(){return c},setValue:function(m){c=""+m},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function gt(r){r._valueTracker||(r._valueTracker=we(r))}function Fe(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var o=s.getValue(),c="";return r&&(c=Ee(r)?r.checked?"true":"false":r.value),r=c,r!==o?(s.setValue(r),!0):!1}function Ne(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function nt(r,s){var o=s.checked;return J({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??r._wrapperState.initialChecked})}function dr(r,s){var o=s.defaultValue==null?"":s.defaultValue,c=s.checked!=null?s.checked:s.defaultChecked;o=ke(s.value!=null?s.value:o),r._wrapperState={initialChecked:c,initialValue:o,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Er(r,s){s=s.checked,s!=null&&W(r,"checked",s,!1)}function Fr(r,s){Er(r,s);var o=ke(s.value),c=s.type;if(o!=null)c==="number"?(o===0&&r.value===""||r.value!=o)&&(r.value=""+o):r.value!==""+o&&(r.value=""+o);else if(c==="submit"||c==="reset"){r.removeAttribute("value");return}s.hasOwnProperty("value")?ii(r,s.type,o):s.hasOwnProperty("defaultValue")&&ii(r,s.type,ke(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(r.defaultChecked=!!s.defaultChecked)}function Hr(r,s,o){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var c=s.type;if(!(c!=="submit"&&c!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+r._wrapperState.initialValue,o||s===r.value||(r.value=s),r.defaultValue=s}o=r.name,o!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,o!==""&&(r.name=o)}function ii(r,s,o){(s!=="number"||Ne(r.ownerDocument)!==r)&&(o==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+o&&(r.defaultValue=""+o))}var Nt=Array.isArray;function H(r,s,o,c){if(r=r.options,s){s={};for(var u=0;u<o.length;u++)s["$"+o[u]]=!0;for(o=0;o<r.length;o++)u=s.hasOwnProperty("$"+r[o].value),r[o].selected!==u&&(r[o].selected=u),u&&c&&(r[o].defaultSelected=!0)}else{for(o=""+ke(o),s=null,u=0;u<r.length;u++){if(r[u].value===o){r[u].selected=!0,c&&(r[u].defaultSelected=!0);return}s!==null||r[u].disabled||(s=r[u])}s!==null&&(s.selected=!0)}}function ge(r,s){if(s.dangerouslySetInnerHTML!=null)throw Error(i(91));return J({},s,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function xe(r,s){var o=s.value;if(o==null){if(o=s.children,s=s.defaultValue,o!=null){if(s!=null)throw Error(i(92));if(Nt(o)){if(1<o.length)throw Error(i(93));o=o[0]}s=o}s==null&&(s=""),o=s}r._wrapperState={initialValue:ke(o)}}function me(r,s){var o=ke(s.value),c=ke(s.defaultValue);o!=null&&(o=""+o,o!==r.value&&(r.value=o),s.defaultValue==null&&r.defaultValue!==o&&(r.defaultValue=o)),c!=null&&(r.defaultValue=""+c)}function Be(r){var s=r.textContent;s===r._wrapperState.initialValue&&s!==""&&s!==null&&(r.value=s)}function He(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function mt(r,s){return r==null||r==="http://www.w3.org/1999/xhtml"?He(s):r==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var Dt,Wr=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,o,c,u){MSApp.execUnsafeLocalFunction(function(){return r(s,o,c,u)})}:r})(function(r,s){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=s;else{for(Dt=Dt||document.createElement("div"),Dt.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Dt.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;s.firstChild;)r.appendChild(s.firstChild)}});function Nr(r,s){if(s){var o=r.firstChild;if(o&&o===r.lastChild&&o.nodeType===3){o.nodeValue=s;return}}r.textContent=s}var Rt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Bt=["Webkit","ms","Moz","O"];Object.keys(Rt).forEach(function(r){Bt.forEach(function(s){s=s+r.charAt(0).toUpperCase()+r.substring(1),Rt[s]=Rt[r]})});function si(r,s,o){return s==null||typeof s=="boolean"||s===""?"":o||typeof s!="number"||s===0||Rt.hasOwnProperty(r)&&Rt[r]?(""+s).trim():s+"px"}function $r(r,s){r=r.style;for(var o in s)if(s.hasOwnProperty(o)){var c=o.indexOf("--")===0,u=si(o,s[o],c);o==="float"&&(o="cssFloat"),c?r.setProperty(o,u):r[o]=u}}var Vi=J({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ps(r,s){if(s){if(Vi[r]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(i(137,r));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(i(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(i(61))}if(s.style!=null&&typeof s.style!="object")throw Error(i(62))}}function Ys(r,s){if(r.indexOf("-")===-1)return typeof s.is=="string";switch(r){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 _s=null;function Gs(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Xs=null,yi=null,qe=null;function It(r){if(r=mn(r)){if(typeof Xs!="function")throw Error(i(280));var s=r.stateNode;s&&(s=Po(s),Xs(r.stateNode,r.type,s))}}function Ot(r){yi?qe?qe.push(r):qe=[r]:yi=r}function Dr(){if(yi){var r=yi,s=qe;if(qe=yi=null,It(r),s)for(r=0;r<s.length;r++)It(s[r])}}function Ut(r,s){return r(s)}function At(){}var Xt=!1;function ni(r,s,o){if(Xt)return r(s,o);Xt=!0;try{return Ut(r,s,o)}finally{Xt=!1,(yi!==null||qe!==null)&&(At(),Dr())}}function Ye(r,s){var o=r.stateNode;if(o===null)return null;var c=Po(o);if(c===null)return null;o=c[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(r=r.type,c=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!c;break e;default:r=!1}if(r)return null;if(o&&typeof o!="function")throw Error(i(231,s,typeof o));return o}var fr=!1;if(d)try{var jt={};Object.defineProperty(jt,"passive",{get:function(){fr=!0}}),window.addEventListener("test",jt,jt),window.removeEventListener("test",jt,jt)}catch{fr=!1}function Rr(r,s,o,c,u,p,m,C,N){var O=Array.prototype.slice.call(arguments,3);try{s.apply(o,O)}catch(V){this.onError(V)}}var Pr=!1,Ur=null,nr=!1,oi=null,Js={onError:function(r){Pr=!0,Ur=r}};function Ug(r,s,o,c,u,p,m,C,N){Pr=!1,Ur=null,Rr.apply(Js,arguments)}function Kg(r,s,o,c,u,p,m,C,N){if(Ug.apply(this,arguments),Pr){if(Pr){var O=Ur;Pr=!1,Ur=null}else throw Error(i(198));nr||(nr=!0,oi=O)}}function qi(r){var s=r,o=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(o=s.return),r=s.return;while(r)}return s.tag===3?o:null}function du(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function fu(r){if(qi(r)!==r)throw Error(i(188))}function Vg(r){var s=r.alternate;if(!s){if(s=qi(r),s===null)throw Error(i(188));return s!==r?null:r}for(var o=r,c=s;;){var u=o.return;if(u===null)break;var p=u.alternate;if(p===null){if(c=u.return,c!==null){o=c;continue}break}if(u.child===p.child){for(p=u.child;p;){if(p===o)return fu(u),r;if(p===c)return fu(u),s;p=p.sibling}throw Error(i(188))}if(o.return!==c.return)o=u,c=p;else{for(var m=!1,C=u.child;C;){if(C===o){m=!0,o=u,c=p;break}if(C===c){m=!0,c=u,o=p;break}C=C.sibling}if(!m){for(C=p.child;C;){if(C===o){m=!0,o=p,c=u;break}if(C===c){m=!0,c=p,o=u;break}C=C.sibling}if(!m)throw Error(i(189))}}if(o.alternate!==c)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?r:s}function pu(r){return r=Vg(r),r!==null?_u(r):null}function _u(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var s=_u(r);if(s!==null)return s;r=r.sibling}return null}var gu=t.unstable_scheduleCallback,mu=t.unstable_cancelCallback,qg=t.unstable_shouldYield,Yg=t.unstable_requestPaint,rt=t.unstable_now,Gg=t.unstable_getCurrentPriorityLevel,Zl=t.unstable_ImmediatePriority,vu=t.unstable_UserBlockingPriority,co=t.unstable_NormalPriority,Xg=t.unstable_LowPriority,yu=t.unstable_IdlePriority,ho=null,Kr=null;function Jg(r){if(Kr&&typeof Kr.onCommitFiberRoot=="function")try{Kr.onCommitFiberRoot(ho,r,void 0,(r.current.flags&128)===128)}catch{}}var Tr=Math.clz32?Math.clz32:em,Qg=Math.log,Zg=Math.LN2;function em(r){return r>>>=0,r===0?32:31-(Qg(r)/Zg|0)|0}var uo=64,fo=4194304;function Qs(r){switch(r&-r){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: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 r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function po(r,s){var o=r.pendingLanes;if(o===0)return 0;var c=0,u=r.suspendedLanes,p=r.pingedLanes,m=o&268435455;if(m!==0){var C=m&~u;C!==0?c=Qs(C):(p&=m,p!==0&&(c=Qs(p)))}else m=o&~u,m!==0?c=Qs(m):p!==0&&(c=Qs(p));if(c===0)return 0;if(s!==0&&s!==c&&(s&u)===0&&(u=c&-c,p=s&-s,u>=p||u===16&&(p&4194240)!==0))return s;if((c&4)!==0&&(c|=o&16),s=r.entangledLanes,s!==0)for(r=r.entanglements,s&=c;0<s;)o=31-Tr(s),u=1<<o,c|=r[o],s&=~u;return c}function tm(r,s){switch(r){case 1:case 2:case 4:return s+250;case 8:case 16:case 32:case 64: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 s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rm(r,s){for(var o=r.suspendedLanes,c=r.pingedLanes,u=r.expirationTimes,p=r.pendingLanes;0<p;){var m=31-Tr(p),C=1<<m,N=u[m];N===-1?((C&o)===0||(C&c)!==0)&&(u[m]=tm(C,s)):N<=s&&(r.expiredLanes|=C),p&=~C}}function ea(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Su(){var r=uo;return uo<<=1,(uo&4194240)===0&&(uo=64),r}function ta(r){for(var s=[],o=0;31>o;o++)s.push(r);return s}function Zs(r,s,o){r.pendingLanes|=s,s!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,s=31-Tr(s),r[s]=o}function im(r,s){var o=r.pendingLanes&~s;r.pendingLanes=s,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=s,r.mutableReadLanes&=s,r.entangledLanes&=s,s=r.entanglements;var c=r.eventTimes;for(r=r.expirationTimes;0<o;){var u=31-Tr(o),p=1<<u;s[u]=0,c[u]=-1,r[u]=-1,o&=~p}}function ra(r,s){var o=r.entangledLanes|=s;for(r=r.entanglements;o;){var c=31-Tr(o),u=1<<c;u&s|r[c]&s&&(r[c]|=s),o&=~u}}var Ae=0;function wu(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var xu,ia,bu,Cu,ku,sa=!1,_o=[],Si=null,wi=null,xi=null,en=new Map,tn=new Map,bi=[],sm="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 submit".split(" ");function Eu(r,s){switch(r){case"focusin":case"focusout":Si=null;break;case"dragenter":case"dragleave":wi=null;break;case"mouseover":case"mouseout":xi=null;break;case"pointerover":case"pointerout":en.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":tn.delete(s.pointerId)}}function rn(r,s,o,c,u,p){return r===null||r.nativeEvent!==p?(r={blockedOn:s,domEventName:o,eventSystemFlags:c,nativeEvent:p,targetContainers:[u]},s!==null&&(s=mn(s),s!==null&&ia(s)),r):(r.eventSystemFlags|=c,s=r.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),r)}function nm(r,s,o,c,u){switch(s){case"focusin":return Si=rn(Si,r,s,o,c,u),!0;case"dragenter":return wi=rn(wi,r,s,o,c,u),!0;case"mouseover":return xi=rn(xi,r,s,o,c,u),!0;case"pointerover":var p=u.pointerId;return en.set(p,rn(en.get(p)||null,r,s,o,c,u)),!0;case"gotpointercapture":return p=u.pointerId,tn.set(p,rn(tn.get(p)||null,r,s,o,c,u)),!0}return!1}function Nu(r){var s=Yi(r.target);if(s!==null){var o=qi(s);if(o!==null){if(s=o.tag,s===13){if(s=du(o),s!==null){r.blockedOn=s,ku(r.priority,function(){bu(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){r.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}r.blockedOn=null}function go(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var o=oa(r.domEventName,r.eventSystemFlags,s[0],r.nativeEvent);if(o===null){o=r.nativeEvent;var c=new o.constructor(o.type,o);_s=c,o.target.dispatchEvent(c),_s=null}else return s=mn(o),s!==null&&ia(s),r.blockedOn=o,!1;s.shift()}return!0}function Du(r,s,o){go(r)&&o.delete(s)}function om(){sa=!1,Si!==null&&go(Si)&&(Si=null),wi!==null&&go(wi)&&(wi=null),xi!==null&&go(xi)&&(xi=null),en.forEach(Du),tn.forEach(Du)}function sn(r,s){r.blockedOn===s&&(r.blockedOn=null,sa||(sa=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,om)))}function nn(r){function s(u){return sn(u,r)}if(0<_o.length){sn(_o[0],r);for(var o=1;o<_o.length;o++){var c=_o[o];c.blockedOn===r&&(c.blockedOn=null)}}for(Si!==null&&sn(Si,r),wi!==null&&sn(wi,r),xi!==null&&sn(xi,r),en.forEach(s),tn.forEach(s),o=0;o<bi.length;o++)c=bi[o],c.blockedOn===r&&(c.blockedOn=null);for(;0<bi.length&&(o=bi[0],o.blockedOn===null);)Nu(o),o.blockedOn===null&&bi.shift()}var gs=P.ReactCurrentBatchConfig,mo=!0;function lm(r,s,o,c){var u=Ae,p=gs.transition;gs.transition=null;try{Ae=1,na(r,s,o,c)}finally{Ae=u,gs.transition=p}}function am(r,s,o,c){var u=Ae,p=gs.transition;gs.transition=null;try{Ae=4,na(r,s,o,c)}finally{Ae=u,gs.transition=p}}function na(r,s,o,c){if(mo){var u=oa(r,s,o,c);if(u===null)ba(r,s,c,vo,o),Eu(r,c);else if(nm(u,r,s,o,c))c.stopPropagation();else if(Eu(r,c),s&4&&-1<sm.indexOf(r)){for(;u!==null;){var p=mn(u);if(p!==null&&xu(p),p=oa(r,s,o,c),p===null&&ba(r,s,c,vo,o),p===u)break;u=p}u!==null&&c.stopPropagation()}else ba(r,s,c,null,o)}}var vo=null;function oa(r,s,o,c){if(vo=null,r=Gs(c),r=Yi(r),r!==null)if(s=qi(r),s===null)r=null;else if(o=s.tag,o===13){if(r=du(s),r!==null)return r;r=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null);return vo=r,null}function Ru(r){switch(r){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Gg()){case Zl:return 1;case vu:return 4;case co:case Xg:return 16;case yu:return 536870912;default:return 16}default:return 16}}var Ci=null,la=null,yo=null;function Pu(){if(yo)return yo;var r,s=la,o=s.length,c,u="value"in Ci?Ci.value:Ci.textContent,p=u.length;for(r=0;r<o&&s[r]===u[r];r++);var m=o-r;for(c=1;c<=m&&s[o-c]===u[p-c];c++);return yo=u.slice(r,1<c?1-c:void 0)}function So(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function wo(){return!0}function Tu(){return!1}function or(r){function s(o,c,u,p,m){this._reactName=o,this._targetInst=u,this.type=c,this.nativeEvent=p,this.target=m,this.currentTarget=null;for(var C in r)r.hasOwnProperty(C)&&(o=r[C],this[C]=o?o(p):p[C]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?wo:Tu,this.isPropagationStopped=Tu,this}return J(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=wo)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=wo)},persist:function(){},isPersistent:wo}),s}var ms={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},aa=or(ms),on=J({},ms,{view:0,detail:0}),cm=or(on),ca,ha,ln,xo=J({},on,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:da,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==ln&&(ln&&r.type==="mousemove"?(ca=r.screenX-ln.screenX,ha=r.screenY-ln.screenY):ha=ca=0,ln=r),ca)},movementY:function(r){return"movementY"in r?r.movementY:ha}}),Mu=or(xo),hm=J({},xo,{dataTransfer:0}),um=or(hm),dm=J({},on,{relatedTarget:0}),ua=or(dm),fm=J({},ms,{animationName:0,elapsedTime:0,pseudoElement:0}),pm=or(fm),_m=J({},ms,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),gm=or(_m),mm=J({},ms,{data:0}),Lu=or(mm),vm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ym={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"},Sm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wm(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=Sm[r])?!!s[r]:!1}function da(){return wm}var xm=J({},on,{key:function(r){if(r.key){var s=vm[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=So(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?ym[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:da,charCode:function(r){return r.type==="keypress"?So(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?So(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),bm=or(xm),Cm=J({},xo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bu=or(Cm),km=J({},on,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:da}),Em=or(km),Nm=J({},ms,{propertyName:0,elapsedTime:0,pseudoElement:0}),Dm=or(Nm),Rm=J({},xo,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Pm=or(Rm),Tm=[9,13,27,32],fa=d&&"CompositionEvent"in window,an=null;d&&"documentMode"in document&&(an=document.documentMode);var Mm=d&&"TextEvent"in window&&!an,Iu=d&&(!fa||an&&8<an&&11>=an),Ou=" ",Au=!1;function ju(r,s){switch(r){case"keyup":return Tm.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zu(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var vs=!1;function Lm(r,s){switch(r){case"compositionend":return zu(s);case"keypress":return s.which!==32?null:(Au=!0,Ou);case"textInput":return r=s.data,r===Ou&&Au?null:r;default:return null}}function Bm(r,s){if(vs)return r==="compositionend"||!fa&&ju(r,s)?(r=Pu(),yo=la=Ci=null,vs=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Iu&&s.locale!=="ko"?null:s.data;default:return null}}var Im={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 Fu(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!Im[r.type]:s==="textarea"}function Hu(r,s,o,c){Ot(c),s=No(s,"onChange"),0<s.length&&(o=new aa("onChange","change",null,o,c),r.push({event:o,listeners:s}))}var cn=null,hn=null;function Om(r){nd(r,0)}function bo(r){var s=bs(r);if(Fe(s))return r}function Am(r,s){if(r==="change")return s}var Wu=!1;if(d){var pa;if(d){var _a="oninput"in document;if(!_a){var $u=document.createElement("div");$u.setAttribute("oninput","return;"),_a=typeof $u.oninput=="function"}pa=_a}else pa=!1;Wu=pa&&(!document.documentMode||9<document.documentMode)}function Uu(){cn&&(cn.detachEvent("onpropertychange",Ku),hn=cn=null)}function Ku(r){if(r.propertyName==="value"&&bo(hn)){var s=[];Hu(s,hn,r,Gs(r)),ni(Om,s)}}function jm(r,s,o){r==="focusin"?(Uu(),cn=s,hn=o,cn.attachEvent("onpropertychange",Ku)):r==="focusout"&&Uu()}function zm(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return bo(hn)}function Fm(r,s){if(r==="click")return bo(s)}function Hm(r,s){if(r==="input"||r==="change")return bo(s)}function Wm(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var Mr=typeof Object.is=="function"?Object.is:Wm;function un(r,s){if(Mr(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var o=Object.keys(r),c=Object.keys(s);if(o.length!==c.length)return!1;for(c=0;c<o.length;c++){var u=o[c];if(!_.call(s,u)||!Mr(r[u],s[u]))return!1}return!0}function Vu(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function qu(r,s){var o=Vu(r);r=0;for(var c;o;){if(o.nodeType===3){if(c=r+o.textContent.length,r<=s&&c>=s)return{node:o,offset:s-r};r=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Vu(o)}}function Yu(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Yu(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Gu(){for(var r=window,s=Ne();s instanceof r.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)r=s.contentWindow;else break;s=Ne(r.document)}return s}function ga(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}function $m(r){var s=Gu(),o=r.focusedElem,c=r.selectionRange;if(s!==o&&o&&o.ownerDocument&&Yu(o.ownerDocument.documentElement,o)){if(c!==null&&ga(o)){if(s=c.start,r=c.end,r===void 0&&(r=s),"selectionStart"in o)o.selectionStart=s,o.selectionEnd=Math.min(r,o.value.length);else if(r=(s=o.ownerDocument||document)&&s.defaultView||window,r.getSelection){r=r.getSelection();var u=o.textContent.length,p=Math.min(c.start,u);c=c.end===void 0?p:Math.min(c.end,u),!r.extend&&p>c&&(u=c,c=p,p=u),u=qu(o,p);var m=qu(o,c);u&&m&&(r.rangeCount!==1||r.anchorNode!==u.node||r.anchorOffset!==u.offset||r.focusNode!==m.node||r.focusOffset!==m.offset)&&(s=s.createRange(),s.setStart(u.node,u.offset),r.removeAllRanges(),p>c?(r.addRange(s),r.extend(m.node,m.offset)):(s.setEnd(m.node,m.offset),r.addRange(s)))}}for(s=[],r=o;r=r.parentNode;)r.nodeType===1&&s.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<s.length;o++)r=s[o],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var Um=d&&"documentMode"in document&&11>=document.documentMode,ys=null,ma=null,dn=null,va=!1;function Xu(r,s,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;va||ys==null||ys!==Ne(c)||(c=ys,"selectionStart"in c&&ga(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),dn&&un(dn,c)||(dn=c,c=No(ma,"onSelect"),0<c.length&&(s=new aa("onSelect","select",null,s,o),r.push({event:s,listeners:c}),s.target=ys)))}function Co(r,s){var o={};return o[r.toLowerCase()]=s.toLowerCase(),o["Webkit"+r]="webkit"+s,o["Moz"+r]="moz"+s,o}var Ss={animationend:Co("Animation","AnimationEnd"),animationiteration:Co("Animation","AnimationIteration"),animationstart:Co("Animation","AnimationStart"),transitionend:Co("Transition","TransitionEnd")},ya={},Ju={};d&&(Ju=document.createElement("div").style,"AnimationEvent"in window||(delete Ss.animationend.animation,delete Ss.animationiteration.animation,delete Ss.animationstart.animation),"TransitionEvent"in window||delete Ss.transitionend.transition);function ko(r){if(ya[r])return ya[r];if(!Ss[r])return r;var s=Ss[r],o;for(o in s)if(s.hasOwnProperty(o)&&o in Ju)return ya[r]=s[o];return r}var Qu=ko("animationend"),Zu=ko("animationiteration"),ed=ko("animationstart"),td=ko("transitionend"),rd=new Map,id="abort auxClick 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(" ");function ki(r,s){rd.set(r,s),a(s,[r])}for(var Sa=0;Sa<id.length;Sa++){var wa=id[Sa],Km=wa.toLowerCase(),Vm=wa[0].toUpperCase()+wa.slice(1);ki(Km,"on"+Vm)}ki(Qu,"onAnimationEnd"),ki(Zu,"onAnimationIteration"),ki(ed,"onAnimationStart"),ki("dblclick","onDoubleClick"),ki("focusin","onFocus"),ki("focusout","onBlur"),ki(td,"onTransitionEnd"),h("onMouseEnter",["mouseout","mouseover"]),h("onMouseLeave",["mouseout","mouseover"]),h("onPointerEnter",["pointerout","pointerover"]),h("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fn="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(" "),qm=new Set("cancel close invalid load scroll toggle".split(" ").concat(fn));function sd(r,s,o){var c=r.type||"unknown-event";r.currentTarget=o,Kg(c,s,void 0,r),r.currentTarget=null}function nd(r,s){s=(s&4)!==0;for(var o=0;o<r.length;o++){var c=r[o],u=c.event;c=c.listeners;e:{var p=void 0;if(s)for(var m=c.length-1;0<=m;m--){var C=c[m],N=C.instance,O=C.currentTarget;if(C=C.listener,N!==p&&u.isPropagationStopped())break e;sd(u,C,O),p=N}else for(m=0;m<c.length;m++){if(C=c[m],N=C.instance,O=C.currentTarget,C=C.listener,N!==p&&u.isPropagationStopped())break e;sd(u,C,O),p=N}}}if(nr)throw r=oi,nr=!1,oi=null,r}function We(r,s){var o=s[Ra];o===void 0&&(o=s[Ra]=new Set);var c=r+"__bubble";o.has(c)||(od(s,r,2,!1),o.add(c))}function xa(r,s,o){var c=0;s&&(c|=4),od(o,r,c,s)}var Eo="_reactListening"+Math.random().toString(36).slice(2);function pn(r){if(!r[Eo]){r[Eo]=!0,n.forEach(function(o){o!=="selectionchange"&&(qm.has(o)||xa(o,!1,r),xa(o,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[Eo]||(s[Eo]=!0,xa("selectionchange",!1,s))}}function od(r,s,o,c){switch(Ru(s)){case 1:var u=lm;break;case 4:u=am;break;default:u=na}o=u.bind(null,s,o,r),u=void 0,!fr||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(u=!0),c?u!==void 0?r.addEventListener(s,o,{capture:!0,passive:u}):r.addEventListener(s,o,!0):u!==void 0?r.addEventListener(s,o,{passive:u}):r.addEventListener(s,o,!1)}function ba(r,s,o,c,u){var p=c;if((s&1)===0&&(s&2)===0&&c!==null)e:for(;;){if(c===null)return;var m=c.tag;if(m===3||m===4){var C=c.stateNode.containerInfo;if(C===u||C.nodeType===8&&C.parentNode===u)break;if(m===4)for(m=c.return;m!==null;){var N=m.tag;if((N===3||N===4)&&(N=m.stateNode.containerInfo,N===u||N.nodeType===8&&N.parentNode===u))return;m=m.return}for(;C!==null;){if(m=Yi(C),m===null)return;if(N=m.tag,N===5||N===6){c=p=m;continue e}C=C.parentNode}}c=c.return}ni(function(){var O=p,V=Gs(o),Y=[];e:{var K=rd.get(r);if(K!==void 0){var oe=aa,he=r;switch(r){case"keypress":if(So(o)===0)break e;case"keydown":case"keyup":oe=bm;break;case"focusin":he="focus",oe=ua;break;case"focusout":he="blur",oe=ua;break;case"beforeblur":case"afterblur":oe=ua;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":oe=Mu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=um;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=Em;break;case Qu:case Zu:case ed:oe=pm;break;case td:oe=Dm;break;case"scroll":oe=cm;break;case"wheel":oe=Pm;break;case"copy":case"cut":case"paste":oe=gm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=Bu}var de=(s&4)!==0,it=!de&&r==="scroll",T=de?K!==null?K+"Capture":null:K;de=[];for(var D=O,L;D!==null;){L=D;var Z=L.stateNode;if(L.tag===5&&Z!==null&&(L=Z,T!==null&&(Z=Ye(D,T),Z!=null&&de.push(_n(D,Z,L)))),it)break;D=D.return}0<de.length&&(K=new oe(K,he,null,o,V),Y.push({event:K,listeners:de}))}}if((s&7)===0){e:{if(K=r==="mouseover"||r==="pointerover",oe=r==="mouseout"||r==="pointerout",K&&o!==_s&&(he=o.relatedTarget||o.fromElement)&&(Yi(he)||he[li]))break e;if((oe||K)&&(K=V.window===V?V:(K=V.ownerDocument)?K.defaultView||K.parentWindow:window,oe?(he=o.relatedTarget||o.toElement,oe=O,he=he?Yi(he):null,he!==null&&(it=qi(he),he!==it||he.tag!==5&&he.tag!==6)&&(he=null)):(oe=null,he=O),oe!==he)){if(de=Mu,Z="onMouseLeave",T="onMouseEnter",D="mouse",(r==="pointerout"||r==="pointerover")&&(de=Bu,Z="onPointerLeave",T="onPointerEnter",D="pointer"),it=oe==null?K:bs(oe),L=he==null?K:bs(he),K=new de(Z,D+"leave",oe,o,V),K.target=it,K.relatedTarget=L,Z=null,Yi(V)===O&&(de=new de(T,D+"enter",he,o,V),de.target=L,de.relatedTarget=it,Z=de),it=Z,oe&&he)t:{for(de=oe,T=he,D=0,L=de;L;L=ws(L))D++;for(L=0,Z=T;Z;Z=ws(Z))L++;for(;0<D-L;)de=ws(de),D--;for(;0<L-D;)T=ws(T),L--;for(;D--;){if(de===T||T!==null&&de===T.alternate)break t;de=ws(de),T=ws(T)}de=null}else de=null;oe!==null&&ld(Y,K,oe,de,!1),he!==null&&it!==null&&ld(Y,it,he,de,!0)}}e:{if(K=O?bs(O):window,oe=K.nodeName&&K.nodeName.toLowerCase(),oe==="select"||oe==="input"&&K.type==="file")var fe=Am;else if(Fu(K))if(Wu)fe=Hm;else{fe=zm;var ve=jm}else(oe=K.nodeName)&&oe.toLowerCase()==="input"&&(K.type==="checkbox"||K.type==="radio")&&(fe=Fm);if(fe&&(fe=fe(r,O))){Hu(Y,fe,o,V);break e}ve&&ve(r,K,O),r==="focusout"&&(ve=K._wrapperState)&&ve.controlled&&K.type==="number"&&ii(K,"number",K.value)}switch(ve=O?bs(O):window,r){case"focusin":(Fu(ve)||ve.contentEditable==="true")&&(ys=ve,ma=O,dn=null);break;case"focusout":dn=ma=ys=null;break;case"mousedown":va=!0;break;case"contextmenu":case"mouseup":case"dragend":va=!1,Xu(Y,o,V);break;case"selectionchange":if(Um)break;case"keydown":case"keyup":Xu(Y,o,V)}var ye;if(fa)e:{switch(r){case"compositionstart":var be="onCompositionStart";break e;case"compositionend":be="onCompositionEnd";break e;case"compositionupdate":be="onCompositionUpdate";break e}be=void 0}else vs?ju(r,o)&&(be="onCompositionEnd"):r==="keydown"&&o.keyCode===229&&(be="onCompositionStart");be&&(Iu&&o.locale!=="ko"&&(vs||be!=="onCompositionStart"?be==="onCompositionEnd"&&vs&&(ye=Pu()):(Ci=V,la="value"in Ci?Ci.value:Ci.textContent,vs=!0)),ve=No(O,be),0<ve.length&&(be=new Lu(be,r,null,o,V),Y.push({event:be,listeners:ve}),ye?be.data=ye:(ye=zu(o),ye!==null&&(be.data=ye)))),(ye=Mm?Lm(r,o):Bm(r,o))&&(O=No(O,"onBeforeInput"),0<O.length&&(V=new Lu("onBeforeInput","beforeinput",null,o,V),Y.push({event:V,listeners:O}),V.data=ye))}nd(Y,s)})}function _n(r,s,o){return{instance:r,listener:s,currentTarget:o}}function No(r,s){for(var o=s+"Capture",c=[];r!==null;){var u=r,p=u.stateNode;u.tag===5&&p!==null&&(u=p,p=Ye(r,o),p!=null&&c.unshift(_n(r,p,u)),p=Ye(r,s),p!=null&&c.push(_n(r,p,u))),r=r.return}return c}function ws(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function ld(r,s,o,c,u){for(var p=s._reactName,m=[];o!==null&&o!==c;){var C=o,N=C.alternate,O=C.stateNode;if(N!==null&&N===c)break;C.tag===5&&O!==null&&(C=O,u?(N=Ye(o,p),N!=null&&m.unshift(_n(o,N,C))):u||(N=Ye(o,p),N!=null&&m.push(_n(o,N,C)))),o=o.return}m.length!==0&&r.push({event:s,listeners:m})}var Ym=/\r\n?/g,Gm=/\u0000|\uFFFD/g;function ad(r){return(typeof r=="string"?r:""+r).replace(Ym,`
38
+ `).replace(Gm,"")}function Do(r,s,o){if(s=ad(s),ad(r)!==s&&o)throw Error(i(425))}function Ro(){}var Ca=null,ka=null;function Ea(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Na=typeof setTimeout=="function"?setTimeout:void 0,Xm=typeof clearTimeout=="function"?clearTimeout:void 0,cd=typeof Promise=="function"?Promise:void 0,Jm=typeof queueMicrotask=="function"?queueMicrotask:typeof cd<"u"?function(r){return cd.resolve(null).then(r).catch(Qm)}:Na;function Qm(r){setTimeout(function(){throw r})}function Da(r,s){var o=s,c=0;do{var u=o.nextSibling;if(r.removeChild(o),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(c===0){r.removeChild(u),nn(s);return}c--}else o!=="$"&&o!=="$?"&&o!=="$!"||c++;o=u}while(o);nn(s)}function Ei(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return r}function hd(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="$"||o==="$!"||o==="$?"){if(s===0)return r;s--}else o==="/$"&&s++}r=r.previousSibling}return null}var xs=Math.random().toString(36).slice(2),Vr="__reactFiber$"+xs,gn="__reactProps$"+xs,li="__reactContainer$"+xs,Ra="__reactEvents$"+xs,Zm="__reactListeners$"+xs,ev="__reactHandles$"+xs;function Yi(r){var s=r[Vr];if(s)return s;for(var o=r.parentNode;o;){if(s=o[li]||o[Vr]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(r=hd(r);r!==null;){if(o=r[Vr])return o;r=hd(r)}return s}r=o,o=r.parentNode}return null}function mn(r){return r=r[Vr]||r[li],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function bs(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(i(33))}function Po(r){return r[gn]||null}var Pa=[],Cs=-1;function Ni(r){return{current:r}}function $e(r){0>Cs||(r.current=Pa[Cs],Pa[Cs]=null,Cs--)}function ze(r,s){Cs++,Pa[Cs]=r.current,r.current=s}var Di={},zt=Ni(Di),Jt=Ni(!1),Gi=Di;function ks(r,s){var o=r.type.contextTypes;if(!o)return Di;var c=r.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===s)return c.__reactInternalMemoizedMaskedChildContext;var u={},p;for(p in o)u[p]=s[p];return c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=s,r.__reactInternalMemoizedMaskedChildContext=u),u}function Qt(r){return r=r.childContextTypes,r!=null}function To(){$e(Jt),$e(zt)}function ud(r,s,o){if(zt.current!==Di)throw Error(i(168));ze(zt,s),ze(Jt,o)}function dd(r,s,o){var c=r.stateNode;if(s=s.childContextTypes,typeof c.getChildContext!="function")return o;c=c.getChildContext();for(var u in c)if(!(u in s))throw Error(i(108,De(r)||"Unknown",u));return J({},o,c)}function Mo(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Di,Gi=zt.current,ze(zt,r),ze(Jt,Jt.current),!0}function fd(r,s,o){var c=r.stateNode;if(!c)throw Error(i(169));o?(r=dd(r,s,Gi),c.__reactInternalMemoizedMergedChildContext=r,$e(Jt),$e(zt),ze(zt,r)):$e(Jt),ze(Jt,o)}var ai=null,Lo=!1,Ta=!1;function pd(r){ai===null?ai=[r]:ai.push(r)}function tv(r){Lo=!0,pd(r)}function Ri(){if(!Ta&&ai!==null){Ta=!0;var r=0,s=Ae;try{var o=ai;for(Ae=1;r<o.length;r++){var c=o[r];do c=c(!0);while(c!==null)}ai=null,Lo=!1}catch(u){throw ai!==null&&(ai=ai.slice(r+1)),gu(Zl,Ri),u}finally{Ae=s,Ta=!1}}return null}var Es=[],Ns=0,Bo=null,Io=0,pr=[],_r=0,Xi=null,ci=1,hi="";function Ji(r,s){Es[Ns++]=Io,Es[Ns++]=Bo,Bo=r,Io=s}function _d(r,s,o){pr[_r++]=ci,pr[_r++]=hi,pr[_r++]=Xi,Xi=r;var c=ci;r=hi;var u=32-Tr(c)-1;c&=~(1<<u),o+=1;var p=32-Tr(s)+u;if(30<p){var m=u-u%5;p=(c&(1<<m)-1).toString(32),c>>=m,u-=m,ci=1<<32-Tr(s)+u|o<<u|c,hi=p+r}else ci=1<<p|o<<u|c,hi=r}function Ma(r){r.return!==null&&(Ji(r,1),_d(r,1,0))}function La(r){for(;r===Bo;)Bo=Es[--Ns],Es[Ns]=null,Io=Es[--Ns],Es[Ns]=null;for(;r===Xi;)Xi=pr[--_r],pr[_r]=null,hi=pr[--_r],pr[_r]=null,ci=pr[--_r],pr[_r]=null}var lr=null,ar=null,Ke=!1,Lr=null;function gd(r,s){var o=yr(5,null,null,0);o.elementType="DELETED",o.stateNode=s,o.return=r,s=r.deletions,s===null?(r.deletions=[o],r.flags|=16):s.push(o)}function md(r,s){switch(r.tag){case 5:var o=r.type;return s=s.nodeType!==1||o.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(r.stateNode=s,lr=r,ar=Ei(s.firstChild),!0):!1;case 6:return s=r.pendingProps===""||s.nodeType!==3?null:s,s!==null?(r.stateNode=s,lr=r,ar=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(o=Xi!==null?{id:ci,overflow:hi}:null,r.memoizedState={dehydrated:s,treeContext:o,retryLane:1073741824},o=yr(18,null,null,0),o.stateNode=s,o.return=r,r.child=o,lr=r,ar=null,!0):!1;default:return!1}}function Ba(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Ia(r){if(Ke){var s=ar;if(s){var o=s;if(!md(r,s)){if(Ba(r))throw Error(i(418));s=Ei(o.nextSibling);var c=lr;s&&md(r,s)?gd(c,o):(r.flags=r.flags&-4097|2,Ke=!1,lr=r)}}else{if(Ba(r))throw Error(i(418));r.flags=r.flags&-4097|2,Ke=!1,lr=r}}}function vd(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;lr=r}function Oo(r){if(r!==lr)return!1;if(!Ke)return vd(r),Ke=!0,!1;var s;if((s=r.tag!==3)&&!(s=r.tag!==5)&&(s=r.type,s=s!=="head"&&s!=="body"&&!Ea(r.type,r.memoizedProps)),s&&(s=ar)){if(Ba(r))throw yd(),Error(i(418));for(;s;)gd(r,s),s=Ei(s.nextSibling)}if(vd(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));e:{for(r=r.nextSibling,s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="/$"){if(s===0){ar=Ei(r.nextSibling);break e}s--}else o!=="$"&&o!=="$!"&&o!=="$?"||s++}r=r.nextSibling}ar=null}}else ar=lr?Ei(r.stateNode.nextSibling):null;return!0}function yd(){for(var r=ar;r;)r=Ei(r.nextSibling)}function Ds(){ar=lr=null,Ke=!1}function Oa(r){Lr===null?Lr=[r]:Lr.push(r)}var rv=P.ReactCurrentBatchConfig;function vn(r,s,o){if(r=o.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(o._owner){if(o=o._owner,o){if(o.tag!==1)throw Error(i(309));var c=o.stateNode}if(!c)throw Error(i(147,r));var u=c,p=""+r;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===p?s.ref:(s=function(m){var C=u.refs;m===null?delete C[p]:C[p]=m},s._stringRef=p,s)}if(typeof r!="string")throw Error(i(284));if(!o._owner)throw Error(i(290,r))}return r}function Ao(r,s){throw r=Object.prototype.toString.call(s),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r))}function Sd(r){var s=r._init;return s(r._payload)}function wd(r){function s(T,D){if(r){var L=T.deletions;L===null?(T.deletions=[D],T.flags|=16):L.push(D)}}function o(T,D){if(!r)return null;for(;D!==null;)s(T,D),D=D.sibling;return null}function c(T,D){for(T=new Map;D!==null;)D.key!==null?T.set(D.key,D):T.set(D.index,D),D=D.sibling;return T}function u(T,D){return T=Ai(T,D),T.index=0,T.sibling=null,T}function p(T,D,L){return T.index=L,r?(L=T.alternate,L!==null?(L=L.index,L<D?(T.flags|=2,D):L):(T.flags|=2,D)):(T.flags|=1048576,D)}function m(T){return r&&T.alternate===null&&(T.flags|=2),T}function C(T,D,L,Z){return D===null||D.tag!==6?(D=Nc(L,T.mode,Z),D.return=T,D):(D=u(D,L),D.return=T,D)}function N(T,D,L,Z){var fe=L.type;return fe===re?V(T,D,L.props.children,Z,L.key):D!==null&&(D.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===ee&&Sd(fe)===D.type)?(Z=u(D,L.props),Z.ref=vn(T,D,L),Z.return=T,Z):(Z=ll(L.type,L.key,L.props,null,T.mode,Z),Z.ref=vn(T,D,L),Z.return=T,Z)}function O(T,D,L,Z){return D===null||D.tag!==4||D.stateNode.containerInfo!==L.containerInfo||D.stateNode.implementation!==L.implementation?(D=Dc(L,T.mode,Z),D.return=T,D):(D=u(D,L.children||[]),D.return=T,D)}function V(T,D,L,Z,fe){return D===null||D.tag!==7?(D=ns(L,T.mode,Z,fe),D.return=T,D):(D=u(D,L),D.return=T,D)}function Y(T,D,L){if(typeof D=="string"&&D!==""||typeof D=="number")return D=Nc(""+D,T.mode,L),D.return=T,D;if(typeof D=="object"&&D!==null){switch(D.$$typeof){case M:return L=ll(D.type,D.key,D.props,null,T.mode,L),L.ref=vn(T,null,D),L.return=T,L;case A:return D=Dc(D,T.mode,L),D.return=T,D;case ee:var Z=D._init;return Y(T,Z(D._payload),L)}if(Nt(D)||Q(D))return D=ns(D,T.mode,L,null),D.return=T,D;Ao(T,D)}return null}function K(T,D,L,Z){var fe=D!==null?D.key:null;if(typeof L=="string"&&L!==""||typeof L=="number")return fe!==null?null:C(T,D,""+L,Z);if(typeof L=="object"&&L!==null){switch(L.$$typeof){case M:return L.key===fe?N(T,D,L,Z):null;case A:return L.key===fe?O(T,D,L,Z):null;case ee:return fe=L._init,K(T,D,fe(L._payload),Z)}if(Nt(L)||Q(L))return fe!==null?null:V(T,D,L,Z,null);Ao(T,L)}return null}function oe(T,D,L,Z,fe){if(typeof Z=="string"&&Z!==""||typeof Z=="number")return T=T.get(L)||null,C(D,T,""+Z,fe);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case M:return T=T.get(Z.key===null?L:Z.key)||null,N(D,T,Z,fe);case A:return T=T.get(Z.key===null?L:Z.key)||null,O(D,T,Z,fe);case ee:var ve=Z._init;return oe(T,D,L,ve(Z._payload),fe)}if(Nt(Z)||Q(Z))return T=T.get(L)||null,V(D,T,Z,fe,null);Ao(D,Z)}return null}function he(T,D,L,Z){for(var fe=null,ve=null,ye=D,be=D=0,St=null;ye!==null&&be<L.length;be++){ye.index>be?(St=ye,ye=null):St=ye.sibling;var Le=K(T,ye,L[be],Z);if(Le===null){ye===null&&(ye=St);break}r&&ye&&Le.alternate===null&&s(T,ye),D=p(Le,D,be),ve===null?fe=Le:ve.sibling=Le,ve=Le,ye=St}if(be===L.length)return o(T,ye),Ke&&Ji(T,be),fe;if(ye===null){for(;be<L.length;be++)ye=Y(T,L[be],Z),ye!==null&&(D=p(ye,D,be),ve===null?fe=ye:ve.sibling=ye,ve=ye);return Ke&&Ji(T,be),fe}for(ye=c(T,ye);be<L.length;be++)St=oe(ye,T,be,L[be],Z),St!==null&&(r&&St.alternate!==null&&ye.delete(St.key===null?be:St.key),D=p(St,D,be),ve===null?fe=St:ve.sibling=St,ve=St);return r&&ye.forEach(function(ji){return s(T,ji)}),Ke&&Ji(T,be),fe}function de(T,D,L,Z){var fe=Q(L);if(typeof fe!="function")throw Error(i(150));if(L=fe.call(L),L==null)throw Error(i(151));for(var ve=fe=null,ye=D,be=D=0,St=null,Le=L.next();ye!==null&&!Le.done;be++,Le=L.next()){ye.index>be?(St=ye,ye=null):St=ye.sibling;var ji=K(T,ye,Le.value,Z);if(ji===null){ye===null&&(ye=St);break}r&&ye&&ji.alternate===null&&s(T,ye),D=p(ji,D,be),ve===null?fe=ji:ve.sibling=ji,ve=ji,ye=St}if(Le.done)return o(T,ye),Ke&&Ji(T,be),fe;if(ye===null){for(;!Le.done;be++,Le=L.next())Le=Y(T,Le.value,Z),Le!==null&&(D=p(Le,D,be),ve===null?fe=Le:ve.sibling=Le,ve=Le);return Ke&&Ji(T,be),fe}for(ye=c(T,ye);!Le.done;be++,Le=L.next())Le=oe(ye,T,be,Le.value,Z),Le!==null&&(r&&Le.alternate!==null&&ye.delete(Le.key===null?be:Le.key),D=p(Le,D,be),ve===null?fe=Le:ve.sibling=Le,ve=Le);return r&&ye.forEach(function(Iv){return s(T,Iv)}),Ke&&Ji(T,be),fe}function it(T,D,L,Z){if(typeof L=="object"&&L!==null&&L.type===re&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case M:e:{for(var fe=L.key,ve=D;ve!==null;){if(ve.key===fe){if(fe=L.type,fe===re){if(ve.tag===7){o(T,ve.sibling),D=u(ve,L.props.children),D.return=T,T=D;break e}}else if(ve.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===ee&&Sd(fe)===ve.type){o(T,ve.sibling),D=u(ve,L.props),D.ref=vn(T,ve,L),D.return=T,T=D;break e}o(T,ve);break}else s(T,ve);ve=ve.sibling}L.type===re?(D=ns(L.props.children,T.mode,Z,L.key),D.return=T,T=D):(Z=ll(L.type,L.key,L.props,null,T.mode,Z),Z.ref=vn(T,D,L),Z.return=T,T=Z)}return m(T);case A:e:{for(ve=L.key;D!==null;){if(D.key===ve)if(D.tag===4&&D.stateNode.containerInfo===L.containerInfo&&D.stateNode.implementation===L.implementation){o(T,D.sibling),D=u(D,L.children||[]),D.return=T,T=D;break e}else{o(T,D);break}else s(T,D);D=D.sibling}D=Dc(L,T.mode,Z),D.return=T,T=D}return m(T);case ee:return ve=L._init,it(T,D,ve(L._payload),Z)}if(Nt(L))return he(T,D,L,Z);if(Q(L))return de(T,D,L,Z);Ao(T,L)}return typeof L=="string"&&L!==""||typeof L=="number"?(L=""+L,D!==null&&D.tag===6?(o(T,D.sibling),D=u(D,L),D.return=T,T=D):(o(T,D),D=Nc(L,T.mode,Z),D.return=T,T=D),m(T)):o(T,D)}return it}var Rs=wd(!0),xd=wd(!1),jo=Ni(null),zo=null,Ps=null,Aa=null;function ja(){Aa=Ps=zo=null}function za(r){var s=jo.current;$e(jo),r._currentValue=s}function Fa(r,s,o){for(;r!==null;){var c=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),r===o)break;r=r.return}}function Ts(r,s){zo=r,Aa=Ps=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&s)!==0&&(Zt=!0),r.firstContext=null)}function gr(r){var s=r._currentValue;if(Aa!==r)if(r={context:r,memoizedValue:s,next:null},Ps===null){if(zo===null)throw Error(i(308));Ps=r,zo.dependencies={lanes:0,firstContext:r}}else Ps=Ps.next=r;return s}var Qi=null;function Ha(r){Qi===null?Qi=[r]:Qi.push(r)}function bd(r,s,o,c){var u=s.interleaved;return u===null?(o.next=o,Ha(s)):(o.next=u.next,u.next=o),s.interleaved=o,ui(r,c)}function ui(r,s){r.lanes|=s;var o=r.alternate;for(o!==null&&(o.lanes|=s),o=r,r=r.return;r!==null;)r.childLanes|=s,o=r.alternate,o!==null&&(o.childLanes|=s),o=r,r=r.return;return o.tag===3?o.stateNode:null}var Pi=!1;function Wa(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Cd(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function di(r,s){return{eventTime:r,lane:s,tag:0,payload:null,callback:null,next:null}}function Ti(r,s,o){var c=r.updateQueue;if(c===null)return null;if(c=c.shared,(Me&2)!==0){var u=c.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),c.pending=s,ui(r,o)}return u=c.interleaved,u===null?(s.next=s,Ha(c)):(s.next=u.next,u.next=s),c.interleaved=s,ui(r,o)}function Fo(r,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194240)!==0)){var c=s.lanes;c&=r.pendingLanes,o|=c,s.lanes=o,ra(r,o)}}function kd(r,s){var o=r.updateQueue,c=r.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var u=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var m={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};p===null?u=p=m:p=p.next=m,o=o.next}while(o!==null);p===null?u=p=s:p=p.next=s}else u=p=s;o={baseState:c.baseState,firstBaseUpdate:u,lastBaseUpdate:p,shared:c.shared,effects:c.effects},r.updateQueue=o;return}r=o.lastBaseUpdate,r===null?o.firstBaseUpdate=s:r.next=s,o.lastBaseUpdate=s}function Ho(r,s,o,c){var u=r.updateQueue;Pi=!1;var p=u.firstBaseUpdate,m=u.lastBaseUpdate,C=u.shared.pending;if(C!==null){u.shared.pending=null;var N=C,O=N.next;N.next=null,m===null?p=O:m.next=O,m=N;var V=r.alternate;V!==null&&(V=V.updateQueue,C=V.lastBaseUpdate,C!==m&&(C===null?V.firstBaseUpdate=O:C.next=O,V.lastBaseUpdate=N))}if(p!==null){var Y=u.baseState;m=0,V=O=N=null,C=p;do{var K=C.lane,oe=C.eventTime;if((c&K)===K){V!==null&&(V=V.next={eventTime:oe,lane:0,tag:C.tag,payload:C.payload,callback:C.callback,next:null});e:{var he=r,de=C;switch(K=s,oe=o,de.tag){case 1:if(he=de.payload,typeof he=="function"){Y=he.call(oe,Y,K);break e}Y=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=de.payload,K=typeof he=="function"?he.call(oe,Y,K):he,K==null)break e;Y=J({},Y,K);break e;case 2:Pi=!0}}C.callback!==null&&C.lane!==0&&(r.flags|=64,K=u.effects,K===null?u.effects=[C]:K.push(C))}else oe={eventTime:oe,lane:K,tag:C.tag,payload:C.payload,callback:C.callback,next:null},V===null?(O=V=oe,N=Y):V=V.next=oe,m|=K;if(C=C.next,C===null){if(C=u.shared.pending,C===null)break;K=C,C=K.next,K.next=null,u.lastBaseUpdate=K,u.shared.pending=null}}while(!0);if(V===null&&(N=Y),u.baseState=N,u.firstBaseUpdate=O,u.lastBaseUpdate=V,s=u.shared.interleaved,s!==null){u=s;do m|=u.lane,u=u.next;while(u!==s)}else p===null&&(u.shared.lanes=0);ts|=m,r.lanes=m,r.memoizedState=Y}}function Ed(r,s,o){if(r=s.effects,s.effects=null,r!==null)for(s=0;s<r.length;s++){var c=r[s],u=c.callback;if(u!==null){if(c.callback=null,c=o,typeof u!="function")throw Error(i(191,u));u.call(c)}}}var yn={},qr=Ni(yn),Sn=Ni(yn),wn=Ni(yn);function Zi(r){if(r===yn)throw Error(i(174));return r}function $a(r,s){switch(ze(wn,s),ze(Sn,r),ze(qr,yn),r=s.nodeType,r){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:mt(null,"");break;default:r=r===8?s.parentNode:s,s=r.namespaceURI||null,r=r.tagName,s=mt(s,r)}$e(qr),ze(qr,s)}function Ms(){$e(qr),$e(Sn),$e(wn)}function Nd(r){Zi(wn.current);var s=Zi(qr.current),o=mt(s,r.type);s!==o&&(ze(Sn,r),ze(qr,o))}function Ua(r){Sn.current===r&&($e(qr),$e(Sn))}var Ge=Ni(0);function Wo(r){for(var s=r;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Ka=[];function Va(){for(var r=0;r<Ka.length;r++)Ka[r]._workInProgressVersionPrimary=null;Ka.length=0}var $o=P.ReactCurrentDispatcher,qa=P.ReactCurrentBatchConfig,es=0,Xe=null,ct=null,vt=null,Uo=!1,xn=!1,bn=0,iv=0;function Ft(){throw Error(i(321))}function Ya(r,s){if(s===null)return!1;for(var o=0;o<s.length&&o<r.length;o++)if(!Mr(r[o],s[o]))return!1;return!0}function Ga(r,s,o,c,u,p){if(es=p,Xe=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,$o.current=r===null||r.memoizedState===null?lv:av,r=o(c,u),xn){p=0;do{if(xn=!1,bn=0,25<=p)throw Error(i(301));p+=1,vt=ct=null,s.updateQueue=null,$o.current=cv,r=o(c,u)}while(xn)}if($o.current=qo,s=ct!==null&&ct.next!==null,es=0,vt=ct=Xe=null,Uo=!1,s)throw Error(i(300));return r}function Xa(){var r=bn!==0;return bn=0,r}function Yr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vt===null?Xe.memoizedState=vt=r:vt=vt.next=r,vt}function mr(){if(ct===null){var r=Xe.alternate;r=r!==null?r.memoizedState:null}else r=ct.next;var s=vt===null?Xe.memoizedState:vt.next;if(s!==null)vt=s,ct=r;else{if(r===null)throw Error(i(310));ct=r,r={memoizedState:ct.memoizedState,baseState:ct.baseState,baseQueue:ct.baseQueue,queue:ct.queue,next:null},vt===null?Xe.memoizedState=vt=r:vt=vt.next=r}return vt}function Cn(r,s){return typeof s=="function"?s(r):s}function Ja(r){var s=mr(),o=s.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=r;var c=ct,u=c.baseQueue,p=o.pending;if(p!==null){if(u!==null){var m=u.next;u.next=p.next,p.next=m}c.baseQueue=u=p,o.pending=null}if(u!==null){p=u.next,c=c.baseState;var C=m=null,N=null,O=p;do{var V=O.lane;if((es&V)===V)N!==null&&(N=N.next={lane:0,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null}),c=O.hasEagerState?O.eagerState:r(c,O.action);else{var Y={lane:V,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null};N===null?(C=N=Y,m=c):N=N.next=Y,Xe.lanes|=V,ts|=V}O=O.next}while(O!==null&&O!==p);N===null?m=c:N.next=C,Mr(c,s.memoizedState)||(Zt=!0),s.memoizedState=c,s.baseState=m,s.baseQueue=N,o.lastRenderedState=c}if(r=o.interleaved,r!==null){u=r;do p=u.lane,Xe.lanes|=p,ts|=p,u=u.next;while(u!==r)}else u===null&&(o.lanes=0);return[s.memoizedState,o.dispatch]}function Qa(r){var s=mr(),o=s.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=r;var c=o.dispatch,u=o.pending,p=s.memoizedState;if(u!==null){o.pending=null;var m=u=u.next;do p=r(p,m.action),m=m.next;while(m!==u);Mr(p,s.memoizedState)||(Zt=!0),s.memoizedState=p,s.baseQueue===null&&(s.baseState=p),o.lastRenderedState=p}return[p,c]}function Dd(){}function Rd(r,s){var o=Xe,c=mr(),u=s(),p=!Mr(c.memoizedState,u);if(p&&(c.memoizedState=u,Zt=!0),c=c.queue,Za(Md.bind(null,o,c,r),[r]),c.getSnapshot!==s||p||vt!==null&&vt.memoizedState.tag&1){if(o.flags|=2048,kn(9,Td.bind(null,o,c,u,s),void 0,null),yt===null)throw Error(i(349));(es&30)!==0||Pd(o,s,u)}return u}function Pd(r,s,o){r.flags|=16384,r={getSnapshot:s,value:o},s=Xe.updateQueue,s===null?(s={lastEffect:null,stores:null},Xe.updateQueue=s,s.stores=[r]):(o=s.stores,o===null?s.stores=[r]:o.push(r))}function Td(r,s,o,c){s.value=o,s.getSnapshot=c,Ld(s)&&Bd(r)}function Md(r,s,o){return o(function(){Ld(s)&&Bd(r)})}function Ld(r){var s=r.getSnapshot;r=r.value;try{var o=s();return!Mr(r,o)}catch{return!0}}function Bd(r){var s=ui(r,1);s!==null&&Ar(s,r,1,-1)}function Id(r){var s=Yr();return typeof r=="function"&&(r=r()),s.memoizedState=s.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Cn,lastRenderedState:r},s.queue=r,r=r.dispatch=ov.bind(null,Xe,r),[s.memoizedState,r]}function kn(r,s,o,c){return r={tag:r,create:s,destroy:o,deps:c,next:null},s=Xe.updateQueue,s===null?(s={lastEffect:null,stores:null},Xe.updateQueue=s,s.lastEffect=r.next=r):(o=s.lastEffect,o===null?s.lastEffect=r.next=r:(c=o.next,o.next=r,r.next=c,s.lastEffect=r)),r}function Od(){return mr().memoizedState}function Ko(r,s,o,c){var u=Yr();Xe.flags|=r,u.memoizedState=kn(1|s,o,void 0,c===void 0?null:c)}function Vo(r,s,o,c){var u=mr();c=c===void 0?null:c;var p=void 0;if(ct!==null){var m=ct.memoizedState;if(p=m.destroy,c!==null&&Ya(c,m.deps)){u.memoizedState=kn(s,o,p,c);return}}Xe.flags|=r,u.memoizedState=kn(1|s,o,p,c)}function Ad(r,s){return Ko(8390656,8,r,s)}function Za(r,s){return Vo(2048,8,r,s)}function jd(r,s){return Vo(4,2,r,s)}function zd(r,s){return Vo(4,4,r,s)}function Fd(r,s){if(typeof s=="function")return r=r(),s(r),function(){s(null)};if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function Hd(r,s,o){return o=o!=null?o.concat([r]):null,Vo(4,4,Fd.bind(null,s,r),o)}function ec(){}function Wd(r,s){var o=mr();s=s===void 0?null:s;var c=o.memoizedState;return c!==null&&s!==null&&Ya(s,c[1])?c[0]:(o.memoizedState=[r,s],r)}function $d(r,s){var o=mr();s=s===void 0?null:s;var c=o.memoizedState;return c!==null&&s!==null&&Ya(s,c[1])?c[0]:(r=r(),o.memoizedState=[r,s],r)}function Ud(r,s,o){return(es&21)===0?(r.baseState&&(r.baseState=!1,Zt=!0),r.memoizedState=o):(Mr(o,s)||(o=Su(),Xe.lanes|=o,ts|=o,r.baseState=!0),s)}function sv(r,s){var o=Ae;Ae=o!==0&&4>o?o:4,r(!0);var c=qa.transition;qa.transition={};try{r(!1),s()}finally{Ae=o,qa.transition=c}}function Kd(){return mr().memoizedState}function nv(r,s,o){var c=Ii(r);if(o={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null},Vd(r))qd(s,o);else if(o=bd(r,s,o,c),o!==null){var u=Vt();Ar(o,r,c,u),Yd(o,s,c)}}function ov(r,s,o){var c=Ii(r),u={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null};if(Vd(r))qd(s,u);else{var p=r.alternate;if(r.lanes===0&&(p===null||p.lanes===0)&&(p=s.lastRenderedReducer,p!==null))try{var m=s.lastRenderedState,C=p(m,o);if(u.hasEagerState=!0,u.eagerState=C,Mr(C,m)){var N=s.interleaved;N===null?(u.next=u,Ha(s)):(u.next=N.next,N.next=u),s.interleaved=u;return}}catch{}finally{}o=bd(r,s,u,c),o!==null&&(u=Vt(),Ar(o,r,c,u),Yd(o,s,c))}}function Vd(r){var s=r.alternate;return r===Xe||s!==null&&s===Xe}function qd(r,s){xn=Uo=!0;var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}function Yd(r,s,o){if((o&4194240)!==0){var c=s.lanes;c&=r.pendingLanes,o|=c,s.lanes=o,ra(r,o)}}var qo={readContext:gr,useCallback:Ft,useContext:Ft,useEffect:Ft,useImperativeHandle:Ft,useInsertionEffect:Ft,useLayoutEffect:Ft,useMemo:Ft,useReducer:Ft,useRef:Ft,useState:Ft,useDebugValue:Ft,useDeferredValue:Ft,useTransition:Ft,useMutableSource:Ft,useSyncExternalStore:Ft,useId:Ft,unstable_isNewReconciler:!1},lv={readContext:gr,useCallback:function(r,s){return Yr().memoizedState=[r,s===void 0?null:s],r},useContext:gr,useEffect:Ad,useImperativeHandle:function(r,s,o){return o=o!=null?o.concat([r]):null,Ko(4194308,4,Fd.bind(null,s,r),o)},useLayoutEffect:function(r,s){return Ko(4194308,4,r,s)},useInsertionEffect:function(r,s){return Ko(4,2,r,s)},useMemo:function(r,s){var o=Yr();return s=s===void 0?null:s,r=r(),o.memoizedState=[r,s],r},useReducer:function(r,s,o){var c=Yr();return s=o!==void 0?o(s):s,c.memoizedState=c.baseState=s,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:s},c.queue=r,r=r.dispatch=nv.bind(null,Xe,r),[c.memoizedState,r]},useRef:function(r){var s=Yr();return r={current:r},s.memoizedState=r},useState:Id,useDebugValue:ec,useDeferredValue:function(r){return Yr().memoizedState=r},useTransition:function(){var r=Id(!1),s=r[0];return r=sv.bind(null,r[1]),Yr().memoizedState=r,[s,r]},useMutableSource:function(){},useSyncExternalStore:function(r,s,o){var c=Xe,u=Yr();if(Ke){if(o===void 0)throw Error(i(407));o=o()}else{if(o=s(),yt===null)throw Error(i(349));(es&30)!==0||Pd(c,s,o)}u.memoizedState=o;var p={value:o,getSnapshot:s};return u.queue=p,Ad(Md.bind(null,c,p,r),[r]),c.flags|=2048,kn(9,Td.bind(null,c,p,o,s),void 0,null),o},useId:function(){var r=Yr(),s=yt.identifierPrefix;if(Ke){var o=hi,c=ci;o=(c&~(1<<32-Tr(c)-1)).toString(32)+o,s=":"+s+"R"+o,o=bn++,0<o&&(s+="H"+o.toString(32)),s+=":"}else o=iv++,s=":"+s+"r"+o.toString(32)+":";return r.memoizedState=s},unstable_isNewReconciler:!1},av={readContext:gr,useCallback:Wd,useContext:gr,useEffect:Za,useImperativeHandle:Hd,useInsertionEffect:jd,useLayoutEffect:zd,useMemo:$d,useReducer:Ja,useRef:Od,useState:function(){return Ja(Cn)},useDebugValue:ec,useDeferredValue:function(r){var s=mr();return Ud(s,ct.memoizedState,r)},useTransition:function(){var r=Ja(Cn)[0],s=mr().memoizedState;return[r,s]},useMutableSource:Dd,useSyncExternalStore:Rd,useId:Kd,unstable_isNewReconciler:!1},cv={readContext:gr,useCallback:Wd,useContext:gr,useEffect:Za,useImperativeHandle:Hd,useInsertionEffect:jd,useLayoutEffect:zd,useMemo:$d,useReducer:Qa,useRef:Od,useState:function(){return Qa(Cn)},useDebugValue:ec,useDeferredValue:function(r){var s=mr();return ct===null?s.memoizedState=r:Ud(s,ct.memoizedState,r)},useTransition:function(){var r=Qa(Cn)[0],s=mr().memoizedState;return[r,s]},useMutableSource:Dd,useSyncExternalStore:Rd,useId:Kd,unstable_isNewReconciler:!1};function Br(r,s){if(r&&r.defaultProps){s=J({},s),r=r.defaultProps;for(var o in r)s[o]===void 0&&(s[o]=r[o]);return s}return s}function tc(r,s,o,c){s=r.memoizedState,o=o(c,s),o=o==null?s:J({},s,o),r.memoizedState=o,r.lanes===0&&(r.updateQueue.baseState=o)}var Yo={isMounted:function(r){return(r=r._reactInternals)?qi(r)===r:!1},enqueueSetState:function(r,s,o){r=r._reactInternals;var c=Vt(),u=Ii(r),p=di(c,u);p.payload=s,o!=null&&(p.callback=o),s=Ti(r,p,u),s!==null&&(Ar(s,r,u,c),Fo(s,r,u))},enqueueReplaceState:function(r,s,o){r=r._reactInternals;var c=Vt(),u=Ii(r),p=di(c,u);p.tag=1,p.payload=s,o!=null&&(p.callback=o),s=Ti(r,p,u),s!==null&&(Ar(s,r,u,c),Fo(s,r,u))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var o=Vt(),c=Ii(r),u=di(o,c);u.tag=2,s!=null&&(u.callback=s),s=Ti(r,u,c),s!==null&&(Ar(s,r,c,o),Fo(s,r,c))}};function Gd(r,s,o,c,u,p,m){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(c,p,m):s.prototype&&s.prototype.isPureReactComponent?!un(o,c)||!un(u,p):!0}function Xd(r,s,o){var c=!1,u=Di,p=s.contextType;return typeof p=="object"&&p!==null?p=gr(p):(u=Qt(s)?Gi:zt.current,c=s.contextTypes,p=(c=c!=null)?ks(r,u):Di),s=new s(o,p),r.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Yo,r.stateNode=s,s._reactInternals=r,c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=u,r.__reactInternalMemoizedMaskedChildContext=p),s}function Jd(r,s,o,c){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,c),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,c),s.state!==r&&Yo.enqueueReplaceState(s,s.state,null)}function rc(r,s,o,c){var u=r.stateNode;u.props=o,u.state=r.memoizedState,u.refs={},Wa(r);var p=s.contextType;typeof p=="object"&&p!==null?u.context=gr(p):(p=Qt(s)?Gi:zt.current,u.context=ks(r,p)),u.state=r.memoizedState,p=s.getDerivedStateFromProps,typeof p=="function"&&(tc(r,s,p,o),u.state=r.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(s=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),s!==u.state&&Yo.enqueueReplaceState(u,u.state,null),Ho(r,o,u,c),u.state=r.memoizedState),typeof u.componentDidMount=="function"&&(r.flags|=4194308)}function Ls(r,s){try{var o="",c=s;do o+=_e(c),c=c.return;while(c);var u=o}catch(p){u=`
39
+ Error generating stack: `+p.message+`
40
+ `+p.stack}return{value:r,source:s,stack:u,digest:null}}function ic(r,s,o){return{value:r,source:null,stack:o??null,digest:s??null}}function sc(r,s){try{console.error(s.value)}catch(o){setTimeout(function(){throw o})}}var hv=typeof WeakMap=="function"?WeakMap:Map;function Qd(r,s,o){o=di(-1,o),o.tag=3,o.payload={element:null};var c=s.value;return o.callback=function(){tl||(tl=!0,yc=c),sc(r,s)},o}function Zd(r,s,o){o=di(-1,o),o.tag=3;var c=r.type.getDerivedStateFromError;if(typeof c=="function"){var u=s.value;o.payload=function(){return c(u)},o.callback=function(){sc(r,s)}}var p=r.stateNode;return p!==null&&typeof p.componentDidCatch=="function"&&(o.callback=function(){sc(r,s),typeof c!="function"&&(Li===null?Li=new Set([this]):Li.add(this));var m=s.stack;this.componentDidCatch(s.value,{componentStack:m!==null?m:""})}),o}function ef(r,s,o){var c=r.pingCache;if(c===null){c=r.pingCache=new hv;var u=new Set;c.set(s,u)}else u=c.get(s),u===void 0&&(u=new Set,c.set(s,u));u.has(o)||(u.add(o),r=Cv.bind(null,r,s,o),s.then(r,r))}function tf(r){do{var s;if((s=r.tag===13)&&(s=r.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return r;r=r.return}while(r!==null);return null}function rf(r,s,o,c,u){return(r.mode&1)===0?(r===s?r.flags|=65536:(r.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(s=di(-1,1),s.tag=2,Ti(o,s,1))),o.lanes|=1),r):(r.flags|=65536,r.lanes=u,r)}var uv=P.ReactCurrentOwner,Zt=!1;function Kt(r,s,o,c){s.child=r===null?xd(s,null,o,c):Rs(s,r.child,o,c)}function sf(r,s,o,c,u){o=o.render;var p=s.ref;return Ts(s,u),c=Ga(r,s,o,c,p,u),o=Xa(),r!==null&&!Zt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~u,fi(r,s,u)):(Ke&&o&&Ma(s),s.flags|=1,Kt(r,s,c,u),s.child)}function nf(r,s,o,c,u){if(r===null){var p=o.type;return typeof p=="function"&&!Ec(p)&&p.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(s.tag=15,s.type=p,of(r,s,p,c,u)):(r=ll(o.type,null,c,s,s.mode,u),r.ref=s.ref,r.return=s,s.child=r)}if(p=r.child,(r.lanes&u)===0){var m=p.memoizedProps;if(o=o.compare,o=o!==null?o:un,o(m,c)&&r.ref===s.ref)return fi(r,s,u)}return s.flags|=1,r=Ai(p,c),r.ref=s.ref,r.return=s,s.child=r}function of(r,s,o,c,u){if(r!==null){var p=r.memoizedProps;if(un(p,c)&&r.ref===s.ref)if(Zt=!1,s.pendingProps=c=p,(r.lanes&u)!==0)(r.flags&131072)!==0&&(Zt=!0);else return s.lanes=r.lanes,fi(r,s,u)}return nc(r,s,o,c,u)}function lf(r,s,o){var c=s.pendingProps,u=c.children,p=r!==null?r.memoizedState:null;if(c.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},ze(Is,cr),cr|=o;else{if((o&1073741824)===0)return r=p!==null?p.baseLanes|o:o,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:r,cachePool:null,transitions:null},s.updateQueue=null,ze(Is,cr),cr|=r,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=p!==null?p.baseLanes:o,ze(Is,cr),cr|=c}else p!==null?(c=p.baseLanes|o,s.memoizedState=null):c=o,ze(Is,cr),cr|=c;return Kt(r,s,u,o),s.child}function af(r,s){var o=s.ref;(r===null&&o!==null||r!==null&&r.ref!==o)&&(s.flags|=512,s.flags|=2097152)}function nc(r,s,o,c,u){var p=Qt(o)?Gi:zt.current;return p=ks(s,p),Ts(s,u),o=Ga(r,s,o,c,p,u),c=Xa(),r!==null&&!Zt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~u,fi(r,s,u)):(Ke&&c&&Ma(s),s.flags|=1,Kt(r,s,o,u),s.child)}function cf(r,s,o,c,u){if(Qt(o)){var p=!0;Mo(s)}else p=!1;if(Ts(s,u),s.stateNode===null)Xo(r,s),Xd(s,o,c),rc(s,o,c,u),c=!0;else if(r===null){var m=s.stateNode,C=s.memoizedProps;m.props=C;var N=m.context,O=o.contextType;typeof O=="object"&&O!==null?O=gr(O):(O=Qt(o)?Gi:zt.current,O=ks(s,O));var V=o.getDerivedStateFromProps,Y=typeof V=="function"||typeof m.getSnapshotBeforeUpdate=="function";Y||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(C!==c||N!==O)&&Jd(s,m,c,O),Pi=!1;var K=s.memoizedState;m.state=K,Ho(s,c,m,u),N=s.memoizedState,C!==c||K!==N||Jt.current||Pi?(typeof V=="function"&&(tc(s,o,V,c),N=s.memoizedState),(C=Pi||Gd(s,o,C,c,K,N,O))?(Y||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(s.flags|=4194308)):(typeof m.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=c,s.memoizedState=N),m.props=c,m.state=N,m.context=O,c=C):(typeof m.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{m=s.stateNode,Cd(r,s),C=s.memoizedProps,O=s.type===s.elementType?C:Br(s.type,C),m.props=O,Y=s.pendingProps,K=m.context,N=o.contextType,typeof N=="object"&&N!==null?N=gr(N):(N=Qt(o)?Gi:zt.current,N=ks(s,N));var oe=o.getDerivedStateFromProps;(V=typeof oe=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(C!==Y||K!==N)&&Jd(s,m,c,N),Pi=!1,K=s.memoizedState,m.state=K,Ho(s,c,m,u);var he=s.memoizedState;C!==Y||K!==he||Jt.current||Pi?(typeof oe=="function"&&(tc(s,o,oe,c),he=s.memoizedState),(O=Pi||Gd(s,o,O,c,K,he,N)||!1)?(V||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(c,he,N),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(c,he,N)),typeof m.componentDidUpdate=="function"&&(s.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof m.componentDidUpdate!="function"||C===r.memoizedProps&&K===r.memoizedState||(s.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||C===r.memoizedProps&&K===r.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=he),m.props=c,m.state=he,m.context=N,c=O):(typeof m.componentDidUpdate!="function"||C===r.memoizedProps&&K===r.memoizedState||(s.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||C===r.memoizedProps&&K===r.memoizedState||(s.flags|=1024),c=!1)}return oc(r,s,o,c,p,u)}function oc(r,s,o,c,u,p){af(r,s);var m=(s.flags&128)!==0;if(!c&&!m)return u&&fd(s,o,!1),fi(r,s,p);c=s.stateNode,uv.current=s;var C=m&&typeof o.getDerivedStateFromError!="function"?null:c.render();return s.flags|=1,r!==null&&m?(s.child=Rs(s,r.child,null,p),s.child=Rs(s,null,C,p)):Kt(r,s,C,p),s.memoizedState=c.state,u&&fd(s,o,!0),s.child}function hf(r){var s=r.stateNode;s.pendingContext?ud(r,s.pendingContext,s.pendingContext!==s.context):s.context&&ud(r,s.context,!1),$a(r,s.containerInfo)}function uf(r,s,o,c,u){return Ds(),Oa(u),s.flags|=256,Kt(r,s,o,c),s.child}var lc={dehydrated:null,treeContext:null,retryLane:0};function ac(r){return{baseLanes:r,cachePool:null,transitions:null}}function df(r,s,o){var c=s.pendingProps,u=Ge.current,p=!1,m=(s.flags&128)!==0,C;if((C=m)||(C=r!==null&&r.memoizedState===null?!1:(u&2)!==0),C?(p=!0,s.flags&=-129):(r===null||r.memoizedState!==null)&&(u|=1),ze(Ge,u&1),r===null)return Ia(s),r=s.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((s.mode&1)===0?s.lanes=1:r.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(m=c.children,r=c.fallback,p?(c=s.mode,p=s.child,m={mode:"hidden",children:m},(c&1)===0&&p!==null?(p.childLanes=0,p.pendingProps=m):p=al(m,c,0,null),r=ns(r,c,o,null),p.return=s,r.return=s,p.sibling=r,s.child=p,s.child.memoizedState=ac(o),s.memoizedState=lc,r):cc(s,m));if(u=r.memoizedState,u!==null&&(C=u.dehydrated,C!==null))return dv(r,s,m,c,C,u,o);if(p){p=c.fallback,m=s.mode,u=r.child,C=u.sibling;var N={mode:"hidden",children:c.children};return(m&1)===0&&s.child!==u?(c=s.child,c.childLanes=0,c.pendingProps=N,s.deletions=null):(c=Ai(u,N),c.subtreeFlags=u.subtreeFlags&14680064),C!==null?p=Ai(C,p):(p=ns(p,m,o,null),p.flags|=2),p.return=s,c.return=s,c.sibling=p,s.child=c,c=p,p=s.child,m=r.child.memoizedState,m=m===null?ac(o):{baseLanes:m.baseLanes|o,cachePool:null,transitions:m.transitions},p.memoizedState=m,p.childLanes=r.childLanes&~o,s.memoizedState=lc,c}return p=r.child,r=p.sibling,c=Ai(p,{mode:"visible",children:c.children}),(s.mode&1)===0&&(c.lanes=o),c.return=s,c.sibling=null,r!==null&&(o=s.deletions,o===null?(s.deletions=[r],s.flags|=16):o.push(r)),s.child=c,s.memoizedState=null,c}function cc(r,s){return s=al({mode:"visible",children:s},r.mode,0,null),s.return=r,r.child=s}function Go(r,s,o,c){return c!==null&&Oa(c),Rs(s,r.child,null,o),r=cc(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function dv(r,s,o,c,u,p,m){if(o)return s.flags&256?(s.flags&=-257,c=ic(Error(i(422))),Go(r,s,m,c)):s.memoizedState!==null?(s.child=r.child,s.flags|=128,null):(p=c.fallback,u=s.mode,c=al({mode:"visible",children:c.children},u,0,null),p=ns(p,u,m,null),p.flags|=2,c.return=s,p.return=s,c.sibling=p,s.child=c,(s.mode&1)!==0&&Rs(s,r.child,null,m),s.child.memoizedState=ac(m),s.memoizedState=lc,p);if((s.mode&1)===0)return Go(r,s,m,null);if(u.data==="$!"){if(c=u.nextSibling&&u.nextSibling.dataset,c)var C=c.dgst;return c=C,p=Error(i(419)),c=ic(p,c,void 0),Go(r,s,m,c)}if(C=(m&r.childLanes)!==0,Zt||C){if(c=yt,c!==null){switch(m&-m){case 4:u=2;break;case 16:u=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:u=32;break;case 536870912:u=268435456;break;default:u=0}u=(u&(c.suspendedLanes|m))!==0?0:u,u!==0&&u!==p.retryLane&&(p.retryLane=u,ui(r,u),Ar(c,r,u,-1))}return kc(),c=ic(Error(i(421))),Go(r,s,m,c)}return u.data==="$?"?(s.flags|=128,s.child=r.child,s=kv.bind(null,r),u._reactRetry=s,null):(r=p.treeContext,ar=Ei(u.nextSibling),lr=s,Ke=!0,Lr=null,r!==null&&(pr[_r++]=ci,pr[_r++]=hi,pr[_r++]=Xi,ci=r.id,hi=r.overflow,Xi=s),s=cc(s,c.children),s.flags|=4096,s)}function ff(r,s,o){r.lanes|=s;var c=r.alternate;c!==null&&(c.lanes|=s),Fa(r.return,s,o)}function hc(r,s,o,c,u){var p=r.memoizedState;p===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:o,tailMode:u}:(p.isBackwards=s,p.rendering=null,p.renderingStartTime=0,p.last=c,p.tail=o,p.tailMode=u)}function pf(r,s,o){var c=s.pendingProps,u=c.revealOrder,p=c.tail;if(Kt(r,s,c.children,o),c=Ge.current,(c&2)!==0)c=c&1|2,s.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&ff(r,o,s);else if(r.tag===19)ff(r,o,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}c&=1}if(ze(Ge,c),(s.mode&1)===0)s.memoizedState=null;else switch(u){case"forwards":for(o=s.child,u=null;o!==null;)r=o.alternate,r!==null&&Wo(r)===null&&(u=o),o=o.sibling;o=u,o===null?(u=s.child,s.child=null):(u=o.sibling,o.sibling=null),hc(s,!1,u,o,p);break;case"backwards":for(o=null,u=s.child,s.child=null;u!==null;){if(r=u.alternate,r!==null&&Wo(r)===null){s.child=u;break}r=u.sibling,u.sibling=o,o=u,u=r}hc(s,!0,o,null,p);break;case"together":hc(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Xo(r,s){(s.mode&1)===0&&r!==null&&(r.alternate=null,s.alternate=null,s.flags|=2)}function fi(r,s,o){if(r!==null&&(s.dependencies=r.dependencies),ts|=s.lanes,(o&s.childLanes)===0)return null;if(r!==null&&s.child!==r.child)throw Error(i(153));if(s.child!==null){for(r=s.child,o=Ai(r,r.pendingProps),s.child=o,o.return=s;r.sibling!==null;)r=r.sibling,o=o.sibling=Ai(r,r.pendingProps),o.return=s;o.sibling=null}return s.child}function fv(r,s,o){switch(s.tag){case 3:hf(s),Ds();break;case 5:Nd(s);break;case 1:Qt(s.type)&&Mo(s);break;case 4:$a(s,s.stateNode.containerInfo);break;case 10:var c=s.type._context,u=s.memoizedProps.value;ze(jo,c._currentValue),c._currentValue=u;break;case 13:if(c=s.memoizedState,c!==null)return c.dehydrated!==null?(ze(Ge,Ge.current&1),s.flags|=128,null):(o&s.child.childLanes)!==0?df(r,s,o):(ze(Ge,Ge.current&1),r=fi(r,s,o),r!==null?r.sibling:null);ze(Ge,Ge.current&1);break;case 19:if(c=(o&s.childLanes)!==0,(r.flags&128)!==0){if(c)return pf(r,s,o);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ze(Ge,Ge.current),c)break;return null;case 22:case 23:return s.lanes=0,lf(r,s,o)}return fi(r,s,o)}var _f,uc,gf,mf;_f=function(r,s){for(var o=s.child;o!==null;){if(o.tag===5||o.tag===6)r.appendChild(o.stateNode);else if(o.tag!==4&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},uc=function(){},gf=function(r,s,o,c){var u=r.memoizedProps;if(u!==c){r=s.stateNode,Zi(qr.current);var p=null;switch(o){case"input":u=nt(r,u),c=nt(r,c),p=[];break;case"select":u=J({},u,{value:void 0}),c=J({},c,{value:void 0}),p=[];break;case"textarea":u=ge(r,u),c=ge(r,c),p=[];break;default:typeof u.onClick!="function"&&typeof c.onClick=="function"&&(r.onclick=Ro)}ps(o,c);var m;o=null;for(O in u)if(!c.hasOwnProperty(O)&&u.hasOwnProperty(O)&&u[O]!=null)if(O==="style"){var C=u[O];for(m in C)C.hasOwnProperty(m)&&(o||(o={}),o[m]="")}else O!=="dangerouslySetInnerHTML"&&O!=="children"&&O!=="suppressContentEditableWarning"&&O!=="suppressHydrationWarning"&&O!=="autoFocus"&&(l.hasOwnProperty(O)?p||(p=[]):(p=p||[]).push(O,null));for(O in c){var N=c[O];if(C=u!=null?u[O]:void 0,c.hasOwnProperty(O)&&N!==C&&(N!=null||C!=null))if(O==="style")if(C){for(m in C)!C.hasOwnProperty(m)||N&&N.hasOwnProperty(m)||(o||(o={}),o[m]="");for(m in N)N.hasOwnProperty(m)&&C[m]!==N[m]&&(o||(o={}),o[m]=N[m])}else o||(p||(p=[]),p.push(O,o)),o=N;else O==="dangerouslySetInnerHTML"?(N=N?N.__html:void 0,C=C?C.__html:void 0,N!=null&&C!==N&&(p=p||[]).push(O,N)):O==="children"?typeof N!="string"&&typeof N!="number"||(p=p||[]).push(O,""+N):O!=="suppressContentEditableWarning"&&O!=="suppressHydrationWarning"&&(l.hasOwnProperty(O)?(N!=null&&O==="onScroll"&&We("scroll",r),p||C===N||(p=[])):(p=p||[]).push(O,N))}o&&(p=p||[]).push("style",o);var O=p;(s.updateQueue=O)&&(s.flags|=4)}},mf=function(r,s,o,c){o!==c&&(s.flags|=4)};function En(r,s){if(!Ke)switch(r.tailMode){case"hidden":s=r.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?r.tail=null:o.sibling=null;break;case"collapsed":o=r.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:c.sibling=null}}function Ht(r){var s=r.alternate!==null&&r.alternate.child===r.child,o=0,c=0;if(s)for(var u=r.child;u!==null;)o|=u.lanes|u.childLanes,c|=u.subtreeFlags&14680064,c|=u.flags&14680064,u.return=r,u=u.sibling;else for(u=r.child;u!==null;)o|=u.lanes|u.childLanes,c|=u.subtreeFlags,c|=u.flags,u.return=r,u=u.sibling;return r.subtreeFlags|=c,r.childLanes=o,s}function pv(r,s,o){var c=s.pendingProps;switch(La(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ht(s),null;case 1:return Qt(s.type)&&To(),Ht(s),null;case 3:return c=s.stateNode,Ms(),$e(Jt),$e(zt),Va(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(Oo(s)?s.flags|=4:r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Lr!==null&&(xc(Lr),Lr=null))),uc(r,s),Ht(s),null;case 5:Ua(s);var u=Zi(wn.current);if(o=s.type,r!==null&&s.stateNode!=null)gf(r,s,o,c,u),r.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!c){if(s.stateNode===null)throw Error(i(166));return Ht(s),null}if(r=Zi(qr.current),Oo(s)){c=s.stateNode,o=s.type;var p=s.memoizedProps;switch(c[Vr]=s,c[gn]=p,r=(s.mode&1)!==0,o){case"dialog":We("cancel",c),We("close",c);break;case"iframe":case"object":case"embed":We("load",c);break;case"video":case"audio":for(u=0;u<fn.length;u++)We(fn[u],c);break;case"source":We("error",c);break;case"img":case"image":case"link":We("error",c),We("load",c);break;case"details":We("toggle",c);break;case"input":dr(c,p),We("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!p.multiple},We("invalid",c);break;case"textarea":xe(c,p),We("invalid",c)}ps(o,p),u=null;for(var m in p)if(p.hasOwnProperty(m)){var C=p[m];m==="children"?typeof C=="string"?c.textContent!==C&&(p.suppressHydrationWarning!==!0&&Do(c.textContent,C,r),u=["children",C]):typeof C=="number"&&c.textContent!==""+C&&(p.suppressHydrationWarning!==!0&&Do(c.textContent,C,r),u=["children",""+C]):l.hasOwnProperty(m)&&C!=null&&m==="onScroll"&&We("scroll",c)}switch(o){case"input":gt(c),Hr(c,p,!0);break;case"textarea":gt(c),Be(c);break;case"select":case"option":break;default:typeof p.onClick=="function"&&(c.onclick=Ro)}c=u,s.updateQueue=c,c!==null&&(s.flags|=4)}else{m=u.nodeType===9?u:u.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=He(o)),r==="http://www.w3.org/1999/xhtml"?o==="script"?(r=m.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof c.is=="string"?r=m.createElement(o,{is:c.is}):(r=m.createElement(o),o==="select"&&(m=r,c.multiple?m.multiple=!0:c.size&&(m.size=c.size))):r=m.createElementNS(r,o),r[Vr]=s,r[gn]=c,_f(r,s,!1,!1),s.stateNode=r;e:{switch(m=Ys(o,c),o){case"dialog":We("cancel",r),We("close",r),u=c;break;case"iframe":case"object":case"embed":We("load",r),u=c;break;case"video":case"audio":for(u=0;u<fn.length;u++)We(fn[u],r);u=c;break;case"source":We("error",r),u=c;break;case"img":case"image":case"link":We("error",r),We("load",r),u=c;break;case"details":We("toggle",r),u=c;break;case"input":dr(r,c),u=nt(r,c),We("invalid",r);break;case"option":u=c;break;case"select":r._wrapperState={wasMultiple:!!c.multiple},u=J({},c,{value:void 0}),We("invalid",r);break;case"textarea":xe(r,c),u=ge(r,c),We("invalid",r);break;default:u=c}ps(o,u),C=u;for(p in C)if(C.hasOwnProperty(p)){var N=C[p];p==="style"?$r(r,N):p==="dangerouslySetInnerHTML"?(N=N?N.__html:void 0,N!=null&&Wr(r,N)):p==="children"?typeof N=="string"?(o!=="textarea"||N!=="")&&Nr(r,N):typeof N=="number"&&Nr(r,""+N):p!=="suppressContentEditableWarning"&&p!=="suppressHydrationWarning"&&p!=="autoFocus"&&(l.hasOwnProperty(p)?N!=null&&p==="onScroll"&&We("scroll",r):N!=null&&W(r,p,N,m))}switch(o){case"input":gt(r),Hr(r,c,!1);break;case"textarea":gt(r),Be(r);break;case"option":c.value!=null&&r.setAttribute("value",""+ke(c.value));break;case"select":r.multiple=!!c.multiple,p=c.value,p!=null?H(r,!!c.multiple,p,!1):c.defaultValue!=null&&H(r,!!c.multiple,c.defaultValue,!0);break;default:typeof u.onClick=="function"&&(r.onclick=Ro)}switch(o){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Ht(s),null;case 6:if(r&&s.stateNode!=null)mf(r,s,r.memoizedProps,c);else{if(typeof c!="string"&&s.stateNode===null)throw Error(i(166));if(o=Zi(wn.current),Zi(qr.current),Oo(s)){if(c=s.stateNode,o=s.memoizedProps,c[Vr]=s,(p=c.nodeValue!==o)&&(r=lr,r!==null))switch(r.tag){case 3:Do(c.nodeValue,o,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&Do(c.nodeValue,o,(r.mode&1)!==0)}p&&(s.flags|=4)}else c=(o.nodeType===9?o:o.ownerDocument).createTextNode(c),c[Vr]=s,s.stateNode=c}return Ht(s),null;case 13:if($e(Ge),c=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(Ke&&ar!==null&&(s.mode&1)!==0&&(s.flags&128)===0)yd(),Ds(),s.flags|=98560,p=!1;else if(p=Oo(s),c!==null&&c.dehydrated!==null){if(r===null){if(!p)throw Error(i(318));if(p=s.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(i(317));p[Vr]=s}else Ds(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ht(s),p=!1}else Lr!==null&&(xc(Lr),Lr=null),p=!0;if(!p)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=o,s):(c=c!==null,c!==(r!==null&&r.memoizedState!==null)&&c&&(s.child.flags|=8192,(s.mode&1)!==0&&(r===null||(Ge.current&1)!==0?ht===0&&(ht=3):kc())),s.updateQueue!==null&&(s.flags|=4),Ht(s),null);case 4:return Ms(),uc(r,s),r===null&&pn(s.stateNode.containerInfo),Ht(s),null;case 10:return za(s.type._context),Ht(s),null;case 17:return Qt(s.type)&&To(),Ht(s),null;case 19:if($e(Ge),p=s.memoizedState,p===null)return Ht(s),null;if(c=(s.flags&128)!==0,m=p.rendering,m===null)if(c)En(p,!1);else{if(ht!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(m=Wo(r),m!==null){for(s.flags|=128,En(p,!1),c=m.updateQueue,c!==null&&(s.updateQueue=c,s.flags|=4),s.subtreeFlags=0,c=o,o=s.child;o!==null;)p=o,r=c,p.flags&=14680066,m=p.alternate,m===null?(p.childLanes=0,p.lanes=r,p.child=null,p.subtreeFlags=0,p.memoizedProps=null,p.memoizedState=null,p.updateQueue=null,p.dependencies=null,p.stateNode=null):(p.childLanes=m.childLanes,p.lanes=m.lanes,p.child=m.child,p.subtreeFlags=0,p.deletions=null,p.memoizedProps=m.memoizedProps,p.memoizedState=m.memoizedState,p.updateQueue=m.updateQueue,p.type=m.type,r=m.dependencies,p.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),o=o.sibling;return ze(Ge,Ge.current&1|2),s.child}r=r.sibling}p.tail!==null&&rt()>Os&&(s.flags|=128,c=!0,En(p,!1),s.lanes=4194304)}else{if(!c)if(r=Wo(m),r!==null){if(s.flags|=128,c=!0,o=r.updateQueue,o!==null&&(s.updateQueue=o,s.flags|=4),En(p,!0),p.tail===null&&p.tailMode==="hidden"&&!m.alternate&&!Ke)return Ht(s),null}else 2*rt()-p.renderingStartTime>Os&&o!==1073741824&&(s.flags|=128,c=!0,En(p,!1),s.lanes=4194304);p.isBackwards?(m.sibling=s.child,s.child=m):(o=p.last,o!==null?o.sibling=m:s.child=m,p.last=m)}return p.tail!==null?(s=p.tail,p.rendering=s,p.tail=s.sibling,p.renderingStartTime=rt(),s.sibling=null,o=Ge.current,ze(Ge,c?o&1|2:o&1),s):(Ht(s),null);case 22:case 23:return Cc(),c=s.memoizedState!==null,r!==null&&r.memoizedState!==null!==c&&(s.flags|=8192),c&&(s.mode&1)!==0?(cr&1073741824)!==0&&(Ht(s),s.subtreeFlags&6&&(s.flags|=8192)):Ht(s),null;case 24:return null;case 25:return null}throw Error(i(156,s.tag))}function _v(r,s){switch(La(s),s.tag){case 1:return Qt(s.type)&&To(),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return Ms(),$e(Jt),$e(zt),Va(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 5:return Ua(s),null;case 13:if($e(Ge),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Ds()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return $e(Ge),null;case 4:return Ms(),null;case 10:return za(s.type._context),null;case 22:case 23:return Cc(),null;case 24:return null;default:return null}}var Jo=!1,Wt=!1,gv=typeof WeakSet=="function"?WeakSet:Set,ce=null;function Bs(r,s){var o=r.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(c){Ze(r,s,c)}else o.current=null}function dc(r,s,o){try{o()}catch(c){Ze(r,s,c)}}var vf=!1;function mv(r,s){if(Ca=mo,r=Gu(),ga(r)){if("selectionStart"in r)var o={start:r.selectionStart,end:r.selectionEnd};else e:{o=(o=r.ownerDocument)&&o.defaultView||window;var c=o.getSelection&&o.getSelection();if(c&&c.rangeCount!==0){o=c.anchorNode;var u=c.anchorOffset,p=c.focusNode;c=c.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var m=0,C=-1,N=-1,O=0,V=0,Y=r,K=null;t:for(;;){for(var oe;Y!==o||u!==0&&Y.nodeType!==3||(C=m+u),Y!==p||c!==0&&Y.nodeType!==3||(N=m+c),Y.nodeType===3&&(m+=Y.nodeValue.length),(oe=Y.firstChild)!==null;)K=Y,Y=oe;for(;;){if(Y===r)break t;if(K===o&&++O===u&&(C=m),K===p&&++V===c&&(N=m),(oe=Y.nextSibling)!==null)break;Y=K,K=Y.parentNode}Y=oe}o=C===-1||N===-1?null:{start:C,end:N}}else o=null}o=o||{start:0,end:0}}else o=null;for(ka={focusedElem:r,selectionRange:o},mo=!1,ce=s;ce!==null;)if(s=ce,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,ce=r;else for(;ce!==null;){s=ce;try{var he=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(he!==null){var de=he.memoizedProps,it=he.memoizedState,T=s.stateNode,D=T.getSnapshotBeforeUpdate(s.elementType===s.type?de:Br(s.type,de),it);T.__reactInternalSnapshotBeforeUpdate=D}break;case 3:var L=s.stateNode.containerInfo;L.nodeType===1?L.textContent="":L.nodeType===9&&L.documentElement&&L.removeChild(L.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(Z){Ze(s,s.return,Z)}if(r=s.sibling,r!==null){r.return=s.return,ce=r;break}ce=s.return}return he=vf,vf=!1,he}function Nn(r,s,o){var c=s.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var u=c=c.next;do{if((u.tag&r)===r){var p=u.destroy;u.destroy=void 0,p!==void 0&&dc(s,o,p)}u=u.next}while(u!==c)}}function Qo(r,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var o=s=s.next;do{if((o.tag&r)===r){var c=o.create;o.destroy=c()}o=o.next}while(o!==s)}}function fc(r){var s=r.ref;if(s!==null){var o=r.stateNode;switch(r.tag){case 5:r=o;break;default:r=o}typeof s=="function"?s(r):s.current=r}}function yf(r){var s=r.alternate;s!==null&&(r.alternate=null,yf(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&(delete s[Vr],delete s[gn],delete s[Ra],delete s[Zm],delete s[ev])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Sf(r){return r.tag===5||r.tag===3||r.tag===4}function wf(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Sf(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function pc(r,s,o){var c=r.tag;if(c===5||c===6)r=r.stateNode,s?o.nodeType===8?o.parentNode.insertBefore(r,s):o.insertBefore(r,s):(o.nodeType===8?(s=o.parentNode,s.insertBefore(r,o)):(s=o,s.appendChild(r)),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=Ro));else if(c!==4&&(r=r.child,r!==null))for(pc(r,s,o),r=r.sibling;r!==null;)pc(r,s,o),r=r.sibling}function _c(r,s,o){var c=r.tag;if(c===5||c===6)r=r.stateNode,s?o.insertBefore(r,s):o.appendChild(r);else if(c!==4&&(r=r.child,r!==null))for(_c(r,s,o),r=r.sibling;r!==null;)_c(r,s,o),r=r.sibling}var Pt=null,Ir=!1;function Mi(r,s,o){for(o=o.child;o!==null;)xf(r,s,o),o=o.sibling}function xf(r,s,o){if(Kr&&typeof Kr.onCommitFiberUnmount=="function")try{Kr.onCommitFiberUnmount(ho,o)}catch{}switch(o.tag){case 5:Wt||Bs(o,s);case 6:var c=Pt,u=Ir;Pt=null,Mi(r,s,o),Pt=c,Ir=u,Pt!==null&&(Ir?(r=Pt,o=o.stateNode,r.nodeType===8?r.parentNode.removeChild(o):r.removeChild(o)):Pt.removeChild(o.stateNode));break;case 18:Pt!==null&&(Ir?(r=Pt,o=o.stateNode,r.nodeType===8?Da(r.parentNode,o):r.nodeType===1&&Da(r,o),nn(r)):Da(Pt,o.stateNode));break;case 4:c=Pt,u=Ir,Pt=o.stateNode.containerInfo,Ir=!0,Mi(r,s,o),Pt=c,Ir=u;break;case 0:case 11:case 14:case 15:if(!Wt&&(c=o.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){u=c=c.next;do{var p=u,m=p.destroy;p=p.tag,m!==void 0&&((p&2)!==0||(p&4)!==0)&&dc(o,s,m),u=u.next}while(u!==c)}Mi(r,s,o);break;case 1:if(!Wt&&(Bs(o,s),c=o.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=o.memoizedProps,c.state=o.memoizedState,c.componentWillUnmount()}catch(C){Ze(o,s,C)}Mi(r,s,o);break;case 21:Mi(r,s,o);break;case 22:o.mode&1?(Wt=(c=Wt)||o.memoizedState!==null,Mi(r,s,o),Wt=c):Mi(r,s,o);break;default:Mi(r,s,o)}}function bf(r){var s=r.updateQueue;if(s!==null){r.updateQueue=null;var o=r.stateNode;o===null&&(o=r.stateNode=new gv),s.forEach(function(c){var u=Ev.bind(null,r,c);o.has(c)||(o.add(c),c.then(u,u))})}}function Or(r,s){var o=s.deletions;if(o!==null)for(var c=0;c<o.length;c++){var u=o[c];try{var p=r,m=s,C=m;e:for(;C!==null;){switch(C.tag){case 5:Pt=C.stateNode,Ir=!1;break e;case 3:Pt=C.stateNode.containerInfo,Ir=!0;break e;case 4:Pt=C.stateNode.containerInfo,Ir=!0;break e}C=C.return}if(Pt===null)throw Error(i(160));xf(p,m,u),Pt=null,Ir=!1;var N=u.alternate;N!==null&&(N.return=null),u.return=null}catch(O){Ze(u,s,O)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Cf(s,r),s=s.sibling}function Cf(r,s){var o=r.alternate,c=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Or(s,r),Gr(r),c&4){try{Nn(3,r,r.return),Qo(3,r)}catch(de){Ze(r,r.return,de)}try{Nn(5,r,r.return)}catch(de){Ze(r,r.return,de)}}break;case 1:Or(s,r),Gr(r),c&512&&o!==null&&Bs(o,o.return);break;case 5:if(Or(s,r),Gr(r),c&512&&o!==null&&Bs(o,o.return),r.flags&32){var u=r.stateNode;try{Nr(u,"")}catch(de){Ze(r,r.return,de)}}if(c&4&&(u=r.stateNode,u!=null)){var p=r.memoizedProps,m=o!==null?o.memoizedProps:p,C=r.type,N=r.updateQueue;if(r.updateQueue=null,N!==null)try{C==="input"&&p.type==="radio"&&p.name!=null&&Er(u,p),Ys(C,m);var O=Ys(C,p);for(m=0;m<N.length;m+=2){var V=N[m],Y=N[m+1];V==="style"?$r(u,Y):V==="dangerouslySetInnerHTML"?Wr(u,Y):V==="children"?Nr(u,Y):W(u,V,Y,O)}switch(C){case"input":Fr(u,p);break;case"textarea":me(u,p);break;case"select":var K=u._wrapperState.wasMultiple;u._wrapperState.wasMultiple=!!p.multiple;var oe=p.value;oe!=null?H(u,!!p.multiple,oe,!1):K!==!!p.multiple&&(p.defaultValue!=null?H(u,!!p.multiple,p.defaultValue,!0):H(u,!!p.multiple,p.multiple?[]:"",!1))}u[gn]=p}catch(de){Ze(r,r.return,de)}}break;case 6:if(Or(s,r),Gr(r),c&4){if(r.stateNode===null)throw Error(i(162));u=r.stateNode,p=r.memoizedProps;try{u.nodeValue=p}catch(de){Ze(r,r.return,de)}}break;case 3:if(Or(s,r),Gr(r),c&4&&o!==null&&o.memoizedState.isDehydrated)try{nn(s.containerInfo)}catch(de){Ze(r,r.return,de)}break;case 4:Or(s,r),Gr(r);break;case 13:Or(s,r),Gr(r),u=r.child,u.flags&8192&&(p=u.memoizedState!==null,u.stateNode.isHidden=p,!p||u.alternate!==null&&u.alternate.memoizedState!==null||(vc=rt())),c&4&&bf(r);break;case 22:if(V=o!==null&&o.memoizedState!==null,r.mode&1?(Wt=(O=Wt)||V,Or(s,r),Wt=O):Or(s,r),Gr(r),c&8192){if(O=r.memoizedState!==null,(r.stateNode.isHidden=O)&&!V&&(r.mode&1)!==0)for(ce=r,V=r.child;V!==null;){for(Y=ce=V;ce!==null;){switch(K=ce,oe=K.child,K.tag){case 0:case 11:case 14:case 15:Nn(4,K,K.return);break;case 1:Bs(K,K.return);var he=K.stateNode;if(typeof he.componentWillUnmount=="function"){c=K,o=K.return;try{s=c,he.props=s.memoizedProps,he.state=s.memoizedState,he.componentWillUnmount()}catch(de){Ze(c,o,de)}}break;case 5:Bs(K,K.return);break;case 22:if(K.memoizedState!==null){Nf(Y);continue}}oe!==null?(oe.return=K,ce=oe):Nf(Y)}V=V.sibling}e:for(V=null,Y=r;;){if(Y.tag===5){if(V===null){V=Y;try{u=Y.stateNode,O?(p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none"):(C=Y.stateNode,N=Y.memoizedProps.style,m=N!=null&&N.hasOwnProperty("display")?N.display:null,C.style.display=si("display",m))}catch(de){Ze(r,r.return,de)}}}else if(Y.tag===6){if(V===null)try{Y.stateNode.nodeValue=O?"":Y.memoizedProps}catch(de){Ze(r,r.return,de)}}else if((Y.tag!==22&&Y.tag!==23||Y.memoizedState===null||Y===r)&&Y.child!==null){Y.child.return=Y,Y=Y.child;continue}if(Y===r)break e;for(;Y.sibling===null;){if(Y.return===null||Y.return===r)break e;V===Y&&(V=null),Y=Y.return}V===Y&&(V=null),Y.sibling.return=Y.return,Y=Y.sibling}}break;case 19:Or(s,r),Gr(r),c&4&&bf(r);break;case 21:break;default:Or(s,r),Gr(r)}}function Gr(r){var s=r.flags;if(s&2){try{e:{for(var o=r.return;o!==null;){if(Sf(o)){var c=o;break e}o=o.return}throw Error(i(160))}switch(c.tag){case 5:var u=c.stateNode;c.flags&32&&(Nr(u,""),c.flags&=-33);var p=wf(r);_c(r,p,u);break;case 3:case 4:var m=c.stateNode.containerInfo,C=wf(r);pc(r,C,m);break;default:throw Error(i(161))}}catch(N){Ze(r,r.return,N)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function vv(r,s,o){ce=r,kf(r)}function kf(r,s,o){for(var c=(r.mode&1)!==0;ce!==null;){var u=ce,p=u.child;if(u.tag===22&&c){var m=u.memoizedState!==null||Jo;if(!m){var C=u.alternate,N=C!==null&&C.memoizedState!==null||Wt;C=Jo;var O=Wt;if(Jo=m,(Wt=N)&&!O)for(ce=u;ce!==null;)m=ce,N=m.child,m.tag===22&&m.memoizedState!==null?Df(u):N!==null?(N.return=m,ce=N):Df(u);for(;p!==null;)ce=p,kf(p),p=p.sibling;ce=u,Jo=C,Wt=O}Ef(r)}else(u.subtreeFlags&8772)!==0&&p!==null?(p.return=u,ce=p):Ef(r)}}function Ef(r){for(;ce!==null;){var s=ce;if((s.flags&8772)!==0){var o=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Wt||Qo(5,s);break;case 1:var c=s.stateNode;if(s.flags&4&&!Wt)if(o===null)c.componentDidMount();else{var u=s.elementType===s.type?o.memoizedProps:Br(s.type,o.memoizedProps);c.componentDidUpdate(u,o.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var p=s.updateQueue;p!==null&&Ed(s,p,c);break;case 3:var m=s.updateQueue;if(m!==null){if(o=null,s.child!==null)switch(s.child.tag){case 5:o=s.child.stateNode;break;case 1:o=s.child.stateNode}Ed(s,m,o)}break;case 5:var C=s.stateNode;if(o===null&&s.flags&4){o=C;var N=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":N.autoFocus&&o.focus();break;case"img":N.src&&(o.src=N.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var O=s.alternate;if(O!==null){var V=O.memoizedState;if(V!==null){var Y=V.dehydrated;Y!==null&&nn(Y)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(i(163))}Wt||s.flags&512&&fc(s)}catch(K){Ze(s,s.return,K)}}if(s===r){ce=null;break}if(o=s.sibling,o!==null){o.return=s.return,ce=o;break}ce=s.return}}function Nf(r){for(;ce!==null;){var s=ce;if(s===r){ce=null;break}var o=s.sibling;if(o!==null){o.return=s.return,ce=o;break}ce=s.return}}function Df(r){for(;ce!==null;){var s=ce;try{switch(s.tag){case 0:case 11:case 15:var o=s.return;try{Qo(4,s)}catch(N){Ze(s,o,N)}break;case 1:var c=s.stateNode;if(typeof c.componentDidMount=="function"){var u=s.return;try{c.componentDidMount()}catch(N){Ze(s,u,N)}}var p=s.return;try{fc(s)}catch(N){Ze(s,p,N)}break;case 5:var m=s.return;try{fc(s)}catch(N){Ze(s,m,N)}}}catch(N){Ze(s,s.return,N)}if(s===r){ce=null;break}var C=s.sibling;if(C!==null){C.return=s.return,ce=C;break}ce=s.return}}var yv=Math.ceil,Zo=P.ReactCurrentDispatcher,gc=P.ReactCurrentOwner,vr=P.ReactCurrentBatchConfig,Me=0,yt=null,ot=null,Tt=0,cr=0,Is=Ni(0),ht=0,Dn=null,ts=0,el=0,mc=0,Rn=null,er=null,vc=0,Os=1/0,pi=null,tl=!1,yc=null,Li=null,rl=!1,Bi=null,il=0,Pn=0,Sc=null,sl=-1,nl=0;function Vt(){return(Me&6)!==0?rt():sl!==-1?sl:sl=rt()}function Ii(r){return(r.mode&1)===0?1:(Me&2)!==0&&Tt!==0?Tt&-Tt:rv.transition!==null?(nl===0&&(nl=Su()),nl):(r=Ae,r!==0||(r=window.event,r=r===void 0?16:Ru(r.type)),r)}function Ar(r,s,o,c){if(50<Pn)throw Pn=0,Sc=null,Error(i(185));Zs(r,o,c),((Me&2)===0||r!==yt)&&(r===yt&&((Me&2)===0&&(el|=o),ht===4&&Oi(r,Tt)),tr(r,c),o===1&&Me===0&&(s.mode&1)===0&&(Os=rt()+500,Lo&&Ri()))}function tr(r,s){var o=r.callbackNode;rm(r,s);var c=po(r,r===yt?Tt:0);if(c===0)o!==null&&mu(o),r.callbackNode=null,r.callbackPriority=0;else if(s=c&-c,r.callbackPriority!==s){if(o!=null&&mu(o),s===1)r.tag===0?tv(Pf.bind(null,r)):pd(Pf.bind(null,r)),Jm(function(){(Me&6)===0&&Ri()}),o=null;else{switch(wu(c)){case 1:o=Zl;break;case 4:o=vu;break;case 16:o=co;break;case 536870912:o=yu;break;default:o=co}o=jf(o,Rf.bind(null,r))}r.callbackPriority=s,r.callbackNode=o}}function Rf(r,s){if(sl=-1,nl=0,(Me&6)!==0)throw Error(i(327));var o=r.callbackNode;if(As()&&r.callbackNode!==o)return null;var c=po(r,r===yt?Tt:0);if(c===0)return null;if((c&30)!==0||(c&r.expiredLanes)!==0||s)s=ol(r,c);else{s=c;var u=Me;Me|=2;var p=Mf();(yt!==r||Tt!==s)&&(pi=null,Os=rt()+500,is(r,s));do try{xv();break}catch(C){Tf(r,C)}while(!0);ja(),Zo.current=p,Me=u,ot!==null?s=0:(yt=null,Tt=0,s=ht)}if(s!==0){if(s===2&&(u=ea(r),u!==0&&(c=u,s=wc(r,u))),s===1)throw o=Dn,is(r,0),Oi(r,c),tr(r,rt()),o;if(s===6)Oi(r,c);else{if(u=r.current.alternate,(c&30)===0&&!Sv(u)&&(s=ol(r,c),s===2&&(p=ea(r),p!==0&&(c=p,s=wc(r,p))),s===1))throw o=Dn,is(r,0),Oi(r,c),tr(r,rt()),o;switch(r.finishedWork=u,r.finishedLanes=c,s){case 0:case 1:throw Error(i(345));case 2:ss(r,er,pi);break;case 3:if(Oi(r,c),(c&130023424)===c&&(s=vc+500-rt(),10<s)){if(po(r,0)!==0)break;if(u=r.suspendedLanes,(u&c)!==c){Vt(),r.pingedLanes|=r.suspendedLanes&u;break}r.timeoutHandle=Na(ss.bind(null,r,er,pi),s);break}ss(r,er,pi);break;case 4:if(Oi(r,c),(c&4194240)===c)break;for(s=r.eventTimes,u=-1;0<c;){var m=31-Tr(c);p=1<<m,m=s[m],m>u&&(u=m),c&=~p}if(c=u,c=rt()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*yv(c/1960))-c,10<c){r.timeoutHandle=Na(ss.bind(null,r,er,pi),c);break}ss(r,er,pi);break;case 5:ss(r,er,pi);break;default:throw Error(i(329))}}}return tr(r,rt()),r.callbackNode===o?Rf.bind(null,r):null}function wc(r,s){var o=Rn;return r.current.memoizedState.isDehydrated&&(is(r,s).flags|=256),r=ol(r,s),r!==2&&(s=er,er=o,s!==null&&xc(s)),r}function xc(r){er===null?er=r:er.push.apply(er,r)}function Sv(r){for(var s=r;;){if(s.flags&16384){var o=s.updateQueue;if(o!==null&&(o=o.stores,o!==null))for(var c=0;c<o.length;c++){var u=o[c],p=u.getSnapshot;u=u.value;try{if(!Mr(p(),u))return!1}catch{return!1}}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Oi(r,s){for(s&=~mc,s&=~el,r.suspendedLanes|=s,r.pingedLanes&=~s,r=r.expirationTimes;0<s;){var o=31-Tr(s),c=1<<o;r[o]=-1,s&=~c}}function Pf(r){if((Me&6)!==0)throw Error(i(327));As();var s=po(r,0);if((s&1)===0)return tr(r,rt()),null;var o=ol(r,s);if(r.tag!==0&&o===2){var c=ea(r);c!==0&&(s=c,o=wc(r,c))}if(o===1)throw o=Dn,is(r,0),Oi(r,s),tr(r,rt()),o;if(o===6)throw Error(i(345));return r.finishedWork=r.current.alternate,r.finishedLanes=s,ss(r,er,pi),tr(r,rt()),null}function bc(r,s){var o=Me;Me|=1;try{return r(s)}finally{Me=o,Me===0&&(Os=rt()+500,Lo&&Ri())}}function rs(r){Bi!==null&&Bi.tag===0&&(Me&6)===0&&As();var s=Me;Me|=1;var o=vr.transition,c=Ae;try{if(vr.transition=null,Ae=1,r)return r()}finally{Ae=c,vr.transition=o,Me=s,(Me&6)===0&&Ri()}}function Cc(){cr=Is.current,$e(Is)}function is(r,s){r.finishedWork=null,r.finishedLanes=0;var o=r.timeoutHandle;if(o!==-1&&(r.timeoutHandle=-1,Xm(o)),ot!==null)for(o=ot.return;o!==null;){var c=o;switch(La(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&To();break;case 3:Ms(),$e(Jt),$e(zt),Va();break;case 5:Ua(c);break;case 4:Ms();break;case 13:$e(Ge);break;case 19:$e(Ge);break;case 10:za(c.type._context);break;case 22:case 23:Cc()}o=o.return}if(yt=r,ot=r=Ai(r.current,null),Tt=cr=s,ht=0,Dn=null,mc=el=ts=0,er=Rn=null,Qi!==null){for(s=0;s<Qi.length;s++)if(o=Qi[s],c=o.interleaved,c!==null){o.interleaved=null;var u=c.next,p=o.pending;if(p!==null){var m=p.next;p.next=u,c.next=m}o.pending=c}Qi=null}return r}function Tf(r,s){do{var o=ot;try{if(ja(),$o.current=qo,Uo){for(var c=Xe.memoizedState;c!==null;){var u=c.queue;u!==null&&(u.pending=null),c=c.next}Uo=!1}if(es=0,vt=ct=Xe=null,xn=!1,bn=0,gc.current=null,o===null||o.return===null){ht=1,Dn=s,ot=null;break}e:{var p=r,m=o.return,C=o,N=s;if(s=Tt,C.flags|=32768,N!==null&&typeof N=="object"&&typeof N.then=="function"){var O=N,V=C,Y=V.tag;if((V.mode&1)===0&&(Y===0||Y===11||Y===15)){var K=V.alternate;K?(V.updateQueue=K.updateQueue,V.memoizedState=K.memoizedState,V.lanes=K.lanes):(V.updateQueue=null,V.memoizedState=null)}var oe=tf(m);if(oe!==null){oe.flags&=-257,rf(oe,m,C,p,s),oe.mode&1&&ef(p,O,s),s=oe,N=O;var he=s.updateQueue;if(he===null){var de=new Set;de.add(N),s.updateQueue=de}else he.add(N);break e}else{if((s&1)===0){ef(p,O,s),kc();break e}N=Error(i(426))}}else if(Ke&&C.mode&1){var it=tf(m);if(it!==null){(it.flags&65536)===0&&(it.flags|=256),rf(it,m,C,p,s),Oa(Ls(N,C));break e}}p=N=Ls(N,C),ht!==4&&(ht=2),Rn===null?Rn=[p]:Rn.push(p),p=m;do{switch(p.tag){case 3:p.flags|=65536,s&=-s,p.lanes|=s;var T=Qd(p,N,s);kd(p,T);break e;case 1:C=N;var D=p.type,L=p.stateNode;if((p.flags&128)===0&&(typeof D.getDerivedStateFromError=="function"||L!==null&&typeof L.componentDidCatch=="function"&&(Li===null||!Li.has(L)))){p.flags|=65536,s&=-s,p.lanes|=s;var Z=Zd(p,C,s);kd(p,Z);break e}}p=p.return}while(p!==null)}Bf(o)}catch(fe){s=fe,ot===o&&o!==null&&(ot=o=o.return);continue}break}while(!0)}function Mf(){var r=Zo.current;return Zo.current=qo,r===null?qo:r}function kc(){(ht===0||ht===3||ht===2)&&(ht=4),yt===null||(ts&268435455)===0&&(el&268435455)===0||Oi(yt,Tt)}function ol(r,s){var o=Me;Me|=2;var c=Mf();(yt!==r||Tt!==s)&&(pi=null,is(r,s));do try{wv();break}catch(u){Tf(r,u)}while(!0);if(ja(),Me=o,Zo.current=c,ot!==null)throw Error(i(261));return yt=null,Tt=0,ht}function wv(){for(;ot!==null;)Lf(ot)}function xv(){for(;ot!==null&&!qg();)Lf(ot)}function Lf(r){var s=Af(r.alternate,r,cr);r.memoizedProps=r.pendingProps,s===null?Bf(r):ot=s,gc.current=null}function Bf(r){var s=r;do{var o=s.alternate;if(r=s.return,(s.flags&32768)===0){if(o=pv(o,s,cr),o!==null){ot=o;return}}else{if(o=_v(o,s),o!==null){o.flags&=32767,ot=o;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{ht=6,ot=null;return}}if(s=s.sibling,s!==null){ot=s;return}ot=s=r}while(s!==null);ht===0&&(ht=5)}function ss(r,s,o){var c=Ae,u=vr.transition;try{vr.transition=null,Ae=1,bv(r,s,o,c)}finally{vr.transition=u,Ae=c}return null}function bv(r,s,o,c){do As();while(Bi!==null);if((Me&6)!==0)throw Error(i(327));o=r.finishedWork;var u=r.finishedLanes;if(o===null)return null;if(r.finishedWork=null,r.finishedLanes=0,o===r.current)throw Error(i(177));r.callbackNode=null,r.callbackPriority=0;var p=o.lanes|o.childLanes;if(im(r,p),r===yt&&(ot=yt=null,Tt=0),(o.subtreeFlags&2064)===0&&(o.flags&2064)===0||rl||(rl=!0,jf(co,function(){return As(),null})),p=(o.flags&15990)!==0,(o.subtreeFlags&15990)!==0||p){p=vr.transition,vr.transition=null;var m=Ae;Ae=1;var C=Me;Me|=4,gc.current=null,mv(r,o),Cf(o,r),$m(ka),mo=!!Ca,ka=Ca=null,r.current=o,vv(o),Yg(),Me=C,Ae=m,vr.transition=p}else r.current=o;if(rl&&(rl=!1,Bi=r,il=u),p=r.pendingLanes,p===0&&(Li=null),Jg(o.stateNode),tr(r,rt()),s!==null)for(c=r.onRecoverableError,o=0;o<s.length;o++)u=s[o],c(u.value,{componentStack:u.stack,digest:u.digest});if(tl)throw tl=!1,r=yc,yc=null,r;return(il&1)!==0&&r.tag!==0&&As(),p=r.pendingLanes,(p&1)!==0?r===Sc?Pn++:(Pn=0,Sc=r):Pn=0,Ri(),null}function As(){if(Bi!==null){var r=wu(il),s=vr.transition,o=Ae;try{if(vr.transition=null,Ae=16>r?16:r,Bi===null)var c=!1;else{if(r=Bi,Bi=null,il=0,(Me&6)!==0)throw Error(i(331));var u=Me;for(Me|=4,ce=r.current;ce!==null;){var p=ce,m=p.child;if((ce.flags&16)!==0){var C=p.deletions;if(C!==null){for(var N=0;N<C.length;N++){var O=C[N];for(ce=O;ce!==null;){var V=ce;switch(V.tag){case 0:case 11:case 15:Nn(8,V,p)}var Y=V.child;if(Y!==null)Y.return=V,ce=Y;else for(;ce!==null;){V=ce;var K=V.sibling,oe=V.return;if(yf(V),V===O){ce=null;break}if(K!==null){K.return=oe,ce=K;break}ce=oe}}}var he=p.alternate;if(he!==null){var de=he.child;if(de!==null){he.child=null;do{var it=de.sibling;de.sibling=null,de=it}while(de!==null)}}ce=p}}if((p.subtreeFlags&2064)!==0&&m!==null)m.return=p,ce=m;else e:for(;ce!==null;){if(p=ce,(p.flags&2048)!==0)switch(p.tag){case 0:case 11:case 15:Nn(9,p,p.return)}var T=p.sibling;if(T!==null){T.return=p.return,ce=T;break e}ce=p.return}}var D=r.current;for(ce=D;ce!==null;){m=ce;var L=m.child;if((m.subtreeFlags&2064)!==0&&L!==null)L.return=m,ce=L;else e:for(m=D;ce!==null;){if(C=ce,(C.flags&2048)!==0)try{switch(C.tag){case 0:case 11:case 15:Qo(9,C)}}catch(fe){Ze(C,C.return,fe)}if(C===m){ce=null;break e}var Z=C.sibling;if(Z!==null){Z.return=C.return,ce=Z;break e}ce=C.return}}if(Me=u,Ri(),Kr&&typeof Kr.onPostCommitFiberRoot=="function")try{Kr.onPostCommitFiberRoot(ho,r)}catch{}c=!0}return c}finally{Ae=o,vr.transition=s}}return!1}function If(r,s,o){s=Ls(o,s),s=Qd(r,s,1),r=Ti(r,s,1),s=Vt(),r!==null&&(Zs(r,1,s),tr(r,s))}function Ze(r,s,o){if(r.tag===3)If(r,r,o);else for(;s!==null;){if(s.tag===3){If(s,r,o);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Li===null||!Li.has(c))){r=Ls(o,r),r=Zd(s,r,1),s=Ti(s,r,1),r=Vt(),s!==null&&(Zs(s,1,r),tr(s,r));break}}s=s.return}}function Cv(r,s,o){var c=r.pingCache;c!==null&&c.delete(s),s=Vt(),r.pingedLanes|=r.suspendedLanes&o,yt===r&&(Tt&o)===o&&(ht===4||ht===3&&(Tt&130023424)===Tt&&500>rt()-vc?is(r,0):mc|=o),tr(r,s)}function Of(r,s){s===0&&((r.mode&1)===0?s=1:(s=fo,fo<<=1,(fo&130023424)===0&&(fo=4194304)));var o=Vt();r=ui(r,s),r!==null&&(Zs(r,s,o),tr(r,o))}function kv(r){var s=r.memoizedState,o=0;s!==null&&(o=s.retryLane),Of(r,o)}function Ev(r,s){var o=0;switch(r.tag){case 13:var c=r.stateNode,u=r.memoizedState;u!==null&&(o=u.retryLane);break;case 19:c=r.stateNode;break;default:throw Error(i(314))}c!==null&&c.delete(s),Of(r,o)}var Af;Af=function(r,s,o){if(r!==null)if(r.memoizedProps!==s.pendingProps||Jt.current)Zt=!0;else{if((r.lanes&o)===0&&(s.flags&128)===0)return Zt=!1,fv(r,s,o);Zt=(r.flags&131072)!==0}else Zt=!1,Ke&&(s.flags&1048576)!==0&&_d(s,Io,s.index);switch(s.lanes=0,s.tag){case 2:var c=s.type;Xo(r,s),r=s.pendingProps;var u=ks(s,zt.current);Ts(s,o),u=Ga(null,s,c,r,u,o);var p=Xa();return s.flags|=1,typeof u=="object"&&u!==null&&typeof u.render=="function"&&u.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,Qt(c)?(p=!0,Mo(s)):p=!1,s.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,Wa(s),u.updater=Yo,s.stateNode=u,u._reactInternals=s,rc(s,c,r,o),s=oc(null,s,c,!0,p,o)):(s.tag=0,Ke&&p&&Ma(s),Kt(null,s,u,o),s=s.child),s;case 16:c=s.elementType;e:{switch(Xo(r,s),r=s.pendingProps,u=c._init,c=u(c._payload),s.type=c,u=s.tag=Dv(c),r=Br(c,r),u){case 0:s=nc(null,s,c,r,o);break e;case 1:s=cf(null,s,c,r,o);break e;case 11:s=sf(null,s,c,r,o);break e;case 14:s=nf(null,s,c,Br(c.type,r),o);break e}throw Error(i(306,c,""))}return s;case 0:return c=s.type,u=s.pendingProps,u=s.elementType===c?u:Br(c,u),nc(r,s,c,u,o);case 1:return c=s.type,u=s.pendingProps,u=s.elementType===c?u:Br(c,u),cf(r,s,c,u,o);case 3:e:{if(hf(s),r===null)throw Error(i(387));c=s.pendingProps,p=s.memoizedState,u=p.element,Cd(r,s),Ho(s,c,null,o);var m=s.memoizedState;if(c=m.element,p.isDehydrated)if(p={element:c,isDehydrated:!1,cache:m.cache,pendingSuspenseBoundaries:m.pendingSuspenseBoundaries,transitions:m.transitions},s.updateQueue.baseState=p,s.memoizedState=p,s.flags&256){u=Ls(Error(i(423)),s),s=uf(r,s,c,o,u);break e}else if(c!==u){u=Ls(Error(i(424)),s),s=uf(r,s,c,o,u);break e}else for(ar=Ei(s.stateNode.containerInfo.firstChild),lr=s,Ke=!0,Lr=null,o=xd(s,null,c,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Ds(),c===u){s=fi(r,s,o);break e}Kt(r,s,c,o)}s=s.child}return s;case 5:return Nd(s),r===null&&Ia(s),c=s.type,u=s.pendingProps,p=r!==null?r.memoizedProps:null,m=u.children,Ea(c,u)?m=null:p!==null&&Ea(c,p)&&(s.flags|=32),af(r,s),Kt(r,s,m,o),s.child;case 6:return r===null&&Ia(s),null;case 13:return df(r,s,o);case 4:return $a(s,s.stateNode.containerInfo),c=s.pendingProps,r===null?s.child=Rs(s,null,c,o):Kt(r,s,c,o),s.child;case 11:return c=s.type,u=s.pendingProps,u=s.elementType===c?u:Br(c,u),sf(r,s,c,u,o);case 7:return Kt(r,s,s.pendingProps,o),s.child;case 8:return Kt(r,s,s.pendingProps.children,o),s.child;case 12:return Kt(r,s,s.pendingProps.children,o),s.child;case 10:e:{if(c=s.type._context,u=s.pendingProps,p=s.memoizedProps,m=u.value,ze(jo,c._currentValue),c._currentValue=m,p!==null)if(Mr(p.value,m)){if(p.children===u.children&&!Jt.current){s=fi(r,s,o);break e}}else for(p=s.child,p!==null&&(p.return=s);p!==null;){var C=p.dependencies;if(C!==null){m=p.child;for(var N=C.firstContext;N!==null;){if(N.context===c){if(p.tag===1){N=di(-1,o&-o),N.tag=2;var O=p.updateQueue;if(O!==null){O=O.shared;var V=O.pending;V===null?N.next=N:(N.next=V.next,V.next=N),O.pending=N}}p.lanes|=o,N=p.alternate,N!==null&&(N.lanes|=o),Fa(p.return,o,s),C.lanes|=o;break}N=N.next}}else if(p.tag===10)m=p.type===s.type?null:p.child;else if(p.tag===18){if(m=p.return,m===null)throw Error(i(341));m.lanes|=o,C=m.alternate,C!==null&&(C.lanes|=o),Fa(m,o,s),m=p.sibling}else m=p.child;if(m!==null)m.return=p;else for(m=p;m!==null;){if(m===s){m=null;break}if(p=m.sibling,p!==null){p.return=m.return,m=p;break}m=m.return}p=m}Kt(r,s,u.children,o),s=s.child}return s;case 9:return u=s.type,c=s.pendingProps.children,Ts(s,o),u=gr(u),c=c(u),s.flags|=1,Kt(r,s,c,o),s.child;case 14:return c=s.type,u=Br(c,s.pendingProps),u=Br(c.type,u),nf(r,s,c,u,o);case 15:return of(r,s,s.type,s.pendingProps,o);case 17:return c=s.type,u=s.pendingProps,u=s.elementType===c?u:Br(c,u),Xo(r,s),s.tag=1,Qt(c)?(r=!0,Mo(s)):r=!1,Ts(s,o),Xd(s,c,u),rc(s,c,u,o),oc(null,s,c,!0,r,o);case 19:return pf(r,s,o);case 22:return lf(r,s,o)}throw Error(i(156,s.tag))};function jf(r,s){return gu(r,s)}function Nv(r,s,o,c){this.tag=r,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yr(r,s,o,c){return new Nv(r,s,o,c)}function Ec(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Dv(r){if(typeof r=="function")return Ec(r)?1:0;if(r!=null){if(r=r.$$typeof,r===q)return 11;if(r===X)return 14}return 2}function Ai(r,s){var o=r.alternate;return o===null?(o=yr(r.tag,s,r.key,r.mode),o.elementType=r.elementType,o.type=r.type,o.stateNode=r.stateNode,o.alternate=r,r.alternate=o):(o.pendingProps=s,o.type=r.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=r.flags&14680064,o.childLanes=r.childLanes,o.lanes=r.lanes,o.child=r.child,o.memoizedProps=r.memoizedProps,o.memoizedState=r.memoizedState,o.updateQueue=r.updateQueue,s=r.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=r.sibling,o.index=r.index,o.ref=r.ref,o}function ll(r,s,o,c,u,p){var m=2;if(c=r,typeof r=="function")Ec(r)&&(m=1);else if(typeof r=="string")m=5;else e:switch(r){case re:return ns(o.children,u,p,s);case se:m=8,u|=8;break;case pe:return r=yr(12,o,s,u|2),r.elementType=pe,r.lanes=p,r;case j:return r=yr(13,o,s,u),r.elementType=j,r.lanes=p,r;case G:return r=yr(19,o,s,u),r.elementType=G,r.lanes=p,r;case ie:return al(o,u,p,s);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case Se:m=10;break e;case z:m=9;break e;case q:m=11;break e;case X:m=14;break e;case ee:m=16,c=null;break e}throw Error(i(130,r==null?r:typeof r,""))}return s=yr(m,o,s,u),s.elementType=r,s.type=c,s.lanes=p,s}function ns(r,s,o,c){return r=yr(7,r,c,s),r.lanes=o,r}function al(r,s,o,c){return r=yr(22,r,c,s),r.elementType=ie,r.lanes=o,r.stateNode={isHidden:!1},r}function Nc(r,s,o){return r=yr(6,r,null,s),r.lanes=o,r}function Dc(r,s,o){return s=yr(4,r.children!==null?r.children:[],r.key,s),s.lanes=o,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}function Rv(r,s,o,c,u){this.tag=s,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ta(0),this.expirationTimes=ta(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ta(0),this.identifierPrefix=c,this.onRecoverableError=u,this.mutableSourceEagerHydrationData=null}function Rc(r,s,o,c,u,p,m,C,N){return r=new Rv(r,s,o,C,N),s===1?(s=1,p===!0&&(s|=8)):s=0,p=yr(3,null,null,s),r.current=p,p.stateNode=r,p.memoizedState={element:c,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},Wa(p),r}function Pv(r,s,o){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:A,key:c==null?null:""+c,children:r,containerInfo:s,implementation:o}}function zf(r){if(!r)return Di;r=r._reactInternals;e:{if(qi(r)!==r||r.tag!==1)throw Error(i(170));var s=r;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(Qt(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(i(171))}if(r.tag===1){var o=r.type;if(Qt(o))return dd(r,o,s)}return s}function Ff(r,s,o,c,u,p,m,C,N){return r=Rc(o,c,!0,r,u,p,m,C,N),r.context=zf(null),o=r.current,c=Vt(),u=Ii(o),p=di(c,u),p.callback=s??null,Ti(o,p,u),r.current.lanes=u,Zs(r,u,c),tr(r,c),r}function cl(r,s,o,c){var u=s.current,p=Vt(),m=Ii(u);return o=zf(o),s.context===null?s.context=o:s.pendingContext=o,s=di(p,m),s.payload={element:r},c=c===void 0?null:c,c!==null&&(s.callback=c),r=Ti(u,s,m),r!==null&&(Ar(r,u,m,p),Fo(r,u,m)),m}function hl(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function Hf(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var o=r.retryLane;r.retryLane=o!==0&&o<s?o:s}}function Pc(r,s){Hf(r,s),(r=r.alternate)&&Hf(r,s)}function Tv(){return null}var Wf=typeof reportError=="function"?reportError:function(r){console.error(r)};function Tc(r){this._internalRoot=r}ul.prototype.render=Tc.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(i(409));cl(r,s,null,null)},ul.prototype.unmount=Tc.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;rs(function(){cl(null,r,null,null)}),s[li]=null}};function ul(r){this._internalRoot=r}ul.prototype.unstable_scheduleHydration=function(r){if(r){var s=Cu();r={blockedOn:null,target:r,priority:s};for(var o=0;o<bi.length&&s!==0&&s<bi[o].priority;o++);bi.splice(o,0,r),o===0&&Nu(r)}};function Mc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function dl(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function $f(){}function Mv(r,s,o,c,u){if(u){if(typeof c=="function"){var p=c;c=function(){var O=hl(m);p.call(O)}}var m=Ff(s,c,r,0,null,!1,!1,"",$f);return r._reactRootContainer=m,r[li]=m.current,pn(r.nodeType===8?r.parentNode:r),rs(),m}for(;u=r.lastChild;)r.removeChild(u);if(typeof c=="function"){var C=c;c=function(){var O=hl(N);C.call(O)}}var N=Rc(r,0,!1,null,null,!1,!1,"",$f);return r._reactRootContainer=N,r[li]=N.current,pn(r.nodeType===8?r.parentNode:r),rs(function(){cl(s,N,o,c)}),N}function fl(r,s,o,c,u){var p=o._reactRootContainer;if(p){var m=p;if(typeof u=="function"){var C=u;u=function(){var N=hl(m);C.call(N)}}cl(s,m,r,u)}else m=Mv(o,s,r,u,c);return hl(m)}xu=function(r){switch(r.tag){case 3:var s=r.stateNode;if(s.current.memoizedState.isDehydrated){var o=Qs(s.pendingLanes);o!==0&&(ra(s,o|1),tr(s,rt()),(Me&6)===0&&(Os=rt()+500,Ri()))}break;case 13:rs(function(){var c=ui(r,1);if(c!==null){var u=Vt();Ar(c,r,1,u)}}),Pc(r,1)}},ia=function(r){if(r.tag===13){var s=ui(r,134217728);if(s!==null){var o=Vt();Ar(s,r,134217728,o)}Pc(r,134217728)}},bu=function(r){if(r.tag===13){var s=Ii(r),o=ui(r,s);if(o!==null){var c=Vt();Ar(o,r,s,c)}Pc(r,s)}},Cu=function(){return Ae},ku=function(r,s){var o=Ae;try{return Ae=r,s()}finally{Ae=o}},Xs=function(r,s,o){switch(s){case"input":if(Fr(r,o),s=o.name,o.type==="radio"&&s!=null){for(o=r;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<o.length;s++){var c=o[s];if(c!==r&&c.form===r.form){var u=Po(c);if(!u)throw Error(i(90));Fe(c),Fr(c,u)}}}break;case"textarea":me(r,o);break;case"select":s=o.value,s!=null&&H(r,!!o.multiple,s,!1)}},Ut=bc,At=rs;var Lv={usingClientEntryPoint:!1,Events:[mn,bs,Po,Ot,Dr,bc]},Tn={findFiberByHostInstance:Yi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Bv={bundleType:Tn.bundleType,version:Tn.version,rendererPackageName:Tn.rendererPackageName,rendererConfig:Tn.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:P.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=pu(r),r===null?null:r.stateNode},findFiberByHostInstance:Tn.findFiberByHostInstance||Tv,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var pl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!pl.isDisabled&&pl.supportsFiber)try{ho=pl.inject(Bv),Kr=pl}catch{}}return rr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Lv,rr.createPortal=function(r,s){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Mc(s))throw Error(i(200));return Pv(r,s,null,o)},rr.createRoot=function(r,s){if(!Mc(r))throw Error(i(299));var o=!1,c="",u=Wf;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onRecoverableError!==void 0&&(u=s.onRecoverableError)),s=Rc(r,1,!1,null,null,o,!1,c,u),r[li]=s.current,pn(r.nodeType===8?r.parentNode:r),new Tc(s)},rr.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=pu(s),r=r===null?null:r.stateNode,r},rr.flushSync=function(r){return rs(r)},rr.hydrate=function(r,s,o){if(!dl(s))throw Error(i(200));return fl(null,r,s,!0,o)},rr.hydrateRoot=function(r,s,o){if(!Mc(r))throw Error(i(405));var c=o!=null&&o.hydratedSources||null,u=!1,p="",m=Wf;if(o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(p=o.identifierPrefix),o.onRecoverableError!==void 0&&(m=o.onRecoverableError)),s=Ff(s,null,r,1,o??null,u,!1,p,m),r[li]=s.current,pn(r),c)for(r=0;r<c.length;r++)o=c[r],u=o._getVersion,u=u(o._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[o,u]:s.mutableSourceEagerHydrationData.push(o,u);return new ul(s)},rr.render=function(r,s,o){if(!dl(s))throw Error(i(200));return fl(null,r,s,!1,o)},rr.unmountComponentAtNode=function(r){if(!dl(r))throw Error(i(40));return r._reactRootContainer?(rs(function(){fl(null,null,r,!1,function(){r._reactRootContainer=null,r[li]=null})}),!0):!1},rr.unstable_batchedUpdates=bc,rr.unstable_renderSubtreeIntoContainer=function(r,s,o,c){if(!dl(o))throw Error(i(200));if(r==null||r._reactInternals===void 0)throw Error(i(38));return fl(r,s,o,!1,c)},rr.version="18.3.1-next-f1338f8080-20240426",rr}var Jf;function y_(){if(Jf)return Ic.exports;Jf=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(),Ic.exports=Hv(),Ic.exports}var Qf;function Wv(){if(Qf)return _l;Qf=1;var e=y_();return _l.createRoot=e.createRoot,_l.hydrateRoot=e.hydrateRoot,_l}var $v=Wv();const Uv=v_($v),S_="claudit:sidebar-width",w_=200,x_=500,Kv=300;function Vv(){try{const e=localStorage.getItem(S_);if(e){const t=Number(e);if(t>=w_&&t<=x_)return t}}catch{}return Kv}function qv({nav:e,sidebar:t,main:i}){const[n,l]=b.useState(Vv),a=b.useRef(!1),h=b.useRef(n);h.current=n;const d=b.useCallback(_=>{_.preventDefault(),a.current=!0,document.body.classList.add("select-none")},[]);return b.useEffect(()=>{const _=v=>{if(!a.current)return;const y=Math.min(x_,Math.max(w_,v.clientX-56));l(y),h.current=y},f=()=>{if(a.current){a.current=!1,document.body.classList.remove("select-none");try{localStorage.setItem(S_,String(h.current))}catch{}}};return window.addEventListener("mousemove",_),window.addEventListener("mouseup",f),()=>{window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",f),a.current&&document.body.classList.remove("select-none")}},[]),g.jsxs("div",{className:"h-screen grid",style:{gridTemplateColumns:`56px ${n}px 4px 1fr`},children:[g.jsx("nav",{className:"border-r border-gray-800 bg-gray-950 flex flex-col items-center py-4",children:e}),g.jsx("aside",{className:"border-r border-gray-800 overflow-y-auto bg-gray-900",children:t}),g.jsx("div",{onMouseDown:d,className:"cursor-col-resize bg-transparent hover:bg-blue-500/40 transition-colors"}),g.jsx("main",{className:"overflow-hidden flex flex-col",children:i})]})}const Zf=e=>{let t;const i=new Set,n=(f,v)=>{const y=typeof f=="function"?f(t):f;if(!Object.is(y,t)){const w=t;t=v??(typeof y!="object"||y===null)?y:Object.assign({},t,y),i.forEach(S=>S(t,w))}},l=()=>t,d={setState:n,getState:l,getInitialState:()=>_,subscribe:f=>(i.add(f),()=>i.delete(f))},_=t=e(n,l,d);return d},Yv=(e=>e?Zf(e):Zf),Gv=e=>e;function Xv(e,t=Gv){const i=pt.useSyncExternalStore(e.subscribe,pt.useCallback(()=>t(e.getState()),[e,t]),pt.useCallback(()=>t(e.getInitialState()),[e,t]));return pt.useDebugValue(i),i}const ep=e=>{const t=Yv(e),i=n=>Xv(t,n);return Object.assign(i,t),i},b_=(e=>e?ep(e):ep);function Jv(e,t){let i;try{i=e()}catch{return}return{getItem:l=>{var a;const h=_=>_===null?null:JSON.parse(_,void 0),d=(a=i.getItem(l))!=null?a:null;return d instanceof Promise?d.then(h):h(d)},setItem:(l,a)=>i.setItem(l,JSON.stringify(a,void 0)),removeItem:l=>i.removeItem(l)}}const rh=e=>t=>{try{const i=e(t);return i instanceof Promise?i:{then(n){return rh(n)(i)},catch(n){return this}}}catch(i){return{then(n){return this},catch(n){return rh(n)(i)}}}},Qv=(e,t)=>(i,n,l)=>{let a={storage:Jv(()=>window.localStorage),partialize:x=>x,version:0,merge:(x,I)=>({...I,...x}),...t},h=!1,d=0;const _=new Set,f=new Set;let v=a.storage;if(!v)return e((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),i(...x)},n,l);const y=()=>{const x=a.partialize({...n()});return v.setItem(a.name,{state:x,version:a.version})},w=l.setState;l.setState=(x,I)=>(w(x,I),y());const S=e((...x)=>(i(...x),y()),n,l);l.getInitialState=()=>S;let k;const E=()=>{var x,I;if(!v)return;const U=++d;h=!1,_.forEach(P=>{var M;return P((M=n())!=null?M:S)});const W=((I=a.onRehydrateStorage)==null?void 0:I.call(a,(x=n())!=null?x:S))||void 0;return rh(v.getItem.bind(v))(a.name).then(P=>{if(P)if(typeof P.version=="number"&&P.version!==a.version){if(a.migrate){const M=a.migrate(P.state,P.version);return M instanceof Promise?M.then(A=>[!0,A]):[!0,M]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,P.state];return[!1,void 0]}).then(P=>{var M;if(U!==d)return;const[A,re]=P;if(k=a.merge(re,(M=n())!=null?M:S),i(k,!0),A)return y()}).then(()=>{U===d&&(W==null||W(k,void 0),k=n(),h=!0,f.forEach(P=>P(k)))}).catch(P=>{U===d&&(W==null||W(void 0,P))})};return l.persist={setOptions:x=>{a={...a,...x},x.storage&&(v=x.storage)},clearStorage:()=>{v==null||v.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>E(),hasHydrated:()=>h,onHydrate:x=>(_.add(x),()=>{_.delete(x)}),onFinishHydration:x=>(f.add(x),()=>{f.delete(x)})},a.skipHydration||E(),k||S},Zv=Qv,Oe=b_()(Zv(e=>({view:"sessions",selected:null,selectedCronTaskId:null,selectedTodoId:null,showNewModal:!1,todoSessionPrefill:null,pendingTodoPrompt:null,editingTodoId:null,editingCronTaskId:null,setView:t=>e({view:t}),selectSession:(t,i,n,l)=>e({selected:{projectHash:t,sessionId:i,projectPath:n,isNew:l}}),clearSelected:()=>e({selected:null}),setSelectedCronTaskId:t=>e({selectedCronTaskId:t}),setSelectedTodoId:t=>e({selectedTodoId:t}),setShowNewModal:t=>e({showNewModal:t}),setTodoSessionPrefill:t=>e({todoSessionPrefill:t}),setPendingTodoPrompt:t=>e({pendingTodoPrompt:t}),setEditingTodoId:t=>e({editingTodoId:t}),setEditingCronTaskId:t=>e({editingCronTaskId:t})}),{name:"claudit:ui-state",partialize:e=>({view:e.view,selected:e.selected,selectedTodoId:e.selectedTodoId,selectedCronTaskId:e.selectedCronTaskId,editingTodoId:e.editingTodoId,editingCronTaskId:e.editingCronTaskId})}));function e0(){const e=Oe(i=>i.view),t=Oe(i=>i.setView);return g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("button",{onClick:()=>t("todo"),className:`w-10 h-10 rounded-lg flex items-center justify-center transition-colors ${e==="todo"?"bg-blue-600 text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,title:"Todos",children:g.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[g.jsx("path",{d:"M9 11l3 3L22 4"}),g.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),g.jsx("button",{onClick:()=>t("sessions"),className:`w-10 h-10 rounded-lg flex items-center justify-center transition-colors ${e==="sessions"?"bg-blue-600 text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,title:"Sessions",children:g.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:g.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),g.jsx("button",{onClick:()=>t("cron"),className:`w-10 h-10 rounded-lg flex items-center justify-center transition-colors ${e==="cron"?"bg-blue-600 text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,title:"Workflows",children:g.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[g.jsx("rect",{x:"3",y:"3",width:"7",height:"5",rx:"1"}),g.jsx("rect",{x:"14",y:"16",width:"7",height:"5",rx:"1"}),g.jsx("path",{d:"M10 5.5h2a2 2 0 0 1 2 2v7a2 2 0 0 0 2 2h-2"}),g.jsx("polyline",{points:"14 14.5 16 16.5 14 18.5"})]})})]})}async function Kl(e,t,i){const n=new URLSearchParams;e&&n.set("q",e),n.set("hideEmpty","true"),i&&n.set("managedOnly","true");const l=n.toString(),a=await fetch(`/api/sessions${l?`?${l}`:""}`);if(!a.ok)throw new Error("Failed to fetch sessions");return a.json()}async function t0(e,t){const i=await fetch(`/api/sessions/${encodeURIComponent(e)}/${encodeURIComponent(t)}`);if(!i.ok)throw new Error("Failed to fetch session detail");return i.json()}async function C_(e,t){const i=await fetch("/api/sessions/new",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e,...t})});if(!i.ok){const n=await i.json().catch(()=>({error:"Failed to create session"}));throw new Error(n.error||"Failed to create session")}return i.json()}async function r0(e,t){const i=await fetch(`/api/sessions/${encodeURIComponent(e)}/name`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})});if(!i.ok){const n=await i.json().catch(()=>({error:"Failed to rename session"}));throw new Error(n.error||"Failed to rename session")}}async function i0(e,t){const i=await fetch(`/api/sessions/${encodeURIComponent(e)}/pin`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({pinned:t})});if(!i.ok){const n=await i.json().catch(()=>({error:"Failed to pin session"}));throw new Error(n.error||"Failed to pin session")}}async function tp(e,t){const i=await fetch(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({archived:t})});if(!i.ok){const n=await i.json().catch(()=>({error:"Failed to archive session"}));throw new Error(n.error||"Failed to archive session")}}async function s0(e,t){const i=await fetch(`/api/sessions/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:"DELETE"});if(!i.ok){const n=await i.json().catch(()=>({error:"Failed to delete session"}));throw new Error(n.error||"Failed to delete session")}}async function n0(){const e=await fetch("/api/sessions/archived");if(!e.ok)throw new Error("Failed to fetch archived sessions");return e.json()}async function o0(e){const t=new URLSearchParams;e&&t.set("path",e);const i=t.toString(),n=await fetch(`/api/filesystem/list${i?`?${i}`:""}`);if(!n.ok){const l=await n.json().catch(()=>({error:"Failed to list directory"}));throw new Error(l.error||"Failed to list directory")}return n.json()}const Cr=b_((e,t)=>({groups:[],archivedGroups:[],archivedCount:0,query:"",managedOnly:!1,loading:!0,error:null,expandedSet:new Set,creating:!1,archivedExpanded:!1,archivedGroupExpanded:new Set,_initializedExpanded:!1,_eventWs:null,_reconnectTimer:null,fetchSessions:async i=>{try{e({error:null});const n=await Kl(i,!0,t().managedOnly);e(l=>{const a={groups:n,loading:!1};return!l._initializedExpanded&&n.length>0&&(a.expandedSet=new Set(n.map(h=>h.projectHash)),a._initializedExpanded=!0),a})}catch(n){e({error:n.message,loading:!1})}},fetchArchived:async()=>{try{const i=await n0();e({archivedGroups:i.groups,archivedCount:i.count})}catch{}},createSession:async(i,n)=>{e({creating:!0});try{const l=await C_(i,n),a=t().query;return await t().fetchSessions(a||void 0),l}catch(l){return alert(`Failed to create session: ${l.message}`),null}finally{e({creating:!1})}},renameSession:async(i,n)=>{try{await r0(i,n),await t().fetchSessions(t().query||void 0)}catch(l){alert(`Failed to rename session: ${l.message}`)}},pinSession:async i=>{const{groups:n}=t();let l=!1;for(const a of n){const h=a.sessions.find(d=>d.sessionId===i);if(h){l=!!h.pinned;break}}try{await i0(i,!l),await t().fetchSessions(t().query||void 0)}catch(a){alert(`Failed to pin session: ${a.message}`)}},archiveSession:async i=>{try{await tp(i,!0),await t().fetchSessions(t().query||void 0),await t().fetchArchived()}catch(n){alert(`Failed to archive session: ${n.message}`)}},unarchiveSession:async i=>{try{await tp(i,!1),await t().fetchSessions(t().query||void 0),await t().fetchArchived()}catch(n){alert(`Failed to unarchive session: ${n.message}`)}},deleteSession:async i=>{const{groups:n,archivedGroups:l}=t(),a=[...n,...l];let h="";for(const d of a)if(d.sessions.find(f=>f.sessionId===i)){h=d.projectHash;break}if(h&&window.confirm("Are you sure you want to permanently delete this session? This cannot be undone."))try{await s0(h,i),await t().fetchSessions(t().query||void 0),await t().fetchArchived()}catch(d){alert(`Failed to delete session: ${d.message}`)}},toggleGroup:i=>{e(n=>{const l=new Set(n.expandedSet);return l.has(i)?l.delete(i):l.add(i),{expandedSet:l}})},toggleAllGroups:()=>{e(i=>i.groups.length>0&&i.groups.every(l=>i.expandedSet.has(l.projectHash))?{expandedSet:new Set}:{expandedSet:new Set(i.groups.map(l=>l.projectHash))})},toggleArchivedGroup:i=>{e(n=>{const l=new Set(n.archivedGroupExpanded);return l.has(i)?l.delete(i):l.add(i),{archivedGroupExpanded:l}})},setQuery:i=>e({query:i}),setManagedOnly:i=>e({managedOnly:i}),setArchivedExpanded:i=>e({archivedExpanded:i}),connectEventStream:()=>{const{_eventWs:i}=t();if(i)return;const n=window.location.protocol==="https:"?"wss:":"ws:",l=new WebSocket(`${n}//${window.location.host}/ws/events`);l.onmessage=()=>{t().fetchSessions(t().query||void 0),t().fetchArchived()},l.onclose=()=>{e({_eventWs:null});const a=setTimeout(()=>{e({_reconnectTimer:null}),t().connectEventStream()},3e3);e({_reconnectTimer:a})},l.onerror=()=>{l.close()},e({_eventWs:l})},disconnectEventStream:()=>{const{_eventWs:i,_reconnectTimer:n}=t();n&&clearTimeout(n),i&&i.close(),e({_eventWs:null,_reconnectTimer:null})}}));function l0({value:e,onChange:t}){return g.jsx("div",{className:"p-3 border-b border-gray-800",children:g.jsx("input",{type:"text",placeholder:"Search sessions...",value:e,onChange:i=>t(i.target.value),className:`w-full px-3 py-2 rounded-md bg-gray-800 text-gray-200 text-sm
41
+ placeholder-gray-500 border border-gray-700 focus:border-blue-500
42
+ focus:outline-none transition-colors`})})}function a0({isArchived:e,isPinned:t,onRename:i,onPin:n,onAddTodo:l,onArchive:a,onDelete:h,onClose:d}){const _=b.useRef(null);b.useEffect(()=>{const v=y=>{_.current&&!_.current.contains(y.target)&&d()};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[d]);const f="w-full text-left px-3 py-1.5 text-xs hover:bg-gray-700 transition-colors";return g.jsxs("div",{ref:_,className:"absolute right-2 top-8 z-50 bg-gray-800 border border-gray-700 rounded-md shadow-lg py-1 min-w-[120px]",children:[!e&&g.jsx("button",{onClick:i,className:`${f} text-gray-300`,children:"Rename"}),!e&&g.jsx("button",{onClick:n,className:`${f} text-gray-300`,children:t?"Unpin":"Pin to top"}),!e&&g.jsx("button",{onClick:l,className:`${f} text-gray-300`,children:"Add Todo"}),g.jsx("button",{onClick:a,className:`${f} text-gray-300`,children:e?"Unarchive":"Archive"}),g.jsx("button",{onClick:h,className:`${f} text-red-400 hover:bg-red-900/30`,children:"Delete"})]})}function c0(e){const t=new Date(e),n=new Date().getTime()-t.getTime(),l=Math.floor(n/6e4),a=Math.floor(l/60),h=Math.floor(a/24);return l<1?"just now":l<60?`${l}m ago`:a<24?`${a}h ago`:h<7?`${h}d ago`:t.toLocaleDateString()}function h0({session:e,projectHash:t,isArchived:i}){const[n,l]=b.useState(!1),[a,h]=b.useState(""),[d,_]=b.useState(!1),f=b.useRef(null),v=Oe(z=>z.selected),y=Oe(z=>z.selectSession),w=Oe(z=>z.setTodoSessionPrefill),S=Oe(z=>z.setView),k=Cr(z=>z.renameSession),E=Cr(z=>z.pinSession),x=Cr(z=>z.archiveSession),I=Cr(z=>z.unarchiveSession),U=Cr(z=>z.deleteSession),W=(v==null?void 0:v.sessionId)===e.sessionId;b.useEffect(()=>{n&&f.current&&(f.current.focus(),f.current.select())},[n]);const P=()=>{y(t,e.sessionId,e.projectPath)},M=z=>{z.preventDefault(),z.stopPropagation(),h(e.displayName||e.lastMessage),l(!0)},A=()=>{const z=a.trim();z&&z!==e.lastMessage&&k(e.sessionId,z),l(!1)},re=z=>{z.key==="Enter"?A():z.key==="Escape"&&l(!1)},se=()=>{_(!1),w({sessionId:e.sessionId,sessionLabel:e.displayName||e.lastMessage,projectPath:e.projectPath}),S("todo")},pe=e.displayName||e.lastMessage,Se=(()=>{switch(e.status){case"running":return g.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-green-400 animate-pulse flex-shrink-0",title:"Running"});case"need_attention":return g.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-yellow-400 flex-shrink-0",title:"Needs attention"});default:return g.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-gray-600 flex-shrink-0",title:"Idle"})}})();return g.jsxs("div",{className:`group relative w-full text-left border-b border-gray-800/50 transition-colors cursor-pointer
43
+ ${W?"bg-blue-900/30 border-l-2 border-l-blue-500":"hover:bg-gray-800/50"}`,onClick:P,onDoubleClick:M,children:[g.jsxs("div",{className:"px-4 py-2.5",children:[n?g.jsx("input",{ref:f,value:a,onChange:z=>h(z.target.value),onBlur:A,onKeyDown:re,onClick:z=>z.stopPropagation(),className:"w-full text-sm bg-gray-800 text-gray-200 px-1.5 py-0.5 rounded border border-gray-600 outline-none focus:border-blue-500"}):g.jsxs("div",{className:"flex items-center gap-2",children:[Se,e.pinned&&g.jsx("svg",{className:"w-3 h-3 text-blue-400 flex-shrink-0",viewBox:"0 0 24 24",fill:"currentColor",children:g.jsx("path",{d:"M16 12V4h1V2H7v2h1v8l-2 2v2h5.2v6h1.6v-6H18v-2l-2-2z"})}),g.jsx("div",{className:"text-sm text-gray-300 truncate leading-snug flex-1",children:pe}),g.jsx("button",{onClick:z=>{z.stopPropagation(),_(!d)},className:"opacity-0 group-hover:opacity-100 text-gray-500 hover:text-gray-300 transition-opacity px-1 text-sm flex-shrink-0",children:"..."})]}),g.jsx("div",{className:"text-xs text-gray-500 mt-1 ml-4",children:c0(e.timestamp)})]}),d&&g.jsx(a0,{isArchived:i,isPinned:e.pinned,onRename:()=>{_(!1),h(e.displayName||e.lastMessage),l(!0)},onPin:()=>{_(!1),E(e.sessionId)},onAddTodo:se,onArchive:()=>{_(!1),i?I(e.sessionId):x(e.sessionId)},onDelete:()=>{_(!1),U(e.sessionId)},onClose:()=>_(!1)})]})}function u0(e){return e.split("/").filter(Boolean).slice(-2).join("/")}function rp({group:e,isArchived:t}){const i=Cr(_=>_.expandedSet),n=Cr(_=>_.archivedGroupExpanded),l=Cr(_=>_.toggleGroup),a=Cr(_=>_.toggleArchivedGroup),h=t?n.has(e.projectHash):i.has(e.projectHash),d=()=>{t?a(e.projectHash):l(e.projectHash)};return g.jsxs("div",{children:[g.jsxs("button",{onClick:d,className:`w-full flex items-center gap-2 px-3 py-2 bg-gray-850 hover:bg-gray-800
44
+ text-xs font-medium text-gray-400 uppercase tracking-wider border-b border-gray-800`,children:[g.jsx("span",{className:`transition-transform ${h?"rotate-90":""}`,children:"▶"}),g.jsx("span",{className:"truncate",children:u0(e.projectPath)}),g.jsx("span",{className:"ml-auto text-gray-600",children:e.sessions.length})]}),h&&g.jsx("div",{children:e.sessions.map(_=>g.jsx(h0,{session:_,projectHash:e.projectHash,isArchived:t},_.sessionId))})]})}function Vh({onPathChange:e}){const[t,i]=b.useState(""),[n,l]=b.useState(null),[a,h]=b.useState(!1),[d,_]=b.useState(null),[f,v]=b.useState([]),[y,w]=b.useState(!0),[S,k]=b.useState(null),[E,x]=b.useState(""),I=b.useRef(e);I.current=e;const U=b.useCallback(async P=>{w(!0),k(null);try{const M=await o0(P);i(M.currentPath),l(M.parentPath),h(M.isGitRepo),_(M.gitInfo||null),v(M.entries),x(M.currentPath),I.current(M.currentPath,M.isGitRepo);try{localStorage.setItem("claudit:lastBrowserPath",M.currentPath)}catch{}}catch(M){k(M.message)}finally{w(!1)}},[]);b.useEffect(()=>{const P=(()=>{try{return localStorage.getItem("claudit:lastBrowserPath")}catch{return null}})();U(P||void 0)},[U]);const W=()=>{E.trim()&&U(E.trim())};return g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsxs("div",{className:"flex gap-1",children:[g.jsx("input",{value:E,onChange:P=>x(P.target.value),onKeyDown:P=>{P.key==="Enter"&&W()},className:"flex-1 text-sm bg-gray-800 text-gray-200 px-2 py-1.5 rounded border border-gray-600 outline-none focus:border-blue-500 font-mono",placeholder:"/path/to/directory"}),g.jsx("button",{onClick:W,className:"text-xs px-3 py-1.5 rounded bg-gray-700 text-gray-300 hover:bg-gray-600",children:"Go"})]}),g.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400",children:[g.jsx("span",{className:"truncate font-mono",children:t}),d&&g.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 ml-auto text-orange-400",children:[g.jsx("span",{children:d.repoName}),g.jsx("span",{className:"text-gray-600",children:"/"}),g.jsx("span",{children:d.branch})]})]}),n&&g.jsx("button",{onClick:()=>U(n),className:"text-left text-xs text-blue-400 hover:text-blue-300 px-2 py-1",children:".. (parent directory)"}),g.jsxs("div",{className:"max-h-60 overflow-y-auto border border-gray-700 rounded",children:[y&&g.jsx("div",{className:"p-3 text-xs text-gray-500",children:"Loading..."}),S&&g.jsx("div",{className:"p-3 text-xs text-red-400",children:S}),!y&&!S&&f.length===0&&g.jsx("div",{className:"p-3 text-xs text-gray-500",children:"No subdirectories"}),!y&&!S&&f.map(P=>g.jsxs("button",{onClick:()=>U(P.path),className:"w-full text-left px-3 py-1.5 text-sm text-gray-300 hover:bg-gray-800 flex items-center gap-2 border-b border-gray-800/50 last:border-b-0",children:[g.jsx("span",{className:"text-gray-500 text-xs",children:"📁"}),g.jsx("span",{className:"truncate",children:P.name}),P.gitInfo&&g.jsx("span",{className:"ml-auto flex-shrink-0 text-[10px] text-gray-500 bg-gray-800 px-1.5 py-0.5 rounded",children:P.gitInfo.branch})]},P.path))]})]})}function qh({onClose:e,onCreate:t}){const[i,n]=b.useState(null),[l,a]=b.useState(!1),[h,d]=b.useState(!1),[_,f]=b.useState(""),v=b.useCallback((w,S)=>{n(w),a(S),S||(d(!1),f(""))},[]),y=()=>{if(!i)return;const w=h&&_.trim()?{branchName:_.trim()}:void 0;t(i,w)};return g.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center",onClick:e,children:g.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-lg p-6 w-[480px] max-h-[80vh] overflow-y-auto",onClick:w=>w.stopPropagation(),children:[g.jsx("h2",{className:"text-sm font-semibold text-gray-200 mb-4",children:"New Session"}),g.jsx(Vh,{onPathChange:v}),l&&g.jsxs("div",{className:"mt-3 p-2 bg-gray-800/50 rounded border border-gray-700",children:[g.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-400 cursor-pointer",children:[g.jsx("input",{type:"checkbox",checked:h,onChange:w=>d(w.target.checked),className:"rounded bg-gray-800 border-gray-600"}),"Create git worktree"]}),h&&g.jsx("input",{value:_,onChange:w=>f(w.target.value),placeholder:"Branch name...",autoFocus:!0,className:"mt-2 w-full text-sm bg-gray-800 text-gray-200 px-3 py-1.5 rounded border border-gray-600 outline-none focus:border-blue-500"})]}),g.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[g.jsx("button",{onClick:e,className:"text-xs px-3 py-1.5 rounded bg-gray-700 text-gray-300 hover:bg-gray-600",children:"Cancel"}),g.jsx("button",{onClick:y,disabled:!i||h&&!_.trim(),className:"text-xs px-3 py-1.5 rounded bg-blue-600 text-white hover:bg-blue-500 disabled:opacity-50",children:"Create"})]})]})})}function d0(){const{groups:e,archivedGroups:t,archivedCount:i,query:n,managedOnly:l,loading:a,error:h,expandedSet:d,creating:_,archivedExpanded:f,fetchSessions:v,fetchArchived:y,createSession:w,toggleAllGroups:S,setQuery:k,setManagedOnly:E,setArchivedExpanded:x}=Cr(),I=Oe(A=>A.showNewModal),U=Oe(A=>A.setShowNewModal),W=Oe(A=>A.selectSession);b.useEffect(()=>{v(),y()},[v,y]),b.useEffect(()=>{const A=setTimeout(()=>{v(n||void 0)},300);return()=>clearTimeout(A)},[n,v,l]);const P=async(A,re)=>{U(!1);const se=await w(A,{worktree:re});se&&W(se.projectHash,se.sessionId,se.projectPath)},M=e.length>0&&e.every(A=>d.has(A.projectHash));return g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsxs("div",{className:"px-4 py-3 border-b border-gray-800",children:[g.jsxs("div",{className:"flex items-center justify-between mb-2",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("h1",{className:"text-sm font-semibold text-gray-200",children:"Claude Sessions"}),g.jsx("button",{onClick:S,title:M?"Collapse all":"Expand all",className:"text-gray-500 hover:text-gray-300 transition-colors p-0.5",children:g.jsx("span",{className:`inline-block text-xs transition-transform ${M?"rotate-90":""}`,children:"▶"})})]}),g.jsx("button",{onClick:()=>U(!0),disabled:_,className:"text-xs px-2 py-1 rounded bg-blue-600 hover:bg-blue-500 disabled:opacity-50 text-white transition-colors",children:_?"...":"+ New"})]}),g.jsxs("div",{className:"flex rounded-md overflow-hidden border border-gray-700 text-xs",children:[g.jsx("button",{onClick:()=>E(!1),className:`flex-1 px-3 py-1 transition-colors ${l?"bg-transparent text-gray-500 hover:text-gray-300":"bg-gray-700 text-gray-200"}`,children:"All"}),g.jsx("button",{onClick:()=>E(!0),className:`flex-1 px-3 py-1 transition-colors ${l?"bg-gray-700 text-gray-200":"bg-transparent text-gray-500 hover:text-gray-300"}`,children:"Manager"})]})]}),g.jsx(l0,{value:n,onChange:k}),g.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a&&g.jsx("div",{className:"p-4 text-sm text-gray-500",children:"Loading sessions..."}),h&&g.jsx("div",{className:"p-4 text-sm text-red-400",children:h}),!a&&!h&&e.length===0&&i===0&&g.jsx("div",{className:"p-4 text-sm text-gray-500",children:"No sessions found"}),e.map(A=>g.jsx(rp,{group:A},A.projectHash)),i>0&&g.jsxs("div",{className:"border-t border-gray-800 mt-2",children:[g.jsxs("button",{onClick:()=>x(!f),className:`w-full flex items-center gap-2 px-3 py-2 hover:bg-gray-800
45
+ text-xs font-medium text-gray-500 border-b border-gray-800`,children:[g.jsx("span",{className:`transition-transform ${f?"rotate-90":""}`,children:"▶"}),g.jsxs("span",{children:["Archived (",i,")"]})]}),f&&t.map(A=>g.jsx(rp,{group:A,isArchived:!0},`archived-${A.projectHash}`))]})]}),I&&g.jsx(qh,{onClose:()=>U(!1),onCreate:P})]})}function k_(){return g.jsx("div",{className:"flex-1 flex items-center justify-center text-gray-500",children:g.jsxs("div",{className:"text-center",children:[g.jsx("div",{className:"text-4xl mb-4",children:"💬"}),g.jsx("p",{className:"text-lg",children:"Select a session to view"}),g.jsx("p",{className:"text-sm mt-1",children:"Choose a conversation from the left panel"})]})})}/**
46
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
47
+ * @license MIT
48
+ *
49
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
50
+ * @license MIT
51
+ *
52
+ * Originally forked from (with the author's permission):
53
+ * Fabrice Bellard's javascript vt100 for jslinux:
54
+ * http://bellard.org/jslinux/
55
+ * Copyright (c) 2011 Fabrice Bellard
56
+ */var E_=Object.defineProperty,f0=Object.getOwnPropertyDescriptor,p0=(e,t)=>{for(var i in t)E_(e,i,{get:t[i],enumerable:!0})},tt=(e,t,i,n)=>{for(var l=n>1?void 0:n?f0(t,i):t,a=e.length-1,h;a>=0;a--)(h=e[a])&&(l=(n?h(t,i,l):h(l))||l);return n&&l&&E_(t,i,l),l},ne=(e,t)=>(i,n)=>t(i,n,e),ip="Terminal input",ih={get:()=>ip,set:e=>ip=e},sp="Too much output to announce, navigate to rows manually to read",sh={get:()=>sp,set:e=>sp=e};function _0(e){return e.replace(/\r?\n/g,"\r")}function g0(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function m0(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function v0(e,t,i,n){if(e.stopPropagation(),e.clipboardData){let l=e.clipboardData.getData("text/plain");N_(l,t,i,n)}}function N_(e,t,i,n){e=_0(e),e=g0(e,i.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function D_(e,t,i){let n=i.getBoundingClientRect(),l=e.clientX-n.left-10,a=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${l}px`,t.style.top=`${a}px`,t.style.zIndex="1000",t.focus()}function np(e,t,i,n,l){D_(e,t,i),l&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function Wi(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Vl(e,t=0,i=e.length){let n="";for(let l=t;l<i;++l){let a=e[l];a>65535?(a-=65536,n+=String.fromCharCode((a>>10)+55296)+String.fromCharCode(a%1024+56320)):n+=String.fromCharCode(a)}return n}var y0=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let n=0,l=0;if(this._interim){let a=e.charCodeAt(l++);56320<=a&&a<=57343?t[n++]=(this._interim-55296)*1024+a-56320+65536:(t[n++]=this._interim,t[n++]=a),this._interim=0}for(let a=l;a<i;++a){let h=e.charCodeAt(a);if(55296<=h&&h<=56319){if(++a>=i)return this._interim=h,n;let d=e.charCodeAt(a);56320<=d&&d<=57343?t[n++]=(h-55296)*1024+d-56320+65536:(t[n++]=h,t[n++]=d);continue}h!==65279&&(t[n++]=h)}return n}},S0=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let n=0,l,a,h,d,_=0,f=0;if(this.interim[0]){let w=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let k=0,E;for(;(E=this.interim[++k]&63)&&k<4;)S<<=6,S|=E;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,I=x-k;for(;f<I;){if(f>=i)return 0;if(E=e[f++],(E&192)!==128){f--,w=!0;break}else this.interim[k++]=E,S<<=6,S|=E&63}w||(x===2?S<128?f--:t[n++]=S:x===3?S<2048||S>=55296&&S<=57343||S===65279||(t[n++]=S):S<65536||S>1114111||(t[n++]=S)),this.interim.fill(0)}let v=i-4,y=f;for(;y<i;){for(;y<v&&!((l=e[y])&128)&&!((a=e[y+1])&128)&&!((h=e[y+2])&128)&&!((d=e[y+3])&128);)t[n++]=l,t[n++]=a,t[n++]=h,t[n++]=d,y+=4;if(l=e[y++],l<128)t[n++]=l;else if((l&224)===192){if(y>=i)return this.interim[0]=l,n;if(a=e[y++],(a&192)!==128){y--;continue}if(_=(l&31)<<6|a&63,_<128){y--;continue}t[n++]=_}else if((l&240)===224){if(y>=i)return this.interim[0]=l,n;if(a=e[y++],(a&192)!==128){y--;continue}if(y>=i)return this.interim[0]=l,this.interim[1]=a,n;if(h=e[y++],(h&192)!==128){y--;continue}if(_=(l&15)<<12|(a&63)<<6|h&63,_<2048||_>=55296&&_<=57343||_===65279)continue;t[n++]=_}else if((l&248)===240){if(y>=i)return this.interim[0]=l,n;if(a=e[y++],(a&192)!==128){y--;continue}if(y>=i)return this.interim[0]=l,this.interim[1]=a,n;if(h=e[y++],(h&192)!==128){y--;continue}if(y>=i)return this.interim[0]=l,this.interim[1]=a,this.interim[2]=h,n;if(d=e[y++],(d&192)!==128){y--;continue}if(_=(l&7)<<18|(a&63)<<12|(h&63)<<6|d&63,_<65536||_>1114111)continue;t[n++]=_}}return n}},R_="",Ui=" ",ro=class P_{constructor(){this.fg=0,this.bg=0,this.extended=new Bl}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 P_;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}},Bl=class T_{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}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 T_(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},kr=class M_ extends ro{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Bl,this.combinedData=""}static fromCharData(t){let i=new M_;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Wi(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 i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let l=t[1].charCodeAt(1);56320<=l&&l<=57343?this.content=(n-55296)*1024+l-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},op="di$target",nh="di$dependencies",jc=new Map;function w0(e){return e[nh]||[]}function Et(e){if(jc.has(e))return jc.get(e);let t=function(i,n,l){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");x0(t,i,l)};return t._id=e,jc.set(e,t),t}function x0(e,t,i){t[op]===t?t[nh].push({id:e,index:i}):(t[nh]=[{id:e,index:i}],t[op]=t)}var Yt=Et("BufferService"),L_=Et("CoreMouseService"),fs=Et("CoreService"),b0=Et("CharsetService"),Yh=Et("InstantiationService"),B_=Et("LogService"),Gt=Et("OptionsService"),I_=Et("OscLinkService"),C0=Et("UnicodeService"),io=Et("DecorationService"),oh=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var v;let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let n=[],l=this._optionsService.rawOptions.linkHandler,a=new kr,h=i.getTrimmedLength(),d=-1,_=-1,f=!1;for(let y=0;y<h;y++)if(!(_===-1&&!i.hasContent(y))){if(i.loadCell(y,a),a.hasExtendedAttrs()&&a.extended.urlId)if(_===-1){_=y,d=a.extended.urlId;continue}else f=a.extended.urlId!==d;else _!==-1&&(f=!0);if(f||_!==-1&&y===h-1){let w=(v=this._oscLinkService.getLinkData(d))==null?void 0:v.uri;if(w){let S={start:{x:_+1,y:e},end:{x:y+(!f&&y===h-1?1:0),y:e}},k=!1;if(!(l!=null&&l.allowNonHttpProtocols))try{let E=new URL(w);["http:","https:"].includes(E.protocol)||(k=!0)}catch{k=!0}k||n.push({text:w,range:S,activate:(E,x)=>l?l.activate(E,x,S):k0(E,x),hover:(E,x)=>{var I;return(I=l==null?void 0:l.hover)==null?void 0:I.call(l,E,x,S)},leave:(E,x)=>{var I;return(I=l==null?void 0:l.leave)==null?void 0:I.call(l,E,x,S)}})}f=!1,a.hasExtendedAttrs()&&a.extended.urlId?(_=y,d=a.extended.urlId):(_=-1,d=-1)}}t(n)}};oh=tt([ne(0,Yt),ne(1,Gt),ne(2,I_)],oh);function k0(e,t){if(confirm(`Do you want to navigate to ${t}?
57
+
58
+ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var ql=Et("CharSizeService"),mi=Et("CoreBrowserService"),Gh=Et("MouseService"),vi=Et("RenderService"),E0=Et("SelectionService"),O_=Et("CharacterJoinerService"),$s=Et("ThemeService"),A_=Et("LinkProviderService"),N0=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?lp.isErrorNoTelemetry(e)?new lp(e.message+`
59
+
60
+ `+e.stack):new Error(e.message+`
61
+
62
+ `+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)}},D0=new N0;function Cl(e){R0(e)||D0.onUnexpectedError(e)}var lh="Canceled";function R0(e){return e instanceof P0?!0:e instanceof Error&&e.name===lh&&e.message===lh}var P0=class extends Error{constructor(){super(lh),this.name=this.message}};function T0(e){return new Error(`Illegal argument: ${e}`)}var lp=class ah extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof ah)return t;let i=new ah;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},ch=class j_ extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,j_.prototype)}};function hr(e,t=0){return e[e.length-(1+t)]}var M0;(e=>{function t(a){return a<0}e.isLessThan=t;function i(a){return a<=0}e.isLessThanOrEqual=i;function n(a){return a>0}e.isGreaterThan=n;function l(a){return a===0}e.isNeitherLessOrGreaterThan=l,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(M0||(M0={}));function L0(e,t){let i=this,n=!1,l;return function(){return n||(n=!0,t||(l=e.apply(i,arguments))),l}}var z_;(e=>{function t(P){return P&&typeof P=="object"&&typeof P[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function n(){return i}e.empty=n;function*l(P){yield P}e.single=l;function a(P){return t(P)?P:l(P)}e.wrap=a;function h(P){return P||i}e.from=h;function*d(P){for(let M=P.length-1;M>=0;M--)yield P[M]}e.reverse=d;function _(P){return!P||P[Symbol.iterator]().next().done===!0}e.isEmpty=_;function f(P){return P[Symbol.iterator]().next().value}e.first=f;function v(P,M){let A=0;for(let re of P)if(M(re,A++))return!0;return!1}e.some=v;function y(P,M){for(let A of P)if(M(A))return A}e.find=y;function*w(P,M){for(let A of P)M(A)&&(yield A)}e.filter=w;function*S(P,M){let A=0;for(let re of P)yield M(re,A++)}e.map=S;function*k(P,M){let A=0;for(let re of P)yield*M(re,A++)}e.flatMap=k;function*E(...P){for(let M of P)yield*M}e.concat=E;function x(P,M,A){let re=A;for(let se of P)re=M(re,se);return re}e.reduce=x;function*I(P,M,A=P.length){for(M<0&&(M+=P.length),A<0?A+=P.length:A>P.length&&(A=P.length);M<A;M++)yield P[M]}e.slice=I;function U(P,M=Number.POSITIVE_INFINITY){let A=[];if(M===0)return[A,P];let re=P[Symbol.iterator]();for(let se=0;se<M;se++){let pe=re.next();if(pe.done)return[A,e.empty()];A.push(pe.value)}return[A,{[Symbol.iterator](){return re}}]}e.consume=U;async function W(P){let M=[];for await(let A of P)M.push(A);return Promise.resolve(M)}e.asyncToArray=W})(z_||(z_={}));function us(e){if(z_.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(n){t.push(n)}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 B0(...e){return Ve(()=>us(e))}function Ve(e){return{dispose:L0(()=>{e()})}}var F_=class H_{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{us(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?H_.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)}};F_.DISABLE_DISPOSED_WARNING=!1;var Ki=F_,Pe=class{constructor(){this._store=new Ki,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)}};Pe.None=Object.freeze({dispose(){}});var Ws=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}},gi=typeof window=="object"?window:globalThis,hh=class uh{constructor(t){this.element=t,this.next=uh.Undefined,this.prev=uh.Undefined}};hh.Undefined=new hh(void 0);var Je=hh,ap=class{constructor(){this._first=Je.Undefined,this._last=Je.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Je.Undefined}clear(){let e=this._first;for(;e!==Je.Undefined;){let t=e.next;e.prev=Je.Undefined,e.next=Je.Undefined,e=t}this._first=Je.Undefined,this._last=Je.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new Je(e);if(this._first===Je.Undefined)this._first=i,this._last=i;else if(t){let l=this._last;this._last=i,i.prev=l,l.next=i}else{let l=this._first;this._first=i,i.next=l,l.prev=i}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(i))}}shift(){if(this._first!==Je.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Je.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Je.Undefined&&e.next!==Je.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Je.Undefined&&e.next===Je.Undefined?(this._first=Je.Undefined,this._last=Je.Undefined):e.next===Je.Undefined?(this._last=this._last.prev,this._last.next=Je.Undefined):e.prev===Je.Undefined&&(this._first=this._first.next,this._first.prev=Je.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Je.Undefined;)yield e.element,e=e.next}},I0=globalThis.performance&&typeof globalThis.performance.now=="function",O0=class W_{static create(t){return new W_(t)}constructor(t){this._now=I0&&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}},Lt;(e=>{e.None=()=>Pe.None;function t(q,j){return y(q,()=>{},0,void 0,!0,void 0,j)}e.defer=t;function i(q){return(j,G=null,X)=>{let ee=!1,ie;return ie=q(B=>{if(!ee)return ie?ie.dispose():ee=!0,j.call(G,B)},null,X),ee&&ie.dispose(),ie}}e.once=i;function n(q,j,G){return f((X,ee=null,ie)=>q(B=>X.call(ee,j(B)),null,ie),G)}e.map=n;function l(q,j,G){return f((X,ee=null,ie)=>q(B=>{j(B),X.call(ee,B)},null,ie),G)}e.forEach=l;function a(q,j,G){return f((X,ee=null,ie)=>q(B=>j(B)&&X.call(ee,B),null,ie),G)}e.filter=a;function h(q){return q}e.signal=h;function d(...q){return(j,G=null,X)=>{let ee=B0(...q.map(ie=>ie(B=>j.call(G,B))));return v(ee,X)}}e.any=d;function _(q,j,G,X){let ee=G;return n(q,ie=>(ee=j(ee,ie),ee),X)}e.reduce=_;function f(q,j){let G,X={onWillAddFirstListener(){G=q(ee.fire,ee)},onDidRemoveLastListener(){G==null||G.dispose()}},ee=new te(X);return j==null||j.add(ee),ee.event}function v(q,j){return j instanceof Array?j.push(q):j&&j.add(q),q}function y(q,j,G=100,X=!1,ee=!1,ie,B){let Q,J,R,F=0,ae,le={leakWarningThreshold:ie,onWillAddFirstListener(){Q=q(ue=>{F++,J=j(J,ue),X&&!R&&(_e.fire(J),J=void 0),ae=()=>{let De=J;J=void 0,R=void 0,(!X||F>1)&&_e.fire(De),F=0},typeof G=="number"?(clearTimeout(R),R=setTimeout(ae,G)):R===void 0&&(R=0,queueMicrotask(ae))})},onWillRemoveListener(){ee&&F>0&&(ae==null||ae())},onDidRemoveLastListener(){ae=void 0,Q.dispose()}},_e=new te(le);return B==null||B.add(_e),_e.event}e.debounce=y;function w(q,j=0,G){return e.debounce(q,(X,ee)=>X?(X.push(ee),X):[ee],j,void 0,!0,void 0,G)}e.accumulate=w;function S(q,j=(X,ee)=>X===ee,G){let X=!0,ee;return a(q,ie=>{let B=X||!j(ie,ee);return X=!1,ee=ie,B},G)}e.latch=S;function k(q,j,G){return[e.filter(q,j,G),e.filter(q,X=>!j(X),G)]}e.split=k;function E(q,j=!1,G=[],X){let ee=G.slice(),ie=q(J=>{ee?ee.push(J):Q.fire(J)});X&&X.add(ie);let B=()=>{ee==null||ee.forEach(J=>Q.fire(J)),ee=null},Q=new te({onWillAddFirstListener(){ie||(ie=q(J=>Q.fire(J)),X&&X.add(ie))},onDidAddFirstListener(){ee&&(j?setTimeout(B):B())},onDidRemoveLastListener(){ie&&ie.dispose(),ie=null}});return X&&X.add(Q),Q.event}e.buffer=E;function x(q,j){return(G,X,ee)=>{let ie=j(new U);return q(function(B){let Q=ie.evaluate(B);Q!==I&&G.call(X,Q)},void 0,ee)}}e.chain=x;let I=Symbol("HaltChainable");class U{constructor(){this.steps=[]}map(j){return this.steps.push(j),this}forEach(j){return this.steps.push(G=>(j(G),G)),this}filter(j){return this.steps.push(G=>j(G)?G:I),this}reduce(j,G){let X=G;return this.steps.push(ee=>(X=j(X,ee),X)),this}latch(j=(G,X)=>G===X){let G=!0,X;return this.steps.push(ee=>{let ie=G||!j(ee,X);return G=!1,X=ee,ie?ee:I}),this}evaluate(j){for(let G of this.steps)if(j=G(j),j===I)break;return j}}function W(q,j,G=X=>X){let X=(...Q)=>B.fire(G(...Q)),ee=()=>q.on(j,X),ie=()=>q.removeListener(j,X),B=new te({onWillAddFirstListener:ee,onDidRemoveLastListener:ie});return B.event}e.fromNodeEventEmitter=W;function P(q,j,G=X=>X){let X=(...Q)=>B.fire(G(...Q)),ee=()=>q.addEventListener(j,X),ie=()=>q.removeEventListener(j,X),B=new te({onWillAddFirstListener:ee,onDidRemoveLastListener:ie});return B.event}e.fromDOMEventEmitter=P;function M(q){return new Promise(j=>i(q)(j))}e.toPromise=M;function A(q){let j=new te;return q.then(G=>{j.fire(G)},()=>{j.fire(void 0)}).finally(()=>{j.dispose()}),j.event}e.fromPromise=A;function re(q,j){return q(G=>j.fire(G))}e.forward=re;function se(q,j,G){return j(G),q(X=>j(X))}e.runAndSubscribe=se;class pe{constructor(j,G){this._observable=j,this._counter=0,this._hasChanged=!1;let X={onWillAddFirstListener:()=>{j.addObserver(this)},onDidRemoveLastListener:()=>{j.removeObserver(this)}};this.emitter=new te(X),G&&G.add(this.emitter)}beginUpdate(j){this._counter++}handlePossibleChange(j){}handleChange(j,G){this._hasChanged=!0}endUpdate(j){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Se(q,j){return new pe(q,j).emitter.event}e.fromObservable=Se;function z(q){return(j,G,X)=>{let ee=0,ie=!1,B={beginUpdate(){ee++},endUpdate(){ee--,ee===0&&(q.reportChanges(),ie&&(ie=!1,j.call(G)))},handlePossibleChange(){},handleChange(){ie=!0}};q.addObserver(B),q.reportChanges();let Q={dispose(){q.removeObserver(B)}};return X instanceof Ki?X.add(Q):Array.isArray(X)&&X.push(Q),Q}}e.fromObservableLight=z})(Lt||(Lt={}));var dh=class fh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${fh._idPool++}`,fh.all.add(this)}start(t){this._stopWatch=new O0,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}}};dh.all=new Set,dh._idPool=0;var A0=dh,j0=-1,$_=class U_{constructor(t,i,n=(U_._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=n,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,i){let n=this.threshold;if(n<=0||i<n)return;this._stacks||(this._stacks=new Map);let l=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,l+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[a,h]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${h}):`;console.warn(d),console.warn(a);let _=new H0(d,a);this._errorHandler(_)}return()=>{let a=this._stacks.get(t.value)||0;this._stacks.set(t.value,a-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[n,l]of this._stacks)(!t||i<l)&&(t=[n,l],i=l);return t}};$_._idPool=1;var z0=$_,F0=class K_{constructor(t){this.value=t}static create(){let t=new Error;return new K_(t.stack??"")}print(){console.warn(this.value.split(`
63
+ `).slice(2).join(`
64
+ `))}},H0=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},W0=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},$0=0,zc=class{constructor(e){this.value=e,this.id=$0++}},U0=2,K0,te=class{constructor(t){var i,n,l,a;this._size=0,this._options=t,this._leakageMon=(i=this._options)!=null&&i.leakWarningThreshold?new z0((t==null?void 0:t.onListenerError)??Cl,((n=this._options)==null?void 0:n.leakWarningThreshold)??j0):void 0,this._perfMon=(l=this._options)!=null&&l._profName?new A0(this._options._profName):void 0,this._deliveryQueue=(a=this._options)==null?void 0:a.deliveryQueue}dispose(){var t,i,n,l;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(i=this._options)==null?void 0:i.onDidRemoveLastListener)==null||n.call(i),(l=this._leakageMon)==null||l.dispose())}get event(){return this._event??(this._event=(t,i,n)=>{var d,_,f,v,y;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let w=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(w);let S=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],k=new W0(`${w}. HINT: Stack shows most frequent listener (${S[1]}-times)`,S[0]);return(((d=this._options)==null?void 0:d.onListenerError)||Cl)(k),Pe.None}if(this._disposed)return Pe.None;i&&(t=t.bind(i));let l=new zc(t),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(l.stack=F0.create(),a=this._leakageMon.check(l.stack,this._size+1)),this._listeners?this._listeners instanceof zc?(this._deliveryQueue??(this._deliveryQueue=new V0),this._listeners=[this._listeners,l]):this._listeners.push(l):((f=(_=this._options)==null?void 0:_.onWillAddFirstListener)==null||f.call(_,this),this._listeners=l,(y=(v=this._options)==null?void 0:v.onDidAddFirstListener)==null||y.call(v,this)),this._size++;let h=Ve(()=>{a==null||a(),this._removeListener(l)});return n instanceof Ki?n.add(h):Array.isArray(n)&&n.push(h),h}),this._event}_removeListener(t){var a,h,d,_;if((h=(a=this._options)==null?void 0:a.onWillRemoveListener)==null||h.call(a,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(_=(d=this._options)==null?void 0:d.onDidRemoveLastListener)==null||_.call(d,this),this._size=0;return}let i=this._listeners,n=i.indexOf(t);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--,i[n]=void 0;let l=this._deliveryQueue.current===this;if(this._size*U0<=i.length){let f=0;for(let v=0;v<i.length;v++)i[v]?i[f++]=i[v]:l&&(this._deliveryQueue.end--,f<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=f}}_deliver(t,i){var l;if(!t)return;let n=((l=this._options)==null?void 0:l.onListenerError)||Cl;if(!n){t.value(i);return}try{t.value(i)}catch(a){n(a)}}_deliverQueue(t){let i=t.current._listeners;for(;t.i<t.end;)this._deliver(i[t.i++],t.value);t.reset()}fire(t){var i,n,l,a;if((i=this._deliveryQueue)!=null&&i.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(l=this._perfMon)==null||l.start(this._size),this._listeners)if(this._listeners instanceof zc)this._deliver(this._listeners,t);else{let h=this._deliveryQueue;h.enqueue(this,t,this._listeners.length),this._deliverQueue(h)}(a=this._perfMon)==null||a.stop()}hasListeners(){return this._size>0}},V0=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ph=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new te,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new te,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};ph.INSTANCE=new ph;var Xh=ph;function q0(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}Xh.INSTANCE.onDidChangeZoomLevel;function Y0(e){return Xh.INSTANCE.getZoomFactor(e)}Xh.INSTANCE.onDidChangeFullscreen;var Us=typeof navigator=="object"?navigator.userAgent:"",_h=Us.indexOf("Firefox")>=0,G0=Us.indexOf("AppleWebKit")>=0,Jh=Us.indexOf("Chrome")>=0,X0=!Jh&&Us.indexOf("Safari")>=0;Us.indexOf("Electron/")>=0;Us.indexOf("Android")>=0;var Fc=!1;if(typeof gi.matchMedia=="function"){let e=gi.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=gi.matchMedia("(display-mode: fullscreen)");Fc=e.matches,q0(gi,e,({matches:i})=>{Fc&&t.matches||(Fc=i)})}var Fs="en",gh=!1,mh=!1,kl=!1,V_=!1,gl,El=Fs,cp=Fs,J0,jr,hs=globalThis,Mt,__;typeof hs.vscode<"u"&&typeof hs.vscode.process<"u"?Mt=hs.vscode.process:typeof process<"u"&&typeof((__=process==null?void 0:process.versions)==null?void 0:__.node)=="string"&&(Mt=process);var g_,Q0=typeof((g_=Mt==null?void 0:Mt.versions)==null?void 0:g_.electron)=="string",Z0=Q0&&(Mt==null?void 0:Mt.type)==="renderer",m_;if(typeof Mt=="object"){gh=Mt.platform==="win32",mh=Mt.platform==="darwin",kl=Mt.platform==="linux",kl&&Mt.env.SNAP&&Mt.env.SNAP_REVISION,Mt.env.CI||Mt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,gl=Fs,El=Fs;let e=Mt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);gl=t.userLocale,cp=t.osLocale,El=t.resolvedLanguage||Fs,J0=(m_=t.languagePack)==null?void 0:m_.translationsConfigFile}catch{}V_=!0}else typeof navigator=="object"&&!Z0?(jr=navigator.userAgent,gh=jr.indexOf("Windows")>=0,mh=jr.indexOf("Macintosh")>=0,(jr.indexOf("Macintosh")>=0||jr.indexOf("iPad")>=0||jr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,kl=jr.indexOf("Linux")>=0,(jr==null?void 0:jr.indexOf("Mobi"))>=0,El=globalThis._VSCODE_NLS_LANGUAGE||Fs,gl=navigator.language.toLowerCase(),cp=gl):console.error("Unable to resolve platform.");var q_=gh,ei=mh,ey=kl,hp=V_,ti=jr,zi=El,ty;(e=>{function t(){return zi}e.value=t;function i(){return zi.length===2?zi==="en":zi.length>=3?zi[0]==="e"&&zi[1]==="n"&&zi[2]==="-":!1}e.isDefaultVariant=i;function n(){return zi==="en"}e.isDefault=n})(ty||(ty={}));var ry=typeof hs.postMessage=="function"&&!hs.importScripts;(()=>{if(ry){let e=[];hs.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,l=e.length;n<l;n++){let a=e[n];if(a.id===i.data.vscodeScheduleAsyncWork){e.splice(n,1),a.callback();return}}});let t=0;return i=>{let n=++t;e.push({id:n,callback:i}),hs.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var iy=!!(ti&&ti.indexOf("Chrome")>=0);ti&&ti.indexOf("Firefox")>=0;!iy&&ti&&ti.indexOf("Safari")>=0;ti&&ti.indexOf("Edg/")>=0;ti&&ti.indexOf("Android")>=0;var js=typeof navigator=="object"?navigator:{};hp||document.queryCommandSupported&&document.queryCommandSupported("copy")||js&&js.clipboard&&js.clipboard.writeText,hp||js&&js.clipboard&&js.clipboard.readText;var Qh=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}},Hc=new Qh,up=new Qh,dp=new Qh,sy=new Array(230),Y_;(e=>{function t(d){return Hc.keyCodeToStr(d)}e.toString=t;function i(d){return Hc.strToKeyCode(d)}e.fromString=i;function n(d){return up.keyCodeToStr(d)}e.toUserSettingsUS=n;function l(d){return dp.keyCodeToStr(d)}e.toUserSettingsGeneral=l;function a(d){return up.strToKeyCode(d)||dp.strToKeyCode(d)}e.fromUserSettings=a;function h(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Hc.keyCodeToStr(d)}e.toElectronAccelerator=h})(Y_||(Y_={}));var ny=class G_{constructor(t,i,n,l,a){this.ctrlKey=t,this.shiftKey=i,this.altKey=n,this.metaKey=l,this.keyCode=a}equals(t){return t instanceof G_&&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",i=this.shiftKey?"1":"0",n=this.altKey?"1":"0",l=this.metaKey?"1":"0";return`K${t}${i}${n}${l}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new oy([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},oy=class{constructor(e){if(e.length===0)throw T0("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;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 ly(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return Y_.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(_h)switch(t){case 59:return 85;case 60:if(ey)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ei)return 57;break}else if(G0&&(ei&&t===93||!ei&&t===92))return 57;return sy[t]||0}var ay=ei?256:2048,cy=512,hy=1024,uy=ei?2048:256,fp=class{constructor(e){var i;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=(i=t.getModifierState)==null?void 0:i.call(t,"AltGraph"),this.keyCode=ly(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|=ay),this.altKey&&(t|=cy),this.shiftKey&&(t|=hy),this.metaKey&&(t|=uy),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new ny(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},pp=new WeakMap;function dy(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var fy=class{static getSameOriginWindowChain(e){let t=pp.get(e);if(!t){t=[],pp.set(e,t);let i=e,n;do n=dy(i),n?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=n;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,n=0,l=this.getSameOriginWindowChain(e);for(let a of l){let h=a.window.deref();if(i+=(h==null?void 0:h.scrollY)??0,n+=(h==null?void 0:h.scrollX)??0,h===t||!a.iframeElement)break;let d=a.iframeElement.getBoundingClientRect();i+=d.top,n+=d.left}return{top:i,left:n}}},ml=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 i=fy.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},_p=class{constructor(e,t=0,i=0){var l;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let n=!1;if(Jh){let a=navigator.userAgent.match(/Chrome\/(\d+)/);n=(a?parseInt(a[1]):123)<=122}if(e){let a=e,h=e,d=((l=e.view)==null?void 0:l.devicePixelRatio)||1;if(typeof a.wheelDeltaY<"u")n?this.deltaY=a.wheelDeltaY/(120*d):this.deltaY=a.wheelDeltaY/120;else if(typeof h.VERTICAL_AXIS<"u"&&h.axis===h.VERTICAL_AXIS)this.deltaY=-h.detail/3;else if(e.type==="wheel"){let _=e;_.deltaMode===_.DOM_DELTA_LINE?_h&&!ei?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")X0&&q_?this.deltaX=-(a.wheelDeltaX/120):n?this.deltaX=a.wheelDeltaX/(120*d):this.deltaX=a.wheelDeltaX/120;else if(typeof h.HORIZONTAL_AXIS<"u"&&h.axis===h.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let _=e;_.deltaMode===_.DOM_DELTA_LINE?_h&&!ei?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},X_=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),py;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof _y?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Lt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:X_})})(py||(py={}));var _y=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?X_:(this._emitter||(this._emitter=new te),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Zh=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 ch("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new ch("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},gy=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,i=globalThis){if(this.isDisposed)throw new ch("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=i.setInterval(()=>{e()},t);this.disposable=Ve(()=>{i.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},my;(e=>{async function t(n){let l,a=await Promise.all(n.map(h=>h.then(d=>d,d=>{l||(l=d)})));if(typeof l<"u")throw l;return a}e.settled=t;function i(n){return new Promise(async(l,a)=>{try{await n(l,a)}catch(h){a(h)}})}e.withAsyncBody=i})(my||(my={}));var gp=class wr{static fromArray(t){return new wr(i=>{i.emitMany(t)})}static fromPromise(t){return new wr(async i=>{i.emitMany(await t)})}static fromPromises(t){return new wr(async i=>{await Promise.all(t.map(async n=>i.emitOne(await n)))})}static merge(t){return new wr(async i=>{await Promise.all(t.map(async n=>{for await(let l of n)i.emitOne(l)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new te,queueMicrotask(async()=>{let n={emitOne:l=>this.emitOne(l),emitMany:l=>this.emitMany(l),reject:l=>this.reject(l)};try{await Promise.resolve(t(n)),this.resolve()}catch(l){this.reject(l)}finally{n.emitOne=void 0,n.emitMany=void 0,n.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 Lt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(t,i){return new wr(async n=>{for await(let l of t)n.emitOne(i(l))})}map(t){return wr.map(this,t)}static filter(t,i){return new wr(async n=>{for await(let l of t)i(l)&&n.emitOne(l)})}filter(t){return wr.filter(this,t)}static coalesce(t){return wr.filter(t,i=>!!i)}coalesce(){return wr.coalesce(this)}static async toPromise(t){let i=[];for await(let n of t)i.push(n);return i}toPromise(){return wr.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())}};gp.EMPTY=gp.fromArray([]);var{getWindow:Zr,getWindowId:vy,onDidRegisterWindow:yy}=(function(){let e=new Map,t={window:gi,disposables:new Ki};e.set(gi.vscodeWindowId,t);let i=new te,n=new te,l=new te;function a(h,d){return(typeof h=="number"?e.get(h):void 0)??(d?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:l.event,onDidUnregisterWindow:n.event,registerWindow(h){if(e.has(h.vscodeWindowId))return Pe.None;let d=new Ki,_={window:h,disposables:d.add(new Ki)};return e.set(h.vscodeWindowId,_),d.add(Ve(()=>{e.delete(h.vscodeWindowId),n.fire(h)})),d.add(Ce(h,wt.BEFORE_UNLOAD,()=>{l.fire(h)})),i.fire(_),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(h){return h.vscodeWindowId},hasWindow(h){return e.has(h)},getWindowById:a,getWindow(h){var f;let d=h;if((f=d==null?void 0:d.ownerDocument)!=null&&f.defaultView)return d.ownerDocument.defaultView.window;let _=h;return _!=null&&_.view?_.view.window:gi},getDocument(h){return Zr(h).document}}})(),Sy=class{constructor(e,t,i,n){this._node=e,this._type=t,this._handler=i,this._options=n||!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 Ce(e,t,i,n){return new Sy(e,t,i,n)}var mp=function(e,t,i,n){return Ce(e,t,i,n)},eu,wy=class extends gy{constructor(e){super(),this.defaultTarget=e&&Zr(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},vp=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){Cl(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,n=new Map,l=a=>{i.set(a,!1);let h=e.get(a)??[];for(t.set(a,h),e.set(a,[]),n.set(a,!0);h.length>0;)h.sort(vp.sort),h.shift().execute();n.set(a,!1)};eu=(a,h,d=0)=>{let _=vy(a),f=new vp(h,d),v=e.get(_);return v||(v=[],e.set(_,v)),v.push(f),i.get(_)||(i.set(_,!0),a.requestAnimationFrame(()=>l(_))),f}})();function xy(e){let t=e.getBoundingClientRect(),i=Zr(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var wt={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"},by=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=ir(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=ir(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=ir(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=ir(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=ir(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=ir(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=ir(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=ir(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=ir(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=ir(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=ir(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=ir(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=ir(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=ir(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 ir(e){return typeof e=="number"?`${e}px`:e}function Kn(e){return new by(e)}var J_=class{constructor(){this._hooks=new Ki,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 i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,n,l){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=l;let a=e;try{e.setPointerCapture(t),this._hooks.add(Ve(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=Zr(e)}this._hooks.add(Ce(a,wt.POINTER_MOVE,h=>{if(h.buttons!==i){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(Ce(a,wt.POINTER_UP,h=>this.stopMonitoring(!0)))}};function Cy(e,t,i){let n=null,l=null;if(typeof i.value=="function"?(n="value",l=i.value,l.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(n="get",l=i.get),!l)throw new Error("not supported");let a=`$memoize$${t}`;i[n]=function(...h){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:l.apply(this,h)}),this[a]}}var Qr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Qr||(Qr={}));var zn=class $t extends Pe{constructor(){super(),this.dispatched=!1,this.targets=new ap,this.ignoreTargets=new ap,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Lt.runAndSubscribe(yy,({window:t,disposables:i})=>{i.add(Ce(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),i.add(Ce(t.document,"touchend",n=>this.onTouchEnd(t,n))),i.add(Ce(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:gi,disposables:this._store}))}static addTarget(t){if(!$t.isTouchDevice())return Pe.None;$t.INSTANCE||($t.INSTANCE=new $t);let i=$t.INSTANCE.targets.push(t);return Ve(i)}static ignoreTarget(t){if(!$t.isTouchDevice())return Pe.None;$t.INSTANCE||($t.INSTANCE=new $t);let i=$t.INSTANCE.ignoreTargets.push(t);return Ve(i)}static isTouchDevice(){return"ontouchstart"in gi||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,l=t.targetTouches.length;n<l;n++){let a=t.targetTouches.item(n);this.activeTouches[a.identifier]={id:a.identifier,initialTarget:a.target,initialTimeStamp:i,initialPageX:a.pageX,initialPageY:a.pageY,rollingTimestamps:[i],rollingPageX:[a.pageX],rollingPageY:[a.pageY]};let h=this.newGestureEvent(Qr.Start,a.target);h.pageX=a.pageX,h.pageY=a.pageY,this.dispatchEvent(h)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let n=Date.now(),l=Object.keys(this.activeTouches).length;for(let a=0,h=i.changedTouches.length;a<h;a++){let d=i.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let _=this.activeTouches[d.identifier],f=Date.now()-_.initialTimeStamp;if(f<$t.HOLD_DELAY&&Math.abs(_.initialPageX-hr(_.rollingPageX))<30&&Math.abs(_.initialPageY-hr(_.rollingPageY))<30){let v=this.newGestureEvent(Qr.Tap,_.initialTarget);v.pageX=hr(_.rollingPageX),v.pageY=hr(_.rollingPageY),this.dispatchEvent(v)}else if(f>=$t.HOLD_DELAY&&Math.abs(_.initialPageX-hr(_.rollingPageX))<30&&Math.abs(_.initialPageY-hr(_.rollingPageY))<30){let v=this.newGestureEvent(Qr.Contextmenu,_.initialTarget);v.pageX=hr(_.rollingPageX),v.pageY=hr(_.rollingPageY),this.dispatchEvent(v)}else if(l===1){let v=hr(_.rollingPageX),y=hr(_.rollingPageY),w=hr(_.rollingTimestamps)-_.rollingTimestamps[0],S=v-_.rollingPageX[0],k=y-_.rollingPageY[0],E=[...this.targets].filter(x=>_.initialTarget instanceof Node&&x.contains(_.initialTarget));this.inertia(t,E,n,Math.abs(S)/w,S>0?1:-1,v,Math.abs(k)/w,k>0?1:-1,y)}this.dispatchEvent(this.newGestureEvent(Qr.End,_.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=i,n.tapCount=0,n}dispatchEvent(t){if(t.type===Qr.Tap){let i=new Date().getTime(),n=0;i-this._lastSetTapCountTime>$t.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=i,t.tapCount=n}else(t.type===Qr.Change||t.type===Qr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let i=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let l=0,a=t.initialTarget;for(;a&&a!==n;)l++,a=a.parentElement;i.push([l,n])}i.sort((n,l)=>n[0]-l[0]);for(let[n,l]of i)l.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,n,l,a,h,d,_,f){this.handle=eu(t,()=>{let v=Date.now(),y=v-n,w=0,S=0,k=!0;l+=$t.SCROLL_FRICTION*y,d+=$t.SCROLL_FRICTION*y,l>0&&(k=!1,w=a*l*y),d>0&&(k=!1,S=_*d*y);let E=this.newGestureEvent(Qr.Change);E.translationX=w,E.translationY=S,i.forEach(x=>x.dispatchEvent(E)),k||this.inertia(t,i,v,l,a,h+w,d,_,f+S)})}onTouchMove(t){let i=Date.now();for(let n=0,l=t.changedTouches.length;n<l;n++){let a=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("end of an UNKNOWN touch",a);continue}let h=this.activeTouches[a.identifier],d=this.newGestureEvent(Qr.Change,h.initialTarget);d.translationX=a.pageX-hr(h.rollingPageX),d.translationY=a.pageY-hr(h.rollingPageY),d.pageX=a.pageX,d.pageY=a.pageY,this.dispatchEvent(d),h.rollingPageX.length>3&&(h.rollingPageX.shift(),h.rollingPageY.shift(),h.rollingTimestamps.shift()),h.rollingPageX.push(a.pageX),h.rollingPageY.push(a.pageY),h.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};zn.SCROLL_FRICTION=-.005,zn.HOLD_DELAY=700,zn.CLEAR_TAP_COUNT_TIME=400,tt([Cy],zn,"isTouchDevice",1);var ky=zn,tu=class extends Pe{onclick(e,t){this._register(Ce(e,wt.CLICK,i=>t(new ml(Zr(e),i))))}onmousedown(e,t){this._register(Ce(e,wt.MOUSE_DOWN,i=>t(new ml(Zr(e),i))))}onmouseover(e,t){this._register(Ce(e,wt.MOUSE_OVER,i=>t(new ml(Zr(e),i))))}onmouseleave(e,t){this._register(Ce(e,wt.MOUSE_LEAVE,i=>t(new ml(Zr(e),i))))}onkeydown(e,t){this._register(Ce(e,wt.KEY_DOWN,i=>t(new fp(i))))}onkeyup(e,t){this._register(Ce(e,wt.KEY_UP,i=>t(new fp(i))))}oninput(e,t){this._register(Ce(e,wt.INPUT,t))}onblur(e,t){this._register(Ce(e,wt.BLUR,t))}onfocus(e,t){this._register(Ce(e,wt.FOCUS,t))}onchange(e,t){this._register(Ce(e,wt.CHANGE,t))}ignoreGesture(e){return ky.ignoreTarget(e)}},yp=11,Ey=class extends tu{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=yp+"px",this.domNode.style.height=yp+"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 J_),this._register(mp(this.bgDomNode,wt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(mp(this.domNode,wt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new wy),this._pointerdownScheduleRepeatTimer=this._register(new Zh)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Zr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Ny=class vh{constructor(t,i,n,l,a,h,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,n=n|0,l=l|0,a=a|0,h=h|0,d=d|0),this.rawScrollLeft=l,this.rawScrollTop=d,i<0&&(i=0),l+i>n&&(l=n-i),l<0&&(l=0),a<0&&(a=0),d+a>h&&(d=h-a),d<0&&(d=0),this.width=i,this.scrollWidth=n,this.scrollLeft=l,this.height=a,this.scrollHeight=h,this.scrollTop=d}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,i){return new vh(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new vh(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,i){let n=this.width!==t.width,l=this.scrollWidth!==t.scrollWidth,a=this.scrollLeft!==t.scrollLeft,h=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,_=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,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:n,scrollWidthChanged:l,scrollLeftChanged:a,heightChanged:h,scrollHeightChanged:d,scrollTopChanged:_}}},Dy=class extends Pe{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Ny(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 n;let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),(n=this._smoothScrolling)==null||n.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 i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let n;t?n=new wp(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=wp.start(this._state,i,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 i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},Sp=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function Wc(e,t){let i=t-e;return function(n){return e+i*Ty(n)}}function Ry(e,t,i){return function(n){return n<i?e(n/i):t((n-i)/(1-i))}}var wp=class yh{constructor(t,i,n,l){this.from=t,this.to=i,this.duration=l,this.startTime=n,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,i,n){if(Math.abs(t-i)>2.5*n){let l,a;return t<i?(l=t+.75*n,a=i-.75*n):(l=t-.75*n,a=i+.75*n),Ry(Wc(t,l),Wc(a,i),.33)}return Wc(t,i)}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 i=(t-this.startTime)/this.duration;if(i<1){let n=this.scrollLeft(i),l=this.scrollTop(i);return new Sp(n,l,!1)}return new Sp(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,n){return yh.start(t,i,n)}static start(t,i,n){n=n+10;let l=Date.now()-10;return new yh(t,i,l,n)}};function Py(e){return Math.pow(e,3)}function Ty(e){return 1-Py(1-e)}var My=class extends Pe{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Zh)}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":"")))}},Ly=140,Q_=class extends tu{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 My(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new J_),this._shouldRender=!0,this.domNode=Kn(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(Ce(this.domNode.domNode,wt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Ey(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,n){this.slider=Kn(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ce(this.slider.domNode,wt.POINTER_DOWN,l=>{l.button===0&&(l.preventDefault(),this._sliderPointerDown(l))})),this.onclick(this.slider.domNode,l=>{l.leftButton&&l.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,i=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),l=this._sliderPointerPosition(e);i<=l&&l<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let l=xy(this.domNode.domNode);t=e.pageX-l.left,i=e.pageY-l.top}let n=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,l=>{let a=this._sliderOrthogonalPointerPosition(l),h=Math.abs(a-i);if(q_&&h>Ly){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let d=this._sliderPointerPosition(l)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(d))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Z_=class Sh{constructor(t,i,n,l,a,h){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=l,this._scrollSize=a,this._scrollPosition=h,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Sh(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,n,l,a){let h=Math.max(0,n-t),d=Math.max(0,h-2*i),_=l>0&&l>n;if(!_)return{computedAvailableSize:Math.round(h),computedIsNeeded:_,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(n*d/l))),v=(d-f)/(l-n),y=a*v;return{computedAvailableSize:Math.round(h),computedIsNeeded:_,computedSliderSize:Math.round(f),computedSliderRatio:v,computedSliderPosition:Math.round(y)}}_refreshComputedValues(){let t=Sh._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 i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,n=this._scrollPosition;return i<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},By=class extends Q_{constructor(e,t,i){let n=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Z_(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,l.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}},Iy=class extends Q_{constructor(e,t,i){let n=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Z_(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,l.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}},Oy=500,xp=50,Ay=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},wh=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,i=0,n=1,l=this._rear;do{let a=l===this._front?t:Math.pow(2,-n);if(t-=a,i+=this._memory[l].score*a,l===this._front)break;l=(this._capacity+l-1)%this._capacity,n++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(Jh){let i=Zr(t.browserEvent),n=Y0(i);this.accept(Date.now(),t.deltaX*n,t.deltaY*n)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,n){let l=null,a=new Ay(t,i,n);this._front===-1&&this._rear===-1?(this._memory[0]=a,this._front=0,this._rear=0):(l=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]=a),a.score=this._computeScore(a,l)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),i){let l=Math.abs(t.deltaX),a=Math.abs(t.deltaY),h=Math.abs(i.deltaX),d=Math.abs(i.deltaY),_=Math.max(Math.min(l,h),1),f=Math.max(Math.min(a,d),1),v=Math.max(l,h),y=Math.max(a,d);v%_===0&&y%f===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};wh.INSTANCE=new wh;var jy=wh,zy=class extends tu{constructor(e,t,i){super(),this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new te),this.onWillScroll=this._onWillScroll.event,this._options=Hy(t),this._scrollable=i,this._register(this._scrollable.onScroll(l=>{this._onWillScroll.fire(l),this._onDidScroll(l),this._onScroll.fire(l)}));let n={onMouseWheel:l=>this._onMouseWheel(l),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Iy(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new By(this._scrollable,this._options,n)),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=Kn(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Kn(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Kn(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,l=>this._onMouseOver(l)),this.onmouseleave(this._listenOnDomNode,l=>this._onMouseLeave(l)),this._hideTimeout=this._register(new Zh),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=us(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,ei&&(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 _p(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=us(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new _p(i))};this._mouseWheelToDispose.push(Ce(this._listenOnDomNode,wt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var l;if((l=e.browserEvent)!=null&&l.defaultPrevented)return;let t=jy.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,h=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+a===0?h=a=0:Math.abs(a)>=Math.abs(h)?h=0:a=0),this._options.flipAxes&&([a,h]=[h,a]);let d=!ei&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!h&&(h=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let _=this._scrollable.getFutureScrollPosition(),f={};if(a){let v=xp*a,y=_.scrollTop-(v<0?Math.floor(v):Math.ceil(v));this._verticalScrollbar.writeScrollPosition(f,y)}if(h){let v=xp*h,y=_.scrollLeft-(v<0?Math.floor(v):Math.ceil(v));this._horizontalScrollbar.writeScrollPosition(f,y)}f=this._scrollable.validateScrollPosition(f),(_.scrollLeft!==f.scrollLeft||_.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),i=!0)}let n=i;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(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,i=e.scrollLeft>0,n=i?" left":"",l=t?" top":"",a=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${l}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${l}${n}`)}}_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(),Oy)}},Fy=class extends zy{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Hy(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,ei&&(t.className+=" mac"),t}var xh=class extends Pe{constructor(e,t,i,n,l,a,h,d){super(),this._bufferService=i,this._optionsService=h,this._renderService=d,this._onRequestScrollLines=this._register(new te),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let _=this._register(new Dy({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>eu(n.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{_.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Fy(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},_)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(l.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Lt.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ve(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ve(()=>this._styleElement.remove())),this._register(Lt.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${a.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${a.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${a.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
65
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(f=>this._handleScroll(f)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};xh=tt([ne(2,Yt),ne(3,mi),ne(4,L_),ne(5,$s),ne(6,Gt),ne(7,vi)],xh);var bh=class extends Pe{constructor(e,t,i,n,l){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=n,this._renderService=l,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(a=>this._removeDecoration(a))),this._register(Ve(()=>{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 n;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((n=e==null?void 0:e.options)==null?void 0:n.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 i=e.options.x??0;return i&&i>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 i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*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()}};bh=tt([ne(1,Yt),ne(2,mi),ne(3,io),ne(4,vi)],bh);var Wy=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,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Xr={full:0,left:0,center:0,right:0},Fi={full:0,left:0,center:0,right:0},Ln={full:0,left:0,center:0,right:0},Il=class extends Pe{constructor(e,t,i,n,l,a,h,d){var f;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=n,this._renderService=l,this._optionsService=a,this._themeService=h,this._coreBrowserService=d,this._colorZoneStore=new Wy,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(f=this._viewportElement.parentElement)==null||f.insertBefore(this._canvas,this._viewportElement),this._register(Ve(()=>{var v;return(v=this._canvas)==null?void 0:v.remove()}));let _=this._canvas.getContext("2d");if(_)this._ctx=_;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);Fi.full=this._canvas.width,Fi.left=e,Fi.center=t,Fi.right=e,this._refreshDrawHeightConstants(),Ln.full=1,Ln.left=1,Ln.center=1+Fi.left,Ln.right=1+Fi.left+Fi.center}_refreshDrawHeightConstants(){Xr.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);Xr.left=t,Xr.center=t,Xr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xr.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(Ln[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Xr[e.position||"full"]/2),Fi[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Xr[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}))}};Il=tt([ne(2,Yt),ne(3,io),ne(4,vi),ne(5,Gt),ne(6,$s),ne(7,mi)],Il);var $;(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=`
66
+ `,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=""))($||($={}));var Nl;(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="Ÿ"))(Nl||(Nl={}));var eg;(e=>e.ST=`${$.ESC}\\`)(eg||(eg={}));var Ch=class{constructor(e,t,i,n,l,a){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=n,this._coreService=l,this._renderService=a,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 i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!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,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.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),i=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,l=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=l+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=l+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Ch=tt([ne(2,Yt),ne(3,Gt),ne(4,fs),ne(5,vi)],Ch);var xt=0,bt=0,Ct=0,et=0,bp={css:"#00000000",rgba:0},at;(e=>{function t(l,a,h,d){return d!==void 0?`#${os(l)}${os(a)}${os(h)}${os(d)}`:`#${os(l)}${os(a)}${os(h)}`}e.toCss=t;function i(l,a,h,d=255){return(l<<24|a<<16|h<<8|d)>>>0}e.toRgba=i;function n(l,a,h,d){return{css:e.toCss(l,a,h,d),rgba:e.toRgba(l,a,h,d)}}e.toColor=n})(at||(at={}));var Ue;(e=>{function t(_,f){if(et=(f.rgba&255)/255,et===1)return{css:f.css,rgba:f.rgba};let v=f.rgba>>24&255,y=f.rgba>>16&255,w=f.rgba>>8&255,S=_.rgba>>24&255,k=_.rgba>>16&255,E=_.rgba>>8&255;xt=S+Math.round((v-S)*et),bt=k+Math.round((y-k)*et),Ct=E+Math.round((w-E)*et);let x=at.toCss(xt,bt,Ct),I=at.toRgba(xt,bt,Ct);return{css:x,rgba:I}}e.blend=t;function i(_){return(_.rgba&255)===255}e.isOpaque=i;function n(_,f,v){let y=Dl.ensureContrastRatio(_.rgba,f.rgba,v);if(y)return at.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=n;function l(_){let f=(_.rgba|255)>>>0;return[xt,bt,Ct]=Dl.toChannels(f),{css:at.toCss(xt,bt,Ct),rgba:f}}e.opaque=l;function a(_,f){return et=Math.round(f*255),[xt,bt,Ct]=Dl.toChannels(_.rgba),{css:at.toCss(xt,bt,Ct,et),rgba:at.toRgba(xt,bt,Ct,et)}}e.opacity=a;function h(_,f){return et=_.rgba&255,a(_,et*f/255)}e.multiplyOpacity=h;function d(_){return[_.rgba>>24&255,_.rgba>>16&255,_.rgba>>8&255]}e.toColorRGB=d})(Ue||(Ue={}));var Qe;(e=>{let t,i;try{let l=document.createElement("canvas");l.width=1,l.height=1;let a=l.getContext("2d",{willReadFrequently:!0});a&&(t=a,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function n(l){if(l.match(/#[\da-f]{3,8}/i))switch(l.length){case 4:return xt=parseInt(l.slice(1,2).repeat(2),16),bt=parseInt(l.slice(2,3).repeat(2),16),Ct=parseInt(l.slice(3,4).repeat(2),16),at.toColor(xt,bt,Ct);case 5:return xt=parseInt(l.slice(1,2).repeat(2),16),bt=parseInt(l.slice(2,3).repeat(2),16),Ct=parseInt(l.slice(3,4).repeat(2),16),et=parseInt(l.slice(4,5).repeat(2),16),at.toColor(xt,bt,Ct,et);case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}let a=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return xt=parseInt(a[1]),bt=parseInt(a[2]),Ct=parseInt(a[3]),et=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),at.toColor(xt,bt,Ct,et);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=l,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[xt,bt,Ct,et]=t.getImageData(0,0,1,1).data,et!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:at.toRgba(xt,bt,Ct,et),css:l}}e.toColor=n})(Qe||(Qe={}));var qt;(e=>{function t(n){return i(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function i(n,l,a){let h=n/255,d=l/255,_=a/255,f=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),v=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),y=_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4);return f*.2126+v*.7152+y*.0722}e.relativeLuminance2=i})(qt||(qt={}));var Dl;(e=>{function t(h,d){if(et=(d&255)/255,et===1)return d;let _=d>>24&255,f=d>>16&255,v=d>>8&255,y=h>>24&255,w=h>>16&255,S=h>>8&255;return xt=y+Math.round((_-y)*et),bt=w+Math.round((f-w)*et),Ct=S+Math.round((v-S)*et),at.toRgba(xt,bt,Ct)}e.blend=t;function i(h,d,_){let f=qt.relativeLuminance(h>>8),v=qt.relativeLuminance(d>>8);if(_i(f,v)<_){if(v<f){let S=n(h,d,_),k=_i(f,qt.relativeLuminance(S>>8));if(k<_){let E=l(h,d,_),x=_i(f,qt.relativeLuminance(E>>8));return k>x?S:E}return S}let y=l(h,d,_),w=_i(f,qt.relativeLuminance(y>>8));if(w<_){let S=n(h,d,_),k=_i(f,qt.relativeLuminance(S>>8));return w>k?y:S}return y}}e.ensureContrastRatio=i;function n(h,d,_){let f=h>>24&255,v=h>>16&255,y=h>>8&255,w=d>>24&255,S=d>>16&255,k=d>>8&255,E=_i(qt.relativeLuminance2(w,S,k),qt.relativeLuminance2(f,v,y));for(;E<_&&(w>0||S>0||k>0);)w-=Math.max(0,Math.ceil(w*.1)),S-=Math.max(0,Math.ceil(S*.1)),k-=Math.max(0,Math.ceil(k*.1)),E=_i(qt.relativeLuminance2(w,S,k),qt.relativeLuminance2(f,v,y));return(w<<24|S<<16|k<<8|255)>>>0}e.reduceLuminance=n;function l(h,d,_){let f=h>>24&255,v=h>>16&255,y=h>>8&255,w=d>>24&255,S=d>>16&255,k=d>>8&255,E=_i(qt.relativeLuminance2(w,S,k),qt.relativeLuminance2(f,v,y));for(;E<_&&(w<255||S<255||k<255);)w=Math.min(255,w+Math.ceil((255-w)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),k=Math.min(255,k+Math.ceil((255-k)*.1)),E=_i(qt.relativeLuminance2(w,S,k),qt.relativeLuminance2(f,v,y));return(w<<24|S<<16|k<<8|255)>>>0}e.increaseLuminance=l;function a(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=a})(Dl||(Dl={}));function os(e){let t=e.toString(16);return t.length<2?"0"+t:t}function _i(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var $y=class extends ro{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}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()]}},Ol=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new kr}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 i=[],n=t.translateToString(!0),l=0,a=0,h=0,d=t.getFg(0),_=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==_){if(f-l>1){let v=this._getJoinedRanges(n,h,a,t,l);for(let y=0;y<v.length;y++)i.push(v[y])}l=f,h=a,d=this._workCell.fg,_=this._workCell.bg}a+=this._workCell.getChars().length||Ui.length}if(this._bufferService.cols-l>1){let f=this._getJoinedRanges(n,h,a,t,l);for(let v=0;v<f.length;v++)i.push(f[v])}return i}_getJoinedRanges(e,t,i,n,l){let a=e.substring(t,i),h=[];try{h=this._characterJoiners[0].handler(a)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let _=this._characterJoiners[d].handler(a);for(let f=0;f<_.length;f++)Ol._mergeRanges(h,_[f])}catch(_){console.error(_)}return this._stringRangesToCellRanges(h,n,l),h}_stringRangesToCellRanges(e,t,i){let n=0,l=!1,a=0,h=e[n];if(h){for(let d=i;d<this._bufferService.cols;d++){let _=t.getWidth(d),f=t.getString(d).length||Ui.length;if(_!==0){if(!l&&h[0]<=a&&(h[0]=d,l=!0),h[1]<=a){if(h[1]=d,h=e[++n],!h)break;h[0]<=a?(h[0]=d,l=!0):l=!1}a+=f}}h&&(h[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let n=0;n<e.length;n++){let l=e[n];if(i){if(t[1]<=l[0])return e[n-1][1]=t[1],e;if(t[1]<=l[1])return e[n-1][1]=Math.max(t[1],l[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=l[0])return e.splice(n,0,t),e;if(t[1]<=l[1])return l[0]=Math.min(t[0],l[0]),e;t[0]<l[1]&&(l[0]=Math.min(t[0],l[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};Ol=tt([ne(0,Yt)],Ol);function Uy(e){return 57508<=e&&e<=57558}function Ky(e){return 9472<=e&&e<=9631}function Vy(e){return Uy(e)||Ky(e)}function qy(){return{css:{canvas:vl(),cell:vl()},device:{canvas:vl(),cell:vl(),char:{width:0,height:0,left:0,top:0}}}}function vl(){return{width:0,height:0}}var kh=class{constructor(e,t,i,n,l,a,h){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=n,this._coreService=l,this._decorationService=a,this._themeService=h,this._workCell=new kr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,n,l,a,h,d,_,f,v){let y=[],w=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,k=e.getNoBgTrimmedLength();i&&k<a+1&&(k=a+1);let E,x=0,I="",U=0,W=0,P=0,M=0,A=!1,re=0,se=!1,pe=0,Se=0,z=[],q=f!==-1&&v!==-1;for(let j=0;j<k;j++){e.loadCell(j,this._workCell);let G=this._workCell.getWidth();if(G===0)continue;let X=!1,ee=j>=Se,ie=j,B=this._workCell;if(w.length>0&&j===w[0][0]&&ee){let Ne=w.shift(),nt=this._isCellInSelection(Ne[0],t);for(U=Ne[0]+1;U<Ne[1];U++)ee&&(ee=nt===this._isCellInSelection(U,t));ee&&(ee=!i||a<Ne[0]||a>=Ne[1]),ee?(X=!0,B=new $y(this._workCell,e.translateToString(!0,Ne[0],Ne[1]),Ne[1]-Ne[0]),ie=Ne[1]-1,G=B.getWidth()):Se=Ne[1]}let Q=this._isCellInSelection(j,t),J=i&&j===a,R=q&&j>=f&&j<=v,F=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,Ne=>{F=!0});let ae=B.getChars()||Ui;if(ae===" "&&(B.isUnderline()||B.isOverline())&&(ae=" "),pe=G*d-_.get(ae,B.isBold(),B.isItalic()),!E)E=this._document.createElement("span");else if(x&&(Q&&se||!Q&&!se&&B.bg===W)&&(Q&&se&&S.selectionForeground||B.fg===P)&&B.extended.ext===M&&R===A&&pe===re&&!J&&!X&&!F&&ee){B.isInvisible()?I+=Ui:I+=ae,x++;continue}else x&&(E.textContent=I),E=this._document.createElement("span"),x=0,I="";if(W=B.bg,P=B.fg,M=B.extended.ext,A=R,re=pe,se=Q,X&&a>=j&&a<=ie&&(a=j),!this._coreService.isCursorHidden&&J&&this._coreService.isCursorInitialized){if(z.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&z.push("xterm-cursor-blink"),z.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(l)switch(l){case"outline":z.push("xterm-cursor-outline");break;case"block":z.push("xterm-cursor-block");break;case"bar":z.push("xterm-cursor-bar");break;case"underline":z.push("xterm-cursor-underline");break}}if(B.isBold()&&z.push("xterm-bold"),B.isItalic()&&z.push("xterm-italic"),B.isDim()&&z.push("xterm-dim"),B.isInvisible()?I=Ui:I=B.getChars()||Ui,B.isUnderline()&&(z.push(`xterm-underline-${B.extended.underlineStyle}`),I===" "&&(I=" "),!B.isUnderlineColorDefault()))if(B.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${ro.toColorRGB(B.getUnderlineColor()).join(",")})`;else{let Ne=B.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&B.isBold()&&Ne<8&&(Ne+=8),E.style.textDecorationColor=S.ansi[Ne].css}B.isOverline()&&(z.push("xterm-overline"),I===" "&&(I=" ")),B.isStrikethrough()&&z.push("xterm-strikethrough"),R&&(E.style.textDecoration="underline");let le=B.getFgColor(),_e=B.getFgColorMode(),ue=B.getBgColor(),De=B.getBgColorMode(),ke=!!B.isInverse();if(ke){let Ne=le;le=ue,ue=Ne;let nt=_e;_e=De,De=nt}let Ee,we,gt=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,Ne=>{Ne.options.layer!=="top"&&gt||(Ne.backgroundColorRGB&&(De=50331648,ue=Ne.backgroundColorRGB.rgba>>8&16777215,Ee=Ne.backgroundColorRGB),Ne.foregroundColorRGB&&(_e=50331648,le=Ne.foregroundColorRGB.rgba>>8&16777215,we=Ne.foregroundColorRGB),gt=Ne.options.layer==="top")}),!gt&&Q&&(Ee=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,ue=Ee.rgba>>8&16777215,De=50331648,gt=!0,S.selectionForeground&&(_e=50331648,le=S.selectionForeground.rgba>>8&16777215,we=S.selectionForeground)),gt&&z.push("xterm-decoration-top");let Fe;switch(De){case 16777216:case 33554432:Fe=S.ansi[ue],z.push(`xterm-bg-${ue}`);break;case 50331648:Fe=at.toColor(ue>>16,ue>>8&255,ue&255),this._addStyle(E,`background-color:#${Cp((ue>>>0).toString(16),"0",6)}`);break;case 0:default:ke?(Fe=S.foreground,z.push("xterm-bg-257")):Fe=S.background}switch(Ee||B.isDim()&&(Ee=Ue.multiplyOpacity(Fe,.5)),_e){case 16777216:case 33554432:B.isBold()&&le<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(le+=8),this._applyMinimumContrast(E,Fe,S.ansi[le],B,Ee,void 0)||z.push(`xterm-fg-${le}`);break;case 50331648:let Ne=at.toColor(le>>16&255,le>>8&255,le&255);this._applyMinimumContrast(E,Fe,Ne,B,Ee,we)||this._addStyle(E,`color:#${Cp(le.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(E,Fe,S.foreground,B,Ee,we)||ke&&z.push("xterm-fg-257")}z.length&&(E.className=z.join(" "),z.length=0),!J&&!X&&!F&&ee?x++:E.textContent=I,pe!==this.defaultSpacing&&(E.style.letterSpacing=`${pe}px`),y.push(E),j=ie}return E&&x&&(E.textContent=I),y}_applyMinimumContrast(e,t,i,n,l,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||Vy(n.getCode()))return!1;let h=this._getContrastCache(n),d;if(!l&&!a&&(d=h.getColor(t.rgba,i.rgba)),d===void 0){let _=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);d=Ue.ensureContrastRatio(l||t,a||i,_),h.setColor((l||t).rgba,(a||i).rgba,d??null)}return d?(this._addStyle(e,`color:${d.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let i=this._selectionStart,n=this._selectionEnd;return!i||!n?!1:this._columnSelectMode?i[0]<=n[0]?e>=i[0]&&t>=i[1]&&e<n[0]&&t<=n[1]:e<i[0]&&t>=i[1]&&e>=n[0]&&t<=n[1]:t>i[1]&&t<n[1]||i[1]===n[1]&&t===i[1]&&e>=i[0]&&e<n[0]||i[1]<n[1]&&t===n[1]&&e<n[0]||i[1]<n[1]&&t===i[1]&&e>=i[0]}};kh=tt([ne(1,O_),ne(2,Gt),ne(3,mi),ne(4,fs),ne(5,io),ne(6,$s)],kh);function Cp(e,t,i){for(;e.length<i;)e=t+e;return e}var Yy=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 i=e.createElement("span");i.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontStyle="italic";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold",a.style.fontStyle="italic",this._measureElements=[i,n,l,a],this._container.appendChild(i),this._container.appendChild(n),this._container.appendChild(l),this._container.appendChild(a),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,i,n){e===this._font&&t===this._fontSize&&i===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,i){let n=0;if(!t&&!i&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let h=this._measure(e,0);return h>0&&(this._flat[n]=h),h}let l=e;t&&(l+="B"),i&&(l+="I");let a=this._holey.get(l);if(a===void 0){let h=0;t&&(h|=1),i&&(h|=2),a=this._measure(e,h),a>0&&this._holey.set(l,a)}return a}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},Gy=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,i,n=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let l=e.buffers.active.ydisp,a=t[1]-l,h=i[1]-l,d=Math.max(a,0),_=Math.min(h,e.rows-1);if(d>=e.rows||_<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=a,this.viewportEndRow=h,this.viewportCappedStartRow=d,this.viewportCappedEndRow=_,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function Xy(){return new Gy}var $c="xterm-dom-renderer-owner-",Sr="xterm-rows",yl="xterm-fg-",kp="xterm-bg-",Bn="xterm-focus",Sl="xterm-selection",Jy=1,Eh=class extends Pe{constructor(e,t,i,n,l,a,h,d,_,f,v,y,w,S){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=n,this._viewportElement=l,this._helperContainer=a,this._linkifier2=h,this._charSizeService=_,this._optionsService=f,this._bufferService=v,this._coreService=y,this._coreBrowserService=w,this._themeService=S,this._terminalClass=Jy++,this._rowElements=[],this._selectionRenderModel=Xy(),this.onRequestRedraw=this._register(new te).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Sr),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(Sl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=qy(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(k=>this._injectCss(k))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(kh,document),this._element.classList.add($c+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(k=>this._handleLinkHover(k))),this._register(this._linkifier2.onHideLinkUnderline(k=>this._handleLinkLeave(k))),this._register(Ve(()=>{this._element.classList.remove($c+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Yy(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 i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Sr} 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} .${Sr} { 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} .${Sr} .xterm-dim { color: ${Ue.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 i=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,l=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${l} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Sr}.${Bn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Sr}.${Bn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Sr}.${Bn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${l} 1s step-end infinite;}${this._terminalSelector} .${Sr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Sr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Sr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Sr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Sr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Sl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Sl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Sl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,h]of e.ansi.entries())t+=`${this._terminalSelector} .${yl}${a} { color: ${h.css}; }${this._terminalSelector} .${yl}${a}.xterm-dim { color: ${Ue.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${kp}${a} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${yl}257 { color: ${Ue.opaque(e.background).css}; }${this._terminalSelector} .${yl}257.xterm-dim { color: ${Ue.multiplyOpacity(Ue.opaque(e.background),.5).css}; }${this._terminalSelector} .${kp}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 i=this._rowElements.length;i<=t;i++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}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(Bn),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Bn),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,l=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,h=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(i){let _=e[0]>t[0];d.appendChild(this._createSelectionElement(a,_?t[0]:e[0],_?e[0]:t[0],h-a+1))}else{let _=n===a?e[0]:0,f=a===l?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(a,_,f));let v=h-a-1;if(d.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,v)),a!==h){let y=l===h?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(h,0,y))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,i,n=1){let l=this._document.createElement("div"),a=t*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(i-t);return a+h>this.dimensions.css.canvas.width&&(h=this.dimensions.css.canvas.width-a),l.style.height=`${n*this.dimensions.css.cell.height}px`,l.style.top=`${e*this.dimensions.css.cell.height}px`,l.style.left=`${a}px`,l.style.width=`${h}px`,l}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 i=this._bufferService.buffer,n=i.ybase+i.y,l=Math.min(i.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,h=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=e;_<=t;_++){let f=_+i.ydisp,v=this._rowElements[_],y=i.lines.get(f);if(!v||!y)break;v.replaceChildren(...this._rowFactory.createRow(y,f,f===n,h,d,l,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${$c}${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,i,n,l,a){i<0&&(e=0),n<0&&(t=0);let h=this._bufferService.rows-1;i=Math.max(Math.min(i,h),0),n=Math.max(Math.min(n,h),0),l=Math.min(l,this._bufferService.cols);let d=this._bufferService.buffer,_=d.ybase+d.y,f=Math.min(d.x,l-1),v=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=i;S<=n;++S){let k=S+d.ydisp,E=this._rowElements[S],x=d.lines.get(k);if(!E||!x)break;E.replaceChildren(...this._rowFactory.createRow(x,k,k===_,y,w,f,v,this.dimensions.css.cell.width,this._widthCache,a?S===i?e:0:-1,a?(S===n?t:l)-1:-1))}}};Eh=tt([ne(7,Yh),ne(8,ql),ne(9,Gt),ne(10,Yt),ne(11,fs),ne(12,mi),ne(13,$s)],Eh);var Nh=class extends Pe{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new te),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Zy(this._optionsService))}catch{this._measureStrategy=this._register(new Qy(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())}};Nh=tt([ne(2,Gt)],Nh);var tg=class extends Pe{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)}},Qy=class extends tg{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,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}},Zy=class extends tg{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}},eS=class extends Pe{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new tS(this._window)),this._onDprChange=this._register(new te),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new te),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Lt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ce(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ce(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}},tS=class extends Pe{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ws),this._onDprChange=this._register(new te),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ve(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ce(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)}},rS=class extends Pe{constructor(){super(),this.linkProviders=[],this._register(Ve(()=>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 ru(e,t,i){let n=i.getBoundingClientRect(),l=e.getComputedStyle(i),a=parseInt(l.getPropertyValue("padding-left")),h=parseInt(l.getPropertyValue("padding-top"));return[t.clientX-n.left-a,t.clientY-n.top-h]}function iS(e,t,i,n,l,a,h,d,_){if(!a)return;let f=ru(e,t,i);if(f)return f[0]=Math.ceil((f[0]+(_?h/2:0))/h),f[1]=Math.ceil(f[1]/d),f[0]=Math.min(Math.max(f[0],1),n+(_?1:0)),f[1]=Math.min(Math.max(f[1],1),l),f}var Dh=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,n,l){return iS(window,e,t,i,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(e,t){let i=ru(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};Dh=tt([ne(0,vi),ne(1,ql)],Dh);var sS=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,i){this._rowCount=i,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=[]}},rg={};p0(rg,{getSafariVersion:()=>oS,isChromeOS:()=>og,isFirefox:()=>ig,isIpad:()=>lS,isIphone:()=>aS,isLegacyEdge:()=>nS,isLinux:()=>iu,isMac:()=>Al,isNode:()=>Yl,isSafari:()=>sg,isWindows:()=>ng});var Yl=typeof process<"u"&&"title"in process,so=Yl?"node":navigator.userAgent,no=Yl?"node":navigator.platform,ig=so.includes("Firefox"),nS=so.includes("Edge"),sg=/^((?!chrome|android).)*safari/i.test(so);function oS(){if(!sg)return 0;let e=so.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Al=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(no),lS=no==="iPad",aS=no==="iPhone",ng=["Windows","Win16","Win32","WinCE"].includes(no),iu=no.indexOf("Linux")>=0,og=/\bCrOS\b/.test(so),lg=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,i=0,n=e.timeRemaining(),l=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),l=e.timeRemaining(),i*1.5>l){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=l}this.clear()}},cS=class extends lg{_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())}}},hS=class extends lg{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},jl=!Yl&&"requestIdleCallback"in window?hS:cS,uS=class{constructor(){this._queue=new jl}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Rh=class extends Pe{constructor(e,t,i,n,l,a,h,d,_){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=n,this._coreService=l,this._coreBrowserService=d,this._renderer=this._register(new Ws),this._pausedResizeTask=new uS,this._observerDisposable=this._register(new Ws),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 te),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new te),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new te),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new te),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new sS((f,v)=>this._renderRows(f,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new dS(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ve(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.buffers.onBufferActivate(()=>{var f;return(f=this._renderer.value)==null?void 0:f.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(h.cols,h.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(h.buffer.y,h.buffer.y,!0))),this._register(_.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=Ve(()=>i.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,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),i||(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 i;return(i=this._renderer.value)==null?void 0:i.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,i){var n;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,(n=this._renderer.value)==null||n.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Rh=tt([ne(2,Gt),ne(3,ql),ne(4,fs),ne(5,io),ne(6,Yt),ne(7,mi),ne(8,$s)],Rh);var dS=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,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 fS(e,t,i,n){let l=i.buffer.x,a=i.buffer.y;if(!i.buffer.hasScrollback)return gS(l,a,e,t,i,n)+Gl(a,t,i,n)+mS(l,a,e,t,i,n);let h;if(a===t)return h=l>e?"D":"C",Xn(Math.abs(l-e),Gn(h,n));h=a>t?"D":"C";let d=Math.abs(a-t),_=_S(a>t?e:l,i)+(d-1)*i.cols+1+pS(a>t?l:e);return Xn(_,Gn(h,n))}function pS(e,t){return e-1}function _S(e,t){return t.cols-e}function gS(e,t,i,n,l,a){return Gl(t,n,l,a).length===0?"":Xn(cg(e,t,e,t-ds(t,l),!1,l).length,Gn("D",a))}function Gl(e,t,i,n){let l=e-ds(e,i),a=t-ds(t,i),h=Math.abs(l-a)-vS(e,t,i);return Xn(h,Gn(ag(e,t),n))}function mS(e,t,i,n,l,a){let h;Gl(t,n,l,a).length>0?h=n-ds(n,l):h=t;let d=n,_=yS(e,t,i,n,l,a);return Xn(cg(e,h,i,d,_==="C",l).length,Gn(_,a))}function vS(e,t,i){var h;let n=0,l=e-ds(e,i),a=t-ds(t,i);for(let d=0;d<Math.abs(l-a);d++){let _=ag(e,t)==="A"?-1:1;(h=i.buffer.lines.get(l+_*d))!=null&&h.isWrapped&&n++}return n}function ds(e,t){let i=0,n=t.buffer.lines.get(e),l=n==null?void 0:n.isWrapped;for(;l&&e>=0&&e<t.rows;)i++,n=t.buffer.lines.get(--e),l=n==null?void 0:n.isWrapped;return i}function yS(e,t,i,n,l,a){let h;return Gl(i,n,l,a).length>0?h=n-ds(n,l):h=t,e<i&&h<=n||e>=i&&h<n?"C":"D"}function ag(e,t){return e>t?"A":"B"}function cg(e,t,i,n,l,a){let h=e,d=t,_="";for(;(h!==i||d!==n)&&d>=0&&d<a.buffer.lines.length;)h+=l?1:-1,l&&h>a.cols-1?(_+=a.buffer.translateBufferLineToString(d,!1,e,h),h=0,e=0,d++):!l&&h<0&&(_+=a.buffer.translateBufferLineToString(d,!1,0,e+1),h=a.cols-1,e=h,d--);return _+a.buffer.translateBufferLineToString(d,!1,e,h)}function Gn(e,t){let i=t?"O":"[";return $.ESC+i+e}function Xn(e,t){e=Math.floor(e);let i="";for(let n=0;n<e;n++)i+=t;return i}var SS=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 Ep(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 Uc=50,wS=15,xS=50,bS=500,CS=" ",kS=new RegExp(CS,"g"),Ph=class extends Pe{constructor(e,t,i,n,l,a,h,d,_){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=n,this._coreService=l,this._mouseService=a,this._optionsService=h,this._renderService=d,this._coreBrowserService=_,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new kr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new te),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new te),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new te),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new te),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new SS(this._bufferService),this._activeSelectionMode=0,this._register(Ve(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let l=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let h=e[1];h<=t[1];h++){let d=i.translateBufferLineToString(h,!0,l,a);n.push(d)}}else{let l=e[1]===t[1]?t[0]:void 0;n.push(i.translateBufferLineToString(e[1],!0,e[0],l));for(let a=e[1]+1;a<=t[1]-1;a++){let h=i.lines.get(a),d=i.translateBufferLineToString(a,!0);h!=null&&h.isWrapped?n[n.length-1]+=d:n.push(d)}if(e[1]!==t[1]){let a=i.lines.get(t[1]),h=i.translateBufferLineToString(t[1],!0,0,t[0]);a&&a.isWrapped?n[n.length-1]+=h:n.push(h)}}return n.map(l=>l.replace(kS," ")).join(ng?`\r
67
+ `:`
68
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),iu&&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),i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n||!t?!1:this._areCoordsInSelection(t,i,n)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n?!1:this._areCoordsInSelection([e,t],i,n)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var l,a;let i=(a=(l=this._linkifier.currentLink)==null?void 0:l.link)==null?void 0:a.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=Ep(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,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=ru(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-Uc),Uc),t/=Uc,t/Math.abs(t)+Math.round(t*(wS-1)))}shouldForceSelection(e){return Al?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(),xS)}_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&&!(Al&&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 i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let n=i.lines.get(this._model.selectionEnd[1]);n&&n.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<bS&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let n=fS(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);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,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let n=0;t>=n;n++){let l=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:l>1&&t!==n&&(i+=l-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let l=this._bufferService.buffer,a=l.lines.get(e[1]);if(!a)return;let h=l.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(a,e[0]),_=d,f=e[0]-d,v=0,y=0,w=0,S=0;if(h.charAt(d)===" "){for(;d>0&&h.charAt(d-1)===" ";)d--;for(;_<h.length&&h.charAt(_+1)===" ";)_++}else{let x=e[0],I=e[0];a.getWidth(x)===0&&(v++,x--),a.getWidth(I)===2&&(y++,I++);let U=a.getString(I).length;for(U>1&&(S+=U-1,_+=U-1);x>0&&d>0&&!this._isCharWordSeparator(a.loadCell(x-1,this._workCell));){a.loadCell(x-1,this._workCell);let W=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,x--):W>1&&(w+=W-1,d-=W-1),d--,x--}for(;I<a.length&&_+1<h.length&&!this._isCharWordSeparator(a.loadCell(I+1,this._workCell));){a.loadCell(I+1,this._workCell);let W=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,I++):W>1&&(S+=W-1,_+=W-1),_++,I++}}_++;let k=d+f-v+w,E=Math.min(this._bufferService.cols,_-d+v+y-w-S);if(!(!t&&h.slice(d,_).trim()==="")){if(i&&k===0&&a.getCodePoint(0)!==32){let x=l.lines.get(e[1]-1);if(x&&a.isWrapped&&x.getCodePoint(this._bufferService.cols-1)!==32){let I=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(I){let U=this._bufferService.cols-I.start;k-=U,E+=U}}}if(n&&k+E===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let x=l.lines.get(e[1]+1);if(x!=null&&x.isWrapped&&x.getCodePoint(0)!==32){let I=this._getWordAt([0,e[1]+1],!1,!1,!0);I&&(E+=I.length)}}return{start:k,length:E}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=Ep(i,this._bufferService.cols)}};Ph=tt([ne(3,Yt),ne(4,fs),ne(5,Gh),ne(6,Gt),ne(7,vi),ne(8,mi)],Ph);var Np=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Dp=class{constructor(){this._color=new Np,this._css=new Np}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ut=Object.freeze((()=>{let e=[Qe.toColor("#2e3436"),Qe.toColor("#cc0000"),Qe.toColor("#4e9a06"),Qe.toColor("#c4a000"),Qe.toColor("#3465a4"),Qe.toColor("#75507b"),Qe.toColor("#06989a"),Qe.toColor("#d3d7cf"),Qe.toColor("#555753"),Qe.toColor("#ef2929"),Qe.toColor("#8ae234"),Qe.toColor("#fce94f"),Qe.toColor("#729fcf"),Qe.toColor("#ad7fa8"),Qe.toColor("#34e2e2"),Qe.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let n=t[i/36%6|0],l=t[i/6%6|0],a=t[i%6];e.push({css:at.toCss(n,l,a),rgba:at.toRgba(n,l,a)})}for(let i=0;i<24;i++){let n=8+i*10;e.push({css:at.toCss(n,n,n),rgba:at.toRgba(n,n,n)})}return e})()),ls=Qe.toColor("#ffffff"),Fn=Qe.toColor("#000000"),Rp=Qe.toColor("#ffffff"),Pp=Fn,In={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},ES=ls,Th=class extends Pe{constructor(e){super(),this._optionsService=e,this._contrastCache=new Dp,this._halfContrastCache=new Dp,this._onChangeColors=this._register(new te),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ls,background:Fn,cursor:Rp,cursorAccent:Pp,selectionForeground:void 0,selectionBackgroundTransparent:In,selectionBackgroundOpaque:Ue.blend(Fn,In),selectionInactiveBackgroundTransparent:In,selectionInactiveBackgroundOpaque:Ue.blend(Fn,In),scrollbarSliderBackground:Ue.opacity(ls,.2),scrollbarSliderHoverBackground:Ue.opacity(ls,.4),scrollbarSliderActiveBackground:Ue.opacity(ls,.5),overviewRulerBorder:ls,ansi:ut.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=je(e.foreground,ls),t.background=je(e.background,Fn),t.cursor=Ue.blend(t.background,je(e.cursor,Rp)),t.cursorAccent=Ue.blend(t.background,je(e.cursorAccent,Pp)),t.selectionBackgroundTransparent=je(e.selectionBackground,In),t.selectionBackgroundOpaque=Ue.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=je(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Ue.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?je(e.selectionForeground,bp):void 0,t.selectionForeground===bp&&(t.selectionForeground=void 0),Ue.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Ue.opacity(t.selectionBackgroundTransparent,.3)),Ue.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Ue.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=je(e.scrollbarSliderBackground,Ue.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=je(e.scrollbarSliderHoverBackground,Ue.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=je(e.scrollbarSliderActiveBackground,Ue.opacity(t.foreground,.5)),t.overviewRulerBorder=je(e.overviewRulerBorder,ES),t.ansi=ut.slice(),t.ansi[0]=je(e.black,ut[0]),t.ansi[1]=je(e.red,ut[1]),t.ansi[2]=je(e.green,ut[2]),t.ansi[3]=je(e.yellow,ut[3]),t.ansi[4]=je(e.blue,ut[4]),t.ansi[5]=je(e.magenta,ut[5]),t.ansi[6]=je(e.cyan,ut[6]),t.ansi[7]=je(e.white,ut[7]),t.ansi[8]=je(e.brightBlack,ut[8]),t.ansi[9]=je(e.brightRed,ut[9]),t.ansi[10]=je(e.brightGreen,ut[10]),t.ansi[11]=je(e.brightYellow,ut[11]),t.ansi[12]=je(e.brightBlue,ut[12]),t.ansi[13]=je(e.brightMagenta,ut[13]),t.ansi[14]=je(e.brightCyan,ut[14]),t.ansi[15]=je(e.brightWhite,ut[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<i;n++)t.ansi[n+16]=je(e.extendedAnsi[n],ut[n+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()}}};Th=tt([ne(0,Gt)],Th);function je(e,t){if(e!==void 0)try{return Qe.toColor(e)}catch{}return t}var NS=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},DS=class{constructor(){this._services=new NS,this._services.set(Yh,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=w0(e).sort((a,h)=>a.index-h.index),n=[];for(let a of i){let h=this._services.get(a.id);if(!h)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id._id}.`);n.push(h)}let l=i.length>0?i[0].index:t.length;if(t.length!==l)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${l+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},RS={trace:0,debug:1,info:2,warn:3,error:4,off:5},PS="xterm.js: ",Mh=class extends Pe{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=RS[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,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":PS)+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Mh=tt([ne(0,Gt)],Mh);var Tp=class extends Pe{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new te),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new te),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new te),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 i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];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,...i){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+i.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<i.length;n++)this._array[this._getCyclicIndex(e+n)]=i[n];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let n=this._length+i.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let l=t-1;l>=0;l--)this.set(e+l+i,this.get(e+l));let n=e+t+i-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+i,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Re=3,lt=Object.freeze(new ro),wl=0,Kc=2,Hn=class hg{constructor(t,i,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Re);let l=i||kr.fromCharData([0,R_,1,0]);for(let a=0;a<t;++a)this.setCell(a,l);this.length=t}get(t){let i=this._data[t*Re+0],n=i&2097151;return[this._data[t*Re+1],i&2097152?this._combined[t]:n?Wi(n):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,i){this._data[t*Re+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*Re+0]=t|2097152|i[2]<<22):this._data[t*Re+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*Re+0]>>22}hasWidth(t){return this._data[t*Re+0]&12582912}getFg(t){return this._data[t*Re+1]}getBg(t){return this._data[t*Re+2]}hasContent(t){return this._data[t*Re+0]&4194303}getCodePoint(t){let i=this._data[t*Re+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*Re+0]&2097152}getString(t){let i=this._data[t*Re+0];return i&2097152?this._combined[t]:i&2097151?Wi(i&2097151):""}isProtected(t){return this._data[t*Re+2]&536870912}loadCell(t,i){return wl=t*Re,i.content=this._data[wl+0],i.fg=this._data[wl+1],i.bg=this._data[wl+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*Re+0]=i.content,this._data[t*Re+1]=i.fg,this._data[t*Re+2]=i.bg}setCellFromCodepoint(t,i,n,l){l.bg&268435456&&(this._extendedAttrs[t]=l.extended),this._data[t*Re+0]=i|n<<22,this._data[t*Re+1]=l.fg,this._data[t*Re+2]=l.bg}addCodepointToCell(t,i,n){let l=this._data[t*Re+0];l&2097152?this._combined[t]+=Wi(i):l&2097151?(this._combined[t]=Wi(l&2097151)+Wi(i),l&=-2097152,l|=2097152):l=i|1<<22,n&&(l&=-12582913,l|=n<<22),this._data[t*Re+0]=l}insertCells(t,i,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),i<this.length-t){let l=new kr;for(let a=this.length-t-i-1;a>=0;--a)this.setCell(t+i+a,this.loadCell(t+a,l));for(let a=0;a<i;++a)this.setCell(t+a,n)}else for(let l=t;l<this.length;++l)this.setCell(l,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(t,i,n){if(t%=this.length,i<this.length-t){let l=new kr;for(let a=0;a<this.length-t-i;++a)this.setCell(t+a,this.loadCell(t+i+a,l));for(let a=this.length-i;a<this.length;++a)this.setCell(a,n)}else for(let l=t;l<this.length;++l)this.setCell(l,n);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,n)}replaceCells(t,i,n,l=!1){if(l){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,n),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,n);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,n),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,n);t<i&&t<this.length;)this.setCell(t++,n)}resize(t,i){if(t===this.length)return this._data.length*4*Kc<this._data.buffer.byteLength;let n=t*Re;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let l=new Uint32Array(n);l.set(this._data),this._data=l}for(let l=this.length;l<t;++l)this.setCell(l,i)}else{this._data=this._data.subarray(0,n);let l=Object.keys(this._combined);for(let h=0;h<l.length;h++){let d=parseInt(l[h],10);d>=t&&delete this._combined[d]}let a=Object.keys(this._extendedAttrs);for(let h=0;h<a.length;h++){let d=parseInt(a[h],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,n*4*Kc<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Kc<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,t);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,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 i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new hg(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Re+0]&4194303)return t+(this._data[t*Re+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Re+0]&4194303||this._data[t*Re+2]&50331648)return t+(this._data[t*Re+0]>>22);return 0}copyCellsFrom(t,i,n,l,a){let h=t._data;if(a)for(let _=l-1;_>=0;_--){for(let f=0;f<Re;f++)this._data[(n+_)*Re+f]=h[(i+_)*Re+f];h[(i+_)*Re+2]&268435456&&(this._extendedAttrs[n+_]=t._extendedAttrs[i+_])}else for(let _=0;_<l;_++){for(let f=0;f<Re;f++)this._data[(n+_)*Re+f]=h[(i+_)*Re+f];h[(i+_)*Re+2]&268435456&&(this._extendedAttrs[n+_]=t._extendedAttrs[i+_])}let d=Object.keys(t._combined);for(let _=0;_<d.length;_++){let f=parseInt(d[_],10);f>=i&&(this._combined[f-i+n]=t._combined[f])}}translateToString(t,i,n,l){i=i??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),l&&(l.length=0);let a="";for(;i<n;){let h=this._data[i*Re+0],d=h&2097151,_=h&2097152?this._combined[i]:d?Wi(d):Ui;if(a+=_,l)for(let f=0;f<_.length;++f)l.push(i);i+=h>>22||1}return l&&l.push(i),a}};function TS(e,t,i,n,l,a){let h=[];for(let d=0;d<e.length-1;d++){let _=d,f=e.get(++_);if(!f.isWrapped)continue;let v=[e.get(d)];for(;_<e.length&&f.isWrapped;)v.push(f),f=e.get(++_);if(!a&&n>=d&&n<_){d+=v.length-1;continue}let y=0,w=Jn(v,y,t),S=1,k=0;for(;S<v.length;){let x=Jn(v,S,t),I=x-k,U=i-w,W=Math.min(I,U);v[y].copyCellsFrom(v[S],k,w,W,!1),w+=W,w===i&&(y++,w=0),k+=W,k===x&&(S++,k=0),w===0&&y!==0&&v[y-1].getWidth(i-1)===2&&(v[y].copyCellsFrom(v[y-1],i-1,w++,1,!1),v[y-1].setCell(i-1,l))}v[y].replaceCells(w,i,l);let E=0;for(let x=v.length-1;x>0&&(x>y||v[x].getTrimmedLength()===0);x--)E++;E>0&&(h.push(d+v.length-E),h.push(E)),d+=v.length-1}return h}function MS(e,t){let i=[],n=0,l=t[n],a=0;for(let h=0;h<e.length;h++)if(l===h){let d=t[++n];e.onDeleteEmitter.fire({index:h-a,amount:d}),h+=d-1,a+=d,l=t[++n]}else i.push(h);return{layout:i,countRemoved:a}}function LS(e,t){let i=[];for(let n=0;n<t.length;n++)i.push(e.get(t[n]));for(let n=0;n<i.length;n++)e.set(n,i[n]);e.length=t.length}function BS(e,t,i){let n=[],l=e.map((_,f)=>Jn(e,f,t)).reduce((_,f)=>_+f),a=0,h=0,d=0;for(;d<l;){if(l-d<i){n.push(l-d);break}a+=i;let _=Jn(e,h,t);a>_&&(a-=_,h++);let f=e[h].getWidth(a-1)===2;f&&a--;let v=f?i-1:i;n.push(v),d+=v}return n}function Jn(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,l=e[t+1].getWidth(0)===2;return n&&l?i-1:i}var ug=class dg{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=dg._nextId++,this._onDispose=this.register(new te),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),us(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};ug._nextId=1;var IS=ug,_t={},as=_t.B;_t[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:"≥","{":"π","|":"≠","}":"£","~":"·"};_t.A={"#":"£"};_t.B=void 0;_t[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};_t.C=_t[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};_t.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};_t.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};_t.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};_t.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};_t.E=_t[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};_t.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};_t.H=_t[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};_t["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Mp=4294967295,Lp=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=lt.clone(),this.savedCharset=as,this.markers=[],this._nullCell=kr.fromCharData([0,R_,1,0]),this._whitespaceCell=kr.fromCharData([0,Ui,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new jl,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Tp(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 Bl),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 Bl),this._whitespaceCell}getBlankLine(e,t){return new Hn(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>Mp?Mp:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=lt);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 Tp(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(lt),n=0,l=this._getCorrectBufferLength(t);if(l>this.lines.maxLength&&(this.lines.maxLength=l),this.lines.length>0){if(this._cols<e)for(let h=0;h<this.lines.length;h++)n+=+this.lines.get(h).resize(e,i);let a=0;if(this._rows<t)for(let h=this._rows;h<t;h++)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 Hn(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new Hn(e,i)));else for(let h=this._rows;h>t;h--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(l<this.lines.maxLength){let h=this.lines.length-l;h>0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,0)),this.lines.maxLength=l}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),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 a=0;a<this.lines.length;a++)n+=+this.lines.get(a).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.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 i=this._optionsService.rawOptions.reflowCursorLine,n=TS(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(lt),i);if(n.length>0){let l=MS(this.lines,n);LS(this.lines,l.layout),this._reflowLargerAdjustViewport(e,t,l.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let n=this.getNullCell(lt),l=i;for(;l-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Hn(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(lt),l=[],a=0;for(let h=this.lines.length-1;h>=0;h--){let d=this.lines.get(h);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let _=[d];for(;d.isWrapped&&h>0;)d=this.lines.get(--h),_.unshift(d);if(!i){let W=this.ybase+this.y;if(W>=h&&W<h+_.length)continue}let f=_[_.length-1].getTrimmedLength(),v=BS(_,this._cols,e),y=v.length-_.length,w;this.ybase===0&&this.y!==this.lines.length-1?w=Math.max(0,this.y-this.lines.maxLength+y):w=Math.max(0,this.lines.length-this.lines.maxLength+y);let S=[];for(let W=0;W<y;W++){let P=this.getBlankLine(lt,!0);S.push(P)}S.length>0&&(l.push({start:h+_.length+a,newLines:S}),a+=S.length),_.push(...S);let k=v.length-1,E=v[k];E===0&&(k--,E=v[k]);let x=_.length-y-1,I=f;for(;x>=0;){let W=Math.min(I,E);if(_[k]===void 0)break;if(_[k].copyCellsFrom(_[x],I-W,E-W,W,!0),E-=W,E===0&&(k--,E=v[k]),I-=W,I===0){x--;let P=Math.max(x,0);I=Jn(_,P,this._cols)}}for(let W=0;W<_.length;W++)v[W]<e&&_[W].setCell(v[W],n);let U=y-w;for(;U-- >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+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+y,this.ybase+t-1)}if(l.length>0){let h=[],d=[];for(let E=0;E<this.lines.length;E++)d.push(this.lines.get(E));let _=this.lines.length,f=_-1,v=0,y=l[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let w=0;for(let E=Math.min(this.lines.maxLength-1,_+a-1);E>=0;E--)if(y&&y.start>f+w){for(let x=y.newLines.length-1;x>=0;x--)this.lines.set(E--,y.newLines[x]);E++,h.push({index:f+1,amount:y.newLines.length}),w+=y.newLines.length,y=l[++v]}else this.lines.set(E,d[f--]);let S=0;for(let E=h.length-1;E>=0;E--)h[E].index+=S,this.lines.onInsertEmitter.fire(h[E]),S+=h[E].amount;let k=Math.max(0,_+a-this.lines.maxLength);k>0&&this.lines.onTrimEmitter.fire(k)}}translateBufferLineToString(e,t,i=0,n){let l=this.lines.get(e);return l?l.translateToString(t,i,n):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}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 IS(e);return this.markers.push(t),t.register(this.lines.onTrim(i=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},OS=class extends Pe{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new te),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 Lp(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Lp(!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)}},fg=2,pg=1,Lh=class extends Pe{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new te),this.onResize=this._onResize.event,this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,fg),this.rows=Math.max(e.rawOptions.rows||0,pg),this.buffers=this._register(new OS(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=i.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let l=i.ybase+i.scrollTop,a=i.ybase+i.scrollBottom;if(i.scrollTop===0){let h=i.lines.isFull;a===i.lines.length-1?h?i.lines.recycle().copyFrom(n):i.lines.push(n.clone()):i.lines.splice(a+1,0,n.clone()),h?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let h=a-l+1;i.lines.shiftElements(l+1,h-1,-1),i.lines.set(a,n.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let n=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),n!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};Lh=tt([ne(0,Gt)],Lh);var zs={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:Al,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},AS=["normal","bold","100","200","300","400","500","600","700","800","900"],jS=class extends Pe{constructor(e){super(),this._onOptionChange=this._register(new te),this.onOptionChange=this._onOptionChange.event;let t={...zs};for(let i in e)if(i in t)try{let n=e[i];t[i]=this._sanitizeAndValidateOption(i,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ve(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in zs))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,n)=>{if(!(i in zs))throw new Error(`No option with key "${i}"`);n=this._sanitizeAndValidateOption(i,n),this.rawOptions[i]!==n&&(this.rawOptions[i]=n,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let n={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=zs[e]),!zS(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=zs[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=AS.includes(t)?t:zs[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 zS(e){return e==="block"||e==="underline"||e==="bar"}function Wn(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let n in e)i[n]=t<=1?e[n]:e[n]&&Wn(e[n],t-1);return i}var Bp=Object.freeze({insertMode:!1}),Ip=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Bh=class extends Pe{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new te),this.onData=this._onData.event,this._onUserInput=this._register(new te),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new te),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new te),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Wn(Bp),this.decPrivateModes=Wn(Ip)}reset(){this.modes=Wn(Bp),this.decPrivateModes=Wn(Ip)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.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))}};Bh=tt([ne(0,Yt),ne(1,B_),ne(2,Gt)],Bh);var Op={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 Vc(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var qc=String.fromCharCode,Ap={DEFAULT:e=>{let t=[Vc(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${qc(t[0])}${qc(t[1])}${qc(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Vc(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Vc(e,!0)};${e.x};${e.y}${t}`}},Ih=class extends Pe{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new te),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(Op))this.addProtocol(n,Op[n]);for(let n of Object.keys(Ap))this.addEncoding(n,Ap[n]);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,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let n=t/i,l=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=n+0,Math.abs(e.deltaY)<50&&(l*=.3),this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_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,i){if(i){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)}};Ih=tt([ne(0,Yt),ne(1,fs),ne(2,Gt)],Ih);var Yc=[[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]],FS=[[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]],dt;function HS(e,t){let i=0,n=t.length-1,l;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=i;)if(l=i+n>>1,e>t[l][1])i=l+1;else if(e<t[l][0])n=l-1;else return!0;return!1}var WS=class{constructor(){if(this.version="6",!dt){dt=new Uint8Array(65536),dt.fill(1),dt[0]=0,dt.fill(0,1,32),dt.fill(0,127,160),dt.fill(2,4352,4448),dt[9001]=2,dt[9002]=2,dt.fill(2,11904,42192),dt[12351]=1,dt.fill(2,44032,55204),dt.fill(2,63744,64256),dt.fill(2,65040,65050),dt.fill(2,65072,65136),dt.fill(2,65280,65377),dt.fill(2,65504,65511);for(let e=0;e<Yc.length;++e)dt.fill(0,Yc[e][0],Yc[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?dt[e]:HS(e,FS)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),n=i===0&&t!==0;if(n){let l=cs.extractWidth(t);l===0?n=!1:l>i&&(i=l)}return cs.createPropertyValue(0,i,n)}},cs=class Rl{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new te,this.onChange=this._onChange.event;let t=new WS;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,i,n=!1){return(t&16777215)<<3|(i&3)<<1|(n?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 i=0,n=0,l=t.length;for(let a=0;a<l;++a){let h=t.charCodeAt(a);if(55296<=h&&h<=56319){if(++a>=l)return i+this.wcwidth(h);let f=t.charCodeAt(a);56320<=f&&f<=57343?h=(h-55296)*1024+f-56320+65536:i+=this.wcwidth(f)}let d=this.charProperties(h,n),_=Rl.extractWidth(d);Rl.extractShouldJoin(d)&&(_-=Rl.extractWidth(n)),i+=_,n=d}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},$S=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 jp(e){var n;let t=(n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:n.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var On=2147483647,US=256,_g=class Oh{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>US)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new Oh;if(!t.length)return i;for(let n=Array.isArray(t[0])?1:0;n<t.length;++n){let l=t[n];if(Array.isArray(l))for(let a=0;a<l.length;++a)i.addSubParam(l[a]);else i.addParam(l)}return i}clone(){let t=new Oh(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 i=0;i<this.length;++i){t.push(this.params[i]);let n=this._subParamsIdx[i]>>8,l=this._subParamsIdx[i]&255;l-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,l))}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>On?On: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>On?On:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-i>0?this._subParams.subarray(i,n):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let n=this._subParamsIdx[i]>>8,l=this._subParamsIdx[i]&255;l-n>0&&(t[i]=this._subParams.slice(n,l))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,l=n[i-1];n[i-1]=~l?Math.min(l*10+t,On):t}},An=[],KS=class{constructor(){this._state=0,this._active=An,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 i=this._handlers[e];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,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=An}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=An,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||An,!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,i){if(!this._active.length)this._handlerFb(this._id,"PUT",Vl(e,t,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&i-t>0&&this._put(e,t,i)}}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 i=!1,n=this._active.length-1,l=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&i===!1){for(;n>=0&&(i=this._active[n].end(e),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=An,this._id=-1,this._state=0}}},ur=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Vl(e,t,i),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(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},jn=[],VS=class{constructor(){this._handlers=Object.create(null),this._active=jn,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=jn}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,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=jn,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||jn,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",Vl(e,t,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,n=this._active.length-1,l=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&i===!1){for(;n>=0&&(i=this._active[n].unhook(e),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=jn,this._ident=0}},$n=new _g;$n.addParam(0);var zp=class{constructor(e){this._handler=e,this._data="",this._params=$n,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():$n,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Vl(e,t,i),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(i=>(this._params=$n,this._data="",this._hitLimit=!1,i));return this._params=$n,this._data="",this._hitLimit=!1,t}},qS=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,n){this.table[t<<8|e]=i<<4|n}addMany(e,t,i,n){for(let l=0;l<e.length;l++)this.table[t<<8|e[l]]=i<<4|n}},xr=160,YS=(function(){let e=new qS(4095),t=Array.apply(null,Array(256)).map((d,_)=>_),i=(d,_)=>t.slice(d,_),n=i(32,127),l=i(0,24);l.push(25),l.push.apply(l,i(28,32));let a=i(0,14),h;e.setDefault(1,0),e.addMany(n,0,2,0);for(h in a)e.addMany([24,26,153,154],h,3,0),e.addMany(i(128,144),h,3,0),e.addMany(i(144,152),h,3,0),e.add(156,h,0,0),e.add(27,h,11,1),e.add(157,h,4,8),e.addMany([152,158,159],h,0,7),e.add(155,h,11,3),e.add(144,h,11,9);return e.addMany(l,0,3,0),e.addMany(l,1,3,1),e.add(127,1,0,1),e.addMany(l,8,0,8),e.addMany(l,3,3,3),e.add(127,3,0,3),e.addMany(l,4,3,4),e.add(127,4,0,4),e.addMany(l,6,3,6),e.addMany(l,5,3,5),e.add(127,5,0,5),e.addMany(l,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(l,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(l,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(l,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(l,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(l,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(l,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(xr,0,2,0),e.add(xr,8,5,8),e.add(xr,6,0,6),e.add(xr,11,0,11),e.add(xr,13,13,13),e})(),GS=class extends Pe{constructor(e=YS){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 _g,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},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(Ve(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new KS),this._dcsParser=this._register(new VS),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>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 l=0;l<e.intermediates.length;++l){let a=e.intermediates.charCodeAt(l);if(32>a||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=n,i}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 i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let n=this._escHandlers[i];return n.push(t),{dispose:()=>{let l=n.indexOf(t);l!==-1&&n.splice(l,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 i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let n=this._csiHandlers[i];return n.push(t),{dispose:()=>{let l=n.indexOf(t);l!==-1&&n.splice(l,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,i,n,l){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=n,this._parseStack.chunkPos=l}parse(e,t,i){let n=0,l=0,a=0,h;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,_=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&_>-1){for(;_>=0&&(h=d[_](this._params),h!==!0);_--)if(h instanceof Promise)return this._parseStack.handlerPos=_,h}this._parseStack.handlers=[];break;case 4:if(i===!1&&_>-1){for(;_>=0&&(h=d[_](),h!==!0);_--)if(h instanceof Promise)return this._parseStack.handlerPos=_,h}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(n!==24&&n!==26,i),h)return h;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],h=this._oscParser.end(n!==24&&n!==26,i),h)return h;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=a;d<t;++d){switch(n=e[d],l=this._transitions.table[this.currentState<<8|(n<160?n:xr)],l>>4){case 2:for(let w=d+1;;++w){if(w>=t||(n=e[w])<32||n>126&&n<xr){this._printHandler(e,d,w),d=w-1;break}if(++w>=t||(n=e[w])<32||n>126&&n<xr){this._printHandler(e,d,w),d=w-1;break}if(++w>=t||(n=e[w])<32||n>126&&n<xr){this._printHandler(e,d,w),d=w-1;break}if(++w>=t||(n=e[w])<32||n>126&&n<xr){this._printHandler(e,d,w),d=w-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let _=this._csiHandlers[this._collect<<8|n],f=_?_.length-1:-1;for(;f>=0&&(h=_[f](this._params),h!==!0);f--)if(h instanceof Promise)return this._preserveStack(3,_,f,l,d),h;f<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++d<t&&(n=e[d])>47&&n<60);d--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let v=this._escHandlers[this._collect<<8|n],y=v?v.length-1:-1;for(;y>=0&&(h=v[y](),h!==!0);y--)if(h instanceof Promise)return this._preserveStack(4,v,y,l,d),h;y<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(let w=d+1;;++w)if(w>=t||(n=e[w])===24||n===26||n===27||n>127&&n<xr){this._dcsParser.put(e,d,w),d=w-1;break}break;case 14:if(h=this._dcsParser.unhook(n!==24&&n!==26),h)return this._preserveStack(6,[],0,l,d),h;n===27&&(l|=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 w=d+1;;w++)if(w>=t||(n=e[w])<32||n>127&&n<xr){this._oscParser.put(e,d,w),d=w-1;break}break;case 6:if(h=this._oscParser.end(n!==24&&n!==26),h)return this._preserveStack(5,[],0,l,d),h;n===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=l&15}}},XS=/^([\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})$/,JS=/^[\da-f]+$/;function Fp(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=XS.exec(t);if(i){let n=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/n*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/n*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/n*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),JS.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,n=[0,0,0];for(let l=0;l<3;++l){let a=parseInt(t.slice(i*l,i*l+i),16);n[l]=i===1?a<<4:i===2?a:i===3?a>>4:a>>8}return n}}function Gc(e,t){let i=e.toString(16),n=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function QS(e,t=16){let[i,n,l]=e;return`rgb:${Gc(i,t)}/${Gc(n,t)}/${Gc(l,t)}`}var ZS={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Hi=131072,Hp=10;function Wp(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 $p=5e3,Up=0,ew=class extends Pe{constructor(e,t,i,n,l,a,h,d,_=new GS){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=n,this._optionsService=l,this._oscLinkService=a,this._coreMouseService=h,this._unicodeService=d,this._parser=_,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new y0,this._utf8Decoder=new S0,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=lt.clone(),this._eraseAttrDataInternal=lt.clone(),this._onRequestBell=this._register(new te),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new te),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new te),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new te),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new te),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new te),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new te),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new te),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new te),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new te),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new te),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new te),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 Ah(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:v.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,v,y)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:v,data:y})}),this._parser.setDcsHandlerFallback((f,v,y)=>{v==="HOOK"&&(y=y.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:v,payload:y})}),this._parser.setPrintHandler((f,v,y)=>this.print(f,v,y)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Nl.IND,()=>this.index()),this._parser.setExecuteHandler(Nl.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Nl.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ur(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new ur(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new ur(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new ur(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new ur(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new ur(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new ur(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new ur(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new ur(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new ur(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new ur(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new ur(f=>this.restoreCursorColor(f))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let f in _t)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new zp((f,v)=>this.requestStatusString(f,v)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),$p))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${$p} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,n=this._activeBuffer.x,l=this._activeBuffer.y,a=0,h=this._parseStack.paused;if(h){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;n=this._parseStack.cursorStartX,l=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Hi&&(a=this._parseStack.position+Hi)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Hi&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Hi))),h||this._dirtyRowTracker.clearRange(),e.length>Hi)for(let f=a;f<e.length;f+=Hi){let v=f+Hi<e.length?f+Hi:e.length,y=typeof e=="string"?this._stringDecoder.decode(e.substring(f,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,v),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,y))return this._preserveStack(n,l,y,f),this._logSlowResolvingAsync(i),i}else if(!h){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,f))return this._preserveStack(n,l,f,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==n||this._activeBuffer.y!==l)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),_=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);_<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(_,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,i){let n,l,a=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,_=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,v=this._curAttrData,y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&y.getWidth(this._activeBuffer.x-1)===2&&y.setCellFromCodepoint(this._activeBuffer.x-1,0,1,v);let w=this._parser.precedingJoinState;for(let S=t;S<i;++S){if(n=e[S],n<127&&a){let I=a[String.fromCharCode(n)];I&&(n=I.charCodeAt(0))}let k=this._unicodeService.charProperties(n,w);l=cs.extractWidth(k);let E=cs.extractShouldJoin(k),x=E?cs.extractWidth(w):0;if(w=k,h&&this._onA11yChar.fire(Wi(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+l-x>d){if(_){let I=y,U=this._activeBuffer.x-x;for(this._activeBuffer.x=x,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),y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),x>0&&y instanceof Hn&&y.copyCellsFrom(I,U,0,x,!1);U<d;)I.setCellFromCodepoint(U++,0,1,v)}else if(this._activeBuffer.x=d-1,l===2)continue}if(E&&this._activeBuffer.x){let I=y.getWidth(this._activeBuffer.x-1)?1:2;y.addCodepointToCell(this._activeBuffer.x-I,n,l);for(let U=l-x;--U>=0;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(f&&(y.insertCells(this._activeBuffer.x,l-x,this._activeBuffer.getNullCell(v)),y.getWidth(d-1)===2&&y.setCellFromCodepoint(d-1,0,1,v)),y.setCellFromCodepoint(this._activeBuffer.x++,n,l,v),l>0)for(;--l;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=w,this._activeBuffer.x<d&&i-t>0&&y.getWidth(this._activeBuffer.x)===0&&!y.hasContent(this._activeBuffer.x)&&y.setCellFromCodepoint(this._activeBuffer.x,0,1,v),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>Wp(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new zp(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ur(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,i,n=!1,l=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),l),n&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var n;this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&n.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let l=this._activeBuffer.lines.length-this._bufferService.rows;l>0&&(this._activeBuffer.lines.trimStart(l),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-l,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-l,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 i=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,l=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(l-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}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 i=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(i,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}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(lt));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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 i=e.params[0]||1,n=cs.extractWidth(t),l=this._activeBuffer.x-n,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(l),h=new Uint32Array(a.length*i),d=0;for(let f=0;f<a.length;){let v=a.codePointAt(f)||0;h[d++]=v,f+=v>65535?2:1}let _=d;for(let f=1;f<i;++f)h.copyWithin(_,0,d),_+=d;return this.print(h,0,_),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent($.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent($.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent($.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent($.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent($.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,as),this._charsetService.setgCharset(1,as),this._charsetService.setgCharset(2,as),this._charsetService.setgCharset(3,as);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){(E=>(E[E.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",E[E.SET=1]="SET",E[E.RESET=2]="RESET",E[E.PERMANENTLY_SET=3]="PERMANENTLY_SET",E[E.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let n=this._coreService.decPrivateModes,{activeProtocol:l,activeEncoding:a}=this._coreMouseService,h=this._coreService,{buffers:d,cols:_}=this._bufferService,{active:f,alt:v}=d,y=this._optionsService.rawOptions,w=(E,x)=>(h.triggerDataEvent(`${$.ESC}[${t?"":"?"}${E};${x}$y`),!0),S=E=>E?1:2,k=e.params[0];return t?k===2?w(k,4):k===4?w(k,S(h.modes.insertMode)):k===12?w(k,3):k===20?w(k,S(y.convertEol)):w(k,0):k===1?w(k,S(n.applicationCursorKeys)):k===3?w(k,y.windowOptions.setWinLines?_===80?2:_===132?1:0:0):k===6?w(k,S(n.origin)):k===7?w(k,S(n.wraparound)):k===8?w(k,3):k===9?w(k,S(l==="X10")):k===12?w(k,S(y.cursorBlink)):k===25?w(k,S(!h.isCursorHidden)):k===45?w(k,S(n.reverseWraparound)):k===66?w(k,S(n.applicationKeypad)):k===67?w(k,4):k===1e3?w(k,S(l==="VT200")):k===1002?w(k,S(l==="DRAG")):k===1003?w(k,S(l==="ANY")):k===1004?w(k,S(n.sendFocus)):k===1005?w(k,4):k===1006?w(k,S(a==="SGR")):k===1015?w(k,4):k===1016?w(k,S(a==="SGR_PIXELS")):k===1048?w(k,1):k===47||k===1047||k===1049?w(k,S(f===v)):k===2004?w(k,S(n.bracketedPasteMode)):k===2026?w(k,S(n.synchronizedOutput)):w(k,0)}_updateAttrColor(e,t,i,n,l){return t===2?(e|=50331648,e&=-16777216,e|=ro.fromColorRGB([i,n,l])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let n=[0,0,-1,0,0,0],l=0,a=0;do{if(n[a+l]=e.params[t+a],e.hasSubParams(t+a)){let h=e.getSubParams(t+a),d=0;do n[1]===5&&(l=1),n[a+d+1+l]=h[d];while(++d<h.length&&d+a+1+l<n.length);break}if(n[1]===5&&a+l>=2||n[1]===2&&a+l>=5)break;n[1]&&(l=1)}while(++a+t<e.length&&a+l<n.length);for(let h=2;h<n.length;++h)n[h]===-1&&(n[h]=0);switch(n[0]){case 38:i.fg=this._updateAttrColor(i.fg,n[1],n[3],n[4],n[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,n[1],n[3],n[4],n[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,n[1],n[3],n[4],n[5])}return a}_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=lt.fg,e.bg=lt.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,i,n=this._curAttrData;for(let l=0;l<t;l++)i=e.params[l],i>=30&&i<=37?(n.fg&=-50331904,n.fg|=16777216|i-30):i>=40&&i<=47?(n.bg&=-50331904,n.bg|=16777216|i-40):i>=90&&i<=97?(n.fg&=-50331904,n.fg|=16777216|i-90|8):i>=100&&i<=107?(n.bg&=-50331904,n.bg|=16777216|i-100|8):i===0?this._processSGR0(n):i===1?n.fg|=134217728:i===3?n.bg|=67108864:i===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(l)?e.getSubParams(l)[0]:1,n)):i===5?n.fg|=536870912:i===7?n.fg|=67108864:i===8?n.fg|=1073741824:i===9?n.fg|=2147483648:i===2?n.bg|=134217728:i===21?this._processUnderline(2,n):i===22?(n.fg&=-134217729,n.bg&=-134217729):i===23?n.bg&=-67108865:i===24?(n.fg&=-268435457,this._processUnderline(0,n)):i===25?n.fg&=-536870913:i===27?n.fg&=-67108865:i===28?n.fg&=-1073741825:i===29?n.fg&=2147483647:i===39?(n.fg&=-67108864,n.fg|=lt.fg&16777215):i===49?(n.bg&=-67108864,n.bg|=lt.bg&16777215):i===38||i===48||i===58?l+=this._extractColor(e,l,n):i===53?n.bg|=1073741824:i===55?n.bg&=-1073741825:i===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):i===100?(n.fg&=-67108864,n.fg|=lt.fg&16777215,n.bg&=-67108864,n.bg|=lt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${t};${i}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=lt.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 i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Wp(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(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Hp&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Hp&&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=[],i=e.split(";");for(;i.length>1;){let n=i.shift(),l=i.shift();if(/^\d+$/.exec(n)){let a=parseInt(n);if(Kp(a))if(l==="?")t.push({type:0,index:a});else{let h=Fp(l);h&&t.push({type:1,index:a,color:h})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(i,n):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),n,l=i.findIndex(a=>a.startsWith("id="));return l!==-1&&(n=i[l].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,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 i=e.split(";");for(let n=0;n<i.length&&!(t>=this._specialColors.length);++n,++t)if(i[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let l=Fp(i[n]);l&&this._onColor.fire([{type:1,index:this._specialColors[t],color:l}])}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=[],i=e.split(";");for(let n=0;n<i.length;++n)if(/^\d+$/.exec(i[n])){let l=parseInt(i[n]);Kp(l)&&t.push({type:2,index:l})}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,as),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(ZS[e[0]],_t[e[1]]||as),!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=lt.clone(),this._eraseAttrDataInternal=lt.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 kr;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 i=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(i);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=h=>(this._coreService.triggerDataEvent(`${$.ESC}${h}${$.ESC}\\`),!0),n=this._bufferService.buffer,l=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[l.cursorStyle]-(l.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Ah=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&&(Up=e,e=t,t=Up),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Ah=tt([ne(0,Yt)],Ah);function Kp(e){return 0<=e&&e<256}var tw=5e7,Vp=12,rw=50,iw=class extends Pe{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 te),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 i;for(;i=this._writeBuffer.shift();){this._action(i);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>tw)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 i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],l=this._action(n,t);if(l){let h=d=>performance.now()-i>=Vp?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(i,d);l.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(h);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-i>=Vp)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>rw&&(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()}},jh=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let d=t.addMarker(t.ybase+t.y),_={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(_,d)),this._dataByLinkId.set(_.id,_),_.id}let i=e,n=this._getEntryIdKey(i),l=this._entriesWithId.get(n);if(l)return this.addLineToLink(l.id,t.ybase+t.y),l.id;let a=t.addMarker(t.ybase+t.y),h={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(h,a)),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);i.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(i,n))}}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 i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};jh=tt([ne(0,Yt)],jh);var qp=!1,sw=class extends Pe{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ws),this._onBinary=this._register(new te),this.onBinary=this._onBinary.event,this._onData=this._register(new te),this.onData=this._onData.event,this._onLineFeed=this._register(new te),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new te),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new te),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new te),this._instantiationService=new DS,this.optionsService=this._register(new jS(e)),this._instantiationService.setService(Gt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Lh)),this._instantiationService.setService(Yt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Mh)),this._instantiationService.setService(B_,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Bh)),this._instantiationService.setService(fs,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Ih)),this._instantiationService.setService(L_,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(cs)),this._instantiationService.setService(C0,this.unicodeService),this._charsetService=this._instantiationService.createInstance($S),this._instantiationService.setService(b0,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(jh),this._instantiationService.setService(I_,this._oscLinkService),this._inputHandler=this._register(new ew(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Lt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Lt.forward(this._bufferService.onResize,this._onResize)),this._register(Lt.forward(this.coreService.onData,this._onData)),this._register(Lt.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 iw((t,i)=>this._inputHandler.parse(t,i))),this._register(Lt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new te),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&&!qp&&(this._logService.warn("writeSync is unreliable and will be removed soon."),qp=!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,fg),t=Math.max(t,pg),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(jp.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(jp(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ve(()=>{for(let t of e)t.dispose()})}}},nw={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 ow(e,t,i,n){var h;let l={type:0,cancel:!1,key:void 0},a=(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?l.key=$.ESC+"OA":l.key=$.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?l.key=$.ESC+"OD":l.key=$.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?l.key=$.ESC+"OC":l.key=$.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?l.key=$.ESC+"OB":l.key=$.ESC+"[B");break;case 8:l.key=e.ctrlKey?"\b":$.DEL,e.altKey&&(l.key=$.ESC+l.key);break;case 9:if(e.shiftKey){l.key=$.ESC+"[Z";break}l.key=$.HT,l.cancel=!0;break;case 13:l.key=e.altKey?$.ESC+$.CR:$.CR,l.cancel=!0;break;case 27:l.key=$.ESC,e.altKey&&(l.key=$.ESC+$.ESC),l.cancel=!0;break;case 37:if(e.metaKey)break;a?l.key=$.ESC+"[1;"+(a+1)+"D":t?l.key=$.ESC+"OD":l.key=$.ESC+"[D";break;case 39:if(e.metaKey)break;a?l.key=$.ESC+"[1;"+(a+1)+"C":t?l.key=$.ESC+"OC":l.key=$.ESC+"[C";break;case 38:if(e.metaKey)break;a?l.key=$.ESC+"[1;"+(a+1)+"A":t?l.key=$.ESC+"OA":l.key=$.ESC+"[A";break;case 40:if(e.metaKey)break;a?l.key=$.ESC+"[1;"+(a+1)+"B":t?l.key=$.ESC+"OB":l.key=$.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(l.key=$.ESC+"[2~");break;case 46:a?l.key=$.ESC+"[3;"+(a+1)+"~":l.key=$.ESC+"[3~";break;case 36:a?l.key=$.ESC+"[1;"+(a+1)+"H":t?l.key=$.ESC+"OH":l.key=$.ESC+"[H";break;case 35:a?l.key=$.ESC+"[1;"+(a+1)+"F":t?l.key=$.ESC+"OF":l.key=$.ESC+"[F";break;case 33:e.shiftKey?l.type=2:e.ctrlKey?l.key=$.ESC+"[5;"+(a+1)+"~":l.key=$.ESC+"[5~";break;case 34:e.shiftKey?l.type=3:e.ctrlKey?l.key=$.ESC+"[6;"+(a+1)+"~":l.key=$.ESC+"[6~";break;case 112:a?l.key=$.ESC+"[1;"+(a+1)+"P":l.key=$.ESC+"OP";break;case 113:a?l.key=$.ESC+"[1;"+(a+1)+"Q":l.key=$.ESC+"OQ";break;case 114:a?l.key=$.ESC+"[1;"+(a+1)+"R":l.key=$.ESC+"OR";break;case 115:a?l.key=$.ESC+"[1;"+(a+1)+"S":l.key=$.ESC+"OS";break;case 116:a?l.key=$.ESC+"[15;"+(a+1)+"~":l.key=$.ESC+"[15~";break;case 117:a?l.key=$.ESC+"[17;"+(a+1)+"~":l.key=$.ESC+"[17~";break;case 118:a?l.key=$.ESC+"[18;"+(a+1)+"~":l.key=$.ESC+"[18~";break;case 119:a?l.key=$.ESC+"[19;"+(a+1)+"~":l.key=$.ESC+"[19~";break;case 120:a?l.key=$.ESC+"[20;"+(a+1)+"~":l.key=$.ESC+"[20~";break;case 121:a?l.key=$.ESC+"[21;"+(a+1)+"~":l.key=$.ESC+"[21~";break;case 122:a?l.key=$.ESC+"[23;"+(a+1)+"~":l.key=$.ESC+"[23~";break;case 123:a?l.key=$.ESC+"[24;"+(a+1)+"~":l.key=$.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?l.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?l.key=$.NUL:e.keyCode>=51&&e.keyCode<=55?l.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?l.key=$.DEL:e.keyCode===219?l.key=$.ESC:e.keyCode===220?l.key=$.FS:e.keyCode===221&&(l.key=$.GS);else if((!i||n)&&e.altKey&&!e.metaKey){let d=(h=nw[e.keyCode])==null?void 0:h[e.shiftKey?1:0];if(d)l.key=$.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let _=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(_);e.shiftKey&&(f=f.toUpperCase()),l.key=$.ESC+f}else if(e.keyCode===32)l.key=$.ESC+(e.ctrlKey?$.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let _=e.code.slice(3,4);e.shiftKey||(_=_.toLowerCase()),l.key=$.ESC+_,l.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(l.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?l.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(l.key=$.US),e.key==="@"&&(l.key=$.NUL));break}return l}var st=0,lw=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new jl,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new jl,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((l,a)=>this._getKey(l)-this._getKey(a)),t=0,i=0,n=new Array(this._array.length+this._insertedValues.length);for(let l=0;l<n.length;l++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(n[l]=e[t],t++):n[l]=this._array[i++];this._array=n,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||(st=this._search(t),st===-1)||this._getKey(this._array[st])!==t)return!1;do if(this._array[st]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(st),!0;while(++st<this._array.length&&this._getKey(this._array[st])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((l,a)=>l-a),t=0,i=new Array(this._array.length-e.length),n=0;for(let l=0;l<this._array.length;l++)e[t]===l?t++:i[n++]=this._array[l];this._array=i,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&&(st=this._search(e),!(st<0||st>=this._array.length)&&this._getKey(this._array[st])===e))do yield this._array[st];while(++st<this._array.length&&this._getKey(this._array[st])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(st=this._search(e),!(st<0||st>=this._array.length)&&this._getKey(this._array[st])===e))do t(this._array[st]);while(++st<this._array.length&&this._getKey(this._array[st])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let n=t+i>>1,l=this._getKey(this._array[n]);if(l>e)i=n-1;else if(l<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},Xc=0,Yp=0,aw=class extends Pe{constructor(){super(),this._decorations=new lw(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new te),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new te),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ve(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new cw(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.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,i){let n=0,l=0;for(let a of this._decorations.getKeyIterator(t))n=a.options.x??0,l=n+(a.options.width??1),e>=n&&e<l&&(!i||(a.options.layer??"bottom")===i)&&(yield a)}forEachDecorationAtCell(e,t,i,n){this._decorations.forEachByKey(t,l=>{Xc=l.options.x??0,Yp=Xc+(l.options.width??1),e>=Xc&&e<Yp&&(!i||(l.options.layer??"bottom")===i)&&n(l)})}},cw=class extends Ki{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new te),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new te),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=Qe.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Qe.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},hw=1e3,uw=class{constructor(e,t=hw){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,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 n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let l=n-this._lastRefreshMs,a=this._debounceThresholdMS-l;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},a)}}_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)}},Gp=20,zl=class extends Pe{constructor(e,t,i,n){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let l=this._coreBrowserService.mainDocument;this._accessibilityContainer=l.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=l.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let a=0;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);if(this._topBoundaryFocusListener=a=>this._handleBoundaryFocus(a,0),this._bottomBoundaryFocusListener=a=>this._handleBoundaryFocus(a,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=l.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new uw(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(a=>this._handleResize(a.rows))),this._register(this._terminal.onRender(a=>this._refreshRows(a.start,a.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(a=>this._handleChar(a))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
69
+ `))),this._register(this._terminal.onA11yTab(a=>this._handleTab(a))),this._register(this._terminal.onKey(a=>this._handleKey(a.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ce(l,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ve(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Gp+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
70
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Gp+1&&(this._liveRegion.textContent+=sh.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 i=this._terminal.buffer,n=i.lines.length.toString();for(let l=e;l<=t;l++){let a=i.lines.get(i.ydisp+l),h=[],d=(a==null?void 0:a.translateToString(!0,void 0,void 0,h))||"",_=(i.ydisp+l+1).toString(),f=this._rowElements[l];f&&(d.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=d,this._rowColumns.set(f,h)),f.setAttribute("aria-posinset",_),f.setAttribute("aria-setsize",n),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],l=i.getAttribute("aria-posinset"),a=t===0?"1":`${this._terminal.buffer.lines.length}`;if(l===a||e.relatedTarget!==n)return;let h,d;if(t===0?(h=i,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(h=this._rowElements.shift(),d=i,this._rowContainer.removeChild(h)),h.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let _=this._createAccessibilityTreeNode();this._rowElements.unshift(_),this._rowContainer.insertAdjacentElement("afterbegin",_)}else{let _=this._createAccessibilityTreeNode();this._rowElements.push(_),this._rowContainer.appendChild(_)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var d;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,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 n=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:n,offset:((d=n.textContent)==null?void 0:d.length)??0}),!this._rowContainer.contains(i.node))return;let l=({node:_,offset:f})=>{let v=_ instanceof Text?_.parentNode:_,y=parseInt(v==null?void 0:v.getAttribute("aria-posinset"),10)-1;if(isNaN(y))return console.warn("row is invalid. Race condition?"),null;let w=this._rowColumns.get(v);if(!w)return console.warn("columns is null. Race condition?"),null;let S=f<w.length?w[f]:w.slice(-1)[0]+1;return S>=this._terminal.cols&&(++y,S=0),{row:y,column:S}},a=l(t),h=l(i);if(!(!a||!h)){if(a.row>h.row||a.row===h.row&&a.column>=h.column)throw new Error("invalid range");this._terminal.select(a.column,a.row,(h.row-a.row)*this._terminal.cols-a.column+h.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 l,a;e.style.transform="";let t=e.getBoundingClientRect().width,i=(a=(l=this._rowColumns.get(e))==null?void 0:l.slice(-1))==null?void 0:a[0];if(!i)return;let n=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};zl=tt([ne(1,Yh),ne(2,mi),ne(3,vi)],zl);var zh=class extends Pe{constructor(e,t,i,n,l){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=n,this._linkProviderService=l,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new te),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new te),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ve(()=>{var a;us(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(a=this._activeProviderReplies)==null||a.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ce(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ce(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ce(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ce(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 i=e.composedPath();for(let n=0;n<i.length;n++){let l=i[n];if(l.classList.contains("xterm"))break;if(l.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 n,l;(!this._activeProviderReplies||!t)&&((n=this._activeProviderReplies)==null||n.forEach(a=>{a==null||a.forEach(h=>{h.link.dispose&&h.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[a,h]of this._linkProviderService.linkProviders.entries())t?(l=this._activeProviderReplies)!=null&&l.get(a)&&(i=this._checkLinkProviderResult(a,e,i)):h.provideLinks(e.y,d=>{var f,v;if(this._isMouseOut)return;let _=d==null?void 0:d.map(y=>({link:y}));(f=this._activeProviderReplies)==null||f.set(a,_),i=this._checkLinkProviderResult(a,e,i),((v=this._activeProviderReplies)==null?void 0:v.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let n=0;n<t.size;n++){let l=t.get(n);if(l)for(let a=0;a<l.length;a++){let h=l[a],d=h.link.range.start.y<e?0:h.link.range.start.x,_=h.link.range.end.y>e?this._bufferService.cols:h.link.range.end.x;for(let f=d;f<=_;f++){if(i.has(f)){l.splice(a--,1);break}i.add(f)}}}}_checkLinkProviderResult(e,t,i){var a;if(!this._activeProviderReplies)return i;let n=this._activeProviderReplies.get(e),l=!1;for(let h=0;h<e;h++)(!this._activeProviderReplies.has(h)||this._activeProviderReplies.get(h))&&(l=!0);if(!l&&n){let h=n.find(d=>this._linkAtPosition(d.link,t));h&&(i=!0,this._handleNewLink(h))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let h=0;h<this._activeProviderReplies.size;h++){let d=(a=this._activeProviderReplies.get(h))==null?void 0:a.find(_=>this._linkAtPosition(_.link,t));if(d){i=!0,this._handleNewLink(d);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&dw(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,us(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 i,n;return(n=(i=this._currentLink)==null?void 0:i.state)==null?void 0:n.decorations.pointerCursor},set:i=>{var n;(n=this._currentLink)!=null&&n.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,n;return(n=(i=this._currentLink)==null?void 0:i.state)==null?void 0:n.decorations.underline},set:i=>{var n,l,a;(n=this._currentLink)!=null&&n.state&&((a=(l=this._currentLink)==null?void 0:l.state)==null?void 0:a.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let n=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,l=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=l&&(this._clearCurrentLink(n,l),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(e,t,i){var n;(n=this._currentLink)!=null&&n.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(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,n=this._bufferService.buffer.ydisp,l=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-n-1,i.end.x,i.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(l)}_linkLeave(e,t,i){var n;(n=this._currentLink)!=null&&n.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(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,l=t.y*this._bufferService.cols+t.x;return i<=l&&l<=n}_positionFromMouseEvent(e,t,i){let n=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,n,l){return{x1:e,y1:t,x2:i,y2:n,cols:this._bufferService.cols,fg:l}}};zh=tt([ne(1,Gh),ne(2,vi),ne(3,Yt),ne(4,A_)],zh);function dw(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 fw=class extends sw{constructor(e={}){super(e),this._linkifier=this._register(new Ws),this.browser=rg,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ws),this._onCursorMove=this._register(new te),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new te),this.onKey=this._onKey.event,this._onRender=this._register(new te),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new te),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new te),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new te),this.onBell=this._onBell.event,this._onFocus=this._register(new te),this._onBlur=this._register(new te),this._onA11yCharEmitter=this._register(new te),this._onA11yTabEmitter=this._register(new te),this._onWillOpen=this._register(new te),this._setup(),this._decorationService=this._instantiationService.createInstance(aw),this._instantiationService.setService(io,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(rS),this._instantiationService.setService(A_,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(oh)),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(Lt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Lt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Lt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Lt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Ve(()=>{var t,i;this._customKeyEventHandler=void 0,(i=(t=this.element)==null?void 0:t.parentNode)==null||i.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 i,n="";switch(t.index){case 256:i="foreground",n="10";break;case 257:i="background",n="11";break;case 258:i="cursor",n="12";break;default:i="ansi",n="4;"+t.index}switch(t.type){case 0:let l=Ue.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${QS(l)}${eg.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(a=>a.ansi[t.index]=at.toColor(...t.color));else{let a=i;this._themeService.modifyColors(h=>h[a]=at.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(zl,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.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($.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 i=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,l=t.getWidth(i),a=this._renderService.dimensions.css.cell.width*l,h=this.buffer.y*this._renderService.dimensions.css.cell.height,d=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=h+"px",this.textarea.style.width=a+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ce(this.element,"copy",t=>{this.hasSelection()&&m0(t,this._selectionService)}));let e=t=>v0(t,this.textarea,this.coreService,this.optionsService);this._register(Ce(this.textarea,"paste",e)),this._register(Ce(this.element,"paste",e)),ig?this._register(Ce(this.element,"mousedown",t=>{t.button===2&&np(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ce(this.element,"contextmenu",t=>{np(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),iu&&this._register(Ce(this.element,"auxclick",t=>{t.button===1&&D_(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ce(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ce(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ce(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ce(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ce(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ce(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ce(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var l;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"),((l=this.element)==null?void 0:l.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(Ce(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",ih.get()),og||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",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(eS,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(mi,this._coreBrowserService),this._register(Ce(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(Ce(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Nh,this._document,this._helperContainer),this._instantiationService.setService(ql,this._charSizeService),this._themeService=this._instantiationService.createInstance(Th),this._instantiationService.setService($s,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ol),this._instantiationService.setService(O_,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Rh,this.rows,this.screenElement)),this._instantiationService.setService(vi,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Ch,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Dh),this._instantiationService.setService(Gh,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(zh,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(xh,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ph,this.element,this.screenElement,n)),this._instantiationService.setService(E0,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(Lt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var a;this._selectionService.refresh(),(a=this._viewport)==null||a.queueSync()})),this._register(this._instantiationService.createInstance(bh,this.screenElement)),this._register(Ce(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),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(zl,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Il,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Il,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Eh,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(a){var f,v,y,w,S;let h=e._mouseService.getMouseReportCoords(a,e.screenElement);if(!h)return!1;let d,_;switch(a.overrideType||a.type){case"mousemove":_=32,a.buttons===void 0?(d=3,a.button!==void 0&&(d=a.button<3?a.button:3)):d=a.buttons&1?0:a.buttons&4?1:a.buttons&2?2:3;break;case"mouseup":_=0,d=a.button<3?a.button:3;break;case"mousedown":_=1,d=a.button<3?a.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(a)===!1)return!1;let k=a.deltaY;if(k===0||e.coreMouseService.consumeWheelEvent(a,(w=(y=(v=(f=e._renderService)==null?void 0:f.dimensions)==null?void 0:v.device)==null?void 0:y.cell)==null?void 0:w.height,(S=e._coreBrowserService)==null?void 0:S.dpr)===0)return!1;_=k<0?0:1,d=4;break;default:return!1}return _===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:h.col,row:h.row,x:h.x,y:h.y,button:d,action:_,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},l={mouseup:a=>(i(a),a.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(a)),wheel:a=>(i(a),this.cancel(a,!0)),mousedrag:a=>{a.buttons&&i(a)},mousemove:a=>{a.buttons||i(a)}};this._register(this.coreMouseService.onProtocolChange(a=>{a?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(a)),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()),a&8?n.mousemove||(t.addEventListener("mousemove",l.mousemove),n.mousemove=l.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),a&16?n.wheel||(t.addEventListener("wheel",l.wheel,{passive:!1}),n.wheel=l.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),a&2?n.mouseup||(n.mouseup=l.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),a&4?n.mousedrag||(n.mousedrag=l.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ce(t,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return i(a),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(a)})),this._register(Ce(t,"wheel",a=>{var h,d,_,f,v;if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(a)===!1)return!1;if(!this.buffer.hasScrollback){if(a.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(a,(f=(_=(d=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:d.device)==null?void 0:_.cell)==null?void 0:f.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return this.cancel(a,!0);let y=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(a.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(y,!0),this.cancel(a,!0)}}},{passive:!1}))}refresh(e,t){var i;(i=this._renderService)==null||i.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){N_(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,i){this._selectionService.setSelection(e,t,i)}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 i;(i=this._selectionService)==null||i.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 i=ow(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let n=this.rows-1;return this.scrollLines(i.type===2?-n:n),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.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((i.key===$.ETX||i.key===$.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=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"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(pw(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 i;(i=this._charSizeService)==null||i.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(lt));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($.ESC+"[I"):this.coreService.triggerDataEvent($.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[4;${i};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),l=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[6;${l};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function pw(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var _w=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;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)}},gw=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 kr)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},Xp=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 gw(t)}getNullCell(){return new kr}},mw=class extends Pe{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new te),this.onBufferChange=this._onBufferChange.event,this._normal=new Xp(this._core.buffers.normal,"normal"),this._alternate=new Xp(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)}},vw=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,n)=>t(i,n.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)}},yw=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}},Sw=["cols","rows"],Jr=0,ww=class extends Pe{constructor(e){super(),this._core=this._register(new fw(e)),this._addonManager=this._register(new _w),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],i=(n,l)=>{this._checkReadonlyOptions(n),this._core.options[n]=l};for(let n in this._core.options){let l={get:t.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this._publicOptions,n,l)}}_checkReadonlyOptions(e){if(Sw.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 vw(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new yw(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 mw(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,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}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
71
+ `,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 ih.get()},set promptLabel(e){ih.set(e)},get tooMuchOutput(){return sh.get()},set tooMuchOutput(e){sh.set(e)}}}_verifyIntegers(...e){for(Jr of e)if(Jr===1/0||isNaN(Jr)||Jr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Jr of e)if(Jr&&(Jr===1/0||isNaN(Jr)||Jr%1!==0||Jr<0))throw new Error("This API only accepts positive integers")}};/**
72
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
73
+ * @license MIT
74
+ *
75
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
76
+ * @license MIT
77
+ *
78
+ * Originally forked from (with the author's permission):
79
+ * Fabrice Bellard's javascript vt100 for jslinux:
80
+ * http://bellard.org/jslinux/
81
+ * Copyright (c) 2011 Fabrice Bellard
82
+ */var xw=2,bw=1,Cw=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var y;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((y=this._terminal.options.overviewRuler)==null?void 0:y.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(i.getPropertyValue("height")),l=Math.max(0,parseInt(i.getPropertyValue("width"))),a=window.getComputedStyle(this._terminal.element),h={top:parseInt(a.getPropertyValue("padding-top")),bottom:parseInt(a.getPropertyValue("padding-bottom")),right:parseInt(a.getPropertyValue("padding-right")),left:parseInt(a.getPropertyValue("padding-left"))},d=h.top+h.bottom,_=h.right+h.left,f=n-d,v=l-_-t;return{cols:Math.max(xw,Math.floor(v/e.css.cell.width)),rows:Math.max(bw,Math.floor(f/e.css.cell.height))}}};/**
83
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
84
+ * @license MIT
85
+ *
86
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
87
+ * @license MIT
88
+ *
89
+ * Originally forked from (with the author's permission):
90
+ * Fabrice Bellard's javascript vt100 for jslinux:
91
+ * http://bellard.org/jslinux/
92
+ * Copyright (c) 2011 Fabrice Bellard
93
+ */var kw=class{constructor(e,t,i,n={}){this._terminal=e,this._regex=t,this._handler=i,this._options=n}provideLinks(e,t){let i=Nw.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(i,n)=>{if(this._options.hover){let{range:l}=t;this._options.hover(i,n,l)}},t))}};function Ew(e){try{let t=new URL(e),i=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(i.toLocaleLowerCase())}catch{return!1}}var Nw=class Pl{static computeLink(t,i,n,l){let a=new RegExp(i.source,(i.flags||"")+"g"),[h,d]=Pl._getWindowedLineStrings(t-1,n),_=h.join(""),f,v=[];for(;f=a.exec(_);){let y=f[0];if(!Ew(y))continue;let[w,S]=Pl._mapStrIdx(n,d,0,f.index),[k,E]=Pl._mapStrIdx(n,w,S,y.length);if(w===-1||S===-1||k===-1||E===-1)continue;let x={start:{x:S+1,y:w+1},end:{x:E,y:k+1}};v.push({range:x,text:y,activate:l})}return v}static _getWindowedLineStrings(t,i){let n,l=t,a=t,h=0,d="",_=[];if(n=i.buffer.active.getLine(t)){let f=n.translateToString(!0);if(n.isWrapped&&f[0]!==" "){for(h=0;(n=i.buffer.active.getLine(--l))&&h<2048&&(d=n.translateToString(!0),h+=d.length,_.push(d),!(!n.isWrapped||d.indexOf(" ")!==-1)););_.reverse()}for(_.push(f),h=0;(n=i.buffer.active.getLine(++a))&&n.isWrapped&&h<2048&&(d=n.translateToString(!0),h+=d.length,_.push(d),d.indexOf(" ")===-1););}return[_,l]}static _mapStrIdx(t,i,n,l){let a=t.buffer.active,h=a.getNullCell(),d=n;for(;l;){let _=a.getLine(i);if(!_)return[-1,-1];for(let f=d;f<_.length;++f){_.getCell(f,h);let v=h.getChars();if(h.getWidth()&&(l-=v.length||1,f===_.length-1&&v==="")){let y=a.getLine(i+1);y&&y.isWrapped&&(y.getCell(0,h),h.getWidth()===2&&(l+=1))}if(l<0)return[i,f]}i++,d=0}return[i,d]}},Dw=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Rw(e,t){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var Pw=class{constructor(e=Rw,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||Dw;this._linkProvider=this._terminal.registerLinkProvider(new kw(this._terminal,i,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const Tw="\0";function Mw({sessionId:e,projectPath:t,isNew:i}){const n=b.useRef(null),l=b.useRef(null),a=b.useRef(null),h=b.useRef(null),[d,_]=b.useState("connecting");return Oe(f=>f.pendingTodoPrompt),Oe(f=>f.setPendingTodoPrompt),b.useEffect(()=>{if(!n.current)return;const f=new ww({cursorBlink:!0,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",cursorAccent:"#0d1117",selectionBackground:"#264f78",black:"#484f58",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#b1bac4",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"},allowProposedApi:!0}),v=new Cw,y=new Pw;f.loadAddon(v),f.loadAddon(y),f.open(n.current),v.fit(),l.current=f,h.current=v;const w=window.location.protocol==="https:"?"wss:":"ws:",S=new WebSocket(`${w}//${window.location.host}/ws/terminal`);a.current=S,S.onopen=()=>{const I=v.proposeDimensions();S.send(JSON.stringify({type:i?"new":"resume",sessionId:e,projectPath:t,cols:(I==null?void 0:I.cols)||80,rows:(I==null?void 0:I.rows)||24}))},S.onmessage=I=>{const U=I.data;if(U.startsWith(Tw)){const W=JSON.parse(U.slice(1));switch(W.type){case"ready":_("connected");{const P=Oe.getState().pendingTodoPrompt;P&&P.sessionId===e&&setTimeout(()=>{S.readyState===WebSocket.OPEN&&S.send(JSON.stringify({type:"input",data:P.prompt})),Oe.getState().setPendingTodoPrompt(null)},1500)}break;case"exit":_("exited"),f.writeln(""),f.writeln("\x1B[90m--- Process exited (code: "+W.exitCode+") ---\x1B[0m");break;case"error":_("error"),f.writeln("\x1B[31mError: "+W.message+"\x1B[0m");break}return}f.write(U)},S.onerror=()=>{_("error"),f.writeln("\x1B[31mWebSocket connection error\x1B[0m")},S.onclose=()=>{l.current&&_("exited")};const k=f.onData(I=>{S.readyState===WebSocket.OPEN&&S.send(JSON.stringify({type:"input",data:I}))});let E;const x=new ResizeObserver(()=>{clearTimeout(E),E=setTimeout(()=>{if(!h.current||!l.current)return;h.current.fit();const I=h.current.proposeDimensions();I&&S.readyState===WebSocket.OPEN&&S.send(JSON.stringify({type:"resize",cols:I.cols,rows:I.rows}))},100)});return x.observe(n.current),()=>{clearTimeout(E),x.disconnect(),k.dispose(),S.close(),a.current=null,f.dispose(),l.current=null,h.current=null,_("connecting")}},[e,t,i]),g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsx("div",{className:"flex items-center gap-2 px-3 py-1 bg-gray-900 border-b border-gray-800 text-xs shrink-0",children:g.jsxs("span",{className:d==="connected"?"text-green-400":d==="connecting"?"text-yellow-400":d==="error"?"text-red-400":"text-gray-500",children:[g.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full mr-1 ${d==="connected"?"bg-green-400":d==="connecting"?"bg-yellow-400 animate-pulse":d==="error"?"bg-red-400":"bg-gray-500"}`}),d==="connected"?"Terminal connected":d==="connecting"?"Connecting...":d==="error"?"Connection error":"Process exited"]})}),g.jsx("div",{ref:n,className:"flex-1 min-h-0",style:{padding:"4px 0 0 4px"}})]})}function Lw({projectHash:e,sessionId:t,projectPath:i,isNew:n}){const[l,a]=b.useState(null),[h,d]=b.useState(!0),[_,f]=b.useState(null);return b.useEffect(()=>{let v=!1;return d(!0),f(null),t0(e,t).then(y=>{v||(a(y),d(!1))}).catch(y=>{v||(f(y.message),d(!1))}),()=>{v=!0}},[e,t]),h?g.jsx("div",{className:"flex-1 flex items-center justify-center text-gray-500",children:"Loading session..."}):_?g.jsx("div",{className:"flex-1 flex items-center justify-center text-red-400",children:_}):l?g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsx("div",{className:"border-b border-gray-800 px-6 py-3 bg-gray-900 flex items-center justify-between shrink-0",children:g.jsxs("div",{children:[g.jsx("div",{className:"text-sm font-medium text-gray-200 truncate",children:l.projectPath.split("/").pop()||l.sessionId}),g.jsx("div",{className:"text-xs text-gray-500 truncate",children:l.sessionId})]})}),g.jsx(Mw,{sessionId:t,projectPath:i,isNew:n})]}):g.jsx(k_,{})}async function gg(){const e=await fetch("/api/cron");if(!e.ok)throw new Error("Failed to fetch cron tasks");return e.json()}async function Bw(e){const t=await fetch("/api/cron",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to create cron task");return t.json()}async function Jp(e,t){const i=await fetch(`/api/cron/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok)throw new Error("Failed to update cron task");return i.json()}async function Iw(e){if(!(await fetch(`/api/cron/${encodeURIComponent(e)}`,{method:"DELETE"})).ok)throw new Error("Failed to delete cron task")}async function Ow(e){if(!(await fetch(`/api/cron/${encodeURIComponent(e)}/run`,{method:"POST"})).ok)throw new Error("Failed to run cron task")}async function Aw(e){const t=await fetch(`/api/cron/${encodeURIComponent(e)}/executions`);if(!t.ok)throw new Error("Failed to fetch executions");return t.json()}const Fl={running:{dot:"bg-green-500",text:"text-green-400",bg:"bg-green-900/30",label:"Running"},success:{dot:"bg-green-500",text:"text-green-400",bg:"bg-green-900/30",label:"Success"},error:{dot:"bg-red-500",text:"text-red-400",bg:"bg-red-900/30",label:"Error"},warning:{dot:"bg-yellow-500",text:"text-yellow-400",bg:"bg-yellow-900/30",label:"Warning"},need_attention:{dot:"bg-yellow-500",text:"text-yellow-400",bg:"bg-yellow-900/30",label:"Needs Attention"},idle:{dot:"bg-gray-500",text:"text-gray-400",bg:"bg-gray-700",label:"Idle"},enabled:{dot:"bg-green-500",text:"text-green-400",bg:"bg-green-900/30",label:"ON"},disabled:{dot:"bg-gray-500",text:"text-gray-400",bg:"bg-gray-700",label:"OFF"},synced:{dot:"bg-green-500",text:"text-green-400",bg:"bg-green-900/30",label:"Synced"},local_modified:{dot:"bg-yellow-500",text:"text-yellow-400",bg:"bg-yellow-900/30",label:"Modified"},sync_error:{dot:"bg-red-500",text:"text-red-400",bg:"bg-red-900/30",label:"Sync Error"}};function Qp({status:e,title:t}){const i=Fl[e]||Fl.idle;return g.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${i.dot}`,title:t||i.label})}function Qn({status:e,label:t}){const i=Fl[e]||Fl.idle;return g.jsxs("span",{className:`text-xs px-2 py-0.5 rounded inline-flex items-center gap-1.5 ${i.text} ${i.bg}`,children:[g.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${i.dot}`}),t||i.label]})}function jw(e){if(!e)return"never";const t=Date.now()-new Date(e).getTime(),i=Math.floor(t/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const n=Math.floor(i/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function zw({task:e,selected:t,onSelect:i}){return g.jsxs("button",{onClick:i,className:`w-full text-left px-4 py-3 border-b border-gray-800 transition-colors ${t?"bg-blue-900/30":"hover:bg-gray-800/50"}`,children:[g.jsxs("div",{className:"flex items-center justify-between mb-1",children:[g.jsx("span",{className:"text-sm font-medium text-gray-200 truncate",children:e.name}),g.jsx(Qn,{status:e.enabled?"enabled":"disabled"})]}),g.jsx("div",{className:"text-xs text-gray-500 font-mono",children:e.cronExpression}),g.jsxs("div",{className:"text-xs text-gray-600 mt-1",children:["Last run: ",jw(e.lastRun)]})]})}function mg(e){const t=e.trim().split(/\s+/);if(t.length!==5)return e;const[i,n,l,a,h]=t;if(i.startsWith("*/")&&n==="*"&&l==="*"&&a==="*"&&h==="*"){const d=parseInt(i.slice(2));if(!isNaN(d))return`Every ${d} minute${d===1?"":"s"}`}if(/^\d+$/.test(i)&&n==="*"&&l==="*"&&a==="*"&&h==="*")return`Every hour at :${i.padStart(2,"0")}`;if(/^\d+$/.test(i)&&/^\d+$/.test(n)&&l==="*"&&a==="*"&&h==="*")return`Daily at ${n.padStart(2,"0")}:${i.padStart(2,"0")}`;if(/^\d+$/.test(i)&&/^\d+$/.test(n)&&l==="*"&&a==="*"&&h!=="*"){const d={0:"Sun",1:"Mon",2:"Tue",3:"Wed",4:"Thu",5:"Fri",6:"Sat",7:"Sun"};return`${{"1-5":"weekdays","0,6":"weekends","6,0":"weekends"}[h]||h.split(",").map(v=>d[v]||v).join(", ")} at ${n.padStart(2,"0")}:${i.padStart(2,"0")}`}return e}function Fw(e){const t=e.trim().split(/\s+/);if(t.length!==5)return{preset:"custom",minutes:30,hour:"9",minute:"0",weekday:"1-5"};const[i,n,l,a,h]=t;return i.startsWith("*/")&&n==="*"&&l==="*"&&a==="*"&&h==="*"?{preset:"every_n_min",minutes:parseInt(i.slice(2))||30,hour:"9",minute:"0",weekday:"1-5"}:/^\d+$/.test(i)&&n==="*"&&l==="*"&&a==="*"&&h==="*"?{preset:"hourly",minutes:30,hour:"9",minute:i,weekday:"1-5"}:/^\d+$/.test(i)&&/^\d+$/.test(n)&&l==="*"&&a==="*"&&h==="*"?{preset:"daily",minutes:30,hour:n,minute:i,weekday:"1-5"}:/^\d+$/.test(i)&&/^\d+$/.test(n)&&l==="*"&&a==="*"&&h!=="*"?{preset:"weekly",minutes:30,hour:n,minute:i,weekday:h}:{preset:"custom",minutes:30,hour:"9",minute:"0",weekday:"1-5"}}function Hw({value:e,onChange:t}){const i=Fw(e),[n,l]=b.useState(i.preset),[a,h]=b.useState(i.minutes),[d,_]=b.useState(i.hour),[f,v]=b.useState(i.minute),[y,w]=b.useState(i.weekday),[S,k]=b.useState(e);b.useEffect(()=>{let x;switch(n){case"every_n_min":x=`*/${a} * * * *`;break;case"hourly":x=`${f} * * * *`;break;case"daily":x=`${f} ${d} * * *`;break;case"weekly":x=`${f} ${d} * * ${y}`;break;case"custom":x=S;break;default:x=e}x!==e&&t(x)},[n,a,d,f,y,S]);const E=[{key:"every_n_min",label:"Every N min"},{key:"hourly",label:"Hourly"},{key:"daily",label:"Daily"},{key:"weekly",label:"Weekly"},{key:"custom",label:"Custom"}];return g.jsxs("div",{className:"space-y-2",children:[g.jsx("div",{className:"flex gap-1 flex-wrap",children:E.map(x=>g.jsx("button",{type:"button",onClick:()=>l(x.key),className:`text-xs px-2.5 py-1 rounded-full transition-colors ${n===x.key?"bg-blue-600 text-white":"bg-gray-800 text-gray-400 hover:text-white hover:bg-gray-700"}`,children:x.label},x.key))}),g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n==="every_n_min"&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-xs text-gray-400",children:"Every"}),g.jsx("select",{value:a,onChange:x=>h(parseInt(x.target.value)),className:"bg-gray-800 border border-gray-700 rounded px-2 py-1 text-sm text-gray-200 focus:outline-none focus:border-blue-500",children:[1,2,5,10,15,20,30,45,60].map(x=>g.jsx("option",{value:x,children:x},x))}),g.jsx("span",{className:"text-xs text-gray-400",children:"minutes"})]}),n==="hourly"&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-xs text-gray-400",children:"At minute"}),g.jsx("select",{value:f,onChange:x=>v(x.target.value),className:"bg-gray-800 border border-gray-700 rounded px-2 py-1 text-sm text-gray-200 focus:outline-none focus:border-blue-500",children:[0,5,10,15,20,30,45].map(x=>g.jsx("option",{value:x,children:`:${String(x).padStart(2,"0")}`},x))}),g.jsx("span",{className:"text-xs text-gray-400",children:"of every hour"})]}),(n==="daily"||n==="weekly")&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-xs text-gray-400",children:"At"}),g.jsx("input",{type:"time",value:`${d.padStart(2,"0")}:${f.padStart(2,"0")}`,onChange:x=>{const[I,U]=x.target.value.split(":");_(String(parseInt(I))),v(String(parseInt(U)))},className:"bg-gray-800 border border-gray-700 rounded px-2 py-1 text-sm text-gray-200 focus:outline-none focus:border-blue-500"})]}),n==="weekly"&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-xs text-gray-400",children:"on"}),g.jsxs("select",{value:y,onChange:x=>w(x.target.value),className:"bg-gray-800 border border-gray-700 rounded px-2 py-1 text-sm text-gray-200 focus:outline-none focus:border-blue-500",children:[g.jsx("option",{value:"1-5",children:"Weekdays (Mon-Fri)"}),g.jsx("option",{value:"0,6",children:"Weekends"}),g.jsx("option",{value:"*",children:"Every day"}),g.jsx("option",{value:"1",children:"Monday"}),g.jsx("option",{value:"2",children:"Tuesday"}),g.jsx("option",{value:"3",children:"Wednesday"}),g.jsx("option",{value:"4",children:"Thursday"}),g.jsx("option",{value:"5",children:"Friday"}),g.jsx("option",{value:"6",children:"Saturday"}),g.jsx("option",{value:"0",children:"Sunday"})]})]}),n==="custom"&&g.jsx("input",{type:"text",value:S,onChange:x=>k(x.target.value),className:"flex-1 bg-gray-800 border border-gray-700 rounded-lg px-3 py-2 text-sm text-gray-200 font-mono focus:outline-none focus:border-blue-500",placeholder:"*/30 * * * *"})]}),g.jsxs("div",{className:"text-xs text-gray-500",children:[mg(e),n!=="custom"&&g.jsx("span",{className:"ml-2 text-gray-600 font-mono",children:e})]})]})}function vg({initial:e,onSubmit:t,onCancel:i}){const[n,l]=b.useState((e==null?void 0:e.name)??""),[a,h]=b.useState((e==null?void 0:e.cronExpression)??"*/30 * * * *"),[d,_]=b.useState((e==null?void 0:e.prompt)??""),[f,v]=b.useState((e==null?void 0:e.projectPath)??""),[y,w]=b.useState((e==null?void 0:e.enabled)??!0),[S,k]=b.useState(!1),E=x=>{x.preventDefault(),t({name:n.trim(),cronExpression:a.trim(),prompt:d.trim(),projectPath:f.trim()||void 0,enabled:y})};return g.jsxs("form",{onSubmit:E,className:"space-y-4",children:[g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-gray-400 mb-1",children:"Task Name"}),g.jsx("input",{type:"text",value:n,onChange:x=>l(x.target.value),required:!0,className:"w-full bg-gray-800 border border-gray-700 rounded-lg px-3 py-2 text-sm text-gray-200 focus:outline-none focus:border-blue-500",placeholder:"e.g. Daily code review"})]}),g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-gray-400 mb-1",children:"Schedule"}),g.jsx(Hw,{value:a,onChange:h})]}),g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-gray-400 mb-1",children:"Prompt"}),g.jsx("textarea",{value:d,onChange:x=>_(x.target.value),required:!0,rows:5,className:"w-full bg-gray-800 border border-gray-700 rounded-lg px-3 py-2 text-sm text-gray-200 focus:outline-none focus:border-blue-500 resize-none",placeholder:"The prompt to send to Claude..."}),g.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["Use ",g.jsx("code",{className:"text-gray-500 bg-gray-800 px-1 rounded",children:"{{todos}}"})," to inject pending todo list into the prompt"]})]}),g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-gray-400 mb-1",children:"Project Path (optional)"}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("input",{type:"text",value:f,onChange:x=>v(x.target.value),className:"flex-1 bg-gray-800 border border-gray-700 rounded-lg px-3 py-2 text-sm text-gray-200 focus:outline-none focus:border-blue-500",placeholder:"/path/to/project"}),g.jsx("button",{type:"button",onClick:()=>k(!S),className:`px-3 py-2 text-sm rounded-lg transition-colors ${S?"bg-blue-600 text-white":"bg-gray-700 text-gray-300 hover:bg-gray-600"}`,children:"Browse"})]}),S&&g.jsxs("div",{className:"mt-2 p-3 bg-gray-800/50 border border-gray-700 rounded-lg",children:[g.jsx(Vh,{onPathChange:x=>{v(x)}}),g.jsx("button",{type:"button",onClick:()=>{if(k(!1),f)try{localStorage.setItem("claudit:lastBrowserPath",f)}catch{}},className:"mt-2 text-xs text-blue-400 hover:text-blue-300",children:"Done"})]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("input",{type:"checkbox",checked:y,onChange:x=>w(x.target.checked),id:"task-enabled",className:"rounded"}),g.jsx("label",{htmlFor:"task-enabled",className:"text-sm text-gray-300",children:"Enabled"})]}),g.jsxs("div",{className:"flex gap-2 pt-2",children:[g.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-600 text-white text-sm rounded-lg hover:bg-blue-500 transition-colors",children:e?"Save Changes":"Create Task"}),g.jsx("button",{type:"button",onClick:i,className:"px-4 py-2 bg-gray-700 text-gray-300 text-sm rounded-lg hover:bg-gray-600 transition-colors",children:"Cancel"})]})]})}function Ww({selectedTaskId:e,onSelect:t}){const[i,n]=b.useState([]),[l,a]=b.useState(!0),[h,d]=b.useState(!1),_=b.useCallback(async()=>{try{const v=await gg();n(v)}catch(v){console.error("Failed to load cron tasks:",v)}finally{a(!1)}},[]);b.useEffect(()=>{_();const v=setInterval(_,1e4);return()=>clearInterval(v)},[_]);const f=async v=>{try{const y=await Bw(v);n(w=>[...w,y]),d(!1),t(y.id)}catch(y){console.error("Failed to create task:",y)}};return g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsxs("div",{className:"p-4 border-b border-gray-800 flex items-center justify-between",children:[g.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Cron Tasks"}),g.jsx("button",{onClick:()=>d(!h),className:"text-xs px-3 py-1.5 bg-blue-600 text-white rounded-lg hover:bg-blue-500 transition-colors",children:h?"Cancel":"+ New"})]}),h&&g.jsx("div",{className:"p-4 border-b border-gray-800 bg-gray-900/50",children:g.jsx(vg,{onSubmit:f,onCancel:()=>d(!1)})}),g.jsx("div",{className:"flex-1 overflow-y-auto",children:l?g.jsx("div",{className:"p-4 text-gray-500 text-sm",children:"Loading..."}):i.length===0?g.jsx("div",{className:"p-4 text-gray-500 text-sm text-center",children:"No cron tasks yet. Create one to get started."}):i.map(v=>g.jsx(zw,{task:v,selected:v.id===e,onSelect:()=>t(v.id)},v.id))})]})}function $w(e,t){if(!e)return t??!0;try{const i=localStorage.getItem(e);if(i!==null)return i==="true"}catch{}return t??!0}function Tl({title:e,count:t,defaultOpen:i,storageKey:n,children:l}){const[a,h]=b.useState(()=>$w(n,i)),d=()=>{const _=!a;if(h(_),n)try{localStorage.setItem(n,String(_))}catch{}};return g.jsxs("div",{children:[g.jsxs("button",{onClick:d,className:"w-full flex items-center gap-1.5 text-sm font-semibold text-gray-400 hover:text-gray-300 transition-colors mb-2",children:[g.jsx("span",{className:"text-xs text-gray-600",children:a?"▾":"▸"}),g.jsx("span",{children:e}),t!==void 0&&g.jsxs("span",{className:"text-xs text-gray-600",children:["(",t,")"]})]}),a&&l]})}function Uw({taskId:e,onTaskDeleted:t}){const[i,n]=b.useState(null),[l,a]=b.useState([]),[h,d]=b.useState([]),[_,f]=b.useState(!1),v=Oe(M=>M.editingCronTaskId),y=Oe(M=>M.setEditingCronTaskId),w=Oe(M=>M.selectSession),S=Oe(M=>M.setView),k=v===e&&e!==null,E=M=>y(M?e:null),x=b.useCallback(async()=>{if(!e){n(null),a([]);return}try{const A=(await gg()).find(pe=>pe.id===e);n(A??null);const re=await Aw(e);a(re);const se=await Kl(void 0,!0);d(se.flatMap(pe=>pe.sessions))}catch(M){console.error("Failed to load task detail:",M)}},[e]);if(b.useEffect(()=>{x();const M=setInterval(x,5e3);return()=>clearInterval(M)},[x]),!e)return g.jsx("div",{className:"flex-1 flex items-center justify-center text-gray-500",children:g.jsxs("div",{className:"text-center",children:[g.jsx("div",{className:"text-4xl mb-4",children:g.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mx-auto text-gray-600",children:[g.jsx("rect",{x:"3",y:"3",width:"7",height:"5",rx:"1"}),g.jsx("rect",{x:"14",y:"16",width:"7",height:"5",rx:"1"}),g.jsx("path",{d:"M10 5.5h2a2 2 0 0 1 2 2v7a2 2 0 0 0 2 2h-2"}),g.jsx("polyline",{points:"14 14.5 16 16.5 14 18.5"})]})}),g.jsx("p",{className:"text-lg",children:"Select a workflow to view"}),g.jsx("p",{className:"text-sm mt-1",children:"Or create a new one from the left panel"})]})});if(!i)return g.jsx("div",{className:"p-6 text-gray-500",children:"Loading..."});const I=async()=>{try{const M=await Jp(i.id,{enabled:!i.enabled});n(M)}catch(M){console.error("Failed to toggle task:",M)}},U=async()=>{if(confirm(`Delete task "${i.name}"?`))try{await Iw(i.id),t()}catch(M){console.error("Failed to delete task:",M)}},W=async()=>{f(!0);try{await Ow(i.id),setTimeout(x,1e3)}catch(M){console.error("Failed to run task:",M)}finally{f(!1)}},P=async M=>{try{const A=await Jp(i.id,M);n(A),E(!1)}catch(A){console.error("Failed to update task:",A)}};return k?g.jsxs("div",{className:"px-4 py-3 overflow-y-auto",children:[g.jsx("h2",{className:"text-lg font-semibold text-gray-200 mb-3",children:"Edit Task"}),g.jsx(vg,{initial:i,onSubmit:P,onCancel:()=>E(!1)})]}):g.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[g.jsxs("div",{className:"px-4 py-3 border-b border-gray-800",children:[g.jsxs("div",{className:"flex items-center justify-between mb-2",children:[g.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:i.name}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("button",{onClick:I,className:"hover:opacity-80 transition-opacity",children:g.jsx(Qn,{status:i.enabled?"enabled":"disabled",label:i.enabled?"Enabled":"Disabled"})}),g.jsx("button",{onClick:W,disabled:_,className:"text-xs px-3 py-1.5 bg-blue-600 text-white rounded-lg hover:bg-blue-500 transition-colors disabled:opacity-50",children:_?"Starting...":"Run Now"}),g.jsx("button",{onClick:()=>E(!0),className:"text-xs px-3 py-1.5 bg-gray-700 text-gray-300 rounded-lg hover:bg-gray-600 transition-colors",children:"Edit"}),g.jsx("button",{onClick:U,className:"text-xs px-3 py-1.5 bg-red-900/50 text-red-400 rounded-lg hover:bg-red-900/70 transition-colors",children:"Delete"})]})]}),g.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[g.jsxs("div",{children:[g.jsx("span",{className:"text-gray-500",children:"Schedule:"})," ",g.jsx("span",{className:"text-gray-300",children:mg(i.cronExpression)}),g.jsx("span",{className:"text-gray-600 font-mono text-xs ml-2",children:i.cronExpression})]}),i.projectPath&&g.jsxs("div",{children:[g.jsx("span",{className:"text-gray-500",children:"Project:"})," ",g.jsx("span",{className:"text-gray-300",children:i.projectPath})]}),g.jsxs("div",{children:[g.jsx("span",{className:"text-gray-500",children:"Last run:"})," ",g.jsx("span",{className:"text-gray-300",children:i.lastRun?new Date(i.lastRun).toLocaleString():"Never"})]}),g.jsxs("div",{children:[g.jsx("span",{className:"text-gray-500",children:"Created:"})," ",g.jsx("span",{className:"text-gray-300",children:new Date(i.createdAt).toLocaleString()})]})]}),g.jsxs("div",{className:"mt-2",children:[g.jsx("span",{className:"text-gray-500 text-sm",children:"Prompt:"}),g.jsx("pre",{className:"mt-1 text-sm text-gray-300 bg-gray-800 rounded-lg p-2 whitespace-pre-wrap max-h-32 overflow-y-auto",children:i.prompt})]})]}),g.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:g.jsx(Tl,{title:"Execution History",count:l.length,defaultOpen:!0,storageKey:"claudit:cronExecHistory",children:l.length===0?g.jsx("div",{className:"text-gray-600 text-sm",children:"No executions yet."}):g.jsx("div",{className:"space-y-2",children:l.map(M=>g.jsx(Kw,{execution:M,sessions:h,onJumpToSession:A=>{w(A.projectHash,A.sessionId,A.projectPath),S("sessions")}},M.id))})})})]})}function Kw({execution:e,sessions:t,onJumpToSession:i}){const[n,l]=b.useState(!1),a=e.finishedAt?Math.round((new Date(e.finishedAt).getTime()-new Date(e.startedAt).getTime())/1e3):null,h=e.sessionId?t.find(d=>d.sessionId===e.sessionId):void 0;return g.jsxs("div",{className:"border border-gray-800 rounded-lg overflow-hidden",children:[g.jsxs("button",{onClick:()=>l(!n),className:"w-full text-left px-3 py-2 flex items-center justify-between hover:bg-gray-800/30 transition-colors",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(Qn,{status:e.status}),g.jsx("span",{className:"text-xs text-gray-400",children:new Date(e.startedAt).toLocaleString()}),a!==null&&g.jsxs("span",{className:"text-xs text-gray-600",children:[a,"s"]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[h&&g.jsxs("span",{onClick:d=>{d.stopPropagation(),i(h)},className:"text-xs px-2 py-0.5 bg-gray-700 text-blue-400 rounded hover:bg-gray-600 transition-colors cursor-pointer flex items-center gap-1",children:[g.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[g.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),g.jsx("polyline",{points:"15 3 21 3 21 9"}),g.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"Session"]}),g.jsx("span",{className:"text-gray-500 text-xs",children:n?"▲":"▼"})]})]}),n&&g.jsxs("div",{className:"px-3 pb-2 border-t border-gray-800",children:[e.output&&g.jsxs("div",{className:"mt-2",children:[g.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"Output:"}),g.jsx("pre",{className:"text-xs text-gray-300 bg-gray-900 rounded p-2 max-h-40 overflow-auto whitespace-pre-wrap",children:e.output})]}),e.error&&g.jsxs("div",{className:"mt-2",children:[g.jsx("div",{className:"text-xs text-red-400 mb-1",children:"Error:"}),g.jsx("pre",{className:"text-xs text-red-300 bg-red-900/20 rounded p-2 max-h-40 overflow-auto whitespace-pre-wrap",children:e.error})]}),!e.output&&!e.error&&g.jsx("div",{className:"mt-2 text-xs text-gray-600",children:e.status==="running"?"Task is still running...":"No output."})]})]})}async function yg(){const e=await fetch("/api/todo");if(!e.ok)throw new Error("Failed to fetch todos");return e.json()}async function Vw(e){const t=await fetch("/api/todo",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to create todo");return t.json()}async function Ml(e,t){const i=await fetch(`/api/todo/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok)throw new Error("Failed to update todo");return i.json()}async function qw(e){if(!(await fetch(`/api/todo/${encodeURIComponent(e)}`,{method:"DELETE"})).ok)throw new Error("Failed to delete todo")}async function Jc(e){if(!(await fetch("/api/todo/reorder",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:e})})).ok)throw new Error("Failed to reorder todos")}async function Yw(){const e=await fetch("/api/todo/groups");if(!e.ok)throw new Error("Failed to fetch groups");return e.json()}async function Sg(e){const t=await fetch("/api/todo/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});if(!t.ok)throw new Error("Failed to create group");return t.json()}async function Gw(e,t){const i=await fetch(`/api/todo/groups/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok)throw new Error("Failed to update group");return i.json()}async function Xw(e){if(!(await fetch(`/api/todo/groups/${encodeURIComponent(e)}`,{method:"DELETE"})).ok)throw new Error("Failed to delete group")}async function Jw(){const e=await fetch("/api/todo/providers");if(!e.ok)throw new Error("Failed to fetch provider types");return e.json()}async function Qw(){const e=await fetch("/api/todo/providers/configs");if(!e.ok)throw new Error("Failed to fetch provider configs");return e.json()}async function Zw(e){const t=await fetch("/api/todo/providers/configs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const i=await t.json().catch(()=>({}));throw new Error(i.error||"Failed to create provider config")}return t.json()}async function Zp(e,t){const i=await fetch(`/api/todo/providers/configs/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok){const n=await i.json().catch(()=>({}));throw new Error(n.error||"Failed to update provider config")}return i.json()}async function ex(e){if(!(await fetch(`/api/todo/providers/configs/${encodeURIComponent(e)}`,{method:"DELETE"})).ok)throw new Error("Failed to delete provider config")}async function tx(e){const t=await fetch(`/api/todo/providers/configs/${encodeURIComponent(e)}/sync`,{method:"POST"});if(!t.ok)throw new Error("Failed to sync provider");return t.json()}async function rx(){const e=await fetch("/api/todo/providers/sync-all",{method:"POST"});if(!e.ok)throw new Error("Failed to sync providers");return e.json()}var Un=y_();function ix(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return b.useMemo(()=>n=>{t.forEach(l=>l(n))},t)}const Xl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ks(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function su(e){return"nodeType"in e}function sr(e){var t,i;return e?Ks(e)?e:su(e)&&(t=(i=e.ownerDocument)==null?void 0:i.defaultView)!=null?t:window:window}function nu(e){const{Document:t}=sr(e);return e instanceof t}function oo(e){return Ks(e)?!1:e instanceof sr(e).HTMLElement}function wg(e){return e instanceof sr(e).SVGElement}function Vs(e){return e?Ks(e)?e.document:su(e)?nu(e)?e:oo(e)||wg(e)?e.ownerDocument:document:document:document}const ri=Xl?b.useLayoutEffect:b.useEffect;function ou(e){const t=b.useRef(e);return ri(()=>{t.current=e}),b.useCallback(function(){for(var i=arguments.length,n=new Array(i),l=0;l<i;l++)n[l]=arguments[l];return t.current==null?void 0:t.current(...n)},[])}function sx(){const e=b.useRef(null),t=b.useCallback((n,l)=>{e.current=setInterval(n,l)},[]),i=b.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,i]}function Zn(e,t){t===void 0&&(t=[e]);const i=b.useRef(e);return ri(()=>{i.current!==e&&(i.current=e)},t),i}function lo(e,t){const i=b.useRef();return b.useMemo(()=>{const n=e(i.current);return i.current=n,n},[...t])}function Hl(e){const t=ou(e),i=b.useRef(null),n=b.useCallback(l=>{l!==i.current&&(t==null||t(l,i.current)),i.current=l},[]);return[i,n]}function Fh(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let Qc={};function ao(e,t){return b.useMemo(()=>{if(t)return t;const i=Qc[e]==null?0:Qc[e]+1;return Qc[e]=i,e+"-"+i},[e,t])}function xg(e){return function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),l=1;l<i;l++)n[l-1]=arguments[l];return n.reduce((a,h)=>{const d=Object.entries(h);for(const[_,f]of d){const v=a[_];v!=null&&(a[_]=v+e*f)}return a},{...t})}}const Hs=xg(1),Wl=xg(-1);function nx(e){return"clientX"in e&&"clientY"in e}function lu(e){if(!e)return!1;const{KeyboardEvent:t}=sr(e.target);return t&&e instanceof t}function ox(e){if(!e)return!1;const{TouchEvent:t}=sr(e.target);return t&&e instanceof t}function Hh(e){if(ox(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:i}=e.touches[0];return{x:t,y:i}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:i}=e.changedTouches[0];return{x:t,y:i}}}return nx(e)?{x:e.clientX,y:e.clientY}:null}const eo=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:i}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(i?Math.round(i):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:i}=e;return"scaleX("+t+") scaleY("+i+")"}},Transform:{toString(e){if(e)return[eo.Translate.toString(e),eo.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:i,easing:n}=e;return t+" "+i+"ms "+n}}}),e_="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function lx(e){return e.matches(e_)?e:e.querySelector(e_)}const ax={display:"none"};function cx(e){let{id:t,value:i}=e;return pt.createElement("div",{id:t,style:ax},i)}function hx(e){let{id:t,announcement:i,ariaLiveType:n="assertive"}=e;const l={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 pt.createElement("div",{id:t,style:l,role:"status","aria-live":n,"aria-atomic":!0},i)}function ux(){const[e,t]=b.useState("");return{announce:b.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const bg=b.createContext(null);function dx(e){const t=b.useContext(bg);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function fx(){const[e]=b.useState(()=>new Set),t=b.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[b.useCallback(n=>{let{type:l,event:a}=n;e.forEach(h=>{var d;return(d=h[l])==null?void 0:d.call(h,a)})},[e]),t]}const px={draggable:`
94
+ To pick up a draggable item, press the space bar.
95
+ While dragging, use the arrow keys to move the item.
96
+ Press space again to drop the item in its new position, or press escape to cancel.
97
+ `},_x={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:i}=e;return i?"Draggable item "+t.id+" was moved over droppable area "+i.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:i}=e;return i?"Draggable item "+t.id+" was dropped over droppable area "+i.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function gx(e){let{announcements:t=_x,container:i,hiddenTextDescribedById:n,screenReaderInstructions:l=px}=e;const{announce:a,announcement:h}=ux(),d=ao("DndLiveRegion"),[_,f]=b.useState(!1);if(b.useEffect(()=>{f(!0)},[]),dx(b.useMemo(()=>({onDragStart(y){let{active:w}=y;a(t.onDragStart({active:w}))},onDragMove(y){let{active:w,over:S}=y;t.onDragMove&&a(t.onDragMove({active:w,over:S}))},onDragOver(y){let{active:w,over:S}=y;a(t.onDragOver({active:w,over:S}))},onDragEnd(y){let{active:w,over:S}=y;a(t.onDragEnd({active:w,over:S}))},onDragCancel(y){let{active:w,over:S}=y;a(t.onDragCancel({active:w,over:S}))}}),[a,t])),!_)return null;const v=pt.createElement(pt.Fragment,null,pt.createElement(cx,{id:n,value:l.draggable}),pt.createElement(hx,{id:d,announcement:h}));return i?Un.createPortal(v,i):v}var ft;(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"})(ft||(ft={}));function $l(){}function mx(e,t){return b.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function vx(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return b.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const zr=Object.freeze({x:0,y:0});function yx(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Sx(e,t){let{data:{value:i}}=e,{data:{value:n}}=t;return i-n}function wx(e,t){let{data:{value:i}}=e,{data:{value:n}}=t;return n-i}function xx(e,t){if(!e||e.length===0)return null;const[i]=e;return i[t]}function t_(e,t,i){return t===void 0&&(t=e.left),i===void 0&&(i=e.top),{x:t+e.width*.5,y:i+e.height*.5}}const bx=e=>{let{collisionRect:t,droppableRects:i,droppableContainers:n}=e;const l=t_(t,t.left,t.top),a=[];for(const h of n){const{id:d}=h,_=i.get(d);if(_){const f=yx(t_(_),l);a.push({id:d,data:{droppableContainer:h,value:f}})}}return a.sort(Sx)};function Cx(e,t){const i=Math.max(t.top,e.top),n=Math.max(t.left,e.left),l=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),h=l-n,d=a-i;if(n<l&&i<a){const _=t.width*t.height,f=e.width*e.height,v=h*d,y=v/(_+f-v);return Number(y.toFixed(4))}return 0}const kx=e=>{let{collisionRect:t,droppableRects:i,droppableContainers:n}=e;const l=[];for(const a of n){const{id:h}=a,d=i.get(h);if(d){const _=Cx(d,t);_>0&&l.push({id:h,data:{droppableContainer:a,value:_}})}}return l.sort(wx)};function Ex(e,t,i){return{...e,scaleX:t&&i?t.width/i.width:1,scaleY:t&&i?t.height/i.height:1}}function Cg(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:zr}function Nx(e){return function(i){for(var n=arguments.length,l=new Array(n>1?n-1:0),a=1;a<n;a++)l[a-1]=arguments[a];return l.reduce((h,d)=>({...h,top:h.top+e*d.y,bottom:h.bottom+e*d.y,left:h.left+e*d.x,right:h.right+e*d.x}),{...i})}}const Dx=Nx(1);function Rx(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 Px(e,t,i){const n=Rx(t);if(!n)return e;const{scaleX:l,scaleY:a,x:h,y:d}=n,_=e.left-h-(1-l)*parseFloat(i),f=e.top-d-(1-a)*parseFloat(i.slice(i.indexOf(" ")+1)),v=l?e.width/l:e.width,y=a?e.height/a:e.height;return{width:v,height:y,top:f,right:_+v,bottom:f+y,left:_}}const Tx={ignoreTransform:!1};function qs(e,t){t===void 0&&(t=Tx);let i=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:v}=sr(e).getComputedStyle(e);f&&(i=Px(i,f,v))}const{top:n,left:l,width:a,height:h,bottom:d,right:_}=i;return{top:n,left:l,width:a,height:h,bottom:d,right:_}}function r_(e){return qs(e,{ignoreTransform:!0})}function Mx(e){const t=e.innerWidth,i=e.innerHeight;return{top:0,left:0,right:t,bottom:i,width:t,height:i}}function Lx(e,t){return t===void 0&&(t=sr(e).getComputedStyle(e)),t.position==="fixed"}function Bx(e,t){t===void 0&&(t=sr(e).getComputedStyle(e));const i=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const a=t[l];return typeof a=="string"?i.test(a):!1})}function au(e,t){const i=[];function n(l){if(t!=null&&i.length>=t||!l)return i;if(nu(l)&&l.scrollingElement!=null&&!i.includes(l.scrollingElement))return i.push(l.scrollingElement),i;if(!oo(l)||wg(l)||i.includes(l))return i;const a=sr(e).getComputedStyle(l);return l!==e&&Bx(l,a)&&i.push(l),Lx(l,a)?i:n(l.parentNode)}return e?n(e):i}function kg(e){const[t]=au(e,1);return t??null}function Zc(e){return!Xl||!e?null:Ks(e)?e:su(e)?nu(e)||e===Vs(e).scrollingElement?window:oo(e)?e:null:null}function Eg(e){return Ks(e)?e.scrollX:e.scrollLeft}function Ng(e){return Ks(e)?e.scrollY:e.scrollTop}function Wh(e){return{x:Eg(e),y:Ng(e)}}var kt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(kt||(kt={}));function Dg(e){return!Xl||!e?!1:e===document.scrollingElement}function Rg(e){const t={x:0,y:0},i=Dg(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-i.width,y:e.scrollHeight-i.height},l=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,h=e.scrollTop>=n.y,d=e.scrollLeft>=n.x;return{isTop:l,isLeft:a,isBottom:h,isRight:d,maxScroll:n,minScroll:t}}const Ix={x:.2,y:.2};function Ox(e,t,i,n,l){let{top:a,left:h,right:d,bottom:_}=i;n===void 0&&(n=10),l===void 0&&(l=Ix);const{isTop:f,isBottom:v,isLeft:y,isRight:w}=Rg(e),S={x:0,y:0},k={x:0,y:0},E={height:t.height*l.y,width:t.width*l.x};return!f&&a<=t.top+E.height?(S.y=kt.Backward,k.y=n*Math.abs((t.top+E.height-a)/E.height)):!v&&_>=t.bottom-E.height&&(S.y=kt.Forward,k.y=n*Math.abs((t.bottom-E.height-_)/E.height)),!w&&d>=t.right-E.width?(S.x=kt.Forward,k.x=n*Math.abs((t.right-E.width-d)/E.width)):!y&&h<=t.left+E.width&&(S.x=kt.Backward,k.x=n*Math.abs((t.left+E.width-h)/E.width)),{direction:S,speed:k}}function Ax(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:h}=window;return{top:0,left:0,right:a,bottom:h,width:a,height:h}}const{top:t,left:i,right:n,bottom:l}=e.getBoundingClientRect();return{top:t,left:i,right:n,bottom:l,width:e.clientWidth,height:e.clientHeight}}function Pg(e){return e.reduce((t,i)=>Hs(t,Wh(i)),zr)}function jx(e){return e.reduce((t,i)=>t+Eg(i),0)}function zx(e){return e.reduce((t,i)=>t+Ng(i),0)}function Fx(e,t){if(t===void 0&&(t=qs),!e)return;const{top:i,left:n,bottom:l,right:a}=t(e);kg(e)&&(l<=0||a<=0||i>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Hx=[["x",["left","right"],jx],["y",["top","bottom"],zx]];class cu{constructor(t,i){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 n=au(i),l=Pg(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,h,d]of Hx)for(const _ of h)Object.defineProperty(this,_,{get:()=>{const f=d(n),v=l[a]-f;return this.rect[_]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Vn{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(i=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...i)})},this.target=t}add(t,i,n){var l;(l=this.target)==null||l.addEventListener(t,i,n),this.listeners.push([t,i,n])}}function Wx(e){const{EventTarget:t}=sr(e);return e instanceof t?e:Vs(e)}function eh(e,t){const i=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(i**2+n**2)>t:"x"in t&&"y"in t?i>t.x&&n>t.y:"x"in t?i>t.x:"y"in t?n>t.y:!1}var br;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(br||(br={}));function i_(e){e.preventDefault()}function $x(e){e.stopPropagation()}var Ie;(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"})(Ie||(Ie={}));const Tg={start:[Ie.Space,Ie.Enter],cancel:[Ie.Esc],end:[Ie.Space,Ie.Enter,Ie.Tab]},Ux=(e,t)=>{let{currentCoordinates:i}=t;switch(e.code){case Ie.Right:return{...i,x:i.x+25};case Ie.Left:return{...i,x:i.x-25};case Ie.Down:return{...i,y:i.y+25};case Ie.Up:return{...i,y:i.y-25}}};class Mg{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:i}}=t;this.props=t,this.listeners=new Vn(Vs(i)),this.windowListeners=new Vn(sr(i)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(br.Resize,this.handleCancel),this.windowListeners.add(br.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(br.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:i}=this.props,n=t.node.current;n&&Fx(n),i(zr)}handleKeyDown(t){if(lu(t)){const{active:i,context:n,options:l}=this.props,{keyboardCodes:a=Tg,coordinateGetter:h=Ux,scrollBehavior:d="smooth"}=l,{code:_}=t;if(a.end.includes(_)){this.handleEnd(t);return}if(a.cancel.includes(_)){this.handleCancel(t);return}const{collisionRect:f}=n.current,v=f?{x:f.left,y:f.top}:zr;this.referenceCoordinates||(this.referenceCoordinates=v);const y=h(t,{active:i,context:n.current,currentCoordinates:v});if(y){const w=Wl(y,v),S={x:0,y:0},{scrollableAncestors:k}=n.current;for(const E of k){const x=t.code,{isTop:I,isRight:U,isLeft:W,isBottom:P,maxScroll:M,minScroll:A}=Rg(E),re=Ax(E),se={x:Math.min(x===Ie.Right?re.right-re.width/2:re.right,Math.max(x===Ie.Right?re.left:re.left+re.width/2,y.x)),y:Math.min(x===Ie.Down?re.bottom-re.height/2:re.bottom,Math.max(x===Ie.Down?re.top:re.top+re.height/2,y.y))},pe=x===Ie.Right&&!U||x===Ie.Left&&!W,Se=x===Ie.Down&&!P||x===Ie.Up&&!I;if(pe&&se.x!==y.x){const z=E.scrollLeft+w.x,q=x===Ie.Right&&z<=M.x||x===Ie.Left&&z>=A.x;if(q&&!w.y){E.scrollTo({left:z,behavior:d});return}q?S.x=E.scrollLeft-z:S.x=x===Ie.Right?E.scrollLeft-M.x:E.scrollLeft-A.x,S.x&&E.scrollBy({left:-S.x,behavior:d});break}else if(Se&&se.y!==y.y){const z=E.scrollTop+w.y,q=x===Ie.Down&&z<=M.y||x===Ie.Up&&z>=A.y;if(q&&!w.x){E.scrollTo({top:z,behavior:d});return}q?S.y=E.scrollTop-z:S.y=x===Ie.Down?E.scrollTop-M.y:E.scrollTop-A.y,S.y&&E.scrollBy({top:-S.y,behavior:d});break}}this.handleMove(t,Hs(Wl(y,this.referenceCoordinates),S))}}}handleMove(t,i){const{onMove:n}=this.props;t.preventDefault(),n(i)}handleEnd(t){const{onEnd:i}=this.props;t.preventDefault(),this.detach(),i()}handleCancel(t){const{onCancel:i}=this.props;t.preventDefault(),this.detach(),i()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Mg.activators=[{eventName:"onKeyDown",handler:(e,t,i)=>{let{keyboardCodes:n=Tg,onActivation:l}=t,{active:a}=i;const{code:h}=e.nativeEvent;if(n.start.includes(h)){const d=a.activatorNode.current;return d&&e.target!==d?!1:(e.preventDefault(),l==null||l({event:e.nativeEvent}),!0)}return!1}}];function s_(e){return!!(e&&"distance"in e)}function n_(e){return!!(e&&"delay"in e)}class hu{constructor(t,i,n){var l;n===void 0&&(n=Wx(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=i;const{event:a}=t,{target:h}=a;this.props=t,this.events=i,this.document=Vs(h),this.documentListeners=new Vn(this.document),this.listeners=new Vn(n),this.windowListeners=new Vn(sr(h)),this.initialCoordinates=(l=Hh(a))!=null?l:zr,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:i,bypassActivationConstraint:n}}}=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(br.Resize,this.handleCancel),this.windowListeners.add(br.DragStart,i_),this.windowListeners.add(br.VisibilityChange,this.handleCancel),this.windowListeners.add(br.ContextMenu,i_),this.documentListeners.add(br.Keydown,this.handleKeydown),i){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(n_(i)){this.timeoutId=setTimeout(this.handleStart,i.delay),this.handlePending(i);return}if(s_(i)){this.handlePending(i);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,i){const{active:n,onPending:l}=this.props;l(n,t,this.initialCoordinates,i)}handleStart(){const{initialCoordinates:t}=this,{onStart:i}=this.props;t&&(this.activated=!0,this.documentListeners.add(br.Click,$x,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(br.SelectionChange,this.removeTextSelection),i(t))}handleMove(t){var i;const{activated:n,initialCoordinates:l,props:a}=this,{onMove:h,options:{activationConstraint:d}}=a;if(!l)return;const _=(i=Hh(t))!=null?i:zr,f=Wl(l,_);if(!n&&d){if(s_(d)){if(d.tolerance!=null&&eh(f,d.tolerance))return this.handleCancel();if(eh(f,d.distance))return this.handleStart()}if(n_(d)&&eh(f,d.tolerance))return this.handleCancel();this.handlePending(d,f);return}t.cancelable&&t.preventDefault(),h(_)}handleEnd(){const{onAbort:t,onEnd:i}=this.props;this.detach(),this.activated||t(this.props.active),i()}handleCancel(){const{onAbort:t,onCancel:i}=this.props;this.detach(),this.activated||t(this.props.active),i()}handleKeydown(t){t.code===Ie.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Kx={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class uu extends hu{constructor(t){const{event:i}=t,n=Vs(i.target);super(t,Kx,n)}}uu.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:i}=e,{onActivation:n}=t;return!i.isPrimary||i.button!==0?!1:(n==null||n({event:i}),!0)}}];const Vx={move:{name:"mousemove"},end:{name:"mouseup"}};var $h;(function(e){e[e.RightClick=2]="RightClick"})($h||($h={}));class qx extends hu{constructor(t){super(t,Vx,Vs(t.event.target))}}qx.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:i}=e,{onActivation:n}=t;return i.button===$h.RightClick?!1:(n==null||n({event:i}),!0)}}];const th={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Yx extends hu{constructor(t){super(t,th)}static setup(){return window.addEventListener(th.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(th.move.name,t)};function t(){}}}Yx.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:i}=e,{onActivation:n}=t;const{touches:l}=i;return l.length>1?!1:(n==null||n({event:i}),!0)}}];var qn;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(qn||(qn={}));var Ul;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ul||(Ul={}));function Gx(e){let{acceleration:t,activator:i=qn.Pointer,canScroll:n,draggingRect:l,enabled:a,interval:h=5,order:d=Ul.TreeOrder,pointerCoordinates:_,scrollableAncestors:f,scrollableAncestorRects:v,delta:y,threshold:w}=e;const S=Jx({delta:y,disabled:!a}),[k,E]=sx(),x=b.useRef({x:0,y:0}),I=b.useRef({x:0,y:0}),U=b.useMemo(()=>{switch(i){case qn.Pointer:return _?{top:_.y,bottom:_.y,left:_.x,right:_.x}:null;case qn.DraggableRect:return l}},[i,l,_]),W=b.useRef(null),P=b.useCallback(()=>{const A=W.current;if(!A)return;const re=x.current.x*I.current.x,se=x.current.y*I.current.y;A.scrollBy(re,se)},[]),M=b.useMemo(()=>d===Ul.TreeOrder?[...f].reverse():f,[d,f]);b.useEffect(()=>{if(!a||!f.length||!U){E();return}for(const A of M){if((n==null?void 0:n(A))===!1)continue;const re=f.indexOf(A),se=v[re];if(!se)continue;const{direction:pe,speed:Se}=Ox(A,se,U,t,w);for(const z of["x","y"])S[z][pe[z]]||(Se[z]=0,pe[z]=0);if(Se.x>0||Se.y>0){E(),W.current=A,k(P,h),x.current=Se,I.current=pe;return}}x.current={x:0,y:0},I.current={x:0,y:0},E()},[t,P,n,E,a,h,JSON.stringify(U),JSON.stringify(S),k,f,M,v,JSON.stringify(w)])}const Xx={x:{[kt.Backward]:!1,[kt.Forward]:!1},y:{[kt.Backward]:!1,[kt.Forward]:!1}};function Jx(e){let{delta:t,disabled:i}=e;const n=Fh(t);return lo(l=>{if(i||!n||!l)return Xx;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[kt.Backward]:l.x[kt.Backward]||a.x===-1,[kt.Forward]:l.x[kt.Forward]||a.x===1},y:{[kt.Backward]:l.y[kt.Backward]||a.y===-1,[kt.Forward]:l.y[kt.Forward]||a.y===1}}},[i,t,n])}function Qx(e,t){const i=t!=null?e.get(t):void 0,n=i?i.node.current:null;return lo(l=>{var a;return t==null?null:(a=n??l)!=null?a:null},[n,t])}function Zx(e,t){return b.useMemo(()=>e.reduce((i,n)=>{const{sensor:l}=n,a=l.activators.map(h=>({eventName:h.eventName,handler:t(h.handler,n)}));return[...i,...a]},[]),[e,t])}var to;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(to||(to={}));var Uh;(function(e){e.Optimized="optimized"})(Uh||(Uh={}));const o_=new Map;function e1(e,t){let{dragging:i,dependencies:n,config:l}=t;const[a,h]=b.useState(null),{frequency:d,measure:_,strategy:f}=l,v=b.useRef(e),y=x(),w=Zn(y),S=b.useCallback(function(I){I===void 0&&(I=[]),!w.current&&h(U=>U===null?I:U.concat(I.filter(W=>!U.includes(W))))},[w]),k=b.useRef(null),E=lo(I=>{if(y&&!i)return o_;if(!I||I===o_||v.current!==e||a!=null){const U=new Map;for(let W of e){if(!W)continue;if(a&&a.length>0&&!a.includes(W.id)&&W.rect.current){U.set(W.id,W.rect.current);continue}const P=W.node.current,M=P?new cu(_(P),P):null;W.rect.current=M,M&&U.set(W.id,M)}return U}return I},[e,a,i,y,_]);return b.useEffect(()=>{v.current=e},[e]),b.useEffect(()=>{y||S()},[i,y]),b.useEffect(()=>{a&&a.length>0&&h(null)},[JSON.stringify(a)]),b.useEffect(()=>{y||typeof d!="number"||k.current!==null||(k.current=setTimeout(()=>{S(),k.current=null},d))},[d,y,S,...n]),{droppableRects:E,measureDroppableContainers:S,measuringScheduled:a!=null};function x(){switch(f){case to.Always:return!1;case to.BeforeDragging:return i;default:return!i}}}function Lg(e,t){return lo(i=>e?i||(typeof t=="function"?t(e):e):null,[t,e])}function t1(e,t){return Lg(e,t)}function r1(e){let{callback:t,disabled:i}=e;const n=ou(t),l=b.useMemo(()=>{if(i||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,i]);return b.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function Jl(e){let{callback:t,disabled:i}=e;const n=ou(t),l=b.useMemo(()=>{if(i||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[i]);return b.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function i1(e){return new cu(qs(e),e)}function l_(e,t,i){t===void 0&&(t=i1);const[n,l]=b.useState(null);function a(){l(_=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=_??i)!=null?f:null}const v=t(e);return JSON.stringify(_)===JSON.stringify(v)?_:v})}const h=r1({callback(_){if(e)for(const f of _){const{type:v,target:y}=f;if(v==="childList"&&y instanceof HTMLElement&&y.contains(e)){a();break}}}}),d=Jl({callback:a});return ri(()=>{a(),e?(d==null||d.observe(e),h==null||h.observe(document.body,{childList:!0,subtree:!0})):(d==null||d.disconnect(),h==null||h.disconnect())},[e]),n}function s1(e){const t=Lg(e);return Cg(e,t)}const a_=[];function n1(e){const t=b.useRef(e),i=lo(n=>e?n&&n!==a_&&e&&t.current&&e.parentNode===t.current.parentNode?n:au(e):a_,[e]);return b.useEffect(()=>{t.current=e},[e]),i}function o1(e){const[t,i]=b.useState(null),n=b.useRef(e),l=b.useCallback(a=>{const h=Zc(a.target);h&&i(d=>d?(d.set(h,Wh(h)),new Map(d)):null)},[]);return b.useEffect(()=>{const a=n.current;if(e!==a){h(a);const d=e.map(_=>{const f=Zc(_);return f?(f.addEventListener("scroll",l,{passive:!0}),[f,Wh(f)]):null}).filter(_=>_!=null);i(d.length?new Map(d):null),n.current=e}return()=>{h(e),h(a)};function h(d){d.forEach(_=>{const f=Zc(_);f==null||f.removeEventListener("scroll",l)})}},[l,e]),b.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,h)=>Hs(a,h),zr):Pg(e):zr,[e,t])}function c_(e,t){t===void 0&&(t=[]);const i=b.useRef(null);return b.useEffect(()=>{i.current=null},t),b.useEffect(()=>{const n=e!==zr;n&&!i.current&&(i.current=e),!n&&i.current&&(i.current=null)},[e]),i.current?Wl(e,i.current):zr}function l1(e){b.useEffect(()=>{if(!Xl)return;const t=e.map(i=>{let{sensor:n}=i;return n.setup==null?void 0:n.setup()});return()=>{for(const i of t)i==null||i()}},e.map(t=>{let{sensor:i}=t;return i}))}function a1(e,t){return b.useMemo(()=>e.reduce((i,n)=>{let{eventName:l,handler:a}=n;return i[l]=h=>{a(h,t)},i},{}),[e,t])}function Bg(e){return b.useMemo(()=>e?Mx(e):null,[e])}const h_=[];function c1(e,t){t===void 0&&(t=qs);const[i]=e,n=Bg(i?sr(i):null),[l,a]=b.useState(h_);function h(){a(()=>e.length?e.map(_=>Dg(_)?n:new cu(t(_),_)):h_)}const d=Jl({callback:h});return ri(()=>{d==null||d.disconnect(),h(),e.forEach(_=>d==null?void 0:d.observe(_))},[e]),l}function h1(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return oo(t)?t:e}function u1(e){let{measure:t}=e;const[i,n]=b.useState(null),l=b.useCallback(f=>{for(const{target:v}of f)if(oo(v)){n(y=>{const w=t(v);return y?{...y,width:w.width,height:w.height}:w});break}},[t]),a=Jl({callback:l}),h=b.useCallback(f=>{const v=h1(f);a==null||a.disconnect(),v&&(a==null||a.observe(v)),n(v?t(v):null)},[t,a]),[d,_]=Hl(h);return b.useMemo(()=>({nodeRef:d,rect:i,setRef:_}),[i,d,_])}const d1=[{sensor:uu,options:{}},{sensor:Mg,options:{}}],f1={current:{}},Ll={draggable:{measure:r_},droppable:{measure:r_,strategy:to.WhileDragging,frequency:Uh.Optimized},dragOverlay:{measure:qs}};class Yn extends Map{get(t){var i;return t!=null&&(i=super.get(t))!=null?i:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:i}=t;return!i})}getNodeFor(t){var i,n;return(i=(n=this.get(t))==null?void 0:n.node.current)!=null?i:void 0}}const p1={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Yn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:$l},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ll,measureDroppableContainers:$l,windowRect:null,measuringScheduled:!1},_1={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:$l,draggableNodes:new Map,over:null,measureDroppableContainers:$l},Ql=b.createContext(_1),Ig=b.createContext(p1);function g1(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Yn}}}function m1(e,t){switch(t.type){case ft.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ft.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 ft.DragEnd:case ft.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ft.RegisterDroppable:{const{element:i}=t,{id:n}=i,l=new Yn(e.droppable.containers);return l.set(n,i),{...e,droppable:{...e.droppable,containers:l}}}case ft.SetDroppableDisabled:{const{id:i,key:n,disabled:l}=t,a=e.droppable.containers.get(i);if(!a||n!==a.key)return e;const h=new Yn(e.droppable.containers);return h.set(i,{...a,disabled:l}),{...e,droppable:{...e.droppable,containers:h}}}case ft.UnregisterDroppable:{const{id:i,key:n}=t,l=e.droppable.containers.get(i);if(!l||n!==l.key)return e;const a=new Yn(e.droppable.containers);return a.delete(i),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function v1(e){let{disabled:t}=e;const{active:i,activatorEvent:n,draggableNodes:l}=b.useContext(Ql),a=Fh(n),h=Fh(i==null?void 0:i.id);return b.useEffect(()=>{if(!t&&!n&&a&&h!=null){if(!lu(a)||document.activeElement===a.target)return;const d=l.get(h);if(!d)return;const{activatorNode:_,node:f}=d;if(!_.current&&!f.current)return;requestAnimationFrame(()=>{for(const v of[_.current,f.current]){if(!v)continue;const y=lx(v);if(y){y.focus();break}}})}},[n,t,l,h,a]),null}function y1(e,t){let{transform:i,...n}=t;return e!=null&&e.length?e.reduce((l,a)=>a({transform:l,...n}),i):i}function S1(e){return b.useMemo(()=>({draggable:{...Ll.draggable,...e==null?void 0:e.draggable},droppable:{...Ll.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Ll.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 w1(e){let{activeNode:t,measure:i,initialRect:n,config:l=!0}=e;const a=b.useRef(!1),{x:h,y:d}=typeof l=="boolean"?{x:l,y:l}:l;ri(()=>{if(!h&&!d||!t){a.current=!1;return}if(a.current||!n)return;const f=t==null?void 0:t.node.current;if(!f||f.isConnected===!1)return;const v=i(f),y=Cg(v,n);if(h||(y.x=0),d||(y.y=0),a.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const w=kg(f);w&&w.scrollBy({top:y.y,left:y.x})}},[t,h,d,n,i])}const Og=b.createContext({...zr,scaleX:1,scaleY:1});var $i;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})($i||($i={}));const x1=b.memo(function(t){var i,n,l,a;let{id:h,accessibility:d,autoScroll:_=!0,children:f,sensors:v=d1,collisionDetection:y=kx,measuring:w,modifiers:S,...k}=t;const E=b.useReducer(m1,void 0,g1),[x,I]=E,[U,W]=fx(),[P,M]=b.useState($i.Uninitialized),A=P===$i.Initialized,{draggable:{active:re,nodes:se,translate:pe},droppable:{containers:Se}}=x,z=re!=null?se.get(re):null,q=b.useRef({initial:null,translated:null}),j=b.useMemo(()=>{var qe;return re!=null?{id:re,data:(qe=z==null?void 0:z.data)!=null?qe:f1,rect:q}:null},[re,z]),G=b.useRef(null),[X,ee]=b.useState(null),[ie,B]=b.useState(null),Q=Zn(k,Object.values(k)),J=ao("DndDescribedBy",h),R=b.useMemo(()=>Se.getEnabled(),[Se]),F=S1(w),{droppableRects:ae,measureDroppableContainers:le,measuringScheduled:_e}=e1(R,{dragging:A,dependencies:[pe.x,pe.y],config:F.droppable}),ue=Qx(se,re),De=b.useMemo(()=>ie?Hh(ie):null,[ie]),ke=yi(),Ee=t1(ue,F.draggable.measure);w1({activeNode:re!=null?se.get(re):null,config:ke.layoutShiftCompensation,initialRect:Ee,measure:F.draggable.measure});const we=l_(ue,F.draggable.measure,Ee),gt=l_(ue?ue.parentElement:null),Fe=b.useRef({activatorEvent:null,active:null,activeNode:ue,collisionRect:null,collisions:null,droppableRects:ae,draggableNodes:se,draggingNode:null,draggingNodeRect:null,droppableContainers:Se,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ne=Se.getNodeFor((i=Fe.current.over)==null?void 0:i.id),nt=u1({measure:F.dragOverlay.measure}),dr=(n=nt.nodeRef.current)!=null?n:ue,Er=A?(l=nt.rect)!=null?l:we:null,Fr=!!(nt.nodeRef.current&&nt.rect),Hr=s1(Fr?null:we),ii=Bg(dr?sr(dr):null),Nt=n1(A?Ne??ue:null),H=c1(Nt),ge=y1(S,{transform:{x:pe.x-Hr.x,y:pe.y-Hr.y,scaleX:1,scaleY:1},activatorEvent:ie,active:j,activeNodeRect:we,containerNodeRect:gt,draggingNodeRect:Er,over:Fe.current.over,overlayNodeRect:nt.rect,scrollableAncestors:Nt,scrollableAncestorRects:H,windowRect:ii}),xe=De?Hs(De,pe):null,me=o1(Nt),Be=c_(me),He=c_(me,[we]),mt=Hs(ge,Be),Dt=Er?Dx(Er,ge):null,Wr=j&&Dt?y({active:j,collisionRect:Dt,droppableRects:ae,droppableContainers:R,pointerCoordinates:xe}):null,Nr=xx(Wr,"id"),[Rt,Bt]=b.useState(null),si=Fr?ge:Hs(ge,He),$r=Ex(si,(a=Rt==null?void 0:Rt.rect)!=null?a:null,we),Vi=b.useRef(null),ps=b.useCallback((qe,It)=>{let{sensor:Ot,options:Dr}=It;if(G.current==null)return;const Ut=se.get(G.current);if(!Ut)return;const At=qe.nativeEvent,Xt=new Ot({active:G.current,activeNode:Ut,event:At,options:Dr,context:Fe,onAbort(Ye){if(!se.get(Ye))return;const{onDragAbort:jt}=Q.current,Rr={id:Ye};jt==null||jt(Rr),U({type:"onDragAbort",event:Rr})},onPending(Ye,fr,jt,Rr){if(!se.get(Ye))return;const{onDragPending:Ur}=Q.current,nr={id:Ye,constraint:fr,initialCoordinates:jt,offset:Rr};Ur==null||Ur(nr),U({type:"onDragPending",event:nr})},onStart(Ye){const fr=G.current;if(fr==null)return;const jt=se.get(fr);if(!jt)return;const{onDragStart:Rr}=Q.current,Pr={activatorEvent:At,active:{id:fr,data:jt.data,rect:q}};Un.unstable_batchedUpdates(()=>{Rr==null||Rr(Pr),M($i.Initializing),I({type:ft.DragStart,initialCoordinates:Ye,active:fr}),U({type:"onDragStart",event:Pr}),ee(Vi.current),B(At)})},onMove(Ye){I({type:ft.DragMove,coordinates:Ye})},onEnd:ni(ft.DragEnd),onCancel:ni(ft.DragCancel)});Vi.current=Xt;function ni(Ye){return async function(){const{active:jt,collisions:Rr,over:Pr,scrollAdjustedTranslate:Ur}=Fe.current;let nr=null;if(jt&&Ur){const{cancelDrop:oi}=Q.current;nr={activatorEvent:At,active:jt,collisions:Rr,delta:Ur,over:Pr},Ye===ft.DragEnd&&typeof oi=="function"&&await Promise.resolve(oi(nr))&&(Ye=ft.DragCancel)}G.current=null,Un.unstable_batchedUpdates(()=>{I({type:Ye}),M($i.Uninitialized),Bt(null),ee(null),B(null),Vi.current=null;const oi=Ye===ft.DragEnd?"onDragEnd":"onDragCancel";if(nr){const Js=Q.current[oi];Js==null||Js(nr),U({type:oi,event:nr})}})}}},[se]),Ys=b.useCallback((qe,It)=>(Ot,Dr)=>{const Ut=Ot.nativeEvent,At=se.get(Dr);if(G.current!==null||!At||Ut.dndKit||Ut.defaultPrevented)return;const Xt={active:At};qe(Ot,It.options,Xt)===!0&&(Ut.dndKit={capturedBy:It.sensor},G.current=Dr,ps(Ot,It))},[se,ps]),_s=Zx(v,Ys);l1(v),ri(()=>{we&&P===$i.Initializing&&M($i.Initialized)},[we,P]),b.useEffect(()=>{const{onDragMove:qe}=Q.current,{active:It,activatorEvent:Ot,collisions:Dr,over:Ut}=Fe.current;if(!It||!Ot)return;const At={active:It,activatorEvent:Ot,collisions:Dr,delta:{x:mt.x,y:mt.y},over:Ut};Un.unstable_batchedUpdates(()=>{qe==null||qe(At),U({type:"onDragMove",event:At})})},[mt.x,mt.y]),b.useEffect(()=>{const{active:qe,activatorEvent:It,collisions:Ot,droppableContainers:Dr,scrollAdjustedTranslate:Ut}=Fe.current;if(!qe||G.current==null||!It||!Ut)return;const{onDragOver:At}=Q.current,Xt=Dr.get(Nr),ni=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,Ye={active:qe,activatorEvent:It,collisions:Ot,delta:{x:Ut.x,y:Ut.y},over:ni};Un.unstable_batchedUpdates(()=>{Bt(ni),At==null||At(Ye),U({type:"onDragOver",event:Ye})})},[Nr]),ri(()=>{Fe.current={activatorEvent:ie,active:j,activeNode:ue,collisionRect:Dt,collisions:Wr,droppableRects:ae,draggableNodes:se,draggingNode:dr,draggingNodeRect:Er,droppableContainers:Se,over:Rt,scrollableAncestors:Nt,scrollAdjustedTranslate:mt},q.current={initial:Er,translated:Dt}},[j,ue,Wr,Dt,se,dr,Er,ae,Se,Rt,Nt,mt]),Gx({...ke,delta:pe,draggingRect:Dt,pointerCoordinates:xe,scrollableAncestors:Nt,scrollableAncestorRects:H});const Gs=b.useMemo(()=>({active:j,activeNode:ue,activeNodeRect:we,activatorEvent:ie,collisions:Wr,containerNodeRect:gt,dragOverlay:nt,draggableNodes:se,droppableContainers:Se,droppableRects:ae,over:Rt,measureDroppableContainers:le,scrollableAncestors:Nt,scrollableAncestorRects:H,measuringConfiguration:F,measuringScheduled:_e,windowRect:ii}),[j,ue,we,ie,Wr,gt,nt,se,Se,ae,Rt,le,Nt,H,F,_e,ii]),Xs=b.useMemo(()=>({activatorEvent:ie,activators:_s,active:j,activeNodeRect:we,ariaDescribedById:{draggable:J},dispatch:I,draggableNodes:se,over:Rt,measureDroppableContainers:le}),[ie,_s,j,we,I,J,se,Rt,le]);return pt.createElement(bg.Provider,{value:W},pt.createElement(Ql.Provider,{value:Xs},pt.createElement(Ig.Provider,{value:Gs},pt.createElement(Og.Provider,{value:$r},f)),pt.createElement(v1,{disabled:(d==null?void 0:d.restoreFocus)===!1})),pt.createElement(gx,{...d,hiddenTextDescribedById:J}));function yi(){const qe=(X==null?void 0:X.autoScrollEnabled)===!1,It=typeof _=="object"?_.enabled===!1:_===!1,Ot=A&&!qe&&!It;return typeof _=="object"?{..._,enabled:Ot}:{enabled:Ot}}}),b1=b.createContext(null),u_="button",C1="Draggable";function k1(e){let{id:t,data:i,disabled:n=!1,attributes:l}=e;const a=ao(C1),{activators:h,activatorEvent:d,active:_,activeNodeRect:f,ariaDescribedById:v,draggableNodes:y,over:w}=b.useContext(Ql),{role:S=u_,roleDescription:k="draggable",tabIndex:E=0}=l??{},x=(_==null?void 0:_.id)===t,I=b.useContext(x?Og:b1),[U,W]=Hl(),[P,M]=Hl(),A=a1(h,t),re=Zn(i);ri(()=>(y.set(t,{id:t,key:a,node:U,activatorNode:P,data:re}),()=>{const pe=y.get(t);pe&&pe.key===a&&y.delete(t)}),[y,t]);const se=b.useMemo(()=>({role:S,tabIndex:E,"aria-disabled":n,"aria-pressed":x&&S===u_?!0:void 0,"aria-roledescription":k,"aria-describedby":v.draggable}),[n,S,E,x,k,v.draggable]);return{active:_,activatorEvent:d,activeNodeRect:f,attributes:se,isDragging:x,listeners:n?void 0:A,node:U,over:w,setNodeRef:W,setActivatorNodeRef:M,transform:I}}function E1(){return b.useContext(Ig)}const N1="Droppable",D1={timeout:25};function R1(e){let{data:t,disabled:i=!1,id:n,resizeObserverConfig:l}=e;const a=ao(N1),{active:h,dispatch:d,over:_,measureDroppableContainers:f}=b.useContext(Ql),v=b.useRef({disabled:i}),y=b.useRef(!1),w=b.useRef(null),S=b.useRef(null),{disabled:k,updateMeasurementsFor:E,timeout:x}={...D1,...l},I=Zn(E??n),U=b.useCallback(()=>{if(!y.current){y.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{f(Array.isArray(I.current)?I.current:[I.current]),S.current=null},x)},[x]),W=Jl({callback:U,disabled:k||!h}),P=b.useCallback((se,pe)=>{W&&(pe&&(W.unobserve(pe),y.current=!1),se&&W.observe(se))},[W]),[M,A]=Hl(P),re=Zn(t);return b.useEffect(()=>{!W||!M.current||(W.disconnect(),y.current=!1,W.observe(M.current))},[M,W]),b.useEffect(()=>(d({type:ft.RegisterDroppable,element:{id:n,key:a,disabled:i,node:M,rect:w,data:re}}),()=>d({type:ft.UnregisterDroppable,key:a,id:n})),[n]),b.useEffect(()=>{i!==v.current.disabled&&(d({type:ft.SetDroppableDisabled,id:n,key:a,disabled:i}),v.current.disabled=i)},[n,a,i,d]),{active:h,rect:w,isOver:(_==null?void 0:_.id)===n,node:M,over:_,setNodeRef:A}}function Ag(e,t,i){const n=e.slice();return n.splice(i<0?n.length+i:i,0,n.splice(t,1)[0]),n}function P1(e,t){return e.reduce((i,n,l)=>{const a=t.get(n);return a&&(i[l]=a),i},Array(e.length))}function xl(e){return e!==null&&e>=0}function T1(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function M1(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const jg=e=>{let{rects:t,activeIndex:i,overIndex:n,index:l}=e;const a=Ag(t,n,i),h=t[l],d=a[l];return!d||!h?null:{x:d.left-h.left,y:d.top-h.top,scaleX:d.width/h.width,scaleY:d.height/h.height}},bl={scaleX:1,scaleY:1},d_=e=>{var t;let{activeIndex:i,activeNodeRect:n,index:l,rects:a,overIndex:h}=e;const d=(t=a[i])!=null?t:n;if(!d)return null;if(l===i){const f=a[h];return f?{x:0,y:i<h?f.top+f.height-(d.top+d.height):f.top-d.top,...bl}:null}const _=L1(a,l,i);return l>i&&l<=h?{x:0,y:-d.height-_,...bl}:l<i&&l>=h?{x:0,y:d.height+_,...bl}:{x:0,y:0,...bl}};function L1(e,t,i){const n=e[t],l=e[t-1],a=e[t+1];return n?i<t?l?n.top-(l.top+l.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):l?n.top-(l.top+l.height):0:0}const zg="Sortable",Fg=pt.createContext({activeIndex:-1,containerId:zg,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:jg,disabled:{draggable:!1,droppable:!1}});function f_(e){let{children:t,id:i,items:n,strategy:l=jg,disabled:a=!1}=e;const{active:h,dragOverlay:d,droppableRects:_,over:f,measureDroppableContainers:v}=E1(),y=ao(zg,i),w=d.rect!==null,S=b.useMemo(()=>n.map(A=>typeof A=="object"&&"id"in A?A.id:A),[n]),k=h!=null,E=h?S.indexOf(h.id):-1,x=f?S.indexOf(f.id):-1,I=b.useRef(S),U=!T1(S,I.current),W=x!==-1&&E===-1||U,P=M1(a);ri(()=>{U&&k&&v(S)},[U,S,k,v]),b.useEffect(()=>{I.current=S},[S]);const M=b.useMemo(()=>({activeIndex:E,containerId:y,disabled:P,disableTransforms:W,items:S,overIndex:x,useDragOverlay:w,sortedRects:P1(S,_),strategy:l}),[E,y,P.draggable,P.droppable,W,S,x,_,w,l]);return pt.createElement(Fg.Provider,{value:M},t)}const B1=e=>{let{id:t,items:i,activeIndex:n,overIndex:l}=e;return Ag(i,n,l).indexOf(t)},I1=e=>{let{containerId:t,isSorting:i,wasDragging:n,index:l,items:a,newIndex:h,previousItems:d,previousContainerId:_,transition:f}=e;return!f||!n||d!==a&&l===h?!1:i?!0:h!==l&&t===_},O1={duration:200,easing:"ease"},Hg="transform",A1=eo.Transition.toString({property:Hg,duration:0,easing:"linear"}),j1={roleDescription:"sortable"};function z1(e){let{disabled:t,index:i,node:n,rect:l}=e;const[a,h]=b.useState(null),d=b.useRef(i);return ri(()=>{if(!t&&i!==d.current&&n.current){const _=l.current;if(_){const f=qs(n.current,{ignoreTransform:!0}),v={x:_.left-f.left,y:_.top-f.top,scaleX:_.width/f.width,scaleY:_.height/f.height};(v.x||v.y)&&h(v)}}i!==d.current&&(d.current=i)},[t,i,n,l]),b.useEffect(()=>{a&&h(null)},[a]),a}function F1(e){let{animateLayoutChanges:t=I1,attributes:i,disabled:n,data:l,getNewIndex:a=B1,id:h,strategy:d,resizeObserverConfig:_,transition:f=O1}=e;const{items:v,containerId:y,activeIndex:w,disabled:S,disableTransforms:k,sortedRects:E,overIndex:x,useDragOverlay:I,strategy:U}=b.useContext(Fg),W=H1(n,S),P=v.indexOf(h),M=b.useMemo(()=>({sortable:{containerId:y,index:P,items:v},...l}),[y,l,P,v]),A=b.useMemo(()=>v.slice(v.indexOf(h)),[v,h]),{rect:re,node:se,isOver:pe,setNodeRef:Se}=R1({id:h,data:M,disabled:W.droppable,resizeObserverConfig:{updateMeasurementsFor:A,..._}}),{active:z,activatorEvent:q,activeNodeRect:j,attributes:G,setNodeRef:X,listeners:ee,isDragging:ie,over:B,setActivatorNodeRef:Q,transform:J}=k1({id:h,data:M,attributes:{...j1,...i},disabled:W.draggable}),R=ix(Se,X),F=!!z,ae=F&&!k&&xl(w)&&xl(x),le=!I&&ie,_e=le&&ae?J:null,De=ae?_e??(d??U)({rects:E,activeNodeRect:j,activeIndex:w,overIndex:x,index:P}):null,ke=xl(w)&&xl(x)?a({id:h,items:v,activeIndex:w,overIndex:x}):P,Ee=z==null?void 0:z.id,we=b.useRef({activeId:Ee,items:v,newIndex:ke,containerId:y}),gt=v!==we.current.items,Fe=t({active:z,containerId:y,isDragging:ie,isSorting:F,id:h,index:P,items:v,newIndex:we.current.newIndex,previousItems:we.current.items,previousContainerId:we.current.containerId,transition:f,wasDragging:we.current.activeId!=null}),Ne=z1({disabled:!Fe,index:P,node:se,rect:re});return b.useEffect(()=>{F&&we.current.newIndex!==ke&&(we.current.newIndex=ke),y!==we.current.containerId&&(we.current.containerId=y),v!==we.current.items&&(we.current.items=v)},[F,ke,y,v]),b.useEffect(()=>{if(Ee===we.current.activeId)return;if(Ee!=null&&we.current.activeId==null){we.current.activeId=Ee;return}const dr=setTimeout(()=>{we.current.activeId=Ee},50);return()=>clearTimeout(dr)},[Ee]),{active:z,activeIndex:w,attributes:G,data:M,rect:re,index:P,newIndex:ke,items:v,isOver:pe,isSorting:F,isDragging:ie,listeners:ee,node:se,overIndex:x,over:B,setNodeRef:R,setActivatorNodeRef:Q,setDroppableNodeRef:Se,setDraggableNodeRef:X,transform:Ne??De,transition:nt()};function nt(){if(Ne||gt&&we.current.newIndex===P)return A1;if(!(le&&!lu(q)||!f)&&(F||Fe))return eo.Transition.toString({...f,property:Hg})}}function H1(e,t){var i,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(i=e==null?void 0:e.draggable)!=null?i:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}Ie.Down,Ie.Right,Ie.Up,Ie.Left;const W1={low:"bg-gray-500",medium:"bg-yellow-500",high:"bg-red-500"},$1={meego:"bg-blue-900/50 text-blue-400","lark-docs":"bg-green-900/50 text-green-400",supabase:"bg-emerald-900/50 text-emerald-400"};function p_({todo:e,selected:t,multiSelected:i,sessionStatus:n,onSelect:l,onToggle:a,onContextMenu:h}){const d=U1(e.createdAt),{attributes:_,listeners:f,setNodeRef:v,transform:y,transition:w,isDragging:S}=F1({id:e.id}),k={transform:eo.Transform.toString(y),transition:w,opacity:S?.5:1};return g.jsxs("div",{ref:v,style:k,..._,...f,onClick:l,onContextMenu:h,className:`px-4 py-3 border-b border-gray-800 cursor-pointer transition-colors flex items-start gap-3 ${t?"bg-gray-800":i?"bg-gray-800/70":"hover:bg-gray-800/50"}${i?" ring-1 ring-blue-500/30":""}`,children:[g.jsx("button",{onClick:E=>{E.stopPropagation(),a()},className:`mt-0.5 w-4 h-4 rounded border flex-shrink-0 flex items-center justify-center transition-colors ${e.completed?"bg-blue-600 border-blue-600":"border-gray-500 hover:border-gray-300"}`,children:e.completed&&g.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:g.jsx("polyline",{points:"20 6 9 17 4 12"})})}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${W1[e.priority]}`}),g.jsx("span",{className:`text-sm truncate ${e.completed?"text-gray-500 line-through":"text-gray-200"}`,children:e.title}),n&&g.jsx(Qp,{status:n,title:`Session: ${n}`}),e.provider&&g.jsxs("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 flex items-center gap-1 ${$1[e.provider.providerId]||"bg-gray-700 text-gray-400"}`,children:[g.jsx(Qp,{status:e.provider.syncStatus}),e.provider.providerId]})]}),g.jsx("div",{className:"text-xs text-gray-500 mt-1 ml-4",children:d})]})]})}function U1(e){const t=Date.now()-new Date(e).getTime(),i=Math.floor(t/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const n=Math.floor(i/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function Wg({initial:e,sessions:t,prefillSessionId:i,onSubmit:n,onCancel:l,onCreateSession:a}){const[h,d]=b.useState((e==null?void 0:e.title)??""),[_,f]=b.useState((e==null?void 0:e.description)??""),[v,y]=b.useState((e==null?void 0:e.priority)??"medium"),[w,S]=b.useState((e==null?void 0:e.sessionId)??i??"");b.useEffect(()=>{i&&S(i)},[i]);const k=x=>{if(x==="__new__"){a==null||a();return}S(x)},E=x=>{if(x.preventDefault(),!h.trim())return;let I,U;if(w&&t){const W=t.find(P=>P.sessionId===w);W&&(I=W.sessionId,U=W.displayName||W.lastMessage)}else w&&(I=w);n({title:h.trim(),description:_.trim()||void 0,priority:v,sessionId:I,sessionLabel:U})};return g.jsxs("form",{onSubmit:E,className:"space-y-3",children:[g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-gray-400 mb-1",children:"Title *"}),g.jsx("input",{type:"text",value:h,onChange:x=>d(x.target.value),className:"w-full bg-gray-800 border border-gray-700 rounded-lg px-3 py-2 text-sm text-gray-200 focus:outline-none focus:border-blue-500",placeholder:"What needs to be done?",autoFocus:!0})]}),g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-gray-400 mb-1",children:"Description"}),g.jsx("textarea",{value:_,onChange:x=>f(x.target.value),rows:3,className:"w-full bg-gray-800 border border-gray-700 rounded-lg px-3 py-2 text-sm text-gray-200 focus:outline-none focus:border-blue-500 resize-none",placeholder:"Optional details..."})]}),g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-gray-400 mb-1",children:"Priority"}),g.jsx("div",{className:"flex gap-2",children:["low","medium","high"].map(x=>g.jsx("button",{type:"button",onClick:()=>y(x),className:`text-xs px-3 py-1.5 rounded-lg capitalize transition-colors ${v===x?x==="high"?"bg-red-900/50 text-red-400":x==="medium"?"bg-yellow-900/50 text-yellow-400":"bg-gray-700 text-gray-300":"bg-gray-800 text-gray-500 hover:text-gray-300"}`,children:x},x))})]}),g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-gray-400 mb-1",children:"Linked Session"}),t?g.jsxs("select",{value:w,onChange:x=>k(x.target.value),className:"w-full bg-gray-800 border border-gray-700 rounded-lg px-3 py-2 text-sm text-gray-200 focus:outline-none focus:border-blue-500",children:[g.jsx("option",{value:"",children:"(No session)"}),t.map(x=>g.jsx("option",{value:x.sessionId,children:x.displayName||x.lastMessage||x.sessionId.slice(0,8)},x.sessionId)),a&&g.jsx("option",{value:"__new__",children:"+ New Session..."})]}):g.jsx("input",{type:"text",value:w,onChange:x=>S(x.target.value),className:"w-full bg-gray-800 border border-gray-700 rounded-lg px-3 py-2 text-sm text-gray-200 focus:outline-none focus:border-blue-500",placeholder:"Session ID"})]}),g.jsxs("div",{className:"flex gap-2 justify-end pt-1",children:[g.jsx("button",{type:"button",onClick:l,className:"text-xs px-3 py-1.5 bg-gray-700 text-gray-300 rounded-lg hover:bg-gray-600 transition-colors",children:"Cancel"}),g.jsx("button",{type:"submit",disabled:!h.trim(),className:"text-xs px-3 py-1.5 bg-blue-600 text-white rounded-lg hover:bg-blue-500 transition-colors disabled:opacity-50",children:e?"Save":"Create"})]})]})}function K1({onClose:e}){const[t,i]=b.useState([]),[n,l]=b.useState([]),[a,h]=b.useState(!0),[d,_]=b.useState(null),[f,v]=b.useState(null),[y,w]=b.useState(null),[S,k]=b.useState(null);b.useEffect(()=>{E()},[]);async function E(){try{const[P,M]=await Promise.all([Jw(),Qw()]);i(P),l(M)}catch(P){k(P.message)}finally{h(!1)}}async function x(P){try{const M=await Zp(P.id,{enabled:!P.enabled});l(A=>A.map(re=>re.id===M.id?M:re))}catch(M){k(M.message)}}async function I(P){if(confirm("Delete this provider configuration?"))try{await ex(P),l(M=>M.filter(A=>A.id!==P))}catch(M){k(M.message)}}async function U(P){w(P);try{const M=await tx(P),A=`Imported: ${M.imported}, Updated: ${M.updated}`+(M.errors.length>0?`, Errors: ${M.errors.length}`:"");alert(A),await E()}catch(M){k(M.message)}finally{w(null)}}const W=new Map(t.map(P=>[P.id,P]));return g.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:e,children:g.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-lg w-full max-w-2xl max-h-[80vh] flex flex-col",onClick:P=>P.stopPropagation(),children:[g.jsxs("div",{className:"p-4 border-b border-gray-700 flex items-center justify-between",children:[g.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Provider Settings"}),g.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white text-xl leading-none",children:"×"})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[S&&g.jsxs("div",{className:"bg-red-900/30 border border-red-800 text-red-300 text-sm rounded p-3",children:[S,g.jsx("button",{onClick:()=>k(null),className:"ml-2 underline",children:"dismiss"})]}),a?g.jsx("div",{className:"text-gray-500 text-sm",children:"Loading..."}):g.jsxs(g.Fragment,{children:[n.map(P=>g.jsx(V1,{config:P,providerType:W.get(P.providerId),isEditing:f===P.id,isSyncing:y===P.id,onToggle:()=>x(P),onEdit:()=>v(f===P.id?null:P.id),onSave:async M=>{try{const A=await Zp(P.id,M);l(re=>re.map(se=>se.id===A.id?A:se)),v(null)}catch(A){k(A.message)}},onDelete:()=>I(P.id),onSync:()=>U(P.id)},P.id)),n.length===0&&!d&&g.jsx("div",{className:"text-gray-500 text-sm text-center py-6",children:"No providers configured. Add one below."}),d?g.jsx(q1,{providerType:W.get(d),onSave:async P=>{try{const M=await Zw(P);l(A=>[...A,M]),_(null)}catch(M){k(M.message)}},onCancel:()=>_(null)}):g.jsxs("div",{className:"pt-2",children:[g.jsx("label",{className:"text-sm text-gray-400 block mb-1",children:"Add Provider"}),g.jsx("div",{className:"flex gap-2",children:t.map(P=>g.jsxs("button",{onClick:()=>_(P.id),className:"text-xs px-3 py-1.5 bg-gray-800 text-gray-300 rounded hover:bg-gray-700 transition-colors",children:["+ ",P.displayName]},P.id))})]})]})]})]})})}function V1({config:e,providerType:t,isEditing:i,isSyncing:n,onToggle:l,onEdit:a,onSave:h,onDelete:d,onSync:_}){const[f,v]=b.useState(e.name),[y,w]=b.useState(e.syncIntervalMinutes??0),[S,k]=b.useState(e.config);return g.jsxs("div",{className:"bg-gray-800 rounded-lg p-3 space-y-2",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("button",{onClick:l,className:`w-8 h-4 rounded-full relative transition-colors ${e.enabled?"bg-blue-600":"bg-gray-600"}`,children:g.jsx("span",{className:`absolute top-0.5 w-3 h-3 rounded-full bg-white transition-transform ${e.enabled?"left-4":"left-0.5"}`})}),g.jsx("span",{className:"text-sm text-gray-200 font-medium",children:e.name}),g.jsx("span",{className:"text-xs text-gray-500 bg-gray-700 px-2 py-0.5 rounded",children:(t==null?void 0:t.displayName)||e.providerId})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[e.lastSyncAt&&g.jsxs("span",{className:"text-xs text-gray-500",children:["Synced ",new Date(e.lastSyncAt).toLocaleTimeString()]}),g.jsx("button",{onClick:_,disabled:n,className:"text-xs px-2 py-1 bg-gray-700 text-gray-300 rounded hover:bg-gray-600 disabled:opacity-50",children:n?"Syncing...":"Sync"}),g.jsx("button",{onClick:a,className:"text-xs px-2 py-1 bg-gray-700 text-gray-300 rounded hover:bg-gray-600",children:i?"Cancel":"Edit"}),g.jsx("button",{onClick:d,className:"text-xs px-2 py-1 bg-red-900/50 text-red-400 rounded hover:bg-red-900/70",children:"Delete"})]})]}),e.lastSyncError&&g.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 rounded px-2 py-1",children:e.lastSyncError}),i&&t&&g.jsxs("div",{className:"border-t border-gray-700 pt-3 mt-2 space-y-3",children:[g.jsxs("div",{children:[g.jsx("label",{className:"text-xs text-gray-400 block mb-1",children:"Name"}),g.jsx("input",{type:"text",value:f,onChange:E=>v(E.target.value),className:"w-full bg-gray-900 border border-gray-600 rounded px-3 py-1.5 text-sm text-gray-200"})]}),g.jsx($g,{schema:t.configSchema,values:S,onChange:k}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs text-gray-400 block mb-1",children:"Auto-sync interval (minutes, 0 = manual only)"}),g.jsx("input",{type:"number",min:0,value:y,onChange:E=>w(Number(E.target.value)),className:"w-32 bg-gray-900 border border-gray-600 rounded px-3 py-1.5 text-sm text-gray-200"})]}),g.jsx("button",{onClick:()=>h({name:f,config:S,syncIntervalMinutes:y}),className:"text-xs px-3 py-1.5 bg-blue-600 text-white rounded hover:bg-blue-500",children:"Save"})]})]})}function q1({providerType:e,onSave:t,onCancel:i}){const[n,l]=b.useState(""),[a,h]=b.useState({}),[d,_]=b.useState(0);return g.jsxs("div",{className:"bg-gray-800 rounded-lg p-4 space-y-3 border border-blue-800",children:[g.jsxs("h3",{className:"text-sm font-semibold text-gray-200",children:["Add ",e.displayName," Provider"]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs text-gray-400 block mb-1",children:"Name"}),g.jsx("input",{type:"text",value:n,onChange:f=>l(f.target.value),placeholder:`e.g. My ${e.displayName}`,className:"w-full bg-gray-900 border border-gray-600 rounded px-3 py-1.5 text-sm text-gray-200"})]}),g.jsx($g,{schema:e.configSchema,values:a,onChange:h}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs text-gray-400 block mb-1",children:"Auto-sync interval (minutes, 0 = manual only)"}),g.jsx("input",{type:"number",min:0,value:d,onChange:f=>_(Number(f.target.value)),className:"w-32 bg-gray-900 border border-gray-600 rounded px-3 py-1.5 text-sm text-gray-200"})]}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("button",{onClick:()=>t({providerId:e.id,name:n,config:a,syncIntervalMinutes:d}),disabled:!n,className:"text-xs px-3 py-1.5 bg-blue-600 text-white rounded hover:bg-blue-500 disabled:opacity-50",children:"Create"}),g.jsx("button",{onClick:i,className:"text-xs px-3 py-1.5 bg-gray-700 text-gray-300 rounded hover:bg-gray-600",children:"Cancel"})]})]})}function $g({schema:e,values:t,onChange:i}){function n(l,a){i({...t,[l]:a})}return g.jsx(g.Fragment,{children:e.map(l=>g.jsxs("div",{children:[g.jsxs("label",{className:"text-xs text-gray-400 block mb-1",children:[l.label,l.required&&g.jsx("span",{className:"text-red-400",children:" *"})]}),l.type==="select"&&l.options?g.jsxs("select",{value:String(t[l.key]??""),onChange:a=>n(l.key,a.target.value),className:"w-full bg-gray-900 border border-gray-600 rounded px-3 py-1.5 text-sm text-gray-200",children:[g.jsx("option",{value:"",children:"Select..."}),l.options.map(a=>g.jsx("option",{value:a.value,children:a.label},a.value))]}):l.type==="boolean"?g.jsx("input",{type:"checkbox",checked:!!t[l.key],onChange:a=>n(l.key,a.target.checked),className:"rounded"}):l.type==="number"?g.jsx("input",{type:"number",value:Number(t[l.key]??0),onChange:a=>n(l.key,Number(a.target.value)),placeholder:l.placeholder,className:"w-full bg-gray-900 border border-gray-600 rounded px-3 py-1.5 text-sm text-gray-200"}):g.jsx("input",{type:l.secret?"password":"text",value:String(t[l.key]??""),onChange:a=>n(l.key,a.target.value),placeholder:l.placeholder,className:"w-full bg-gray-900 border border-gray-600 rounded px-3 py-1.5 text-sm text-gray-200"})]},l.key))})}function Y1({groups:e,onGroupsChanged:t}){const[i,n]=b.useState(""),[l,a]=b.useState(null),[h,d]=b.useState(""),[_,f]=b.useState(!1),v=async()=>{if(i.trim()){f(!0);try{await Sg(i.trim()),n(""),t()}catch(S){console.error("Failed to create group:",S)}finally{f(!1)}}},y=async S=>{if(h.trim())try{await Gw(S,{name:h.trim()}),a(null),t()}catch(k){console.error("Failed to rename group:",k)}},w=async(S,k)=>{if(confirm(`Delete group "${k}"? Todos in this group will become ungrouped.`))try{await Xw(S),t()}catch(E){console.error("Failed to delete group:",E)}};return g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"flex gap-1",children:[g.jsx("input",{value:i,onChange:S=>n(S.target.value),onKeyDown:S=>{S.key==="Enter"&&v()},placeholder:"New group name...",className:"flex-1 text-xs bg-gray-800 text-gray-200 px-2 py-1 rounded border border-gray-600 outline-none focus:border-blue-500"}),g.jsx("button",{onClick:v,disabled:_||!i.trim(),className:"text-xs px-2 py-1 bg-blue-600 text-white rounded hover:bg-blue-500 disabled:opacity-50",children:"Add"})]}),e.map(S=>g.jsx("div",{className:"flex items-center gap-2 text-xs",children:l===S.id?g.jsxs(g.Fragment,{children:[g.jsx("input",{value:h,onChange:k=>d(k.target.value),onKeyDown:k=>{k.key==="Enter"&&y(S.id),k.key==="Escape"&&a(null)},autoFocus:!0,className:"flex-1 bg-gray-800 text-gray-200 px-2 py-1 rounded border border-gray-600 outline-none focus:border-blue-500"}),g.jsx("button",{onClick:()=>y(S.id),className:"text-blue-400 hover:text-blue-300",children:"Save"}),g.jsx("button",{onClick:()=>a(null),className:"text-gray-500 hover:text-gray-300",children:"Cancel"})]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"flex-1 text-gray-300 truncate",children:S.name}),g.jsx("button",{onClick:()=>{a(S.id),d(S.name)},className:"text-gray-500 hover:text-gray-300",children:"Rename"}),g.jsx("button",{onClick:()=>w(S.id,S.name),className:"text-red-500 hover:text-red-400",children:"Delete"})]})},S.id))]})}function G1({selectedTodoId:e,onSelect:t}){const[i,n]=b.useState([]),[l,a]=b.useState([]),[h,d]=b.useState([]),[_,f]=b.useState(!0),[v,y]=b.useState(!1),[w,S]=b.useState(!1),[k,E]=b.useState(!1),[x,I]=b.useState(!1),[U,W]=b.useState(!1),[P,M]=b.useState("all"),[A,re]=b.useState("all"),[se,pe]=b.useState(new Set),[Se,z]=b.useState(null),[q,j]=b.useState(""),[G,X]=b.useState(!1),[ee,ie]=b.useState(()=>{try{const H=localStorage.getItem("claudit:collapsedGroups");return H?new Set(JSON.parse(H)):new Set}catch{return new Set}}),B=Oe(H=>H.todoSessionPrefill),Q=Oe(H=>H.setTodoSessionPrefill),J=H=>{ie(ge=>{const xe=new Set(ge);xe.has(H)?xe.delete(H):xe.add(H);try{localStorage.setItem("claudit:collapsedGroups",JSON.stringify([...xe]))}catch{}return xe})},R=b.useRef(null),F=vx(mx(uu,{activationConstraint:{distance:8}})),ae=new Map;h.forEach(H=>ae.set(H.sessionId,H));const le=b.useCallback(async()=>{try{const H=await yg();n(H)}catch(H){console.error("Failed to load todos:",H)}finally{f(!1)}},[]),_e=b.useCallback(async()=>{try{const H=await Yw();a(H)}catch(H){console.error("Failed to load groups:",H)}},[]),ue=b.useCallback(async()=>{try{const ge=(await Kl(void 0,!0)).flatMap(xe=>xe.sessions);d(ge)}catch(H){console.error("Failed to load sessions:",H)}},[]);b.useEffect(()=>{le(),_e(),ue();const H=setInterval(le,1e4);return()=>clearInterval(H)},[le,_e,ue]),b.useEffect(()=>{B&&y(!0)},[B]),b.useEffect(()=>{if(!Se)return;const H=()=>z(null);return window.addEventListener("click",H),()=>window.removeEventListener("click",H)},[Se]);const De=async H=>{try{const xe=await Vw({...H,groupId:A!=="all"&&A!=="ungrouped"?A:void 0});n(me=>[...me,xe]),y(!1),Q(null),t(xe.id)}catch(ge){console.error("Failed to create todo:",ge)}},ke=async H=>{try{const ge=await Ml(H.id,{completed:!H.completed,completedAt:H.completed?void 0:new Date().toISOString()});n(xe=>xe.map(me=>me.id===ge.id?ge:me))}catch(ge){console.error("Failed to toggle todo:",ge)}},Ee=async()=>{W(!0);try{const ge=(await rx()).reduce((xe,me)=>({imported:xe.imported+me.imported,updated:xe.updated+me.updated}),{imported:0,updated:0});(ge.imported>0||ge.updated>0)&&await le()}catch(H){console.error("Failed to sync providers:",H)}finally{W(!1)}},we=()=>{y(!1),Q(null)},gt=async H=>{S(!1),await ue()},Fe=(H,ge)=>{const xe=Fr(),me=xe.findIndex(Be=>Be.id===H);if(ge.shiftKey&&R.current!==null){const Be=Math.min(R.current,me),He=Math.max(R.current,me),mt=xe.slice(Be,He+1).map(Dt=>Dt.id);pe(new Set(mt))}else ge.metaKey||ge.ctrlKey?pe(Be=>{const He=new Set(Be);return He.has(H)?He.delete(H):He.add(H),He}):pe(new Set);R.current=me,t(H)},Ne=(H,ge)=>{ge.preventDefault();const xe=se.size>0&&se.has(H)?Array.from(se):[H];z({x:ge.clientX,y:ge.clientY,todoIds:xe})},nt=async H=>{if(!Se)return;const ge=Se.todoIds.map(xe=>{const me=i.find(Be=>Be.id===xe);return{id:xe,position:(me==null?void 0:me.position)??0,groupId:H??void 0}});try{await Jc(ge),await le()}catch(xe){console.error("Failed to move todos:",xe)}z(null),pe(new Set)},dr=async()=>{if(q.trim()){try{const H=await Sg(q.trim());if(await _e(),j(""),X(!1),Se){const ge=Se.todoIds.map(xe=>{const me=i.find(Be=>Be.id===xe);return{id:xe,position:(me==null?void 0:me.position)??0,groupId:H.id}});await Jc(ge),await le()}}catch(H){console.error("Failed to create group:",H)}z(null),pe(new Set)}},Er=async H=>{var Nr,Rt;const{active:ge,over:xe}=H;if(!xe||ge.id===xe.id)return;const me=Fr(),Be=me.findIndex(Bt=>Bt.id===ge.id),He=me.findIndex(Bt=>Bt.id===xe.id);if(Be<0||He<0)return;let mt;if(He===0)mt=(((Nr=me[0])==null?void 0:Nr.position)??1e3)-1e3;else if(He>=me.length-1)mt=(((Rt=me[me.length-1])==null?void 0:Rt.position)??0)+1e3;else{const Bt=me[He>Be?He:He-1],si=me[He>Be?He+1:He];mt=Math.round((((Bt==null?void 0:Bt.position)??0)+((si==null?void 0:si.position)??0))/2)}const Dt=me[Be],Wr=[{id:Dt.id,position:mt,groupId:Dt.groupId}];n(Bt=>Bt.map($r=>$r.id===Dt.id?{...$r,position:mt}:$r).sort(($r,Vi)=>($r.position??0)-(Vi.position??0)));try{await Jc(Wr)}catch(Bt){console.error("Failed to reorder:",Bt),await le()}},Fr=()=>i.filter(H=>!(P==="active"&&H.completed||P==="done"&&!H.completed||A==="ungrouped"&&H.groupId||A!=="all"&&A!=="ungrouped"&&H.groupId!==A)),Hr=Fr(),ii=i.filter(H=>!H.completed).length,Nt=A==="all"&&l.length>0?(()=>{const H=[],ge=new Map;for(const me of Hr){const Be=me.groupId??null;ge.has(Be)||ge.set(Be,[]),ge.get(Be).push(me)}for(const me of l){const Be=ge.get(me.id);Be&&Be.length>0&&H.push({groupId:me.id,label:me.name,items:Be})}const xe=ge.get(null);return xe&&xe.length>0&&H.push({groupId:null,label:"Ungrouped",items:xe}),H})():null;return g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsxs("div",{className:"p-4 border-b border-gray-800 flex items-center justify-between",children:[g.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Todos"}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("button",{onClick:Ee,disabled:U,title:"Sync all providers",className:"text-xs px-2 py-1.5 bg-gray-700 text-gray-300 rounded-lg hover:bg-gray-600 transition-colors disabled:opacity-50",children:U?"...":"↻"}),g.jsx("button",{onClick:()=>E(!0),title:"Provider settings",className:"text-xs px-2 py-1.5 bg-gray-700 text-gray-300 rounded-lg hover:bg-gray-600 transition-colors",children:"⚙"}),g.jsx("button",{onClick:()=>{y(!v),v&&Q(null)},className:"text-xs px-3 py-1.5 bg-blue-600 text-white rounded-lg hover:bg-blue-500 transition-colors",children:v?"Cancel":"+ New"})]})]}),g.jsx("div",{className:"px-4 py-2 border-b border-gray-800 flex gap-1",children:["all","active","done"].map(H=>g.jsxs("button",{onClick:()=>M(H),className:`text-xs px-3 py-1 rounded-full capitalize transition-colors ${P===H?"bg-blue-600 text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[H,H==="active"?` (${ii})`:""]},H))}),l.length>0&&g.jsxs("div",{className:"px-4 py-2 border-b border-gray-800 flex items-center gap-1 flex-wrap",children:[g.jsx("button",{onClick:()=>re("all"),className:`text-xs px-2.5 py-1 rounded-full transition-colors ${A==="all"?"bg-purple-600 text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:"All"}),g.jsx("button",{onClick:()=>re("ungrouped"),className:`text-xs px-2.5 py-1 rounded-full transition-colors ${A==="ungrouped"?"bg-purple-600 text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:"Ungrouped"}),l.map(H=>g.jsx("button",{onClick:()=>re(H.id),onContextMenu:ge=>{ge.preventDefault()},className:`text-xs px-2.5 py-1 rounded-full transition-colors ${A===H.id?"bg-purple-600 text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:H.name},H.id)),g.jsx("button",{onClick:()=>I(!x),className:"text-xs px-2 py-1 rounded-full text-gray-500 hover:text-white hover:bg-gray-800 transition-colors",title:"Manage groups",children:x?"×":"+"})]}),(x||l.length===0)&&g.jsxs("div",{className:"px-4 py-2 border-b border-gray-800 bg-gray-900/50",children:[g.jsx(Y1,{groups:l,onGroupsChanged:_e}),l.length>0&&g.jsx("button",{onClick:()=>I(!1),className:"mt-1 text-xs text-gray-500 hover:text-gray-300",children:"Close"})]}),v&&g.jsx("div",{className:"p-4 border-b border-gray-800 bg-gray-900/50",children:g.jsx(Wg,{sessions:h,prefillSessionId:B==null?void 0:B.sessionId,onSubmit:De,onCancel:we,onCreateSession:()=>S(!0)})}),g.jsx(x1,{sensors:F,collisionDetection:bx,onDragEnd:Er,children:g.jsx("div",{className:"flex-1 overflow-y-auto",children:_?g.jsx("div",{className:"p-4 text-gray-500 text-sm",children:"Loading..."}):Hr.length===0?g.jsx("div",{className:"p-4 text-gray-500 text-sm text-center",children:P==="all"?"No todos yet. Create one to get started.":P==="active"?"No active todos.":"No completed todos."}):Nt?Nt.map(H=>{const ge=H.groupId??"ungrouped",xe=ee.has(ge);return g.jsxs("div",{children:[g.jsxs("button",{onClick:()=>J(ge),className:"w-full px-4 py-1.5 text-[10px] font-semibold text-gray-500 uppercase tracking-wider bg-gray-900/30 border-b border-gray-800/50 flex items-center justify-between hover:bg-gray-800/30 transition-colors",children:[g.jsxs("span",{children:[H.label," (",H.items.length,")"]}),g.jsx("span",{className:"text-gray-600",children:xe?"▸":"▾"})]}),!xe&&g.jsx(f_,{items:H.items.map(me=>me.id),strategy:d_,children:H.items.map(me=>{const Be=me.sessionId?ae.get(me.sessionId):void 0;return g.jsx(p_,{todo:me,selected:me.id===e,multiSelected:se.has(me.id),sessionStatus:Be==null?void 0:Be.status,onSelect:He=>Fe(me.id,He),onToggle:()=>ke(me),onContextMenu:He=>Ne(me.id,He)},me.id)})})]},ge)}):g.jsx(f_,{items:Hr.map(H=>H.id),strategy:d_,children:Hr.map(H=>{const ge=H.sessionId?ae.get(H.sessionId):void 0;return g.jsx(p_,{todo:H,selected:H.id===e,multiSelected:se.has(H.id),sessionStatus:ge==null?void 0:ge.status,onSelect:xe=>Fe(H.id,xe),onToggle:()=>ke(H),onContextMenu:xe=>Ne(H.id,xe)},H.id)})})})}),Se&&g.jsxs("div",{className:"fixed z-50 bg-gray-800 border border-gray-700 rounded-lg shadow-xl py-1 min-w-[180px]",style:{left:Se.x,top:Se.y},onClick:H=>H.stopPropagation(),children:[g.jsxs("div",{className:"px-3 py-1 text-[10px] text-gray-500 uppercase tracking-wider",children:[Se.todoIds.length," item",Se.todoIds.length>1?"s":""]}),g.jsx("button",{onClick:()=>nt(null),className:"w-full text-left px-3 py-1.5 text-xs text-gray-300 hover:bg-gray-700 transition-colors",children:"Remove from group"}),l.map(H=>g.jsxs("button",{onClick:()=>nt(H.id),className:"w-full text-left px-3 py-1.5 text-xs text-gray-300 hover:bg-gray-700 transition-colors",children:["Move to: ",H.name]},H.id)),g.jsx("div",{className:"border-t border-gray-700 mt-1 pt-1",children:G?g.jsxs("div",{className:"px-3 py-1 flex gap-1",children:[g.jsx("input",{value:q,onChange:H=>j(H.target.value),onKeyDown:H=>{H.key==="Enter"&&dr(),H.key==="Escape"&&(X(!1),z(null))},autoFocus:!0,placeholder:"Group name...",className:"flex-1 text-xs bg-gray-900 text-gray-200 px-2 py-1 rounded border border-gray-600 outline-none focus:border-blue-500"}),g.jsx("button",{onClick:dr,className:"text-xs px-2 py-1 bg-blue-600 text-white rounded hover:bg-blue-500",children:"OK"})]}):g.jsx("button",{onClick:()=>X(!0),className:"w-full text-left px-3 py-1.5 text-xs text-blue-400 hover:bg-gray-700 transition-colors",children:"Create new group..."})})]}),w&&g.jsx(qh,{onClose:()=>S(!1),onCreate:gt}),k&&g.jsx(K1,{onClose:()=>{E(!1),le()}})]})}function X1(){return g.jsx("div",{className:"flex-1 flex items-center justify-center text-gray-500",children:g.jsxs("div",{className:"text-center",children:[g.jsx("div",{className:"text-4xl mb-4",children:g.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mx-auto text-gray-600",children:[g.jsx("path",{d:"M9 11l3 3L22 4"}),g.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),g.jsx("p",{className:"text-lg",children:"Select a todo to view"}),g.jsx("p",{className:"text-sm mt-1",children:"Or create a new one from the left panel"})]})})}function J1({onSelect:e,onClose:t}){const[i,n]=b.useState(null),[l,a]=b.useState(!1),[h,d]=b.useState(!1),[_,f]=b.useState(""),v=b.useCallback((w,S)=>{n(w),a(S),S||(d(!1),f(""))},[]),y=()=>{if(!i)return;try{localStorage.setItem("claudit:lastBrowserPath",i)}catch{}const w=h&&_.trim()?{branchName:_.trim()}:void 0;e(i,w)};return g.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center",onClick:t,children:g.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-lg p-6 w-[480px] max-h-[80vh] overflow-y-auto",onClick:w=>w.stopPropagation(),children:[g.jsx("h2",{className:"text-sm font-semibold text-gray-200 mb-1",children:"Claudit"}),g.jsx("p",{className:"text-xs text-gray-400 mb-4",children:"Pick a project directory to start a new Claude session for this todo."}),g.jsx(Vh,{onPathChange:v}),l&&g.jsxs("div",{className:"mt-3 p-2 bg-gray-800/50 rounded border border-gray-700",children:[g.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-400 cursor-pointer",children:[g.jsx("input",{type:"checkbox",checked:h,onChange:w=>d(w.target.checked),className:"rounded bg-gray-800 border-gray-600"}),"Create git worktree"]}),h&&g.jsx("input",{value:_,onChange:w=>f(w.target.value),placeholder:"Branch name...",autoFocus:!0,className:"mt-2 w-full text-sm bg-gray-800 text-gray-200 px-3 py-1.5 rounded border border-gray-600 outline-none focus:border-blue-500"})]}),g.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[g.jsx("button",{onClick:t,className:"text-xs px-3 py-1.5 rounded bg-gray-700 text-gray-300 hover:bg-gray-600",children:"Cancel"}),g.jsx("button",{onClick:y,disabled:!i||h&&!_.trim(),className:"text-xs px-3 py-1.5 rounded bg-purple-600 text-white hover:bg-purple-500 disabled:opacity-50",children:"Start"})]})]})})}const Q1={low:{text:"Low",className:"bg-gray-700 text-gray-300"},medium:{text:"Medium",className:"bg-yellow-900/50 text-yellow-400"},high:{text:"High",className:"bg-red-900/50 text-red-400"}};function Z1({todoId:e,onTodoDeleted:t}){const[i,n]=b.useState(null),[l,a]=b.useState([]),[h,d]=b.useState(!1),[_,f]=b.useState(!1),[v,y]=b.useState(!1),w=Oe(z=>z.selectSession),S=Oe(z=>z.setView),k=Oe(z=>z.setPendingTodoPrompt),E=Oe(z=>z.editingTodoId),x=Oe(z=>z.setEditingTodoId),I=E===e&&e!==null,U=z=>x(z?e:null),W=b.useCallback(async()=>{if(!e){n(null);return}try{const q=(await yg()).find(j=>j.id===e);n(q??null)}catch(z){console.error("Failed to load todo:",z)}},[e]),P=b.useCallback(async()=>{try{const z=await Kl(void 0,!0);a(z.flatMap(q=>q.sessions))}catch(z){console.error("Failed to load sessions:",z)}},[]);if(b.useEffect(()=>{W(),P()},[W,P]),!e)return g.jsx(X1,{});if(!i)return g.jsx("div",{className:"p-6 text-gray-500",children:"Loading..."});const M=async()=>{try{const z=await Ml(i.id,{completed:!i.completed,completedAt:i.completed?void 0:new Date().toISOString()});n(z)}catch(z){console.error("Failed to toggle todo:",z)}},A=async()=>{if(confirm(`Delete todo "${i.title}"?`))try{await qw(i.id),t()}catch(z){console.error("Failed to delete todo:",z)}},re=async z=>{try{const q=await Ml(i.id,z);n(q),U(!1)}catch(q){console.error("Failed to update todo:",q)}},se=async(z,q)=>{d(!1),y(!0);try{const j=await C_(z,{worktree:q,displayName:i.title}),G=["I have a task to complete:","",`Title: ${i.title}`,`Priority: ${i.priority}`,i.description?`Description: ${i.description}`:"","","Please help me complete this task. Start by understanding what needs to be done, then propose an approach and implement it step by step."].filter(ee=>ee!=="").join(`
98
+ `),X=await Ml(i.id,{sessionId:j.sessionId,sessionLabel:`Claude It: ${i.title}`});n(X),k({sessionId:j.sessionId,prompt:G}),w(j.projectHash,j.sessionId,j.projectPath),S("sessions")}catch(j){console.error("Failed to create Claude It session:",j),alert(`Failed to create session: ${j.message}`)}finally{y(!1)}},pe=async()=>{f(!1),await P()};if(I)return g.jsxs("div",{className:"px-4 py-3 overflow-y-auto",children:[g.jsx("h2",{className:"text-lg font-semibold text-gray-200 mb-3",children:"Edit Todo"}),g.jsx(Wg,{initial:i,sessions:l,onSubmit:re,onCancel:()=>U(!1),onCreateSession:()=>f(!0)}),_&&g.jsx(qh,{onClose:()=>f(!1),onCreate:pe})]});const Se=Q1[i.priority];return g.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[g.jsxs("div",{className:"px-4 py-3 border-b border-gray-800",children:[g.jsxs("div",{className:"flex items-center justify-between mb-2",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("button",{onClick:M,className:`w-5 h-5 rounded border flex-shrink-0 flex items-center justify-center transition-colors ${i.completed?"bg-blue-600 border-blue-600":"border-gray-500 hover:border-gray-300"}`,children:i.completed&&g.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:g.jsx("polyline",{points:"20 6 9 17 4 12"})})}),g.jsx("h2",{className:`text-lg font-semibold ${i.completed?"text-gray-500 line-through":"text-gray-200"}`,children:i.title})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[!i.sessionId&&!i.completed&&g.jsx("button",{onClick:()=>d(!0),disabled:v,className:"text-xs px-3 py-1.5 bg-purple-600 text-white rounded-lg hover:bg-purple-500 transition-colors disabled:opacity-50 flex items-center gap-1.5",children:v?g.jsxs(g.Fragment,{children:[g.jsxs("svg",{className:"animate-spin w-3 h-3",viewBox:"0 0 24 24",fill:"none",children:[g.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),g.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Creating..."]}):g.jsxs(g.Fragment,{children:[g.jsx("svg",{width:"10",height:"12",viewBox:"0 0 10 12",fill:"currentColor",children:g.jsx("polygon",{points:"0,0 10,6 0,12"})}),"Claudit"]})}),g.jsx("button",{onClick:()=>U(!0),className:"text-xs px-3 py-1.5 bg-gray-700 text-gray-300 rounded-lg hover:bg-gray-600 transition-colors",children:"Edit"}),g.jsx("button",{onClick:A,className:"text-xs px-3 py-1.5 bg-red-900/50 text-red-400 rounded-lg hover:bg-red-900/70 transition-colors",children:"Delete"})]})]}),g.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[g.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${Se.className}`,children:Se.text}),g.jsxs("div",{children:[g.jsx("span",{className:"text-gray-500",children:"Created:"})," ",g.jsx("span",{className:"text-gray-300",children:new Date(i.createdAt).toLocaleString()})]}),i.completedAt&&g.jsxs("div",{children:[g.jsx("span",{className:"text-gray-500",children:"Completed:"})," ",g.jsx("span",{className:"text-gray-300",children:new Date(i.completedAt).toLocaleString()})]})]})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:[i.description&&g.jsx("div",{className:"mb-3",children:g.jsx(Tl,{title:"Description",defaultOpen:!0,storageKey:`claudit:todo:${i.id}:desc`,children:g.jsx("p",{className:"text-sm text-gray-300 whitespace-pre-wrap bg-gray-800 rounded-lg p-2",children:i.description})})}),i.sessionId&&(()=>{const z=l.find(q=>q.sessionId===i.sessionId);return g.jsx("div",{className:"mb-3",children:g.jsx(Tl,{title:"Linked Session",defaultOpen:!0,storageKey:`claudit:todo:${i.id}:session`,children:g.jsxs("div",{className:"text-sm bg-gray-800 rounded-lg p-2 space-y-2",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-gray-300",children:i.sessionLabel||i.sessionId}),g.jsx("span",{className:"text-gray-600 text-xs font-mono",children:i.sessionId})]}),z&&g.jsxs("button",{onClick:()=>{w(z.projectHash,z.sessionId,z.projectPath),S("sessions")},className:"text-xs px-2 py-1 bg-gray-700 text-blue-400 rounded hover:bg-gray-600 transition-colors flex items-center gap-1",children:[g.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[g.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),g.jsx("polyline",{points:"15 3 21 3 21 9"}),g.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"Jump to Session"]})]}),z&&g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Qn,{status:z.status}),z.lastMessage&&g.jsxs("span",{className:"text-xs text-gray-500 truncate ml-2",children:[z.lastMessage.slice(0,80),z.lastMessage.length>80?"...":""]})]})]})})})})(),i.provider&&g.jsx("div",{className:"mb-3",children:g.jsx(Tl,{title:"Provider",defaultOpen:!0,storageKey:`claudit:todo:${i.id}:provider`,children:g.jsxs("div",{className:"text-sm bg-gray-800 rounded-lg p-2 space-y-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-gray-500",children:"Source:"}),g.jsx("span",{className:"text-gray-300",children:i.provider.providerId}),g.jsx(Qn,{status:i.provider.syncStatus})]}),i.provider.lastSyncedAt&&g.jsxs("div",{children:[g.jsx("span",{className:"text-gray-500",children:"Last synced:"})," ",g.jsx("span",{className:"text-gray-300",children:new Date(i.provider.lastSyncedAt).toLocaleString()})]}),i.provider.externalUrl&&g.jsxs("div",{children:[g.jsx("span",{className:"text-gray-500",children:"External link:"})," ",g.jsxs("a",{href:i.provider.externalUrl,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300 underline text-xs",children:["Open in ",i.provider.providerId]})]}),i.provider.syncError&&g.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 rounded px-2 py-1",children:i.provider.syncError})]})})}),!i.description&&!i.sessionId&&!i.provider&&g.jsx("div",{className:"text-gray-600 text-sm",children:"No additional details."})]}),h&&g.jsx(J1,{onSelect:se,onClose:()=>d(!1)})]})}function eb(){const e=Oe(v=>v.view),t=Oe(v=>v.selected),i=Oe(v=>v.selectedCronTaskId),n=Oe(v=>v.setSelectedCronTaskId),l=Oe(v=>v.selectedTodoId),a=Oe(v=>v.setSelectedTodoId),h=Cr(v=>v.connectEventStream),d=Cr(v=>v.disconnectEventStream);b.useEffect(()=>(h(),()=>d()),[h,d]);const _=()=>e==="todo"?g.jsx(G1,{selectedTodoId:l,onSelect:a}):e==="sessions"?g.jsx(d0,{}):g.jsx(Ww,{selectedTaskId:i,onSelect:n}),f=()=>e==="todo"?g.jsx(Z1,{todoId:l,onTodoDeleted:()=>a(null)}):e==="sessions"?t?g.jsx(Lw,{projectHash:t.projectHash,sessionId:t.sessionId,projectPath:t.projectPath,isNew:t.isNew}):g.jsx(k_,{}):g.jsx(Uw,{taskId:i,onTaskDeleted:()=>n(null)});return g.jsx(qv,{nav:g.jsx(e0,{}),sidebar:_(),main:f()})}Uv.createRoot(document.getElementById("root")).render(g.jsx(pt.StrictMode,{children:g.jsx(eb,{})}));